Revision 1405
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormField.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 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.
|
|
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 | 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.
|
|
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 | 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. |
|
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. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 | 23 |
package org.gvsig.tools.dynform.spi.dynformfield; |
25 | 24 |
|
... | ... | |
51 | 50 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
52 | 51 |
import org.gvsig.tools.dynobject.DynField_v2; |
53 | 52 |
import org.gvsig.tools.dynobject.DynObject; |
53 |
import org.gvsig.tools.dynobject.Tags; |
|
54 | 54 |
import org.gvsig.tools.service.Manager; |
55 | 55 |
import org.gvsig.tools.service.spi.ServiceManager; |
56 | 56 |
import org.slf4j.Logger; |
57 | 57 |
import org.slf4j.LoggerFactory; |
58 | 58 |
|
59 | 59 |
@SuppressWarnings({"rawtypes", "unchecked"}) |
60 |
public abstract class AbstractJDynFormField implements JDynFormField{ |
|
60 |
public abstract class AbstractJDynFormField implements JDynFormField {
|
|
61 | 61 |
|
62 |
protected static final Logger logger = LoggerFactory |
|
63 |
.getLogger(AbstractJDynFormField.class); |
|
64 |
|
|
65 |
private DynFormSPIManager manager = null; |
|
66 |
private DynFormFieldDefinition definition = null; |
|
67 |
private JLabel jlabel = null; |
|
68 |
private JPanel jlabelpanel = null; |
|
69 |
private Set listeners = null; |
|
70 |
private JProblemIndicator problemIndicator = null; |
|
62 |
protected static final Logger logger = LoggerFactory |
|
63 |
.getLogger(AbstractJDynFormField.class); |
|
71 | 64 |
|
72 |
protected DynObject parameters = null; |
|
73 |
protected JComponent contents = null; |
|
65 |
private DynFormSPIManager manager = null; |
|
66 |
private DynFormFieldDefinition definition = null; |
|
67 |
private JLabel jlabel = null; |
|
68 |
private JPanel jlabelpanel = null; |
|
69 |
private Set listeners = null; |
|
70 |
private JProblemIndicator problemIndicator = null; |
|
74 | 71 |
|
75 |
private boolean readOnly = false; |
|
76 |
private List customActions; |
|
77 |
protected boolean emptyToNull = false; |
|
72 |
protected DynObject parameters = null; |
|
73 |
protected JComponent contents = null; |
|
74 |
|
|
75 |
private boolean readOnly = false; |
|
76 |
private final List customActions; |
|
77 |
protected boolean emptyToNull = false; |
|
78 | 78 |
private JDynForm form; |
79 | 79 |
|
80 |
public AbstractJDynFormField(DynObject parameters, |
|
81 |
ServiceManager serviceManager) { |
|
82 |
this.parameters = parameters; |
|
83 |
this.manager = (DynFormSPIManager) serviceManager; |
|
84 |
this.definition = this.getDefinition(); |
|
85 |
this.listeners = new HashSet(); |
|
86 |
this.readOnly = this.definition.isReadOnly(); |
|
87 |
this.problemIndicator = this.manager.createProblemIndicator(this); |
|
88 |
this.customActions = new ArrayList<>(); |
|
89 |
this.loadDefaultValuesFromTags(definition.getTags()); |
|
90 |
} |
|
80 | 91 |
|
81 |
public AbstractJDynFormField(DynObject parameters,
|
|
82 |
ServiceManager serviceManager) {
|
|
83 |
this.parameters = parameters;
|
|
84 |
this.manager = (DynFormSPIManager) serviceManager;
|
|
85 |
this.definition = this.getDefinition();
|
|
86 |
this.listeners = new HashSet();
|
|
87 |
this.readOnly = this.definition.isReadOnly();
|
|
88 |
this.problemIndicator = this.manager.createProblemIndicator(this);
|
|
89 |
this.customActions = new ArrayList<Action>();
|
|
90 |
}
|
|
92 |
public void loadDefaultValuesFromTags(Tags tags) {
|
|
93 |
try {
|
|
94 |
this.readOnly = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_READONLY);
|
|
95 |
} catch (CoercionException ex) {
|
|
96 |
}
|
|
97 |
try {
|
|
98 |
this.emptyToNull = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_TRANSLATE_EMPTY_TO_NULL);
|
|
99 |
} catch (CoercionException ex) {
|
|
100 |
}
|
|
101 |
}
|
|
91 | 102 |
|
92 |
public abstract void initComponent(); |
|
93 |
public abstract Object getAssignedValue(); |
|
103 |
public abstract void initComponent(); |
|
94 | 104 |
|
95 |
public Object getParameterValue() { |
|
96 |
return this.parameters.getDynValue(DynFormSPIManager.FIELD_VALUE); |
|
97 |
} |
|
105 |
public abstract Object getAssignedValue(); |
|
98 | 106 |
|
99 |
public JComponent asJComponent() { |
|
100 |
if (this.contents == null) { |
|
101 |
this.initComponent(); |
|
102 |
if(!this.customActions.isEmpty()){ |
|
103 |
addPopupComponents(); |
|
104 |
} |
|
105 |
if( this.readOnly ) { |
|
106 |
this.setReadOnly(readOnly); |
|
107 |
} |
|
108 |
} |
|
109 |
return this.contents; |
|
110 |
} |
|
107 |
public Object getParameterValue() { |
|
108 |
return this.parameters.getDynValue(DynFormSPIManager.FIELD_VALUE); |
|
109 |
} |
|
111 | 110 |
|
112 |
public String getName() { |
|
113 |
return this.definition.getName(); |
|
114 |
} |
|
111 |
@Override |
|
112 |
public JComponent asJComponent() { |
|
113 |
if (this.contents == null) { |
|
114 |
this.initComponent(); |
|
115 |
if (!this.customActions.isEmpty()) { |
|
116 |
addPopupComponents(); |
|
117 |
} |
|
118 |
if (this.readOnly) { |
|
119 |
this.setReadOnly(readOnly); |
|
120 |
} |
|
121 |
} |
|
122 |
return this.contents; |
|
123 |
} |
|
115 | 124 |
|
116 |
public String getLabel() { |
|
117 |
if(definition.getLabel() != null) |
|
118 |
return definition.getLabel(); |
|
119 |
else |
|
120 |
return this.getName(); |
|
121 |
} |
|
125 |
public String getName() { |
|
126 |
return this.definition.getName(); |
|
127 |
} |
|
122 | 128 |
|
123 |
public JComponent getJLabel() { |
|
124 |
if (this.jlabel == null) { |
|
125 |
if( getTagValueAsBoolean("dynform.label.empty", false) ) { |
|
126 |
this.jlabel = new JLabel(""); |
|
127 |
} else { |
|
128 |
this.jlabel = new JLabel(this.getLabel()); |
|
129 |
} |
|
130 |
this.jlabel.setLabelFor(this.contents); |
|
131 |
if( this.getDefinition().isMandatory() ) { |
|
132 |
this.jlabel.setForeground(Color.red.darker()); |
|
133 |
} |
|
134 |
this.jlabelpanel = new JPanel(); |
|
135 |
this.jlabelpanel.setLayout(new BorderLayout()); |
|
136 |
this.jlabelpanel.add(jlabel,BorderLayout.CENTER); |
|
137 |
this.jlabelpanel.add(problemIndicator.asJComponent(), BorderLayout.LINE_END); |
|
138 |
} |
|
139 |
return this.jlabelpanel; |
|
140 |
} |
|
129 |
public String getLabel() { |
|
130 |
if (definition.getLabel() != null) { |
|
131 |
return definition.getLabel(); |
|
132 |
} else { |
|
133 |
return this.getName(); |
|
134 |
} |
|
135 |
} |
|
141 | 136 |
|
142 |
public DynFormFieldDefinition getDefinition() { |
|
143 |
return (DynFormFieldDefinition) this.parameters |
|
144 |
.getDynValue(DynFormSPIManager.FIELD_FIELDDEFINITION); |
|
145 |
} |
|
137 |
public JComponent getJLabel() { |
|
138 |
if (this.jlabel == null) { |
|
139 |
if (getTagValueAsBoolean(DynFormSPIManager.TAG_DYNFORM_LABEL_EMPTY, false)) { |
|
140 |
this.jlabel = new JLabel(""); |
|
141 |
} else { |
|
142 |
this.jlabel = new JLabel(this.getLabel()); |
|
143 |
} |
|
144 |
this.jlabel.setLabelFor(this.contents); |
|
145 |
if (this.getDefinition().isMandatory()) { |
|
146 |
this.jlabel.setForeground(Color.red.darker()); |
|
147 |
} |
|
148 |
this.jlabelpanel = new JPanel(); |
|
149 |
this.jlabelpanel.setLayout(new BorderLayout()); |
|
150 |
this.jlabelpanel.add(jlabel, BorderLayout.CENTER); |
|
151 |
this.jlabelpanel.add(problemIndicator.asJComponent(), BorderLayout.LINE_END); |
|
152 |
} |
|
153 |
return this.jlabelpanel; |
|
154 |
} |
|
146 | 155 |
|
147 |
public Manager getManager() { |
|
148 |
return this.manager; |
|
149 |
} |
|
150 |
|
|
151 |
public DynFormSPIManager getServiceManager(){ |
|
152 |
return this.manager; |
|
153 |
} |
|
156 |
public DynFormFieldDefinition getDefinition() { |
|
157 |
return (DynFormFieldDefinition) this.parameters |
|
158 |
.getDynValue(DynFormSPIManager.FIELD_FIELDDEFINITION); |
|
159 |
} |
|
154 | 160 |
|
155 |
public void addListener(JDynFormFieldListener listener) {
|
|
156 |
this.listeners.add(listener);
|
|
157 |
}
|
|
161 |
public Manager getManager() {
|
|
162 |
return this.manager;
|
|
163 |
}
|
|
158 | 164 |
|
159 |
public void removeListener(JDynFormFieldListener listener) { |
|
160 |
this.listeners.remove(listener); |
|
161 |
} |
|
162 |
|
|
163 |
protected void fireFieldChangedEvent() { |
|
164 |
Iterator it = this.listeners.iterator(); |
|
165 |
while (it.hasNext()) { |
|
166 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
167 |
try { |
|
168 |
listener.fieldChanged(this); |
|
169 |
} catch (Exception ex) { |
|
170 |
logger.info("Error calling listener " + listener.toString() |
|
171 |
+ "(" + listener.getClass().getName() + ") from " |
|
172 |
+ this.toString() + "(" + this.getClass().getName() |
|
173 |
+ ").", ex); |
|
174 |
} |
|
175 |
} |
|
176 |
} |
|
165 |
public DynFormSPIManager getServiceManager() { |
|
166 |
return this.manager; |
|
167 |
} |
|
177 | 168 |
|
178 |
protected void fireFieldEnterEvent() { |
|
179 |
Iterator it = this.listeners.iterator(); |
|
180 |
while (it.hasNext()) { |
|
181 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
182 |
try { |
|
183 |
listener.fieldEnter(this); |
|
184 |
} catch (Exception ex) { |
|
185 |
logger.info("Error calling listener " + listener.toString() |
|
186 |
+ "(" + listener.getClass().getName() + ") from " |
|
187 |
+ this.toString() + "(" + this.getClass().getName() |
|
188 |
+ ").", ex); |
|
189 |
} |
|
190 |
} |
|
191 |
} |
|
169 |
public void addListener(JDynFormFieldListener listener) { |
|
170 |
this.listeners.add(listener); |
|
171 |
} |
|
192 | 172 |
|
193 |
protected void fireFieldExitEvent() { |
|
194 |
Iterator it = this.listeners.iterator(); |
|
195 |
while (it.hasNext()) { |
|
196 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
197 |
try { |
|
198 |
listener.fieldExit(this); |
|
199 |
} catch (Exception ex) { |
|
200 |
logger.info("Error calling listener " + listener.toString() |
|
201 |
+ "(" + listener.getClass().getName() + ") from " |
|
202 |
+ this.toString() + "(" + this.getClass().getName() |
|
203 |
+ ").", ex); |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
207 |
|
|
208 |
public void fireMessageEvent(String message) { |
|
209 |
Iterator it = this.listeners.iterator(); |
|
210 |
while (it.hasNext()) { |
|
211 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
212 |
try { |
|
213 |
listener.message(this, message); |
|
214 |
} catch (Exception ex) { |
|
215 |
logger.info("Error calling listener " + listener.toString() |
|
216 |
+ "(" + listener.getClass().getName() + ") from " |
|
217 |
+ this.toString() + "(" + this.getClass().getName() |
|
218 |
+ ").", ex); |
|
219 |
} |
|
220 |
} |
|
221 |
} |
|
173 |
public void removeListener(JDynFormFieldListener listener) { |
|
174 |
this.listeners.remove(listener); |
|
175 |
} |
|
222 | 176 |
|
223 |
public boolean isReadOnly() { |
|
224 |
return this.readOnly ; |
|
225 |
} |
|
226 |
|
|
227 |
public void setReadOnly(boolean readonly) { |
|
177 |
protected void fireFieldChangedEvent() { |
|
178 |
Iterator it = this.listeners.iterator(); |
|
179 |
while (it.hasNext()) { |
|
180 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
181 |
try { |
|
182 |
listener.fieldChanged(this); |
|
183 |
} catch (Exception ex) { |
|
184 |
logger.info("Error calling listener " + listener.toString() |
|
185 |
+ "(" + listener.getClass().getName() + ") from " |
|
186 |
+ this.toString() + "(" + this.getClass().getName() |
|
187 |
+ ").", ex); |
|
188 |
} |
|
189 |
} |
|
190 |
} |
|
191 |
|
|
192 |
protected void fireFieldEnterEvent() { |
|
193 |
Iterator it = this.listeners.iterator(); |
|
194 |
while (it.hasNext()) { |
|
195 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
196 |
try { |
|
197 |
listener.fieldEnter(this); |
|
198 |
} catch (Exception ex) { |
|
199 |
logger.info("Error calling listener " + listener.toString() |
|
200 |
+ "(" + listener.getClass().getName() + ") from " |
|
201 |
+ this.toString() + "(" + this.getClass().getName() |
|
202 |
+ ").", ex); |
|
203 |
} |
|
204 |
} |
|
205 |
} |
|
206 |
|
|
207 |
protected void fireFieldExitEvent() { |
|
208 |
Iterator it = this.listeners.iterator(); |
|
209 |
while (it.hasNext()) { |
|
210 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
211 |
try { |
|
212 |
listener.fieldExit(this); |
|
213 |
} catch (Exception ex) { |
|
214 |
logger.info("Error calling listener " + listener.toString() |
|
215 |
+ "(" + listener.getClass().getName() + ") from " |
|
216 |
+ this.toString() + "(" + this.getClass().getName() |
|
217 |
+ ").", ex); |
|
218 |
} |
|
219 |
} |
|
220 |
} |
|
221 |
|
|
222 |
public void fireMessageEvent(String message) { |
|
223 |
Iterator it = this.listeners.iterator(); |
|
224 |
while (it.hasNext()) { |
|
225 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
226 |
try { |
|
227 |
listener.message(this, message); |
|
228 |
} catch (Exception ex) { |
|
229 |
logger.info("Error calling listener " + listener.toString() |
|
230 |
+ "(" + listener.getClass().getName() + ") from " |
|
231 |
+ this.toString() + "(" + this.getClass().getName() |
|
232 |
+ ").", ex); |
|
233 |
} |
|
234 |
} |
|
235 |
} |
|
236 |
|
|
237 |
public boolean isReadOnly() { |
|
238 |
return this.readOnly; |
|
239 |
} |
|
240 |
|
|
241 |
public void setReadOnly(boolean readonly) { |
|
228 | 242 |
// FIXME: Implememtacion por defecto, sobreescribirla en las subclases |
229 |
// segun convenga para cada componente. |
|
230 |
JTextComponent x = null; |
|
231 |
|
|
232 |
this.readOnly = readonly; |
|
233 |
if(jlabel != null){ |
|
234 |
this.jlabel.setEnabled(!readonly); |
|
235 |
} |
|
236 |
if( this.contents != null ) { |
|
237 |
if( this.contents instanceof JTextComponent ) { |
|
238 |
x = (JTextComponent) this.contents; |
|
239 |
x.setEditable(!readonly); |
|
240 |
} else if( this.contents instanceof JScrollPane ) { |
|
241 |
try { |
|
242 |
JViewport port = ((JScrollPane)this.contents).getViewport(); |
|
243 |
x = (JTextComponent) port.getView(); |
|
244 |
x.setEditable(!readonly); |
|
245 |
} catch(Exception ex) { |
|
246 |
this.contents.setEnabled(!readOnly); |
|
247 |
} |
|
248 |
} else { |
|
249 |
this.contents.setEnabled(!readOnly); |
|
250 |
} |
|
251 |
} |
|
252 |
} |
|
243 |
// segun convenga para cada componente. |
|
244 |
JTextComponent x = null; |
|
253 | 245 |
|
254 |
public JProblemIndicator problemIndicator() { |
|
255 |
return this.problemIndicator; |
|
256 |
} |
|
246 |
this.readOnly = readonly; |
|
247 |
if (jlabel != null) { |
|
248 |
this.jlabel.setEnabled(!readonly); |
|
249 |
} |
|
250 |
if (this.contents != null) { |
|
251 |
if (this.contents instanceof JTextComponent) { |
|
252 |
x = (JTextComponent) this.contents; |
|
253 |
x.setEditable(!readonly); |
|
254 |
} else if (this.contents instanceof JScrollPane) { |
|
255 |
try { |
|
256 |
JViewport port = ((JScrollPane) this.contents).getViewport(); |
|
257 |
x = (JTextComponent) port.getView(); |
|
258 |
x.setEditable(!readonly); |
|
259 |
} catch (Exception ex) { |
|
260 |
this.contents.setEnabled(!readOnly); |
|
261 |
} |
|
262 |
} else { |
|
263 |
this.contents.setEnabled(!readOnly); |
|
264 |
} |
|
265 |
} |
|
266 |
} |
|
257 | 267 |
|
258 |
public class IllegalFieldValue extends RuntimeException { |
|
259 |
|
|
260 |
/** |
|
261 |
* |
|
262 |
*/ |
|
263 |
private static final long serialVersionUID = -4409236610055983438L; |
|
268 |
public JProblemIndicator problemIndicator() { |
|
269 |
return this.problemIndicator; |
|
270 |
} |
|
264 | 271 |
|
265 |
public IllegalFieldValue(JDynFormField field, String message) { |
|
266 |
super("The value of field '"+field.getLabel()+"' is not valid. " + message); |
|
267 |
} |
|
268 |
} |
|
269 |
|
|
270 |
public String toString() { |
|
271 |
return super.toString() + "{" + this.getName() + "}"; |
|
272 |
} |
|
273 |
|
|
274 |
public boolean isModified() { |
|
275 |
boolean modified = false; |
|
276 |
try { |
|
277 |
if( !this.isReadOnly() ) { |
|
278 |
Object value = this.getValue(); |
|
279 |
if( value == null ) { |
|
280 |
if( value != this.getAssignedValue() ) { |
|
281 |
modified = true; |
|
282 |
} |
|
283 |
} else { |
|
284 |
if( ! value.equals(this.getAssignedValue()) ) { |
|
285 |
modified = true; |
|
286 |
} |
|
287 |
} |
|
288 |
} |
|
289 |
} catch(IllegalFieldValue ex) { |
|
290 |
// Si es incorrecto el valor del campo decimos a capom que esta modificado. |
|
291 |
modified = true; |
|
292 |
} |
|
293 |
return modified; |
|
294 |
} |
|
295 |
|
|
296 |
private void addPopupComponents(){ |
|
297 |
Iterator it = this.customActions.iterator(); |
|
298 |
while(it.hasNext()){ |
|
299 |
Object obj = it.next(); |
|
300 |
if(obj!=null){ |
|
301 |
Action act = (Action) obj; |
|
302 |
if(contents instanceof SupportPopupMenu) { |
|
303 |
DynFormFieldAction sact = new DynFormFieldAction(this, act); |
|
304 |
((SupportPopupMenu) this.contents).addActionToPopupMenu( |
|
305 |
sact.getName(), |
|
306 |
sact); |
|
307 |
} |
|
308 |
}else{ |
|
309 |
if(contents instanceof SupportPopupMenu) { |
|
310 |
((SupportPopupMenu) this.contents).addSeparatorToPopupMenu(); |
|
311 |
} |
|
312 |
} |
|
313 |
|
|
314 |
} |
|
315 |
} |
|
272 |
public class IllegalFieldValue extends RuntimeException { |
|
316 | 273 |
|
317 |
public void addActionToPopupMenu(String name, Action action) { |
|
318 |
if(contents != null){ |
|
319 |
if(contents instanceof SupportPopupMenu ) { |
|
320 |
DynFormFieldAction sact = new DynFormFieldAction(this,action); |
|
321 |
((SupportPopupMenu) this.contents).addActionToPopupMenu( |
|
322 |
sact.getName(), |
|
323 |
sact); |
|
324 |
} |
|
325 |
}else{ |
|
326 |
this.customActions.add(action); |
|
327 |
} |
|
328 |
} |
|
274 |
/** |
|
275 |
* |
|
276 |
*/ |
|
277 |
private static final long serialVersionUID = -4409236610055983438L; |
|
329 | 278 |
|
330 |
public void addSeparatorToPopupMenu() { |
|
331 |
if(contents != null){ |
|
332 |
if( contents instanceof SupportPopupMenu ) { |
|
333 |
((SupportPopupMenu) this.contents).addSeparatorToPopupMenu(); |
|
334 |
} |
|
335 |
}else{ |
|
336 |
this.customActions.add(null); |
|
337 |
} |
|
338 |
} |
|
339 |
|
|
340 |
public void setTranslateEmptyToNull(boolean emptyToNull) { |
|
341 |
this.emptyToNull = emptyToNull; |
|
342 |
} |
|
343 |
|
|
344 |
public boolean translateEmptyToNull() { |
|
345 |
return this.emptyToNull; |
|
346 |
} |
|
279 |
public IllegalFieldValue(JDynFormField field, String message) { |
|
280 |
super("The value of field '" + field.getLabel() + "' is not valid. " + message); |
|
281 |
} |
|
282 |
} |
|
347 | 283 |
|
284 |
public String toString() { |
|
285 |
return super.toString() + "{" + this.getName() + "}"; |
|
286 |
} |
|
287 |
|
|
288 |
public boolean isModified() { |
|
289 |
boolean modified = false; |
|
290 |
try { |
|
291 |
if (!this.isReadOnly()) { |
|
292 |
Object value = this.getValue(); |
|
293 |
if (value == null) { |
|
294 |
if (value != this.getAssignedValue()) { |
|
295 |
modified = true; |
|
296 |
} |
|
297 |
} else { |
|
298 |
if (!value.equals(this.getAssignedValue())) { |
|
299 |
modified = true; |
|
300 |
} |
|
301 |
} |
|
302 |
} |
|
303 |
} catch (IllegalFieldValue ex) { |
|
304 |
// Si es incorrecto el valor del campo decimos a capom que esta modificado. |
|
305 |
modified = true; |
|
306 |
} |
|
307 |
return modified; |
|
308 |
} |
|
309 |
|
|
310 |
private void addPopupComponents() { |
|
311 |
Iterator it = this.customActions.iterator(); |
|
312 |
while (it.hasNext()) { |
|
313 |
Object obj = it.next(); |
|
314 |
if (obj != null) { |
|
315 |
Action act = (Action) obj; |
|
316 |
if (contents instanceof SupportPopupMenu) { |
|
317 |
DynFormFieldAction sact = new DynFormFieldAction(this, act); |
|
318 |
((SupportPopupMenu) this.contents).addActionToPopupMenu( |
|
319 |
sact.getName(), |
|
320 |
sact); |
|
321 |
} |
|
322 |
} else { |
|
323 |
if (contents instanceof SupportPopupMenu) { |
|
324 |
((SupportPopupMenu) this.contents).addSeparatorToPopupMenu(); |
|
325 |
} |
|
326 |
} |
|
327 |
|
|
328 |
} |
|
329 |
} |
|
330 |
|
|
331 |
public void addActionToPopupMenu(String name, Action action) { |
|
332 |
if (contents != null) { |
|
333 |
if (contents instanceof SupportPopupMenu) { |
|
334 |
DynFormFieldAction sact = new DynFormFieldAction(this, action); |
|
335 |
((SupportPopupMenu) this.contents).addActionToPopupMenu( |
|
336 |
sact.getName(), |
|
337 |
sact); |
|
338 |
} |
|
339 |
} else { |
|
340 |
this.customActions.add(action); |
|
341 |
} |
|
342 |
} |
|
343 |
|
|
344 |
public void addSeparatorToPopupMenu() { |
|
345 |
if (contents != null) { |
|
346 |
if (contents instanceof SupportPopupMenu) { |
|
347 |
((SupportPopupMenu) this.contents).addSeparatorToPopupMenu(); |
|
348 |
} |
|
349 |
} else { |
|
350 |
this.customActions.add(null); |
|
351 |
} |
|
352 |
} |
|
353 |
|
|
354 |
public void setTranslateEmptyToNull(boolean emptyToNull) { |
|
355 |
this.emptyToNull = emptyToNull; |
|
356 |
} |
|
357 |
|
|
358 |
public boolean translateEmptyToNull() { |
|
359 |
return this.emptyToNull; |
|
360 |
} |
|
361 |
|
|
362 |
@SuppressWarnings("UnnecessaryReturnStatement") |
|
348 | 363 |
public void clear() { |
349 |
if( this.contents == null ) {
|
|
364 |
if (this.contents == null) {
|
|
350 | 365 |
return; |
351 | 366 |
} |
352 |
if( this.contents instanceof JTextField ) {
|
|
367 |
if (this.contents instanceof JTextField) {
|
|
353 | 368 |
Object value = this.getDefinition().getDefaultValue(); |
354 |
if( value != null ) {
|
|
369 |
if (value != null) {
|
|
355 | 370 |
value = value.toString(); |
356 | 371 |
} else { |
357 | 372 |
value = ""; |
358 | 373 |
} |
359 |
((JTextField)this.contents).setText((String)value);
|
|
374 |
((JTextField) this.contents).setText((String) value);
|
|
360 | 375 |
return; |
361 | 376 |
} |
362 |
if( this.contents instanceof JSpinner ) {
|
|
377 |
if (this.contents instanceof JSpinner) {
|
|
363 | 378 |
Object value = this.getDefinition().getDefaultValue(); |
364 |
if( value != null ) {
|
|
379 |
if (value != null) {
|
|
365 | 380 |
value = value.toString(); |
366 | 381 |
} |
367 |
((JSpinner)this.contents).setValue(value); |
|
382 |
((JSpinner) this.contents).setValue(value);
|
|
368 | 383 |
return; |
369 | 384 |
} |
370 |
if( this.contents instanceof JList ) {
|
|
371 |
((JList)this.contents).setSelectedIndex(-1); |
|
385 |
if (this.contents instanceof JList) {
|
|
386 |
((JList) this.contents).setSelectedIndex(-1);
|
|
372 | 387 |
return; |
373 | 388 |
} |
374 |
if( this.contents instanceof JComboBox ) {
|
|
375 |
((JComboBox)this.contents).setSelectedIndex(-1); |
|
389 |
if (this.contents instanceof JComboBox) {
|
|
390 |
((JComboBox) this.contents).setSelectedIndex(-1);
|
|
376 | 391 |
return; |
377 | 392 |
} |
378 | 393 |
} |
... | ... | |
380 | 395 |
public void setForm(JDynForm form) { |
381 | 396 |
this.form = form; |
382 | 397 |
} |
383 |
|
|
398 |
|
|
399 |
@Override |
|
384 | 400 |
public JDynForm getForm() { |
385 | 401 |
return this.form; |
386 | 402 |
} |
387 | 403 |
|
404 |
@Override |
|
405 |
public void fetch(DynObject container) { |
|
406 |
Object value = this.getValue(); |
|
407 |
container.setDynValue(this.getName(), value); |
|
408 |
} |
|
409 |
|
|
388 | 410 |
protected int getTagValueAsInt(String tagname, int defaultVaue) { |
389 | 411 |
return getTagValueAsInt(tagname, null, defaultVaue); |
390 | 412 |
} |
391 | 413 |
|
392 | 414 |
protected int getTagValueAsInt(String tagname1, String tagname2, int defaultVaue) { |
393 |
DynField_v2 fielddef = (DynField_v2)this.getDefinition();
|
|
415 |
DynField_v2 fielddef = (DynField_v2) this.getDefinition();
|
|
394 | 416 |
String tagname = null; |
395 |
if( fielddef.getTags().has(tagname1) ) {
|
|
417 |
if (fielddef.getTags().has(tagname1)) {
|
|
396 | 418 |
tagname = tagname1; |
397 |
} else if( fielddef.getTags().has(tagname2) ) {
|
|
419 |
} else if (fielddef.getTags().has(tagname2)) {
|
|
398 | 420 |
tagname = tagname2; |
399 | 421 |
} else { |
400 | 422 |
return defaultVaue; |
... | ... | |
403 | 425 |
int value = fielddef.getTags().getInt(tagname); |
404 | 426 |
return value; |
405 | 427 |
} catch (CoercionException ex) { |
406 |
logger.warn("Can't parse tag '"+tagname+"' as int for field '"+fielddef.getName()+"'.",ex);
|
|
428 |
logger.warn("Can't parse tag '" + tagname + "' as int for field '" + fielddef.getName() + "'.", ex);
|
|
407 | 429 |
} |
408 | 430 |
return defaultVaue; |
409 | 431 |
} |
410 |
|
|
432 |
|
|
411 | 433 |
protected boolean getTagValueAsBoolean(String tagname, boolean defaultVaue) { |
412 | 434 |
return getTagValueAsBoolean(tagname, null, defaultVaue); |
413 | 435 |
} |
414 |
|
|
436 |
|
|
415 | 437 |
protected boolean getTagValueAsBoolean(String tagname1, String tagname2, boolean defaultVaue) { |
416 |
DynField_v2 fielddef = (DynField_v2)this.getDefinition();
|
|
438 |
DynField_v2 fielddef = (DynField_v2) this.getDefinition();
|
|
417 | 439 |
String tagname = null; |
418 |
if( fielddef.getTags().has(tagname1) ) {
|
|
440 |
if (fielddef.getTags().has(tagname1)) {
|
|
419 | 441 |
tagname = tagname1; |
420 |
} else if( fielddef.getTags().has(tagname2) ) {
|
|
442 |
} else if (fielddef.getTags().has(tagname2)) {
|
|
421 | 443 |
tagname = tagname2; |
422 | 444 |
} else { |
423 | 445 |
return defaultVaue; |
... | ... | |
426 | 448 |
boolean value = fielddef.getTags().getBoolean(tagname); |
427 | 449 |
return value; |
428 | 450 |
} catch (CoercionException ex) { |
429 |
logger.warn("Can't parse tag '"+tagname+"' as boolean for field '"+fielddef.getName()+"'.",ex);
|
|
451 |
logger.warn("Can't parse tag '" + tagname + "' as boolean for field '" + fielddef.getName() + "'.", ex);
|
|
430 | 452 |
} |
431 | 453 |
return defaultVaue; |
432 | 454 |
} |
433 |
|
|
455 |
|
|
434 | 456 |
protected String getTagValueAsString(String tagname, String defaultVaue) { |
435 | 457 |
return getTagValueAsString(tagname, null, defaultVaue); |
436 | 458 |
} |
437 |
|
|
459 |
|
|
438 | 460 |
protected String getTagValueAsString(String tagname1, String tagname2, String defaultVaue) { |
439 |
DynField_v2 fielddef = (DynField_v2)this.getDefinition();
|
|
461 |
DynField_v2 fielddef = (DynField_v2) this.getDefinition();
|
|
440 | 462 |
String tagname = null; |
441 |
if( fielddef.getTags().has(tagname1) ) {
|
|
463 |
if (fielddef.getTags().has(tagname1)) {
|
|
442 | 464 |
tagname = tagname1; |
443 |
} else if( fielddef.getTags().has(tagname2) ) {
|
|
465 |
} else if (fielddef.getTags().has(tagname2)) {
|
|
444 | 466 |
tagname = tagname2; |
445 | 467 |
} else { |
446 | 468 |
return defaultVaue; |
447 | 469 |
} |
448 | 470 |
try { |
449 |
String value = (String) fielddef.getTags().get(tagname,DataTypes.STRING); |
|
471 |
String value = (String) fielddef.getTags().get(tagname, DataTypes.STRING);
|
|
450 | 472 |
return value; |
451 | 473 |
} catch (CoercionException ex) { |
452 |
logger.warn("Can't parse tag '"+tagname+"' as string for field '"+fielddef.getName()+"'.",ex);
|
|
474 |
logger.warn("Can't parse tag '" + tagname + "' as string for field '" + fielddef.getName() + "'.", ex);
|
|
453 | 475 |
} |
454 | 476 |
return defaultVaue; |
455 | 477 |
} |
456 |
|
|
478 |
|
|
457 | 479 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPIManager.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 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.
|
|
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 | 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.
|
|
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 | 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. |
|
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. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 | 23 |
package org.gvsig.tools.dynform.spi; |
25 | 24 |
|
... | ... | |
38 | 37 |
|
39 | 38 |
public interface DynFormSPIManager extends Manager, ServiceManager { |
40 | 39 |
|
41 |
public static final String FIELD_FORMSETDEFINITION = "definition"; |
|
42 |
public static final String FIELD_FIELDDEFINITION = "fieldDefinition"; |
|
43 |
public static final String FIELD_VALUE = "value"; |
|
40 |
public static final String TAG_DYNFORM_ABEILLE_FORM = "dynform.abeille.form.path"; |
|
41 |
public static final String TAG_DYNFORM_LAYOUTMODE = "dynform.layoutmode"; |
|
42 |
public static final String TAG_DYNFORM_LAYOUTMODE_VALUE_TABS = "tabs"; |
|
43 |
public static final String TAG_DYNFORM_LAYOUTMODE_VALUE_PLAIN = "plain"; |
|
44 |
public static final String TAG_DYNFORM_LAYOUTMODE_VALUE_SEPARATORS = "separators"; |
|
45 |
|
|
46 |
public static final String TAG_DYNFORM_AUTOSAVE = "dynform.autosave"; |
|
47 |
public static final String TAG_DYNFORM_BORDER = "dynform.border"; |
|
48 |
public static final String TAG_DYNFORM_VIEWMODE = "dynform.viewmode"; |
|
49 |
public static final String TAG_DYNFORM_HEIGHT = "dynform.height"; |
|
50 |
public static final String TAG_DYNFORM_WIDTH = "dynform.width"; |
|
51 |
public static final String TAG_DYNFORM_LABEL_EMPTY = "dynform.label.empty"; |
|
52 |
public static final String TAG_DYNFORM_ACTION_NEW = "dynform.action.new"; |
|
53 |
public static final String TAG_DYNFORM_ACTION_UPDATE = "dynform.action.update"; |
|
54 |
public static final String TAG_DYNFORM_ACTION_DELETE = "dynform.action.delete"; |
|
55 |
public static final String TAG_DYNFORM_ACTION_SEARCH = "dynform.action.search"; |
|
56 |
public static final String TAG_DYNFORM_ACTION_CLOSE = "dynform.action.close"; |
|
57 |
public static final String TAG_DYNFORM_ROWS = "dynform.rows"; |
|
58 |
public static final String TAG_DYNFORM_USESCROLLBARS = "dynform.useScrollBars"; |
|
59 |
public static final String TAG_DYNFORM_READONLY = "dynform.readonly"; |
|
60 |
public static final String TAG_DYNFORM_TRANSLATE_EMPTY_TO_NULL = "dynform.translateEmptyToNull"; |
|
44 | 61 |
|
45 |
public static final String SERVICE_NAME_PREFIX = "org.gvsig.tools.dynform.field."; |
|
46 |
public static final String SERVICE_JDYNFORM_NAME_PREFIX = "org.gvsig.tools.dynform."; |
|
47 |
|
|
48 |
public String makeServiceName(int dataType, String className, String subtype); |
|
49 |
public String makeServiceName(int dataType, String subtype); |
|
50 |
public String makeServiceName(DataType dataType, String subtype); |
|
51 |
public String makeServiceName(DataType dataType, String className, String subtype); |
|
52 |
public String makeServiceName(String dynClassFullName); |
|
53 |
|
|
54 |
public DynFormManager getDynFormManager(); |
|
55 |
|
|
56 |
public JZoomDialog createJZoomDialog(String title, String message, String text); |
|
57 |
public JProblemIndicator createProblemIndicator(JDynFormField field); |
|
58 |
|
|
59 |
public JDynFormField createJDynFormField(DynFormFieldDefinition definition,Object value) throws ServiceException ; |
|
62 |
public static final String FIELD_FORMSETDEFINITION = "definition"; |
|
63 |
public static final String FIELD_FIELDDEFINITION = "fieldDefinition"; |
|
64 |
public static final String FIELD_VALUE = "value"; |
|
60 | 65 |
|
66 |
public static final String SERVICE_NAME_PREFIX = "org.gvsig.tools.dynform.field."; |
|
67 |
public static final String SERVICE_JDYNFORM_NAME_PREFIX = "org.gvsig.tools.dynform."; |
|
68 |
|
|
69 |
public String makeServiceName(int dataType, String className, String subtype); |
|
70 |
|
|
71 |
public String makeServiceName(int dataType, String subtype); |
|
72 |
|
|
73 |
public String makeServiceName(DataType dataType, String subtype); |
|
74 |
|
|
75 |
public String makeServiceName(DataType dataType, String className, String subtype); |
|
76 |
|
|
77 |
public String makeServiceName(String dynClassFullName); |
|
78 |
|
|
79 |
public DynFormManager getDynFormManager(); |
|
80 |
|
|
81 |
public JZoomDialog createJZoomDialog(String title, String message, String text); |
|
82 |
|
|
83 |
public JProblemIndicator createProblemIndicator(JDynFormField field); |
|
84 |
|
|
85 |
public JDynFormField createJDynFormField(DynFormFieldDefinition definition, Object value) throws ServiceException; |
|
86 |
|
|
61 | 87 |
public JPopupMenu createTextFieldPopupMenu(String title, JTextComponent component, boolean zoom); |
62 | 88 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/AbstractJDynFormSet.java | ||
---|---|---|
15 | 15 |
import org.gvsig.tools.dispose.DisposableIterator; |
16 | 16 |
import org.gvsig.tools.dynform.DynFormDefinition; |
17 | 17 |
import org.gvsig.tools.dynform.JDynFormSet; |
18 |
import static org.gvsig.tools.dynform.spi.AbstractJDynForm.getLayoutFromTags; |
|
18 | 19 |
import org.gvsig.tools.dynform.spi.dynformfield.VisitableSet; |
19 |
import org.gvsig.tools.dynobject.DynField_v2; |
|
20 | 20 |
import org.gvsig.tools.dynobject.DynObject; |
21 | 21 |
import org.gvsig.tools.dynobject.DynObjectSet; |
22 |
import org.gvsig.tools.dynobject.Tags; |
|
22 | 23 |
import org.gvsig.tools.exception.BaseException; |
23 | 24 |
import org.gvsig.tools.service.Manager; |
24 | 25 |
import org.gvsig.tools.service.Service; |
... | ... | |
57 | 58 |
private boolean _allowNew; |
58 | 59 |
private boolean _allowSearch; |
59 | 60 |
private boolean _allowClose; |
61 |
|
|
62 |
private boolean _isInNewState = false; |
|
60 | 63 |
|
61 | 64 |
public AbstractJDynFormSet(ServiceManager manager, DynFormDefinition definition) throws ServiceException { |
62 | 65 |
this.manager = (DynFormSPIManager) manager; |
63 | 66 |
this.definition = definition; |
64 | 67 |
this.listeners = new DefaultVisitableSet(); |
65 | 68 |
} |
69 |
|
|
70 |
public void loadDefaultValueFromTags(Tags tags) { |
|
71 |
this.setLayoutMode(getLayoutFromTags(tags)); |
|
72 |
|
|
73 |
this.formWidth = tags.getInt(DynFormSPIManager.TAG_DYNFORM_WIDTH, this.formWidth); |
|
74 |
this.formHeight = tags.getInt(DynFormSPIManager.TAG_DYNFORM_HEIGHT, this.formHeight); |
|
75 |
this.readOnly = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_READONLY, this.readOnly); |
|
76 |
this.autosave = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_AUTOSAVE, this.autosave); |
|
77 |
this.useScrollBars = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_USESCROLLBARS, this.useScrollBars); |
|
78 |
this.setAllowNew( tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_NEW, this._allowNew)); |
|
79 |
this.setAllowUpdate(tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_UPDATE, this._allowNew)); |
|
80 |
this.setAllowDelete(tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_DELETE, this._allowNew)); |
|
81 |
this.setAllowSearch(tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_SEARCH, this._allowNew)); |
|
82 |
this.setAllowClose(tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_CLOSE, this._allowNew)); |
|
83 |
} |
|
66 | 84 |
|
85 |
public boolean isInNewState() { |
|
86 |
return this._isInNewState; |
|
87 |
} |
|
88 |
|
|
89 |
protected void enterStateNew() { |
|
90 |
this._isInNewState = true; |
|
91 |
} |
|
92 |
|
|
93 |
protected void leaveTheNewState() { |
|
94 |
this._isInNewState = false; |
|
95 |
} |
|
96 |
|
|
67 | 97 |
public void addListener(JDynFormSetListener listener) { |
68 | 98 |
this.listeners.add(listener); |
69 | 99 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/AbstractJDynForm.java | ||
---|---|---|
21 | 21 |
import javax.swing.JPanel; |
22 | 22 |
import javax.swing.JScrollPane; |
23 | 23 |
import javax.swing.JViewport; |
24 |
import org.apache.commons.lang3.StringUtils; |
|
24 | 25 |
import org.gvsig.tools.dataTypes.CoercionException; |
25 | 26 |
import org.gvsig.tools.dataTypes.DataType; |
26 | 27 |
import org.gvsig.tools.dynform.DynFormDefinition; |
27 | 28 |
import org.gvsig.tools.dynform.DynFormManager; |
28 | 29 |
import org.gvsig.tools.dynform.JDynForm; |
29 | 30 |
import org.gvsig.tools.dynform.JDynFormField; |
31 |
import org.gvsig.tools.dynform.JDynFormSet; |
|
30 | 32 |
import org.gvsig.tools.dynobject.DynObject; |
33 |
import org.gvsig.tools.dynobject.Tags; |
|
31 | 34 |
import org.gvsig.tools.service.ServiceException; |
32 | 35 |
import org.slf4j.Logger; |
33 | 36 |
import org.slf4j.LoggerFactory; |
... | ... | |
56 | 59 |
this.definition = definition; |
57 | 60 |
this.listeners = new HashSet(); |
58 | 61 |
this.customActions = new HashMap(); |
59 |
if (definition.getTags().has("LayoutMode")) { |
|
60 |
try { |
|
61 |
this.layoutMode = definition.getTags().getInt("LayoutMode"); |
|
62 |
} catch (CoercionException e) { |
|
63 |
// Ignorada |
|
62 |
this.loadDefaultValuesFromTags(definition.getTags()); |
|
63 |
} |
|
64 |
|
|
65 |
public static int getLayoutFromTags(Tags tags) { |
|
66 |
String layoutMode = (String) tags.get(DynFormSPIManager.TAG_DYNFORM_LAYOUTMODE); |
|
67 |
if( !StringUtils.isEmpty(layoutMode) ) { |
|
68 |
if( layoutMode.equalsIgnoreCase("0") || |
|
69 |
layoutMode.equalsIgnoreCase(DynFormSPIManager.TAG_DYNFORM_LAYOUTMODE_VALUE_PLAIN) ) { |
|
70 |
return JDynFormSet.USE_PLAIN; |
|
71 |
} else if( layoutMode.equalsIgnoreCase("1") || |
|
72 |
layoutMode.equalsIgnoreCase(DynFormSPIManager.TAG_DYNFORM_LAYOUTMODE_VALUE_TABS) ) { |
|
73 |
return JDynFormSet.USE_TABS; |
|
74 |
} else if( layoutMode.equalsIgnoreCase("2") || |
|
75 |
layoutMode.equalsIgnoreCase(DynFormSPIManager.TAG_DYNFORM_LAYOUTMODE_VALUE_SEPARATORS) ) { |
|
76 |
return JDynFormSet.USE_SEPARATORS; |
|
64 | 77 |
} |
65 | 78 |
} |
79 |
return JDynFormSet.USE_PLAIN; |
|
66 | 80 |
} |
81 |
|
|
82 |
public void loadDefaultValuesFromTags(Tags tags) { |
|
83 |
this.setLayoutMode(getLayoutFromTags(tags)); |
|
84 |
|
|
85 |
try { |
|
86 |
this.formWidth = tags.getInt(DynFormSPIManager.TAG_DYNFORM_WIDTH); |
|
87 |
} catch (CoercionException ex) { |
|
88 |
} |
|
89 |
try { |
|
90 |
this.formHeight = tags.getInt(DynFormSPIManager.TAG_DYNFORM_HEIGHT); |
|
91 |
} catch (CoercionException ex) { |
|
92 |
} |
|
93 |
try { |
|
94 |
this.border = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_BORDER); |
|
95 |
} catch (CoercionException ex) { |
|
96 |
} |
|
97 |
try { |
|
98 |
this.useScrollBars = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_USESCROLLBARS); |
|
99 |
} catch (CoercionException ex) { |
|
100 |
} |
|
101 |
try { |
|
102 |
this.readOnly = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_READONLY); |
|
103 |
} catch (CoercionException ex) { |
|
104 |
} |
|
105 |
} |
|
67 | 106 |
|
68 |
|
|
69 | 107 |
public DynFormSPIManager getServiceManager() { |
70 | 108 |
if ( serviceManager == null ) { |
71 | 109 |
serviceManager = DynFormSPILocator.getDynFormSPIManager(); |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultJDynForm.java | ||
---|---|---|
300 | 300 |
JDynFormField jfield = (JDynFormField) this.getField(name); |
301 | 301 |
if (jfield != null) { |
302 | 302 |
try { |
303 |
Object value = jfield.getValue(); |
|
304 |
values.setDynValue(name, value); |
|
303 |
jfield.fetch(values); |
|
305 | 304 |
} catch (Exception ex) { |
306 | 305 |
logger.warn("Can't get value of field '" + name + "'.", ex); |
307 | 306 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormManager.java | ||
---|---|---|
26 | 26 |
import java.util.HashMap; |
27 | 27 |
import java.util.List; |
28 | 28 |
import java.util.Map; |
29 |
import org.apache.commons.lang3.StringUtils; |
|
29 | 30 |
|
30 | 31 |
import org.gvsig.tools.dispose.DisposableIterator; |
31 | 32 |
import org.gvsig.tools.dynform.DynFormDefinition; |
... | ... | |
34 | 35 |
import org.gvsig.tools.dynform.JDynFormSet; |
35 | 36 |
import org.gvsig.tools.dynform.spi.DynFormSPILocator; |
36 | 37 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
37 |
import org.gvsig.tools.dynobject.DynField; |
|
38 | 38 |
import org.gvsig.tools.dynobject.DynObject; |
39 | 39 |
import org.gvsig.tools.dynobject.DynObjectSet; |
40 | 40 |
import org.gvsig.tools.dynobject.DynStruct; |
41 |
import org.gvsig.tools.dynobject.DynStruct_v2; |
|
42 | 41 |
import org.gvsig.tools.service.Service; |
43 | 42 |
import org.gvsig.tools.service.ServiceException; |
44 | 43 |
|
... | ... | |
90 | 89 |
DefaultDynFormDefinition x ; |
91 | 90 |
x = (DefaultDynFormDefinition) this.getDefinitions().get(name); |
92 | 91 |
if ( x == null ) { |
93 |
x = new DefaultDynFormDefinition(name, this);
|
|
92 |
x = new DefaultDynFormDefinition(definition, this);
|
|
94 | 93 |
this.getDefinitions().put(x.getName(), x); |
95 |
DynField[] fields = definition.getDynFields(); |
|
96 |
for (DynField field : fields) { |
|
97 |
x.add(field); |
|
98 |
} |
|
99 | 94 |
} |
100 |
if ( definition instanceof DynStruct_v2 ) { |
|
101 |
x.getTags().add(((DynStruct_v2) definition).getTags()); |
|
102 |
} |
|
103 |
x.setElementsType(definition); |
|
104 | 95 |
return x; |
105 | 96 |
} |
106 | 97 |
|
... | ... | |
114 | 105 |
DynFormSPIManager serviceManager = this.getServiceManager(); |
115 | 106 |
JDynForm jdynform; |
116 | 107 |
try { |
117 |
DynObject params = serviceManager.createServiceParameters( |
|
118 |
serviceManager.makeServiceName(definition.getName()) |
|
119 |
); |
|
108 |
|
|
109 |
String s = (String) definition.getTags().get(DynFormSPIManager.TAG_DYNFORM_LAYOUTMODE); |
|
110 |
String serviceName ; |
|
111 |
if( StringUtils.isEmpty(s) ) { |
|
112 |
serviceName = serviceManager.makeServiceName(definition.getName()); |
|
113 |
} else { |
|
114 |
serviceName = serviceManager.makeServiceName(s); |
|
115 |
} |
|
116 |
DynObject params = serviceManager.createServiceParameters(serviceName); |
|
120 | 117 |
jdynform = (JDynForm) serviceManager.getService(params); |
121 | 118 |
} catch (ServiceException ex) { |
122 | 119 |
jdynform = new DefaultJDynForm(this, definition); |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/impl/DefaultDynFormDefinition.java | ||
---|---|---|
41 | 41 |
import org.gvsig.tools.dynobject.DynField; |
42 | 42 |
import org.gvsig.tools.dynobject.DynObject; |
43 | 43 |
import org.gvsig.tools.dynobject.DynStruct; |
44 |
import org.gvsig.tools.dynobject.DynStruct_v2; |
|
44 | 45 |
import org.gvsig.tools.dynobject.Tags; |
45 | 46 |
import org.gvsig.tools.dynobject.impl.DefaultTags; |
46 | 47 |
|
... | ... | |
50 | 51 |
private DefaultDynFormManager manager = null; |
51 | 52 |
private List fieldsDefinitions = null; |
52 | 53 |
private String name = null; |
54 |
private String label = null; |
|
53 | 55 |
private Map groupsOrder = null; |
54 | 56 |
private Tags tags = new DefaultTags(); |
55 | 57 |
private DynStruct elementsType; |
56 | 58 |
|
57 | 59 |
public DefaultDynFormDefinition(String name, DefaultDynFormManager manager) { |
58 | 60 |
this.name = name; |
61 |
this.label = name; |
|
59 | 62 |
this.manager = manager; |
60 | 63 |
this.fieldsDefinitions = new ArrayList(); |
61 | 64 |
this.groupsOrder = new HashMap(); |
62 | 65 |
} |
63 |
|
|
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 |
|
|
64 | 89 |
public int getGroupOrder(String group) { |
65 | 90 |
return ((Integer)this.groupsOrder.get(group)).intValue(); |
66 | 91 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/Test.java | ||
---|---|---|
190 | 190 |
public void formAfterSearch(JDynFormSet dynformSet) { |
191 | 191 |
System.out.println("forformAfterSearchmClose"); |
192 | 192 |
} |
193 |
|
|
194 |
@Override |
|
195 |
public void formBeforeCancelNew(JDynFormSet dynformSet) throws AbortActionException { |
|
196 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|
197 |
} |
|
198 |
|
|
199 |
@Override |
|
200 |
public void formAfterCancelNew(JDynFormSet dynformSet) throws AbortActionException { |
|
201 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|
202 |
} |
|
193 | 203 |
}); |
194 | 204 |
form.setAllowDelete(true); |
195 | 205 |
form.setAllowNew(true); |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.impl/src/main/java/org/gvsig/tools/dynform/main/DynObjectProxy.java | ||
---|---|---|
200 | 200 |
return false; |
201 | 201 |
} |
202 | 202 |
|
203 |
public Object invokeDynMethod(String name, DynObject context) throws DynMethodException {
|
|
203 |
public Object invokeDynMethod(String name, Object[] args) throws DynMethodException {
|
|
204 | 204 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
205 | 205 |
} |
206 | 206 |
|
207 |
public Object invokeDynMethod(int code, DynObject context) throws DynMethodException {
|
|
207 |
public Object invokeDynMethod(int code, Object[] args) throws DynMethodException {
|
|
208 | 208 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
209 | 209 |
} |
210 | 210 |
|
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformfield/DynObjectList/JDynFormFieldDynObjectList.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 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.
|
|
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 | 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.
|
|
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 | 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. |
|
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. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 | 23 |
package org.gvsig.tools.dynform.services.dynformfield.DynObjectList; |
25 | 24 |
|
... | ... | |
38 | 37 |
import org.gvsig.tools.dynform.JDynFormField; |
39 | 38 |
import org.gvsig.tools.dynform.JDynFormSet; |
40 | 39 |
import org.gvsig.tools.dynform.JDynFormSet.JDynFormSetListener; |
40 |
import org.gvsig.tools.dynform.spi.AbstractJDynForm; |
|
41 |
import org.gvsig.tools.dynform.spi.AbstractJDynFormSet; |
|
42 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
|
41 | 43 |
import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField; |
42 |
import org.gvsig.tools.dynobject.DynClass; |
|
43 | 44 |
import org.gvsig.tools.dynobject.DynField; |
44 | 45 |
import org.gvsig.tools.dynobject.DynField_v2; |
45 | 46 |
import org.gvsig.tools.dynobject.DynObject; |
... | ... | |
48 | 49 |
import org.gvsig.tools.service.spi.ServiceManager; |
49 | 50 |
|
50 | 51 |
public class JDynFormFieldDynObjectList extends AbstractJDynFormField implements JDynFormField, JDynFormListener, JDynFormSetListener, FocusListener { |
51 |
|
|
52 |
protected List assignedValue = null; |
|
53 |
protected List currentValue = null; |
|
54 |
protected JDynFormSet jdynFormSet = null; |
|
55 |
protected boolean readonly = false; |
|
56 | 52 |
|
57 |
public JDynFormFieldDynObjectList(DynObject parameters, |
|
58 |
ServiceManager serviceManager) { |
|
59 |
super(parameters, serviceManager); |
|
60 |
this.assignedValue = (List) this.getParameterValue(); |
|
61 |
} |
|
53 |
protected List assignedValue = null; |
|
54 |
protected List currentValue = null; |
|
55 |
protected AbstractJDynFormSet jdynFormSet = null; |
|
56 |
protected boolean readonly = false; |
|
62 | 57 |
|
63 |
public void setReadOnly(boolean readonly) { |
|
64 |
super.setReadOnly(readonly); |
|
65 |
if( this.contents != null ) { |
|
66 |
this.jdynFormSet.setReadOnly(readonly); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public Object getAssignedValue() { |
|
71 |
return this.assignedValue; |
|
72 |
} |
|
73 |
|
|
74 |
public void initComponent() { |
|
75 |
this.contents = new JPanel(); |
|
76 |
this.contents.setLayout(new BorderLayout()); |
|
77 |
try { |
|
78 |
DynFormFieldDefinition def = this.getDefinition(); |
|
79 |
DynField_v2 fielddef = (DynField_v2)def; |
|
80 |
DynStruct struct = fielddef.getDynClassOfItems(); |
|
81 |
String viewMode = getTagValueAsString("ViewMode", "dynform.viewmode", "Subform"); |
|
82 |
try{ |
|
83 |
this.jdynFormSet = DynFormLocator.getDynFormManager().createJDynFormSet(viewMode,struct); |
|
84 |
} catch(Exception e){ |
|
85 |
logger.warn("Error en la creaci?n del DynFormSet '"+ viewMode +"'" , e); |
|
86 |
this.jdynFormSet = DynFormLocator.getDynFormManager().createJDynFormSet(struct); |
|
87 |
} |
|
58 |
public JDynFormFieldDynObjectList(DynObject parameters, |
|
59 |
ServiceManager serviceManager) { |
|
60 |
super(parameters, serviceManager); |
|
61 |
this.assignedValue = (List) this.getParameterValue(); |
|
62 |
} |
|
88 | 63 |
|
89 |
int height = getTagValueAsInt("dynform.height", -1); |
|
90 |
if( height>0 ) { |
|
91 |
this.jdynFormSet.setFormSize(50,height); |
|
92 |
} |
|
64 |
public void setReadOnly(boolean readonly) { |
|
65 |
super.setReadOnly(readonly); |
|
66 |
if (this.contents != null) { |
|
67 |
this.jdynFormSet.setReadOnly(readonly); |
|
68 |
} |
|
69 |
} |
|
93 | 70 |
|
94 |
this.jdynFormSet.addListener(this); |
|
95 |
this.jdynFormSet.setLayoutMode(getTagValueAsInt("layoutMode", "dynform.layoutmode",JDynFormSet.USE_PLAIN)); |
|
96 |
this.jdynFormSet.setAllowNew(getTagValueAsBoolean("allowNew", "dynform.action.new", false)); |
|
97 |
this.jdynFormSet.setAllowUpdate(getTagValueAsBoolean("allowUpdate", "dynform.action.update", false)); |
|
98 |
this.jdynFormSet.setAllowDelete(getTagValueAsBoolean("allowDelete", "dynform.action.delete", false)); |
|
99 |
this.jdynFormSet.setAllowSearch(getTagValueAsBoolean("allowSearch", "dynform.action.search", false)); |
|
100 |
this.jdynFormSet.setAllowClose(false); |
|
101 |
this.jdynFormSet.setUseScrollBars(false); |
|
102 |
// this.jdynFormSet.setShowMessageStatus(false); |
|
103 |
// this.jdynFormSet.addListener(this); |
|
104 |
this.contents.add(jdynFormSet.asJComponent(),BorderLayout.CENTER); |
|
105 |
this.contents.setVisible(true); |
|
106 |
this.jdynFormSet.setReadOnly(readonly); |
|
107 |
this.setValue(this.assignedValue); |
|
108 |
} catch (Exception e) { |
|
109 |
logger.warn("",e); |
|
110 |
} |
|
71 |
public Object getAssignedValue() { |
|
72 |
return this.assignedValue; |
|
73 |
} |
|
74 |
|
|
75 |
public void initComponent() { |
|
76 |
this.contents = new JPanel(); |
|
77 |
this.contents.setLayout(new BorderLayout()); |
|
78 |
try { |
|
79 |
DynFormFieldDefinition def = this.getDefinition(); |
|
80 |
DynField_v2 fielddef = (DynField_v2) def; |
|
81 |
DynStruct struct = fielddef.getDynClassOfItems(); |
|
82 |
String viewMode = getTagValueAsString("ViewMode", DynFormSPIManager.TAG_DYNFORM_VIEWMODE, "Subform"); |
|
83 |
try { |
|
84 |
this.jdynFormSet = (AbstractJDynFormSet) DynFormLocator.getDynFormManager().createJDynFormSet(viewMode, struct); |
|
85 |
} catch (Exception e) { |
|
86 |
logger.warn("Error en la creaci?n del DynFormSet '" + viewMode + "'", e); |
|
87 |
this.jdynFormSet = (AbstractJDynFormSet) DynFormLocator.getDynFormManager().createJDynFormSet(struct); |
|
88 |
} |
|
89 |
this.jdynFormSet.loadDefaultValueFromTags(this.getDefinition().getTags()); |
|
90 |
|
|
91 |
// int height = getTagValueAsInt(DynFormSPIManager.TAG_DYNFORM_HEIGHT, -1); |
|
92 |
// if (height > 0) { |
|
93 |
// this.jdynFormSet.setFormSize(50, height); |
|
94 |
// } |
|
95 |
|
|
96 |
this.jdynFormSet.addListener(this); |
|
97 |
this.contents.add(jdynFormSet.asJComponent(), BorderLayout.CENTER); |
|
98 |
this.contents.setVisible(true); |
|
99 |
this.setValue(this.assignedValue); |
|
100 |
} catch (Exception e) { |
|
101 |
logger.warn("", e); |
|
102 |
} |
|
111 | 103 |
// this.jdynForm.addFocusListener(this); |
112 | 104 |
|
113 |
} |
|
114 |
|
|
115 |
|
|
116 |
public void setValue(Object value) { |
|
117 |
if( value == null ) { |
|
105 |
} |
|
106 |
|
|
107 |
public void setValue(Object value) { |
|
108 |
if (value == null) { |
|
118 | 109 |
// TODO |
119 |
// this.jdynForm.clear(); |
|
120 |
} else { |
|
121 |
if( !(value instanceof List) ) { |
|
122 |
logger.info("setValue invoked with non List value ("+value.toString()+")."); |
|
123 |
return; |
|
124 |
} |
|
125 |
try { |
|
126 |
this.jdynFormSet.setValues((List)value); |
|
127 |
} catch (ServiceException e) { |
|
128 |
logger.warn("Error settings values to DynformSet",e); |
|
129 |
} |
|
130 |
} |
|
131 |
this.assignedValue = (List) value; |
|
132 |
this.currentValue = this.assignedValue; |
|
133 |
} |
|
134 |
|
|
135 |
public Object getValue() { |
|
136 |
return this.jdynFormSet.getValues(); |
|
137 |
} |
|
138 |
|
|
139 |
public boolean hasValidValue() { |
|
140 |
return this.jdynFormSet.hasValidValues(); |
|
141 |
} |
|
110 |
// this.jdynForm.clear(); |
|
111 |
} else { |
|
112 |
if (!(value instanceof List)) { |
|
113 |
logger.info("setValue invoked with non List value (" + value.toString() + ")."); |
|
114 |
return; |
|
115 |
} |
|
116 |
try { |
|
117 |
this.jdynFormSet.setValues((List) value); |
|
118 |
} catch (ServiceException e) { |
|
119 |
logger.warn("Error settings values to DynformSet", e); |
|
120 |
} |
|
121 |
} |
|
122 |
this.assignedValue = (List) value; |
|
123 |
this.currentValue = this.assignedValue; |
|
124 |
} |
|
142 | 125 |
|
143 |
public void focusGained(FocusEvent arg0) { |
|
144 |
fireFieldEnterEvent(); |
|
145 |
this.problemIndicator().restore(); |
|
146 |
} |
|
126 |
public Object getValue() { |
|
127 |
return this.jdynFormSet.getValues(); |
|
128 |
} |
|
147 | 129 |
|
148 |
public void focusLost(FocusEvent arg0) {
|
|
149 |
fireFieldExitEvent();
|
|
150 |
}
|
|
130 |
public boolean hasValidValue() {
|
|
131 |
return this.jdynFormSet.hasValidValues();
|
|
132 |
}
|
|
151 | 133 |
|
152 |
public void message(String message) { |
|
153 |
fireMessageEvent(message); |
|
154 |
} |
|
134 |
public void focusGained(FocusEvent arg0) { |
|
135 |
fireFieldEnterEvent(); |
|
136 |
this.problemIndicator().restore(); |
|
137 |
} |
|
155 | 138 |
|
156 |
public void fieldChanged(JDynFormField field) { |
|
139 |
public void focusLost(FocusEvent arg0) { |
|
140 |
fireFieldExitEvent(); |
|
141 |
} |
|
142 |
|
|
143 |
public void message(String message) { |
|
144 |
fireMessageEvent(message); |
|
145 |
} |
|
146 |
|
|
147 |
public void fieldChanged(JDynFormField field) { |
|
157 | 148 |
// TODO Auto-generated method stub |
158 |
|
|
159 |
} |
|
160 | 149 |
|
161 |
public void formMessage(String message) { |
|
150 |
} |
|
151 |
|
|
152 |
public void formMessage(String message) { |
|
162 | 153 |
// TODO Auto-generated method stub |
163 |
|
|
164 |
} |
|
165 | 154 |
|
166 |
public void formClose() { |
|
155 |
} |
|
156 |
|
|
157 |
public void formClose() { |
|
167 | 158 |
// TODO Auto-generated method stub |
168 |
|
|
169 |
} |
|
170 | 159 |
|
171 |
public void formMovedTo(int currentPosition) { |
|
160 |
} |
|
161 |
|
|
162 |
public void formMovedTo(int currentPosition) { |
|
172 | 163 |
// TODO Auto-generated method stub |
173 |
|
|
174 |
} |
|
175 | 164 |
|
176 |
public void formBeforeSave(JDynFormSet dynformSet) throws AbortActionException { |
|
165 |
} |
|
166 |
|
|
167 |
public void formBeforeSave(JDynFormSet dynformSet) throws AbortActionException { |
|
177 | 168 |
// TODO Auto-generated method stub |
178 |
|
|
179 |
} |
|
180 | 169 |
|
181 |
public void formBeforeNew(JDynFormSet dynformSet) throws AbortActionException { |
|
182 |
DynFormFieldDefinition def = this.getDefinition(); |
|
183 |
DynField_v2 fielddef = (DynField_v2)def; |
|
184 |
DynStruct struct = fielddef.getDynClassOfItems(); |
|
185 |
DynObject value = createDynObject(struct); |
|
186 |
this.currentValue.add(value); |
|
170 |
} |
|
187 | 171 |
|
188 |
|
|
189 |
} |
Also available in: Unified diff