Revision 2760
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultVisitableSet.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.tools.dynform.impl; |
|
25 |
|
|
26 |
import java.util.HashSet; |
|
27 |
import java.util.Iterator; |
|
28 |
|
|
29 |
import org.gvsig.tools.dynform.AbortActionException; |
|
30 |
import org.gvsig.tools.dynform.spi.dynformfield.VisitableSet; |
|
31 |
import org.gvsig.tools.exception.BaseException; |
|
32 |
import org.gvsig.tools.visitor.Visitor; |
|
33 |
import org.slf4j.Logger; |
|
34 |
import org.slf4j.LoggerFactory; |
|
35 |
|
|
36 |
public class DefaultVisitableSet extends HashSet implements VisitableSet { |
|
37 |
|
|
38 |
public static final Logger logger = LoggerFactory.getLogger(DefaultVisitableSet.class); |
|
39 |
/** |
|
40 |
* |
|
41 |
*/ |
|
42 |
private static final long serialVersionUID = -5771630108958038764L; |
|
43 |
|
|
44 |
public void accept(Visitor visitor) throws BaseException { |
|
45 |
Iterator it = this.iterator(); |
|
46 |
while (it.hasNext()) { |
|
47 |
Object value = it.next(); |
|
48 |
try { |
|
49 |
visitor.visit(value); |
|
50 |
} catch (AbortActionException ex) { |
|
51 |
throw ex; |
|
52 |
} catch (Exception ex) { |
|
53 |
logger.info("Error visiting " + value.toString() |
|
54 |
+ "(" + value.getClass().getName() + ") with " |
|
55 |
+ visitor.toString() + "(" + visitor.getClass().getName() |
|
56 |
+ ").", ex); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
61 |
} |
|
0 | 62 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJDynFormFactory.java | ||
---|---|---|
1 |
package org.gvsig.tools.dynform.impl; |
|
2 |
|
|
3 |
import org.gvsig.tools.dynform.DynFormDefinition; |
|
4 |
import org.gvsig.tools.dynform.JDynForm; |
|
5 |
import org.gvsig.tools.dynform.JDynForm.DynFormContext; |
|
6 |
import org.gvsig.tools.dynform.spi.dynform.AbstractJDynFormFactory; |
|
7 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
|
8 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager.ComponentsFactory; |
|
9 |
|
|
10 |
/** |
|
11 |
* |
|
12 |
* @author jjdelcerro |
|
13 |
*/ |
|
14 |
public class DefaultJDynFormFactory extends AbstractJDynFormFactory { |
|
15 |
|
|
16 |
public DefaultJDynFormFactory() { |
|
17 |
super("JDYNFORM_DEFAULT"); |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
public boolean isApplicableTo(DynFormContext context, DynFormDefinition definition) { |
|
22 |
return true; |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public JDynForm create( |
|
27 |
DynFormSPIManager manager, |
|
28 |
DynFormContext context, |
|
29 |
DynFormDefinition definition |
|
30 |
) { |
|
31 |
return new DefaultJDynForm(manager, this, definition, context); |
|
32 |
} |
|
33 |
|
|
34 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.tools.dynform.impl; |
|
25 |
|
|
26 |
|
|
27 |
import java.net.URL; |
|
28 |
import org.gvsig.tools.ToolsLocator; |
|
29 |
import org.gvsig.tools.dynform.DynFormLibrary; |
|
30 |
import org.gvsig.tools.dynform.DynFormLocator; |
|
31 |
import org.gvsig.tools.dynform.spi.DynFormSPILocator; |
|
32 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_ACTION_CLOSE; |
|
33 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_ACTION_DELETE; |
|
34 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_ACTION_NEW; |
|
35 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_ACTION_SEARCH; |
|
36 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_ACTION_UPDATE; |
|
37 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_AUTOSAVE; |
|
38 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_BORDER; |
|
39 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_DROPDOWN; |
|
40 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_HEIGHT; |
|
41 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_LABEL_EMPTY; |
|
42 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_READONLY; |
|
43 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_RESIZEWEIGHT; |
|
44 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_ROWS; |
|
45 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_SEPARATOR; |
|
46 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_TRANSLATE_EMPTY_TO_NULL; |
|
47 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_USESCROLLBARS; |
|
48 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_VIEWMODE; |
|
49 |
import static org.gvsig.tools.dynform.spi.DynFormSPIManager.TAG_DYNFORM_WIDTH; |
|
50 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
51 |
import org.gvsig.tools.library.AbstractLibrary; |
|
52 |
import org.gvsig.tools.library.LibraryException; |
|
53 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
54 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
|
55 |
|
|
56 |
public class DefaultDynFormLibrary extends AbstractLibrary { |
|
57 |
public static final String ICON_PROVIDER_NAME = "DynForm"; |
|
58 |
|
|
59 |
public static final String ICON_COMMON_GROUP_NAME = "Common"; |
|
60 |
|
|
61 |
@Override |
|
62 |
public void doRegistration() { |
|
63 |
super.doRegistration(); |
|
64 |
registerAsImplementationOf(DynFormLibrary.class); |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
protected void doInitialize() throws LibraryException { |
|
69 |
DynFormLocator.registerDefaultDynFormManager(DefaultDynFormManager.class); |
|
70 |
DynFormSPILocator.registerDefaultDynFormSPIManager(DefaultDynFormSPIManager.class); |
|
71 |
|
|
72 |
DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager(); |
|
73 |
dynObjectManager.registerTag(TAG_DYNFORM_AUTOSAVE, "Boolean value to activate/deactivate the autosave mode in the form."); |
|
74 |
dynObjectManager.registerTag(TAG_DYNFORM_BORDER, null); |
|
75 |
dynObjectManager.registerTag(TAG_DYNFORM_VIEWMODE, null); |
|
76 |
dynObjectManager.registerTag(TAG_DYNFORM_HEIGHT, "Integer value to set the height of field or form to this value."); |
|
77 |
dynObjectManager.registerTag(TAG_DYNFORM_WIDTH, "Integer value to set the width of form to this value."); |
|
78 |
dynObjectManager.registerTag(TAG_DYNFORM_LABEL_EMPTY, "Boolean value to force the label of field to empty, the label can't be show."); |
|
79 |
dynObjectManager.registerTag(TAG_DYNFORM_ACTION_NEW, "Boolean value to show/hide the action button new in form."); |
|
80 |
dynObjectManager.registerTag(TAG_DYNFORM_ACTION_UPDATE, "Boolean value to show/hide the action button save in form."); |
|
81 |
dynObjectManager.registerTag(TAG_DYNFORM_ACTION_DELETE, "Boolean value to show/hide the action button delete in form."); |
|
82 |
dynObjectManager.registerTag(TAG_DYNFORM_ACTION_SEARCH, "Boolean value to show/hide the action button search in form."); |
|
83 |
dynObjectManager.registerTag(TAG_DYNFORM_ACTION_CLOSE, "Boolean value to show/hide the action button close in form."); |
|
84 |
dynObjectManager.registerTag(TAG_DYNFORM_ROWS, "Integer value to set the number of rows for text fields."); |
|
85 |
dynObjectManager.registerTag(TAG_DYNFORM_USESCROLLBARS, "Boolean value to show/hide scrollbars in the form (default value true)."); |
|
86 |
dynObjectManager.registerTag(TAG_DYNFORM_READONLY, "Boolean value to force the field or form to be in read-only mode."); |
|
87 |
dynObjectManager.registerTag(TAG_DYNFORM_TRANSLATE_EMPTY_TO_NULL, null); |
|
88 |
dynObjectManager.registerTag(TAG_DYNFORM_SEPARATOR, "String value to add a separator previos this field with this."); |
|
89 |
dynObjectManager.registerTag(TAG_DYNFORM_DROPDOWN, "String value to force the type of dropdown to use, must be 'label' or 'combo'."); |
|
90 |
dynObjectManager.registerTag(TAG_DYNFORM_RESIZEWEIGHT, "Integer value between 0 and 100 indicating what the field should expand. A value of 0 indicates that it should not be expanded."); |
|
91 |
|
|
92 |
} |
|
93 |
|
|
94 |
|
|
95 |
@Override |
|
96 |
protected void doPostInitialize() throws LibraryException { |
|
97 |
String[][] iconsInfo = new String[][]{ |
|
98 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-cancelnew"}, |
|
99 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-close"}, |
|
100 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-delete"}, |
|
101 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-first"}, |
|
102 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-last"}, |
|
103 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-new"}, |
|
104 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-next"}, |
|
105 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-previous"}, |
|
106 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-save"}, |
|
107 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-problem-indicator"}, |
|
108 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "form-buttonbar-search"} |
|
109 |
}; |
|
110 |
registerIcons(iconsInfo); |
|
111 |
} |
|
112 |
|
|
113 |
public static void registerIcons(String[][] iconsInfo) { |
|
114 |
IconTheme theme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
|
115 |
for (String[] icon : iconsInfo) { |
|
116 |
// 0 - Provider, 1 - Group, 2 - Name |
|
117 |
URL url = DefaultDynFormLibrary.class.getResource("images/"+ icon[2] + ".png"); |
|
118 |
theme.registerDefault(icon[0], icon[1], icon[2], null, url); |
|
119 |
} |
|
120 |
} |
|
121 |
} |
|
0 | 122 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DynObjectEditor.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2008 IVER T.I. S.A. {{Task}} |
|
27 |
*/ |
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
*/ |
|
32 |
package org.gvsig.tools.dynform.impl; |
|
33 |
|
|
34 |
import java.awt.BorderLayout; |
|
35 |
import java.awt.Component; |
|
36 |
import java.awt.Dimension; |
|
37 |
import java.awt.GridBagConstraints; |
|
38 |
import java.awt.GridBagLayout; |
|
39 |
import java.awt.Insets; |
|
40 |
import java.awt.event.ActionEvent; |
|
41 |
import java.awt.event.ActionListener; |
|
42 |
|
|
43 |
import javax.swing.JButton; |
|
44 |
import javax.swing.JLabel; |
|
45 |
import javax.swing.JPanel; |
|
46 |
|
|
47 |
import org.gvsig.tools.ToolsLocator; |
|
48 |
import org.gvsig.tools.dynform.DynFormLocator; |
|
49 |
import org.gvsig.tools.dynform.JDynForm; |
|
50 |
import org.gvsig.tools.dynobject.DynObject; |
|
51 |
import org.gvsig.tools.i18n.I18nManager; |
|
52 |
import org.gvsig.tools.service.ServiceException; |
|
53 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
54 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
55 |
import org.slf4j.Logger; |
|
56 |
import org.slf4j.LoggerFactory; |
|
57 |
|
|
58 |
/** |
|
59 |
* Editor for a store parameters. |
|
60 |
* |
|
61 |
* @author gvSIG Team |
|
62 |
* @version $Id$ |
|
63 |
*/ |
|
64 |
public class DynObjectEditor extends JPanel implements ActionListener { |
|
65 |
|
|
66 |
private static final long serialVersionUID = 23898787077741411L; |
|
67 |
|
|
68 |
private static final Logger LOG = LoggerFactory |
|
69 |
.getLogger(DynObjectEditor.class); |
|
70 |
|
|
71 |
private String title; |
|
72 |
|
|
73 |
private JButton botAcept; |
|
74 |
private JButton botCancel; |
|
75 |
private JButton botRestoreDefaults; |
|
76 |
private JPanel panButtons; |
|
77 |
private I18nManager i18nManager; |
|
78 |
|
|
79 |
// private boolean modal; |
|
80 |
|
|
81 |
private JDynForm form = null; |
|
82 |
private DynObject data = null; |
|
83 |
|
|
84 |
public DynObjectEditor(DynObject parameters, boolean showDefaultsButton) |
|
85 |
throws ServiceException { |
|
86 |
this.i18nManager = ToolsLocator.getI18nManager(); |
|
87 |
this.data = parameters; |
|
88 |
this.form = DynFormLocator.getDynFormManager().createJDynForm(this.data); |
|
89 |
this.form.setLayoutMode(this.form.USE_TABS); |
|
90 |
this.setLayout(new BorderLayout()); |
|
91 |
this.add(this.form.asJComponent(), BorderLayout.CENTER); |
|
92 |
this.add(getButtonsPanel(showDefaultsButton), BorderLayout.SOUTH); |
|
93 |
this.setPreferredSize(new Dimension(500,250)); |
|
94 |
String s = this.data.getDynClass().getDescription(); |
|
95 |
if( s==null || s.length()==0 ) { |
|
96 |
s = this.data.getDynClass().getName(); |
|
97 |
} |
|
98 |
this.setTitle(s); |
|
99 |
} |
|
100 |
|
|
101 |
public DynObjectEditor(DynObject parameters) throws ServiceException { |
|
102 |
this(parameters, false); |
|
103 |
} |
|
104 |
|
|
105 |
private JPanel getButtonsPanel(boolean add_defaults_button) { |
|
106 |
if (this.panButtons == null) { |
|
107 |
this.panButtons = new JPanel(); |
|
108 |
this.panButtons.setLayout(new GridBagLayout()); |
|
109 |
GridBagConstraints constr = new GridBagConstraints(); |
|
110 |
constr.anchor = GridBagConstraints.LAST_LINE_END; |
|
111 |
constr.fill = GridBagConstraints.HORIZONTAL; |
|
112 |
constr.weightx = 1; |
|
113 |
constr.weighty = 0; |
|
114 |
this.panButtons.add(new JLabel(), constr); |
|
115 |
|
|
116 |
constr = this.getDefaultParametersConstraints(); |
|
117 |
constr.fill = GridBagConstraints.NONE; |
|
118 |
constr.weightx = 0; |
|
119 |
constr.weighty = 0; |
|
120 |
|
|
121 |
this.panButtons.add(this.getAcceptButton(), constr); |
|
122 |
this.panButtons.add(this.getCancelButton(), constr); |
|
123 |
if (add_defaults_button) { |
|
124 |
this.panButtons.add(this.getRestoreDefaults(), constr); |
|
125 |
} |
|
126 |
} |
|
127 |
return this.panButtons; |
|
128 |
} |
|
129 |
|
|
130 |
private GridBagConstraints getDefaultParametersConstraints() { |
|
131 |
GridBagConstraints constr = new GridBagConstraints(); |
|
132 |
constr.insets = new Insets(2, 2, 2, 2); |
|
133 |
constr.ipadx = 2; |
|
134 |
constr.ipady = 2; |
|
135 |
constr.anchor = GridBagConstraints.PAGE_START; |
|
136 |
return constr; |
|
137 |
|
|
138 |
} |
|
139 |
|
|
140 |
private JButton getRestoreDefaults() { |
|
141 |
if (this.botRestoreDefaults == null) { |
|
142 |
this.botRestoreDefaults = |
|
143 |
ToolsSwingLocator.getUsabilitySwingManager().createJButton( |
|
144 |
i18nManager.getTranslation("restoreDefaults")); |
|
145 |
this.botRestoreDefaults.addActionListener(this); |
|
146 |
} |
|
147 |
return this.botRestoreDefaults; |
|
148 |
} |
|
149 |
|
|
150 |
private JButton getCancelButton() { |
|
151 |
if (this.botCancel == null) { |
|
152 |
this.botCancel = |
|
153 |
ToolsSwingLocator.getUsabilitySwingManager().createJButton( |
|
154 |
i18nManager.getTranslation("cancel")); |
|
155 |
this.botCancel.addActionListener(this); |
|
156 |
} |
|
157 |
return this.botCancel; |
|
158 |
} |
|
159 |
|
|
160 |
private JButton getAcceptButton() { |
|
161 |
if (this.botAcept == null) { |
|
162 |
this.botAcept = |
|
163 |
ToolsSwingLocator.getUsabilitySwingManager().createJButton( |
|
164 |
i18nManager.getTranslation("accept")); |
|
165 |
this.botAcept.addActionListener(this); |
|
166 |
} |
|
167 |
return this.botAcept; |
|
168 |
} |
|
169 |
|
|
170 |
public void actionPerformed(ActionEvent e) { |
|
171 |
Component source = (Component) e.getSource(); |
|
172 |
if (source == this.botAcept) { |
|
173 |
this.form.getValues(this.data); |
|
174 |
this.closeWindow(); |
|
175 |
} else if (source == this.botCancel) { |
|
176 |
this.closeWindow(); |
|
177 |
} else if (source == this.botRestoreDefaults) { |
|
178 |
this.form.setValues(this.data); |
|
179 |
} |
|
180 |
} |
|
181 |
|
|
182 |
protected void closeWindow() { |
|
183 |
LOG.debug("Closing window, values edited: ", this.data); |
|
184 |
this.setVisible(false); |
|
185 |
} |
|
186 |
|
|
187 |
public void editObject(boolean modal) { |
|
188 |
// this.modal = modal; |
|
189 |
|
|
190 |
WindowManager wmanager = ToolsSwingLocator.getWindowManager(); |
|
191 |
|
|
192 |
wmanager.showWindow(this,title,WindowManager.MODE.DIALOG); |
|
193 |
|
|
194 |
// wmanager.showWindow(this, |
|
195 |
// Messages.getText("explorer_parameters"), |
|
196 |
// WindowManager.MODE.DIALOG); |
|
197 |
} |
|
198 |
|
|
199 |
public String getTitle() { |
|
200 |
return title; |
|
201 |
} |
|
202 |
|
|
203 |
public void setTitle(String title) { |
|
204 |
this.title = title; |
|
205 |
} |
|
206 |
|
|
207 |
public DynObject getParameters() { |
|
208 |
this.form.getValues(this.data); |
|
209 |
return this.data; |
|
210 |
} |
|
211 |
} |
|
0 | 212 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultZoomDialog.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.tools.dynform.impl; |
|
25 |
|
|
26 |
import java.awt.BorderLayout; |
|
27 |
import java.awt.Dimension; |
|
28 |
import java.awt.Toolkit; |
|
29 |
import java.awt.event.ActionEvent; |
|
30 |
import java.awt.event.ActionListener; |
|
31 |
|
|
32 |
import javax.swing.BorderFactory; |
|
33 |
import javax.swing.JButton; |
|
34 |
import javax.swing.JPanel; |
|
35 |
import javax.swing.JScrollPane; |
|
36 |
|
|
37 |
import org.gvsig.tools.dynform.spi.dynformfield.JCustomTextArea; |
|
38 |
import org.gvsig.tools.dynform.spi.dynformfield.JZoomDialog; |
|
39 |
|
|
40 |
public class DefaultZoomDialog extends JZoomDialog { |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
*/ |
|
45 |
private static final long serialVersionUID = 7913363575200612492L; |
|
46 |
|
|
47 |
private String value = null; |
|
48 |
private JCustomTextArea text = null; |
|
49 |
|
|
50 |
public DefaultZoomDialog(String title, String value) { |
|
51 |
super(title); |
|
52 |
this.value = value; |
|
53 |
initComponents(); |
|
54 |
|
|
55 |
} |
|
56 |
|
|
57 |
public void setEditable(boolean editable) { |
|
58 |
this.text.setEditable(editable); |
|
59 |
} |
|
60 |
|
|
61 |
private void initComponents() { |
|
62 |
|
|
63 |
JPanel panel = new JPanel(); |
|
64 |
panel.setLayout(new BorderLayout()); |
|
65 |
|
|
66 |
text = new JCustomTextArea(null, false); |
|
67 |
text.setText(value); |
|
68 |
text.setLineWrap(true); |
|
69 |
JScrollPane scroll = new JScrollPane(text); |
|
70 |
panel.add(scroll, BorderLayout.CENTER); |
|
71 |
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
72 |
|
|
73 |
JPanel p = new JPanel(); |
|
74 |
|
|
75 |
JButton close = new JButton("Close"); |
|
76 |
close.addActionListener(new ActionListener() { |
|
77 |
public void actionPerformed(ActionEvent arg0) { |
|
78 |
value = text.getText(); |
|
79 |
setVisible(false); |
|
80 |
} |
|
81 |
}); |
|
82 |
|
|
83 |
p.setLayout(new BorderLayout()); |
|
84 |
p.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); |
|
85 |
p.add(close,BorderLayout.LINE_END); |
|
86 |
|
|
87 |
panel.add(p, BorderLayout.PAGE_END); |
|
88 |
|
|
89 |
panel.setPreferredSize(new Dimension(600, 250)); |
|
90 |
|
|
91 |
this.setContentPane(panel); |
|
92 |
|
|
93 |
this.center(); |
|
94 |
this.pack(); |
|
95 |
} |
|
96 |
|
|
97 |
public void center() { |
|
98 |
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); |
|
99 |
Dimension size = this.getPreferredSize(); |
|
100 |
int x = (int) ((dimension.getWidth() - size.getWidth()) / 2); |
|
101 |
int y = (int) ((dimension.getHeight() - size.getHeight()) / 2); |
|
102 |
this.setLocation(x, y); |
|
103 |
} |
|
104 |
public String getText() { |
|
105 |
return this.value; |
|
106 |
} |
|
107 |
} |
|
0 | 108 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/ActionStore.java | ||
---|---|---|
1 |
package org.gvsig.tools.dynform.impl; |
|
2 |
|
|
3 |
import javax.swing.Action; |
|
4 |
|
|
5 |
import org.gvsig.tools.dataTypes.DataType; |
|
6 |
|
|
7 |
public class ActionStore{ |
|
8 |
private DataType tipo; |
|
9 |
private String name; |
|
10 |
private Action action; |
|
11 |
private boolean isSeparator = false; |
|
12 |
|
|
13 |
public ActionStore(DataType tipo,String name, Action action){ |
|
14 |
this.tipo = tipo; |
|
15 |
this.name = name; |
|
16 |
this.action = action; |
|
17 |
} |
|
18 |
|
|
19 |
public ActionStore(DataType tipo){ |
|
20 |
this.tipo = tipo; |
|
21 |
this.isSeparator = true; |
|
22 |
} |
|
23 |
|
|
24 |
public DataType getDataType(){ |
|
25 |
return tipo; |
|
26 |
} |
|
27 |
|
|
28 |
public String getActionName(){ |
|
29 |
return name; |
|
30 |
} |
|
31 |
|
|
32 |
public Action getAction(){ |
|
33 |
return action; |
|
34 |
} |
|
35 |
|
|
36 |
public boolean isSeparator(){ |
|
37 |
return isSeparator; |
|
38 |
} |
|
39 |
} |
|
0 | 40 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormSPIManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.tools.dynform.impl; |
|
25 |
|
|
26 |
import java.awt.event.ActionEvent; |
|
27 |
import java.util.ArrayList; |
|
28 |
import java.util.Collections; |
|
29 |
import java.util.HashMap; |
|
30 |
import java.util.List; |
|
31 |
import java.util.Map; |
|
32 |
|
|
33 |
import javax.swing.AbstractAction; |
|
34 |
import javax.swing.Action; |
|
35 |
import javax.swing.JButton; |
|
36 |
import javax.swing.JCheckBox; |
|
37 |
import javax.swing.JComboBox; |
|
38 |
import javax.swing.JLabel; |
|
39 |
import javax.swing.JList; |
|
40 |
import javax.swing.JPasswordField; |
|
41 |
import javax.swing.JPopupMenu; |
|
42 |
import javax.swing.JScrollPane; |
|
43 |
import javax.swing.JSpinner; |
|
44 |
import javax.swing.JTable; |
|
45 |
import javax.swing.JTextArea; |
|
46 |
import javax.swing.text.DefaultEditorKit; |
|
47 |
import javax.swing.text.JTextComponent; |
|
48 |
import org.apache.commons.lang3.StringUtils; |
|
49 |
import org.gvsig.tools.ToolsLocator; |
|
50 |
import org.gvsig.tools.dynform.DynFormDefinition; |
|
51 |
import org.gvsig.tools.dynform.DynFormFieldDefinition; |
|
52 |
import org.gvsig.tools.dynform.DynFormLocator; |
|
53 |
import org.gvsig.tools.dynform.DynFormManager; |
|
54 |
import org.gvsig.tools.dynform.JDynForm.DynFormContext; |
|
55 |
import org.gvsig.tools.dynform.JDynFormField; |
|
56 |
import org.gvsig.tools.dynform.spi.DynFormSPILocator; |
|
57 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
|
58 |
import org.gvsig.tools.dynform.spi.dynform.JDynFormFactory; |
|
59 |
import org.gvsig.tools.dynform.spi.dynformfield.JCustomSpinner; |
|
60 |
import org.gvsig.tools.dynform.spi.dynformfield.JCustomTextArea; |
|
61 |
import org.gvsig.tools.dynform.spi.dynformfield.JCustomTextField; |
|
62 |
import org.gvsig.tools.dynform.spi.dynformfield.JDynFormFieldFactory; |
|
63 |
import org.gvsig.tools.dynform.spi.dynformset.JDynFormSetFactory; |
|
64 |
import org.gvsig.tools.dynform.spi.dynformfield.JProblemIndicator; |
|
65 |
import org.gvsig.tools.dynform.spi.dynformfield.JZoomDialog; |
|
66 |
import org.gvsig.tools.dynobject.Tags; |
|
67 |
import org.gvsig.tools.i18n.I18nManager; |
|
68 |
import org.gvsig.tools.service.spi.NotRegisteredException; |
|
69 |
import org.slf4j.Logger; |
|
70 |
import org.slf4j.LoggerFactory; |
|
71 |
|
|
72 |
public class DefaultDynFormSPIManager implements DynFormSPIManager { |
|
73 |
|
|
74 |
class DefaultComponentsFactory implements ComponentsFactory { |
|
75 |
|
|
76 |
private class DefaultScrolledComponent<T> implements ScrolledComponent<T> { |
|
77 |
private final T component; |
|
78 |
private final JScrollPane scrollPane; |
|
79 |
|
|
80 |
public DefaultScrolledComponent(JScrollPane scrollPane, T component) { |
|
81 |
this.component = component; |
|
82 |
this.scrollPane = scrollPane; |
|
83 |
} |
|
84 |
|
|
85 |
@Override |
|
86 |
public JScrollPane getScrollPane() { |
|
87 |
return this.scrollPane; |
|
88 |
} |
|
89 |
|
|
90 |
@Override |
|
91 |
public T getComponent() { |
|
92 |
return this.component; |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
@Override |
|
97 |
public boolean containsComponents(DynFormFieldDefinition definition) { |
|
98 |
return false; |
|
99 |
} |
|
100 |
|
|
101 |
@Override |
|
102 |
public boolean containsJComboBox(DynFormFieldDefinition definition, String suffix) { |
|
103 |
return false; |
|
104 |
} |
|
105 |
|
|
106 |
@Override |
|
107 |
public boolean containsJLabel(DynFormFieldDefinition definition, String suffix) { |
|
108 |
return false; |
|
109 |
} |
|
110 |
|
|
111 |
@Override |
|
112 |
public boolean containsJButton(DynFormFieldDefinition definition, String suffix) { |
|
113 |
return false; |
|
114 |
} |
|
115 |
|
|
116 |
@Override |
|
117 |
public boolean containsJSpinner(DynFormFieldDefinition definition, String suffix) { |
|
118 |
return false; |
|
119 |
} |
|
120 |
|
|
121 |
@Override |
|
122 |
public boolean containsJTextField(DynFormFieldDefinition definition, String suffix) { |
|
123 |
return false; |
|
124 |
} |
|
125 |
|
|
126 |
@Override |
|
127 |
public JCheckBox getJCheckBox(DynFormFieldDefinition definition, String suffix) { |
|
128 |
return new JCheckBox(); |
|
129 |
} |
|
130 |
|
|
131 |
@Override |
|
132 |
public JLabel getJLabel(DynFormFieldDefinition definition, String suffix) { |
|
133 |
return new JLabel(); |
|
134 |
} |
|
135 |
|
|
136 |
@Override |
|
137 |
public JButton getJButton(DynFormFieldDefinition definition, String suffix) { |
|
138 |
return new JButton(); |
|
139 |
} |
|
140 |
|
|
141 |
@Override |
|
142 |
public JSpinner getJSpinner(DynFormFieldDefinition definition, String suffix) { |
|
143 |
return new JCustomSpinner(definition.getLabel()); |
|
144 |
} |
|
145 |
|
|
146 |
@Override |
|
147 |
public JComboBox getJComboBox(DynFormFieldDefinition definition, String suffix) { |
|
148 |
return new JComboBox(); |
|
149 |
} |
|
150 |
|
|
151 |
@Override |
|
152 |
public JTextComponent getJTextField(DynFormFieldDefinition definition, String suffix) { |
|
153 |
return new JCustomTextField(definition.getLabel()); |
|
154 |
} |
|
155 |
|
|
156 |
@Override |
|
157 |
public JTextComponent getJPasswordField(DynFormFieldDefinition definition, String suffix) { |
|
158 |
return new JPasswordField(definition.getLabel()); |
|
159 |
} |
|
160 |
|
|
161 |
@Override |
|
162 |
public ScrolledComponent<JTextArea> getJTextArea(DynFormFieldDefinition definition, String suffix) { |
|
163 |
JCustomTextArea component = new JCustomTextArea(definition.getLabel()); |
|
164 |
JScrollPane scrollPane = new JScrollPane(component); |
|
165 |
return new DefaultScrolledComponent<>(scrollPane, component); |
|
166 |
} |
|
167 |
|
|
168 |
@Override |
|
169 |
public ScrolledComponent<JList> getJList(DynFormFieldDefinition definition, String suffix) { |
|
170 |
JList component = new JList(); |
|
171 |
JScrollPane scrollPane = new JScrollPane(component); |
|
172 |
return new DefaultScrolledComponent<>(scrollPane, component); |
|
173 |
} |
|
174 |
|
|
175 |
@Override |
|
176 |
public ScrolledComponent<JTable> getJTable(DynFormFieldDefinition definition, String suffix) { |
|
177 |
JTable component = new JTable(); |
|
178 |
JScrollPane scrollPane = new JScrollPane(component); |
|
179 |
return new DefaultScrolledComponent<>(scrollPane, component); |
|
180 |
} |
|
181 |
} |
|
182 |
|
|
183 |
|
|
184 |
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultDynFormSPIManager.class); |
|
185 |
|
|
186 |
private DynFormManager manager = null; |
|
187 |
private final Map<String,JDynFormFactory> forms; |
|
188 |
private final Map<String,JDynFormSetFactory> formSets; |
|
189 |
private final List<JDynFormFieldFactory> formFields; |
|
190 |
private final Map<String, PopupMenuActionFactory> popupMenuActions; |
|
191 |
|
|
192 |
public DefaultDynFormSPIManager() { |
|
193 |
this.forms = new HashMap<>(); |
|
194 |
this.formSets = new HashMap<>(); |
|
195 |
this.formFields = new ArrayList<>(); |
|
196 |
this.popupMenuActions = new HashMap<>(); |
|
197 |
} |
|
198 |
|
|
199 |
@Override |
|
200 |
public ComponentsFactory createDefaultComponentsFactory() { |
|
201 |
return new DefaultComponentsFactory(); |
|
202 |
} |
|
203 |
|
|
204 |
@Override |
|
205 |
public DynFormManager getDynFormManager() { |
|
206 |
if ( manager == null ) { |
|
207 |
manager = DynFormLocator.getDynFormManager(); |
|
208 |
} |
|
209 |
return manager; |
|
210 |
} |
|
211 |
|
|
212 |
@Override |
|
213 |
public JZoomDialog createJZoomDialog(String title, String message, String text) { |
|
214 |
return new DefaultZoomDialog(title, text); |
|
215 |
} |
|
216 |
|
|
217 |
@Override |
|
218 |
public JProblemIndicator createProblemIndicator(JDynFormField field) { |
|
219 |
return new DefaultJProblemIndicator(field); |
|
220 |
} |
|
221 |
|
|
222 |
@Override |
|
223 |
@SuppressWarnings("null") |
|
224 |
public JPopupMenu createTextFieldPopupMenu(final String title, final JTextComponent component, boolean zoom) { |
|
225 |
JPopupMenu popupMenu = new JPopupMenu(); |
|
226 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
227 |
|
|
228 |
// JMenuItem textEditorAction = new JMenuItem("Text Editor"); |
|
229 |
// textEditorAction.addActionListener(new ActionListener() { |
|
230 |
// public void actionPerformed(ActionEvent arg0) { |
|
231 |
// JZoomDialog dialog = DynFormSPILocator.getDynFormSPIManager().createJZoomDialog("Edit the field", null, component.getText()); |
|
232 |
// dialog.setAlwaysOnTop(true); |
|
233 |
// dialog.setVisible(true); |
|
234 |
// component.setText(dialog.getText()); |
|
235 |
// } |
|
236 |
// }); |
|
237 |
Action textEditorAction = new AbstractAction(i18nManager.getTranslation("text_editor")) { |
|
238 |
@Override |
|
239 |
public void actionPerformed(ActionEvent e) { |
|
240 |
JZoomDialog dialog = DynFormSPILocator.getDynFormSPIManager().createJZoomDialog(title, null, component.getText()); |
|
241 |
dialog.setEditable(component.isEditable()); |
|
242 |
dialog.setAlwaysOnTop(true); |
|
243 |
dialog.setVisible(true); |
|
244 |
if ( component.isEditable() && component.isEnabled() ) { |
|
245 |
component.setText(dialog.getText()); |
|
246 |
} |
|
247 |
} |
|
248 |
}; |
|
249 |
Action copyAction = component.getActionMap().get(DefaultEditorKit.copyAction); |
|
250 |
Action cutAction = component.getActionMap().get(DefaultEditorKit.cutAction); |
|
251 |
Action pasteAction = component.getActionMap().get(DefaultEditorKit.pasteAction); |
|
252 |
Action selectAllAction = component.getActionMap().get(DefaultEditorKit.selectAllAction); |
|
253 |
|
|
254 |
if ( copyAction == null |
|
255 |
&& cutAction == null |
|
256 |
&& pasteAction == null |
|
257 |
&& selectAllAction == null ) { |
|
258 |
copyAction = component.getActionMap().get( i18nManager.getTranslation("copy")); |
|
259 |
cutAction = component.getActionMap().get( i18nManager.getTranslation("cut")); |
|
260 |
pasteAction = component.getActionMap().get( i18nManager.getTranslation("paste")); |
|
261 |
selectAllAction = component.getActionMap().get( i18nManager.getTranslation("SelectAll")); |
|
262 |
} else { |
|
263 |
copyAction.putValue(Action.NAME, i18nManager.getTranslation("copy")); |
|
264 |
cutAction.putValue(Action.NAME, i18nManager.getTranslation("cut")); |
|
265 |
pasteAction.putValue(Action.NAME, i18nManager.getTranslation("paste")); |
|
266 |
selectAllAction.putValue(Action.NAME, i18nManager.getTranslation("SelectAll")); |
|
267 |
} |
|
268 |
|
|
269 |
if ( zoom ) { |
|
270 |
popupMenu.add(textEditorAction); |
|
271 |
popupMenu.addSeparator(); |
|
272 |
} |
|
273 |
popupMenu.add(cutAction); |
|
274 |
popupMenu.add(copyAction); |
|
275 |
popupMenu.add(pasteAction); |
|
276 |
popupMenu.add(selectAllAction); |
|
277 |
|
|
278 |
return popupMenu; |
|
279 |
} |
|
280 |
|
|
281 |
@Override |
|
282 |
public void configurePopupMenu(JDynFormField jfield) { |
|
283 |
for (PopupMenuActionFactory factory : getPopupMenuActionFactories()) { |
|
284 |
if( factory == null ) { |
|
285 |
continue; |
|
286 |
} |
|
287 |
if( factory.isApplicable(jfield) ) { |
|
288 |
jfield.addActionToPopupMenu(factory.getName(), factory.create(jfield)); |
|
289 |
} |
|
290 |
} |
|
291 |
} |
|
292 |
|
|
293 |
@Override |
|
294 |
public Iterable<PopupMenuActionFactory> getPopupMenuActionFactories() { |
|
295 |
return this.popupMenuActions.values(); |
|
296 |
} |
|
297 |
|
|
298 |
@Override |
|
299 |
public void addPopupMenuAction(PopupMenuActionFactory factory) { |
|
300 |
this.popupMenuActions.put(factory.getName(), factory); |
|
301 |
} |
|
302 |
|
|
303 |
@Override |
|
304 |
public void registerDynFieldFactory(JDynFormFieldFactory factory) { |
|
305 |
this.formFields.add(factory); |
|
306 |
this.formFields.sort(null); |
|
307 |
} |
|
308 |
|
|
309 |
@Override |
|
310 |
public void registerDynFormFactory(JDynFormFactory factory) { |
|
311 |
this.forms.put(factory.getName(), factory); |
|
312 |
} |
|
313 |
|
|
314 |
@Override |
|
315 |
public void registerDynFormSetFactory(JDynFormSetFactory factory) { |
|
316 |
this.formSets.put(factory.getName(), factory); |
|
317 |
} |
|
318 |
|
|
319 |
@Override |
|
320 |
public JDynFormFactory getJDynFormFactory(DynFormContext context, DynFormDefinition definition) throws NotRegisteredException { |
|
321 |
for (JDynFormFactory factory : this.forms.values()) { |
|
322 |
if( factory.isApplicableTo(context, definition) ) { |
|
323 |
return factory; |
|
324 |
} |
|
325 |
} |
|
326 |
throw new NotRegisteredException(definition.getName()); |
|
327 |
} |
|
328 |
|
|
329 |
@Override |
|
330 |
public JDynFormSetFactory getJDynFormSetFactory(DynFormContext context, DynFormDefinition definition, Tags contextTags) throws NotRegisteredException { |
|
331 |
for (JDynFormSetFactory factory : this.formSets.values()) { |
|
332 |
if( factory.isApplicableTo(context, definition, contextTags) ) { |
|
333 |
return factory; |
|
334 |
} |
|
335 |
} |
|
336 |
throw new NotRegisteredException(definition.getName()); |
|
337 |
} |
|
338 |
|
|
339 |
@Override |
|
340 |
public JDynFormFieldFactory getJDynFormFieldFactory(DynFormContext context, DynFormFieldDefinition definition) throws NotRegisteredException { |
|
341 |
for (JDynFormFieldFactory factory : this.formFields) { |
|
342 |
if( factory.isApplicableTo(context, definition) ) { |
|
343 |
return factory; |
|
344 |
} |
|
345 |
} |
|
346 |
LOGGER.warn("Can't get JDynFormFieldFactory for '"+definition.getName()+"'."); |
|
347 |
JDynFormFieldFactory factory = this.getJDynFormFieldFactory("UNKNOWN"); |
|
348 |
if( factory==null ) { |
|
349 |
throw new NotRegisteredException(definition.getName()); |
|
350 |
} |
|
351 |
return factory; |
|
352 |
} |
|
353 |
|
|
354 |
@Override |
|
355 |
public JDynFormFieldFactory getJDynFormFieldFactory(String name) { |
|
356 |
for (JDynFormFieldFactory factory : this.formFields) { |
|
357 |
if( StringUtils.equalsIgnoreCase(name, factory.getName()) ) { |
|
358 |
return factory; |
|
359 |
} |
|
360 |
} |
|
361 |
return null; |
|
362 |
} |
|
363 |
|
|
364 |
@Override |
|
365 |
public List<JDynFormFieldFactory> getJDynFormFieldFactories() { |
|
366 |
return Collections.unmodifiableList(this.formFields); |
|
367 |
} |
|
368 |
|
|
369 |
public String dumpFactories() { |
|
370 |
StringBuilder builder = new StringBuilder(); |
|
371 |
builder.append("JDynForm factories:\n"); |
|
372 |
for (JDynFormFactory factory : this.forms.values()) { |
|
373 |
builder.append("- ").append(factory).append("\n"); |
|
374 |
} |
|
375 |
builder.append("JDynFormSet factories:\n"); |
|
376 |
for (JDynFormSetFactory factory : this.formSets.values()) { |
|
377 |
builder.append("- ").append(factory).append("\n"); |
|
378 |
} |
|
379 |
builder.append("JDynFormField factories:\n"); |
|
380 |
for (JDynFormFieldFactory factory : this.formFields) { |
|
381 |
builder.append("- ").append(factory).append("\n"); |
|
382 |
} |
|
383 |
return builder.toString(); |
|
384 |
} |
|
385 |
} |
|
0 | 386 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormDefinition.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.tools.dynform.impl; |
|
25 |
|
|
26 |
import java.util.ArrayList; |
|
27 |
import java.util.Collections; |
|
28 |
import java.util.Comparator; |
|
29 |
import java.util.HashMap; |
|
30 |
import java.util.HashSet; |
|
31 |
import java.util.Iterator; |
|
32 |
import java.util.List; |
|
33 |
import java.util.Map; |
|
34 |
import java.util.Set; |
|
35 |
|
|
36 |
import org.apache.commons.lang3.ObjectUtils; |
|
37 |
import org.apache.commons.lang3.StringUtils; |
|
38 |
import org.gvsig.tools.ToolsLocator; |
|
39 |
import org.gvsig.tools.dynform.DynFormDefinition; |
|
40 |
import org.gvsig.tools.dynform.DynFormFieldDefinition; |
|
41 |
import org.gvsig.tools.dynobject.DynField; |
|
42 |
import org.gvsig.tools.dynobject.DynObject; |
|
43 |
import org.gvsig.tools.dynobject.DynStruct; |
|
44 |
import org.gvsig.tools.dynobject.DynStruct_v2; |
|
45 |
import org.gvsig.tools.dynobject.Tags; |
|
46 |
import org.gvsig.tools.dynobject.impl.DefaultTags; |
|
47 |
|
|
48 |
@SuppressWarnings({ "rawtypes", "unchecked" }) |
|
49 |
public class DefaultDynFormDefinition implements DynFormDefinition { |
|
50 |
|
|
51 |
private DefaultDynFormManager manager = null; |
|
52 |
private List<DynFormFieldDefinition> fieldsDefinitions = null; |
|
53 |
private String name = null; |
|
54 |
private String label = null; |
|
55 |
private Map groupsOrder = null; |
|
56 |
private Tags tags = new DefaultTags(); |
|
57 |
private DynStruct elementsType; |
|
58 |
|
|
59 |
public DefaultDynFormDefinition(String name, DefaultDynFormManager manager) { |
|
60 |
this.name = name; |
|
61 |
this.label = name; |
|
62 |
this.manager = manager; |
|
63 |
this.fieldsDefinitions = new ArrayList(); |
|
64 |
this.groupsOrder = new HashMap(); |
|
65 |
} |
|
66 |
|
|
67 |
public DefaultDynFormDefinition(DynStruct struct, DefaultDynFormManager manager) { |
|
68 |
this(struct.getName(),manager); |
|
69 |
DynField[] fields = struct.getDynFields(); |
|
70 |
for (DynField field : fields) { |
|
71 |
this.add(field); |
|
72 |
} |
|
73 |
if( struct instanceof DynStruct_v2 ) { |
|
74 |
this.setLabel(((DynStruct_v2)struct).getLabel()); |
|
75 |
this.getTags().add(((DynStruct_v2) struct).getTags()); |
|
76 |
} |
|
77 |
this.setElementsType(struct); |
|
78 |
} |
|
79 |
|
|
80 |
|
|
81 |
public String getLabel() { |
|
82 |
return this.label; |
|
83 |
} |
|
84 |
|
|
85 |
public void setLabel(String label) { |
|
86 |
this.label = label; |
|
87 |
} |
|
88 |
|
|
89 |
public int getGroupOrder(String group) { |
|
90 |
return ((Integer)this.groupsOrder.get(group)).intValue(); |
|
91 |
} |
|
92 |
|
|
93 |
public void setGroupOrder(String group, int order) { |
|
94 |
this.groupsOrder.put(group, new Integer(order)); |
|
95 |
} |
|
96 |
|
|
97 |
public DynFormFieldDefinition add(DynField definition) { |
|
98 |
DynFormFieldDefinition x = new DefaultDynFormFieldDefinition(this.manager, definition); |
|
99 |
this.fieldsDefinitions.add(x); |
|
100 |
Collections.sort(this.fieldsDefinitions, new Comparator<DynField>() { |
|
101 |
public int compare(DynField o1, DynField o2) { |
|
102 |
return o1.getOder() - o2.getOder(); |
|
103 |
} |
|
104 |
}); |
|
105 |
return x; |
|
106 |
} |
|
107 |
|
|
108 |
public String getName() { |
|
109 |
return this.name; |
|
110 |
} |
|
111 |
|
|
112 |
public void add(DynStruct definition) { |
|
113 |
DynField[] fields = definition.getDynFields(); |
|
114 |
for( int i=0; i<fields.length; i++ ) { |
|
115 |
this.add(fields[i]); |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
public DynFormFieldDefinition get(String name) { |
|
120 |
Iterator it = this.fieldsDefinitions.iterator(); |
|
121 |
while(it.hasNext()) { |
|
122 |
DynFormFieldDefinition def = (DynFormFieldDefinition) it.next(); |
|
123 |
if( def.getName().equalsIgnoreCase(name)) { |
|
124 |
return def; |
|
125 |
} |
|
126 |
} |
|
127 |
return null; |
|
128 |
} |
|
129 |
|
|
130 |
public DynFormFieldDefinition get(int index) { |
|
131 |
return (DynFormFieldDefinition) this.fieldsDefinitions.get(index); |
|
132 |
} |
|
133 |
|
|
134 |
public int size() { |
|
135 |
return this.fieldsDefinitions.size(); |
|
136 |
} |
|
137 |
|
|
138 |
public void remove(String name) { |
|
139 |
Iterator it = this.fieldsDefinitions.iterator(); |
|
140 |
while(it.hasNext()) { |
|
141 |
DynFormFieldDefinition def = (DynFormFieldDefinition) it.next(); |
|
142 |
if(def.getName().equalsIgnoreCase(name)) { |
|
143 |
it.remove(); |
|
144 |
} |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
public List getGroups() { |
|
149 |
Set groups = new HashSet(); |
|
150 |
Iterator it = this.fieldsDefinitions.iterator(); |
|
151 |
while(it.hasNext()) { |
|
152 |
DynFormFieldDefinition def = (DynFormFieldDefinition) it.next(); |
|
153 |
String group = def.getGroup(); |
|
154 |
groups.add(group); |
|
155 |
if( ! this.groupsOrder.containsKey(group) ) { |
|
156 |
if( StringUtils.isEmpty(group) ) { |
|
157 |
this.setGroupOrder(group, -1); |
|
158 |
} else { |
|
159 |
this.setGroupOrder(group, def.getOder()); |
|
160 |
} |
|
161 |
} |
|
162 |
} |
|
163 |
List r = new ArrayList(); |
|
164 |
r.addAll(groups); |
|
165 |
Collections.sort(r, new Comparator() { |
|
166 |
public int compare(Object o1, Object o2) { |
|
167 |
Integer order1 = (Integer) groupsOrder.get(o1); |
|
168 |
Integer order2 = (Integer) groupsOrder.get(o2); |
|
169 |
return order1.compareTo(order2); |
|
170 |
} |
|
171 |
}); |
|
172 |
return r; |
|
173 |
} |
|
174 |
|
|
175 |
|
|
176 |
public List getSubgroups(String group) { |
|
177 |
if( group == null ) { |
|
178 |
return Collections.EMPTY_LIST; |
|
179 |
} |
|
180 |
Set subgroups = new HashSet(); |
|
181 |
Iterator it = this.fieldsDefinitions.iterator(); |
|
182 |
while(it.hasNext()) { |
|
183 |
DynFormFieldDefinition def = (DynFormFieldDefinition) it.next(); |
|
184 |
if( group.equalsIgnoreCase(def.getGroup())) { |
|
185 |
subgroups.add(def.getSubgroup()); |
|
186 |
} |
|
187 |
} |
|
188 |
List r = new ArrayList(); |
|
189 |
r.addAll(subgroups); |
|
190 |
Collections.sort(r); |
|
191 |
return r; |
|
192 |
} |
|
193 |
|
|
194 |
public List getDefinitions() { |
|
195 |
List r = new ArrayList(); |
|
196 |
Iterator it = this.fieldsDefinitions.iterator(); |
|
197 |
while(it.hasNext()) { |
|
198 |
DynFormFieldDefinition def = (DynFormFieldDefinition) it.next(); |
|
199 |
r.add(def); |
|
200 |
} |
|
201 |
Collections.sort(r, new Comparator() { |
|
202 |
public int compare(Object o1, Object o2) { |
|
203 |
DynFormFieldDefinition def1 = (DynFormFieldDefinition) o1; |
|
204 |
DynFormFieldDefinition def2 = (DynFormFieldDefinition) o2; |
|
205 |
if( def1.getOder() == def2.getOder() ) { |
|
206 |
if(def1.getLabel() != null && def2.getLabel() != null) |
|
207 |
return def1.getLabel().compareToIgnoreCase(def2.getLabel()); |
|
208 |
else{ |
|
209 |
return 0; |
|
210 |
} |
|
211 |
} else { |
|
212 |
return def1.getOder() > def2.getOder() ? 1 : -1; |
|
213 |
} |
|
214 |
}; |
|
215 |
}); |
|
216 |
return r; |
|
217 |
} |
|
218 |
|
|
219 |
public List getDefinitions(String group) { |
|
220 |
List r = new ArrayList(); |
|
221 |
Iterator it = this.fieldsDefinitions.iterator(); |
|
222 |
while(it.hasNext()) { |
|
223 |
DynFormFieldDefinition def = (DynFormFieldDefinition) it.next(); |
|
224 |
if( group == null ) { |
|
225 |
if( def.getGroup() == null ) { |
|
226 |
r.add(def); |
|
227 |
} |
|
228 |
} else { |
|
229 |
if( group.equalsIgnoreCase(def.getGroup())) { |
|
230 |
r.add(def); |
|
231 |
} |
|
232 |
} |
|
233 |
} |
|
234 |
Collections.sort(r, new Comparator() { |
|
235 |
public int compare(Object o1, Object o2) { |
|
236 |
DynFormFieldDefinition def1 = (DynFormFieldDefinition) o1; |
|
237 |
DynFormFieldDefinition def2 = (DynFormFieldDefinition) o2; |
|
238 |
if( def1.getOder() == def2.getOder() ) { |
|
239 |
return ObjectUtils.compare(def1.getLabel(),def2.getLabel()); |
|
240 |
} else { |
|
241 |
return def1.getOder() > def2.getOder() ? 1 : -1; |
|
242 |
} |
|
243 |
}; |
|
244 |
}); |
|
245 |
return r; |
|
246 |
} |
|
247 |
|
|
248 |
public List getDefinitions(String group, String subgroup) { |
|
249 |
List r = new ArrayList(); |
|
250 |
Iterator it = this.fieldsDefinitions.iterator(); |
|
251 |
while(it.hasNext()) { |
|
252 |
DynFormFieldDefinition def = (DynFormFieldDefinition) it.next(); |
|
253 |
if( group.equalsIgnoreCase(def.getGroup()) && subgroup.equalsIgnoreCase(def.getSubgroup())) { |
|
254 |
r.add(def); |
|
255 |
} |
|
256 |
} |
|
257 |
Collections.sort(r, new Comparator() { |
|
258 |
public int compare(Object o1, Object o2) { |
|
259 |
DynFormFieldDefinition def1 = (DynFormFieldDefinition) o1; |
|
260 |
DynFormFieldDefinition def2 = (DynFormFieldDefinition) o2; |
|
261 |
if( def1.getOder() == def2.getOder() ) { |
|
262 |
return def1.getLabel().compareToIgnoreCase(def2.getLabel()); |
|
263 |
} else { |
|
264 |
return def1.getOder() > def2.getOder() ? 1 : -1; |
|
265 |
} |
|
266 |
}; |
|
267 |
}); |
|
268 |
return r; |
|
269 |
} |
|
270 |
|
|
271 |
public Tags getTags() { |
|
272 |
return this.tags; |
|
273 |
} |
|
274 |
|
|
275 |
public DynObject createElement() { |
|
276 |
return ToolsLocator.getDynObjectManager().createDynObject(this.elementsType); |
|
277 |
} |
|
278 |
|
|
279 |
public void setElementsType(DynStruct struct) { |
|
280 |
this.elementsType = struct; |
|
281 |
} |
|
282 |
|
|
283 |
public DynStruct getElementsType() { |
|
284 |
return this.elementsType; |
|
285 |
} |
|
286 |
|
|
287 |
@Override |
|
288 |
public Iterator<DynFormFieldDefinition> iterator() { |
|
289 |
return this.fieldsDefinitions.iterator(); |
|
290 |
} |
|
291 |
|
|
292 |
|
|
293 |
} |
|
0 | 294 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJProblemIndicator.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.tools.dynform.impl; |
|
25 |
|
|
26 |
import java.awt.Cursor; |
|
27 |
import java.awt.event.MouseAdapter; |
|
28 |
import java.awt.event.MouseEvent; |
|
29 |
import java.net.URL; |
|
30 |
|
|
31 |
import javax.swing.ImageIcon; |
|
32 |
import javax.swing.JComponent; |
|
33 |
import javax.swing.JLabel; |
|
34 |
import javax.swing.JOptionPane; |
|
35 |
|
|
36 |
import org.gvsig.tools.dynform.JDynFormField; |
|
37 |
import org.gvsig.tools.dynform.spi.dynformfield.JProblemIndicator; |
|
38 |
import org.gvsig.tools.swing.api.Component; |
|
39 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
40 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
|
41 |
|
|
42 |
public class DefaultJProblemIndicator implements Component, JProblemIndicator { |
|
43 |
|
|
44 |
private String message = null; |
|
45 |
private JLabel indicator = null; |
|
46 |
private ImageIcon okIcon = null; |
|
47 |
private ImageIcon errorIcon = null; |
|
48 |
private Cursor defaultCursor = null; |
|
49 |
private Cursor handCursor = null; |
|
50 |
private JDynFormField field = null; |
|
51 |
|
|
52 |
public DefaultJProblemIndicator(JDynFormField field) { |
|
53 |
this.field = field; |
|
54 |
} |
|
55 |
|
|
56 |
private void initComponentIfNeed() { |
|
57 |
if (this.indicator == null) { |
|
58 |
this.indicator = new JLabel(); |
|
59 |
URL resource; |
|
60 |
IconTheme theme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
|
61 |
this.errorIcon = theme.get("form-problem-indicator"); |
|
62 |
resource = this.getClass().getClassLoader().getResource("org/gvsig/tools/dynform/impl/images/transparent.png"); |
|
63 |
if (resource != null) { |
|
64 |
this.okIcon = new ImageIcon(resource); |
|
65 |
} |
|
66 |
this.indicator.setIcon(this.okIcon); |
|
67 |
|
|
68 |
this.indicator.addMouseListener(new MouseAdapter() { |
|
69 |
@Override |
|
70 |
public void mouseClicked(MouseEvent evt) { |
|
71 |
if (message == null) { |
|
72 |
return; |
|
73 |
} |
|
74 |
int count = evt.getClickCount(); |
|
75 |
if (count == 1) { |
|
76 |
JOptionPane.showMessageDialog(field.asJComponent(), message, "Status", JOptionPane.INFORMATION_MESSAGE); |
|
77 |
} |
|
78 |
} |
|
79 |
}); |
|
80 |
this.defaultCursor = this.indicator.getCursor(); |
|
81 |
this.handCursor = new Cursor(Cursor.HAND_CURSOR); |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
@Override |
|
86 |
public JComponent asJComponent() { |
|
87 |
this.initComponentIfNeed(); |
|
88 |
return this.indicator; |
|
89 |
} |
|
90 |
|
|
91 |
@Override |
|
92 |
public void clear() { |
|
93 |
this.initComponentIfNeed(); |
|
94 |
this.message = null; |
|
95 |
this.indicator.setToolTipText(""); |
|
96 |
this.indicator.setIcon(this.okIcon); |
|
97 |
this.indicator.setCursor(this.defaultCursor); |
|
98 |
} |
|
99 |
|
|
100 |
@Override |
|
101 |
public void set(String message) { |
|
102 |
this.initComponentIfNeed(); |
|
103 |
this.message = message; |
|
104 |
this.indicator.setToolTipText(message); |
|
105 |
this.indicator.setIcon(this.errorIcon); |
|
106 |
this.indicator.setCursor(this.handCursor); |
|
107 |
field.fireMessageEvent(this.message); |
|
108 |
} |
|
109 |
|
|
110 |
@Override |
|
111 |
public void restore() { |
|
112 |
if (message != null) { |
|
113 |
set(message); |
|
114 |
} |
|
115 |
} |
|
116 |
|
|
117 |
} |
|
0 | 118 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.327/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJDynForm.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or modify it under |
|
7 |
* the terms of the GNU General Public License as published by the Free Software |
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
9 |
* version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
14 |
* details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us at info AT |
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.tools.dynform.impl; |
|
24 |
|
|
25 |
import java.awt.Component; |
|
26 |
import org.gvsig.tools.dynform.spi.dynform.AbstractJDynForm; |
|
27 |
import java.util.ArrayList; |
|
28 |
import java.util.HashMap; |
|
29 |
import java.util.Iterator; |
|
30 |
import java.util.List; |
|
31 |
import java.util.Map; |
|
32 |
|
|
33 |
import javax.swing.Action; |
|
34 |
import javax.swing.JComponent; |
Also available in: Unified diff