1 /*
2 Bloof - visualize the evolution of your software project
3 Copyright ( C ) 2003 Lukasz Pekacki <lukasz@pekacki.de>
4 http://bloof.sf.net/
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc.,
16 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 $RCSfile: DialogExtendedMetricParameters.java,v $
19 Created on $Date: 2003/09/10 07:16:42 $
20 */
21 package net.sf.bloof.browser.dialogs;
22
23 import java.awt.BorderLayout;
24 import java.awt.FlowLayout;
25 import java.util.HashMap;
26
27 import javax.swing.BoxLayout;
28 import javax.swing.JPanel;
29 import javax.swing.JTable;
30 import javax.swing.table.TableModel;
31
32 import net.sf.bloof.browser.GuiConstants;
33 import net.sf.bloof.browser.GuiFactory;
34 import net.sf.bloof.browser.events.BrowserAction;
35 import net.sf.bloof.browser.intl.Messages;
36 import net.sf.bloof.browser.intl.Text;
37
38 /**
39 *
40 * @author Lukasz Pekacki <pekacki@users.sourceforge.net>
41 * @version $Id: DialogExtendedMetricParameters.java,v 1.2 2003/09/10 07:16:42 pekacki Exp $
42 */
43 public class DialogExtendedMetricParameters extends BrowserDialog {
44 /**
45 * @param aParams
46 */
47 public DialogExtendedMetricParameters(HashMap aParams) {
48 super(aParams);
49 mTitle = (String) aParams.get(GuiConstants.PARAM_PROP_TITLE);
50 initContentView();
51 setVisible(true);
52 }
53
54 /**
55 *
56 */
57 private void initContentView() {
58 mContentPanel.setLayout(new BorderLayout());
59 JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
60 JPanel tablePanel = new JPanel();
61 tablePanel.setLayout(new BoxLayout(tablePanel, BoxLayout.Y_AXIS));
62 titlePanel.add(GuiFactory.createLabel(mTitle));
63 String[] columNames = {Messages.getString(Text.KEY),Messages.getString(Text.VALUE)};
64 mParamTable = new JTable(new String[ROWS][COLS],columNames);
65 tablePanel.add(mParamTable.getTableHeader());
66 tablePanel.add(mParamTable);
67 mContentPanel.add(titlePanel, BorderLayout.NORTH);
68 mContentPanel.add(tablePanel, BorderLayout.CENTER);
69
70 }
71
72 /**
73 * @see net.sf.bloof.browser.dialogs.BrowserDialog#submitDialog()
74 */
75 protected void submitDialog() {
76 HashMap params = new HashMap();
77 TableModel model = mParamTable.getModel();
78 for (int i = 0; i < ROWS; i++) {
79 Object key = model.getValueAt(i, 0);
80 Object value = model.getValueAt(i, 1);
81 if (key != null && value != null) {
82 params.put(key,value);
83 }
84 }
85 informBrowserActionListeners(new BrowserAction(BrowserAction.APPEND_EXTENDED_METRIC_PARAMS, params));
86 dispose();
87
88 }
89 JTable mParamTable;
90 private String mTitle;
91 private static final int ROWS = 10, COLS = 2;
92 }