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: DialogProperties.java,v $
19 Created on $Date: 2003/09/06 08:40:52 $
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 import java.util.Iterator;
27
28 import javax.swing.JPanel;
29 import javax.swing.JTable;
30
31 import net.sf.bloof.browser.GuiConstants;
32 import net.sf.bloof.browser.GuiFactory;
33 import net.sf.bloof.browser.intl.Messages;
34 import net.sf.bloof.browser.intl.Text;
35
36 /**
37 *
38 * @author Lukasz Pekacki <pekacki@users.sourceforge.net>
39 * @version $Id: DialogProperties.java,v 1.2 2003/09/06 08:40:52 pekacki Exp $
40 */
41 public class DialogProperties extends BrowserDialog {
42 /**
43 * @param aParams
44 */
45 public DialogProperties(HashMap aParams) {
46 super(aParams);
47 mTitle = (String) aParams.get(GuiConstants.PARAM_PROP_TITLE);
48 mProperties = (HashMap) aParams.get(GuiConstants.PARAM_PROPERTIES);
49 initContentView();
50 setVisible(true);
51 }
52
53 /**
54 *
55 */
56 private void initContentView() {
57 mContentPanel.setLayout(new BorderLayout());
58 JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
59 titlePanel.add(GuiFactory.createLabel(mTitle));
60 Object[][] data = new Object[mProperties.size()][COLUM_NAMES.length];
61 int row = 0;
62 for (Iterator iter = mProperties.keySet().iterator(); iter.hasNext();) {
63 String prop = (String) iter.next();
64 String value = (String) mProperties.get(prop);
65 data[row][0] = prop;
66 data[row][1] = value;
67 }
68 JTable propTable = new JTable(data, COLUM_NAMES);
69 propTable.setOpaque(true);
70 propTable.setShowGrid(false);
71 propTable.setDragEnabled(false);
72 propTable.setEnabled(false);
73 propTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
74 propTable.validate();
75
76 mContentPanel.add(titlePanel, BorderLayout.NORTH);
77 mContentPanel.add(propTable, BorderLayout.CENTER);
78
79 }
80
81 /**
82 * @see net.sf.bloof.browser.dialogs.BrowserDialog#submitDialog()
83 */
84 protected void submitDialog() {
85 dispose();
86
87 }
88
89 private String mTitle;
90 private HashMap mProperties;
91 private static final String[] COLUM_NAMES = {Messages.getString(Text.PROPERTY), Messages.getString(Text.VALUE)};
92 }