01: /*
02: JSmooth: a VM wrapper toolkit for Windows
03: Copyright (C) 2003 Rodrigo Reyes <reyes@charabia.net>
04:
05: This program is free software; you can redistribute it and/or modify
06: it under the terms of the GNU General Public License as published by
07: the Free Software Foundation; either version 2 of the License, or
08: (at your option) any later version.
09:
10: This program is distributed in the hope that it will be useful,
11: but WITHOUT ANY WARRANTY; without even the implied warranty of
12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: GNU General Public License for more details.
14:
15: You should have received a copy of the GNU General Public License
16: along with this program; if not, write to the Free Software
17: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18:
19: */
20:
21: package net.charabia.jsmoothgen.application.gui.editors;
22:
23: import net.charabia.jsmoothgen.skeleton.*;
24: import net.charabia.jsmoothgen.application.*;
25: import net.charabia.jsmoothgen.application.gui.*;
26: import net.charabia.jsmoothgen.application.gui.util.*;
27: import javax.swing.*;
28: import java.awt.*;
29: import java.util.*;
30: import java.io.File;
31: import java.util.jar.*;
32:
33: public class JavaProperties extends Editor {
34: private SortedEditableList m_props = new SortedEditableList();
35:
36: public class PropEditor implements SortedEditableList.Editor {
37: public Object createNewItem(SortedEditableList selist) {
38: JavaPropertyPair jpp = new JavaPropertyPair("", "");
39: PropertyEditorDialog dia = new PropertyEditorDialog(jpp);
40:
41: if (dia.ask() && (jpp.getName().trim().length() > 0))
42: return jpp;
43: else
44: return null;
45: }
46:
47: public Object editItem(SortedEditableList selist, Object item) {
48: JavaPropertyPair jpp = (JavaPropertyPair) item;
49: PropertyEditorDialog dia = new PropertyEditorDialog(jpp);
50: dia.setVisible(true);
51: return item;
52: }
53:
54: public boolean removeItem(SortedEditableList selist, Object item) {
55: return true;
56: }
57: }
58:
59: public JavaProperties() {
60: setLayout(new BorderLayout());
61: add(BorderLayout.CENTER, m_props);
62: m_props.setEditor(new PropEditor());
63: }
64:
65: public void dataChanged() {
66: JavaPropertyPair[] props = m_model.getJavaProperties();
67: m_props.setData(props);
68: }
69:
70: public void updateModel() {
71: Object[] po = m_props.getData();
72: JavaPropertyPair[] props = new JavaPropertyPair[po.length];
73: for (int i = 0; i < po.length; i++) {
74: props[i] = (JavaPropertyPair) po[i];
75: }
76: m_model.setJavaProperties(props);
77: }
78:
79: public String getLabel() {
80: return "JAVAPROP_LABEL";
81: }
82:
83: public String getDescription() {
84: return "JAVAPROP_HELP";
85: }
86:
87: public boolean needsBigSpace() {
88: return true;
89: }
90:
91: }
|