Revision 44085
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretype/DefaultFeatureTypeAttributePanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.swing.impl.featuretype; |
2 | 2 |
|
3 |
import com.vividsolutions.jts.operation.distance.GeometryLocation; |
|
4 |
import java.awt.event.ItemEvent; |
|
5 |
import java.awt.event.ItemListener; |
|
3 | 6 |
import java.util.ArrayList; |
4 | 7 |
import java.util.Comparator; |
5 | 8 |
import java.util.List; |
6 | 9 |
import javax.swing.DefaultComboBoxModel; |
7 | 10 |
import javax.swing.JComponent; |
11 |
import javax.swing.JOptionPane; |
|
12 |
import javax.swing.SwingUtilities; |
|
13 |
import javax.swing.event.ChangeEvent; |
|
14 |
import javax.swing.event.ChangeListener; |
|
8 | 15 |
import org.cresques.cts.IProjection; |
9 | 16 |
import org.gvsig.expressionevaluator.Expression; |
10 | 17 |
import org.gvsig.expressionevaluator.swing.CalculatorController; |
11 | 18 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator; |
12 | 19 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager; |
13 | 20 |
import org.gvsig.expressionevaluator.swing.ExpressionPickerController; |
21 |
import org.gvsig.fmap.dal.DALLocator; |
|
22 |
import org.gvsig.fmap.dal.DataManager; |
|
14 | 23 |
import org.gvsig.fmap.dal.DataTypes; |
15 | 24 |
import org.gvsig.fmap.dal.expressionevaluator.FeatureAttributeEmulatorExpression; |
16 | 25 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
17 | 26 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
18 | 27 |
import org.gvsig.fmap.dal.feature.FeatureAttributeEmulator; |
19 | 28 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
29 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
|
20 | 30 |
import org.gvsig.fmap.geom.Geometry; |
31 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
32 |
import org.gvsig.fmap.geom.GeometryManager; |
|
33 |
import org.gvsig.fmap.geom.type.GeometryType; |
|
21 | 34 |
import org.gvsig.timesupport.RelativeInterval; |
22 | 35 |
import org.gvsig.tools.ToolsLocator; |
23 | 36 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
... | ... | |
26 | 39 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
27 | 40 |
import org.gvsig.tools.swing.api.pickercontroller.DatePickerController; |
28 | 41 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
42 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
29 | 43 |
|
30 | 44 |
/** |
31 | 45 |
* |
32 | 46 |
* @author jjdelcerro |
33 | 47 |
*/ |
34 |
public class DefaultFeatureTypeAttributePanel
|
|
35 |
extends FeatureTypeAttributePanelView
|
|
36 |
implements FeatureTypeAttributePanel
|
|
37 |
{ |
|
48 |
@SuppressWarnings("UseSpecificCatch")
|
|
49 |
public class DefaultFeatureTypeAttributePanel
|
|
50 |
extends FeatureTypeAttributePanelView
|
|
51 |
implements FeatureTypeAttributePanel {
|
|
38 | 52 |
|
39 | 53 |
private final List<ListElement<Integer>> fieldTypes; |
40 | 54 |
private final List<ListElement<Integer>> geometryTypes; |
41 | 55 |
private final List<ListElement<Integer>> geometrySubtypes; |
42 |
|
|
56 |
|
|
43 | 57 |
private DatePickerController pickerIntervalEnd; |
44 | 58 |
private DatePickerController pickerIntervalStart; |
45 | 59 |
private CalculatorController<Integer> pickerSize; |
... | ... | |
49 | 63 |
private PickerController<IProjection> pickerCRS; |
50 | 64 |
private ExpressionPickerController pickerVirtualField; |
51 | 65 |
|
66 |
private boolean editable; |
|
52 | 67 |
|
53 | 68 |
public DefaultFeatureTypeAttributePanel() { |
69 |
this.editable = true; |
|
54 | 70 |
DataTypesManager dataManager = ToolsLocator.getDataTypesManager(); |
55 | 71 |
this.fieldTypes = new ArrayList<>(); |
56 | 72 |
this.fieldTypes.add(new ListElement<>(dataManager.getTypeName(DataTypes.BOOLEAN), DataTypes.BOOLEAN)); |
... | ... | |
61 | 77 |
this.fieldTypes.add(new ListElement<>(dataManager.getTypeName(DataTypes.DOUBLE), DataTypes.DOUBLE)); |
62 | 78 |
this.fieldTypes.add(new ListElement<>(dataManager.getTypeName(DataTypes.LONG), DataTypes.LONG)); |
63 | 79 |
this.fieldTypes.add(new ListElement<>(dataManager.getTypeName(DataTypes.INTERVAL), DataTypes.INTERVAL)); |
64 |
this.fieldTypes.add(new ListElement<>(dataManager.getTypeName(DataTypes.DOUBLE), DataTypes.DOUBLE));
|
|
80 |
this.fieldTypes.add(new ListElement<>(dataManager.getTypeName(DataTypes.INSTANT), DataTypes.INSTANT));
|
|
65 | 81 |
this.fieldTypes.add(new ListElement<>(dataManager.getTypeName(DataTypes.STRING), DataTypes.STRING)); |
82 |
this.fieldTypes.add(new ListElement<>(dataManager.getTypeName(DataTypes.GEOMETRY), DataTypes.GEOMETRY)); |
|
66 | 83 |
this.fieldTypes.sort(new Comparator<ListElement<Integer>>() { |
67 | 84 |
@Override |
68 | 85 |
public int compare(ListElement<Integer> o1, ListElement<Integer> o2) { |
... | ... | |
83 | 100 |
return o1.toString().compareTo(o2.toString()); |
84 | 101 |
} |
85 | 102 |
}); |
86 |
|
|
103 |
|
|
87 | 104 |
this.geometrySubtypes = new ArrayList<>(); |
88 | 105 |
this.geometrySubtypes.add(new ListElement("2D", Geometry.SUBTYPES.GEOM2D)); |
89 | 106 |
this.geometrySubtypes.add(new ListElement("2DM", Geometry.SUBTYPES.GEOM3D)); |
... | ... | |
95 | 112 |
return o1.toString().compareTo(o2.toString()); |
96 | 113 |
} |
97 | 114 |
}); |
98 |
|
|
115 |
|
|
99 | 116 |
this.initComponents(); |
100 | 117 |
} |
101 |
|
|
118 |
|
|
102 | 119 |
private void initComponents() { |
103 | 120 |
ToolsSwingManager swingManager = ToolsSwingLocator.getToolsSwingManager(); |
104 | 121 |
ExpressionEvaluatorSwingManager evaluatorManager = ExpressionEvaluatorSwingLocator.getManager(); |
... | ... | |
119 | 136 |
for (ListElement<Integer> element : this.geometrySubtypes) { |
120 | 137 |
modelGeomSubtypes.addElement(element); |
121 | 138 |
} |
122 |
this.cboGeometryType.setModel(modelGeomSubtypes); |
|
123 |
|
|
139 |
|
|
140 |
this.cboGeometrySubtype.setModel(modelGeomSubtypes); |
|
141 |
|
|
124 | 142 |
swingManager.addClearButton(this.txtDefaultValue); |
125 | 143 |
swingManager.addClearButton(this.txtFieldName); |
126 | 144 |
swingManager.addClearButton(this.txtIntervalEnd); |
127 | 145 |
swingManager.addClearButton(this.txtIntervalStart); |
128 | 146 |
swingManager.addClearButton(this.txtPrecision); |
129 | 147 |
swingManager.addClearButton(this.txtSize); |
130 |
|
|
148 |
|
|
131 | 149 |
swingManager.setDefaultPopupMenu(this.txtDefaultValue); |
132 | 150 |
swingManager.setDefaultPopupMenu(this.txtFieldName); |
133 | 151 |
swingManager.setDefaultPopupMenu(this.txtIntervalEnd); |
... | ... | |
138 | 156 |
swingManager.setDefaultPopupMenu(this.cboFieldType); |
139 | 157 |
swingManager.setDefaultPopupMenu(this.cboGeometrySubtype); |
140 | 158 |
swingManager.setDefaultPopupMenu(this.cboGeometryType); |
141 |
|
|
159 |
|
|
142 | 160 |
this.pickerIntervalEnd = swingManager.createDatePickerController( |
143 |
this.txtIntervalEnd,
|
|
161 |
this.txtIntervalEnd, |
|
144 | 162 |
this.btnIntervalEnd |
145 | 163 |
); |
146 | 164 |
this.pickerIntervalStart = swingManager.createDatePickerController( |
147 |
this.txtIntervalStart,
|
|
165 |
this.txtIntervalStart, |
|
148 | 166 |
this.btnIntervalStart |
149 | 167 |
); |
150 | 168 |
this.pickerSize = evaluatorManager.createCalculatorController( |
151 |
this.txtSize,DataTypes.INT |
|
169 |
this.txtSize, DataTypes.INT
|
|
152 | 170 |
); |
153 | 171 |
this.pickerPrecision = evaluatorManager.createCalculatorController( |
154 |
this.txtPrecision,DataTypes.INT |
|
172 |
this.txtPrecision, DataTypes.INT
|
|
155 | 173 |
); |
156 | 174 |
this.pickerFieldName = evaluatorManager.createCalculatorController( |
157 |
this.txtFieldName,DataTypes.STRING |
|
175 |
this.txtFieldName, DataTypes.STRING
|
|
158 | 176 |
); |
159 | 177 |
this.pickerDefaultValue = evaluatorManager.createCalculatorController( |
160 |
this.txtDefaultValue,DataTypes.OBJECT |
|
178 |
this.txtDefaultValue, DataTypes.OBJECT
|
|
161 | 179 |
); |
162 |
|
|
180 |
|
|
181 |
this.btnVirtualField.setText(""); |
|
163 | 182 |
this.pickerVirtualField = ExpressionEvaluatorSwingLocator.getManager() |
164 | 183 |
.createExpressionPickerController(txtVirtualField, btnVirtualField); |
165 | 184 |
|
166 | 185 |
this.pickerCRS = DALSwingLocator.getSwingManager() |
167 | 186 |
.createProjectionPickerController(this.txtCRS, this.btnCRS); |
168 |
|
|
187 |
|
|
188 |
this.cboFieldType.addItemListener(new ItemListener() { |
|
189 |
@Override |
|
190 |
public void itemStateChanged(ItemEvent e) { |
|
191 |
SwingUtilities.invokeLater(new Runnable() { |
|
192 |
@Override |
|
193 |
public void run() { |
|
194 |
doFieldTypeChanged(); |
|
195 |
} |
|
196 |
}); |
|
197 |
|
|
198 |
} |
|
199 |
}); |
|
200 |
|
|
201 |
this.chkVirtualField.addChangeListener(new ChangeListener() { |
|
202 |
@Override |
|
203 |
public void stateChanged(ChangeEvent e) { |
|
204 |
if (chkVirtualField.isSelected()) { |
|
205 |
pickerVirtualField.setEnabled(editable); |
|
206 |
} else { |
|
207 |
pickerVirtualField.setEnabled(false); |
|
208 |
} |
|
209 |
} |
|
210 |
}); |
|
169 | 211 |
} |
170 |
|
|
212 |
|
|
171 | 213 |
@Override |
172 | 214 |
public JComponent asJComponent() { |
173 | 215 |
return this; |
... | ... | |
175 | 217 |
|
176 | 218 |
@Override |
177 | 219 |
public EditableFeatureAttributeDescriptor fetch(EditableFeatureAttributeDescriptor descriptor) { |
220 |
try { |
|
221 |
descriptor.setDataType((int) ListElement.getSelected(this.cboFieldType)); |
|
222 |
descriptor.setName(this.txtFieldName.getText()); |
|
223 |
descriptor.setAllowNull(this.chkAllowNulls.isSelected()); |
|
224 |
descriptor.setIsPrimaryKey(this.chkIsPrimaryKey.isSelected()); |
|
225 |
descriptor.setIsAutomatic(this.chkIsAutomatic.isSelected()); |
|
226 |
descriptor.setSize(this.pickerSize.get()); |
|
227 |
descriptor.setPrecision(this.pickerPrecision.get()); |
|
228 |
descriptor.setDefaultValue(this.pickerDefaultValue.get()); |
|
229 |
switch (descriptor.getType()) { |
|
230 |
case DataTypes.GEOMETRY: |
|
231 |
GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
232 |
GeometryType geomType = geomManager.getGeometryType( |
|
233 |
(int) ListElement.getSelected(this.cboGeometryType), |
|
234 |
(int) ListElement.getSelected(this.cboGeometrySubtype) |
|
235 |
); |
|
236 |
descriptor.setGeometryType(geomType); |
|
237 |
descriptor.setSRS(this.pickerCRS.get()); |
|
238 |
break; |
|
239 |
case DataTypes.INSTANT: |
|
240 |
case DataTypes.INTERVAL: |
|
241 |
case DataTypes.DATE: |
|
242 |
case DataTypes.TIME: |
|
243 |
case DataTypes.TIMESTAMP: |
|
244 |
// FIXME |
|
245 |
break; |
|
246 |
default: |
|
247 |
break; |
|
248 |
} |
|
249 |
if( this.chkVirtualField.isSelected() && this.pickerVirtualField.isEnabled() ) { |
|
250 |
Expression expression = this.pickerVirtualField.get(); |
|
251 |
if( expression==null ) { |
|
252 |
descriptor.setFeatureAttributeEmulator(null); |
|
253 |
} else { |
|
254 |
DataManager dataManager = DALLocator.getDataManager(); |
|
255 |
FeatureAttributeEmulatorExpression emulator = dataManager.createFeatureAttributeEmulatorExpression( |
|
256 |
descriptor.getFeatureType(), |
|
257 |
expression |
|
258 |
); |
|
259 |
descriptor.setFeatureAttributeEmulator(emulator); |
|
260 |
} |
|
261 |
} |
|
262 |
} catch (Exception ex) { |
|
263 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
264 |
dialogs.messageDialog( |
|
265 |
"Can't retrieve information from user form.", |
|
266 |
"Warning", |
|
267 |
JOptionPane.WARNING_MESSAGE |
|
268 |
); |
|
269 |
} |
|
178 | 270 |
return descriptor; |
179 | 271 |
} |
180 | 272 |
|
... | ... | |
189 | 281 |
this.chkAllowNulls.setSelected(false); |
190 | 282 |
this.chkIsAutomatic.setSelected(false); |
191 | 283 |
this.chkIsPrimaryKey.setSelected(false); |
192 |
|
|
284 |
|
|
193 | 285 |
this.chkVirtualField.setSelected(false); |
194 |
this.chkVirtualField.setEnabled(true);
|
|
286 |
this.chkVirtualField.setEnabled(editable);
|
|
195 | 287 |
this.pickerVirtualField.setEnabled(false); |
196 | 288 |
this.pickerVirtualField.set(null); |
197 | 289 |
|
198 |
ListElement.setSelected(cboFieldType, null); |
|
199 | 290 |
ListElement.setSelected(cboGeometryType, null); |
200 | 291 |
ListElement.setSelected(cboGeometrySubtype, null); |
292 |
|
|
293 |
ListElement.setSelected(cboFieldType, DataTypes.STRING); |
|
201 | 294 |
} |
202 |
|
|
295 |
|
|
203 | 296 |
@Override |
204 | 297 |
public void put(FeatureAttributeDescriptor descriptor) { |
205 |
if( descriptor == null ) {
|
|
298 |
if (descriptor == null) {
|
|
206 | 299 |
this.clean(); |
207 | 300 |
return; |
208 | 301 |
} |
302 |
if (!(descriptor instanceof EditableFeatureAttributeDescriptor)) { |
|
303 |
this.setEditable(false); |
|
304 |
} |
|
305 |
ExpressionEvaluatorSwingManager expressionSwingManager = ExpressionEvaluatorSwingLocator.getManager(); |
|
306 |
this.pickerVirtualField = ExpressionEvaluatorSwingLocator.getManager() |
|
307 |
.createExpressionPickerController(txtVirtualField, btnVirtualField); |
|
308 |
if( descriptor.getFeatureType()!=null && descriptor.getFeatureType().getStore()!=null ) { |
|
309 |
this.pickerVirtualField.addElement( |
|
310 |
expressionSwingManager.createElement( |
|
311 |
DataSwingManager.FEATURE_STORE_EXPRESSION_ELEMENT, |
|
312 |
this.pickerVirtualField, |
|
313 |
descriptor.getFeatureType().getStore() |
|
314 |
) |
|
315 |
); |
|
316 |
} |
|
317 |
|
|
209 | 318 |
this.pickerDefaultValue.set(descriptor.getDefaultValue()); |
210 | 319 |
this.pickerFieldName.set(descriptor.getName()); |
211 | 320 |
RelativeInterval interval = (RelativeInterval) descriptor.getInterval(); |
212 |
if( interval==null ) {
|
|
213 |
// this.pickerIntervalEnd.set(null);
|
|
214 |
// this.pickerIntervalStart.set(null);
|
|
321 |
if (interval == null) {
|
|
322 |
this.pickerIntervalEnd.set(null); |
|
323 |
this.pickerIntervalStart.set(null); |
|
215 | 324 |
} else { |
216 | 325 |
this.pickerIntervalEnd.set(interval.getEnd().toDate()); |
217 | 326 |
this.pickerIntervalStart.set(interval.getStart().toDate()); |
218 | 327 |
} |
219 | 328 |
this.pickerPrecision.set(descriptor.getPrecision()); |
220 | 329 |
this.pickerSize.set(descriptor.getSize()); |
221 |
|
|
330 |
|
|
222 | 331 |
this.chkAllowNulls.setSelected(descriptor.allowNull()); |
223 | 332 |
this.chkIsAutomatic.setSelected(descriptor.isAutomatic()); |
224 | 333 |
this.chkIsPrimaryKey.setSelected(descriptor.isPrimaryKey()); |
225 |
|
|
334 |
|
|
226 | 335 |
FeatureAttributeEmulator attrEmulator = descriptor.getFeatureAttributeEmulator(); |
227 |
if( attrEmulator instanceof FeatureAttributeEmulatorExpression ) {
|
|
336 |
if (attrEmulator instanceof FeatureAttributeEmulatorExpression) {
|
|
228 | 337 |
Expression expression = ((FeatureAttributeEmulatorExpression) attrEmulator).getExpression(); |
229 |
this.chkVirtualField.setEnabled(true);
|
|
338 |
this.chkVirtualField.setEnabled(editable);
|
|
230 | 339 |
this.chkVirtualField.setSelected(true); |
340 |
this.pickerVirtualField.setEnabled(editable); |
|
231 | 341 |
this.pickerVirtualField.set(expression); |
232 |
this.pickerVirtualField.setEnabled(true);
|
|
233 |
} else if( descriptor.isComputed() ) {
|
|
342 |
} else if (descriptor.isComputed()) {
|
|
343 |
this.chkVirtualField.setEnabled(false);
|
|
234 | 344 |
this.chkVirtualField.setSelected(true); |
235 |
this.chkVirtualField.setEnabled(false); |
|
236 | 345 |
this.pickerVirtualField.setEnabled(false); |
237 | 346 |
this.pickerVirtualField.set(null); |
238 | 347 |
} else { |
348 |
this.chkVirtualField.setEnabled(editable); |
|
239 | 349 |
this.chkVirtualField.setSelected(false); |
240 |
this.chkVirtualField.setEnabled(true); |
|
241 | 350 |
this.pickerVirtualField.setEnabled(false); |
242 | 351 |
this.pickerVirtualField.set(null); |
243 | 352 |
} |
244 |
|
|
353 |
|
|
245 | 354 |
this.pickerCRS.set(descriptor.getSRS()); |
246 |
|
|
247 |
ListElement.setSelected(cboFieldType, descriptor.getType()); |
|
248 |
if( descriptor.getType()==DataTypes.GEOMETRY ) { |
|
355 |
|
|
356 |
if (descriptor.getGeomType() != null) { |
|
249 | 357 |
ListElement.setSelected(cboGeometryType, descriptor.getGeomType().getType()); |
250 | 358 |
ListElement.setSelected(cboGeometrySubtype, descriptor.getGeomType().getSubType()); |
251 |
this.cboGeometryType.setEnabled(true); |
|
252 |
this.cboGeometrySubtype.setEnabled(true); |
|
253 |
} else { |
|
254 |
this.cboGeometryType.setEnabled(false); |
|
255 |
this.cboGeometrySubtype.setEnabled(false); |
|
256 | 359 |
} |
257 |
|
|
360 |
ListElement.setSelected(cboFieldType, descriptor.getType()); |
|
361 |
|
|
258 | 362 |
} |
259 | 363 |
|
260 |
public void setReadonly(boolean readonly) { |
|
261 |
|
|
364 |
private void doFieldTypeChanged() { |
|
365 |
try { |
|
366 |
Integer fieldType = (Integer) ListElement.getSelected(this.cboFieldType); |
|
367 |
if (fieldType == null) { |
|
368 |
fieldType = DataTypes.UNKNOWN; |
|
369 |
} |
|
370 |
switch (fieldType) { |
|
371 |
case DataTypes.GEOMETRY: |
|
372 |
this.cboGeometryType.setEnabled(editable); |
|
373 |
this.cboGeometrySubtype.setEnabled(editable); |
|
374 |
this.pickerCRS.setEnabled(editable); |
|
375 |
this.cboDateFormat.setEnabled(false); |
|
376 |
this.pickerIntervalStart.setEnabled(false); |
|
377 |
this.pickerIntervalEnd.setEditable(false); |
|
378 |
this.tabAditionalFields.setEnabledAt(1, true); |
|
379 |
this.tabAditionalFields.setEnabledAt(2, false); |
|
380 |
break; |
|
381 |
case DataTypes.INSTANT: |
|
382 |
case DataTypes.INTERVAL: |
|
383 |
case DataTypes.DATE: |
|
384 |
case DataTypes.TIME: |
|
385 |
case DataTypes.TIMESTAMP: |
|
386 |
this.cboGeometryType.setEnabled(false); |
|
387 |
this.cboGeometrySubtype.setEnabled(false); |
|
388 |
this.pickerCRS.setEnabled(false); |
|
389 |
this.cboDateFormat.setEnabled(editable); |
|
390 |
this.pickerIntervalStart.setEnabled(editable); |
|
391 |
this.pickerIntervalEnd.setEditable(editable); |
|
392 |
this.tabAditionalFields.setEnabledAt(1, false); |
|
393 |
this.tabAditionalFields.setEnabledAt(2, true); |
|
394 |
break; |
|
395 |
default: |
|
396 |
this.cboGeometryType.setEnabled(false); |
|
397 |
this.cboGeometrySubtype.setEnabled(false); |
|
398 |
this.pickerCRS.setEnabled(false); |
|
399 |
this.cboDateFormat.setEnabled(false); |
|
400 |
this.pickerIntervalStart.setEnabled(false); |
|
401 |
this.pickerIntervalEnd.setEditable(false); |
|
402 |
this.tabAditionalFields.setEnabledAt(1, false); |
|
403 |
this.tabAditionalFields.setEnabledAt(2, false); |
|
404 |
} |
|
405 |
} catch (Exception ex) { |
|
406 |
|
|
407 |
} |
|
262 | 408 |
} |
409 |
|
|
410 |
public void setEditable(boolean editable) { |
|
411 |
this.editable = editable; |
|
412 |
this.pickerDefaultValue.setEditable(editable); |
|
413 |
this.pickerFieldName.setEditable(editable); |
|
414 |
this.pickerIntervalEnd.setEditable(editable); |
|
415 |
this.pickerIntervalStart.setEditable(editable); |
|
416 |
this.pickerPrecision.setEditable(editable); |
|
417 |
this.pickerSize.setEditable(editable); |
|
418 |
|
|
419 |
this.chkAllowNulls.setEnabled(editable); |
|
420 |
this.chkIsAutomatic.setEnabled(editable); |
|
421 |
this.chkIsPrimaryKey.setEnabled(editable); |
|
422 |
|
|
423 |
this.chkVirtualField.setEnabled(editable); |
|
424 |
this.pickerVirtualField.setEditable(editable); |
|
425 |
|
|
426 |
this.cboDateFormat.setEnabled(editable); |
|
427 |
this.cboFieldType.setEnabled(editable); |
|
428 |
this.cboGeometryType.setEnabled(editable); |
|
429 |
this.cboGeometrySubtype.setEnabled(editable); |
|
430 |
|
|
431 |
} |
|
263 | 432 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretype/FeatureTypePanelView.xml | ||
---|---|---|
74 | 74 |
</object> |
75 | 75 |
</at> |
76 | 76 |
<at name="name">tblFields</at> |
77 |
<at name="width">881</at>
|
|
77 |
<at name="width">884</at>
|
|
78 | 78 |
<at name="scollBars"> |
79 | 79 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
80 | 80 |
<at name="name">scollBars</at> |
... | ... | |
212 | 212 |
<at name="properties"> |
213 | 213 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
214 | 214 |
<at name="name">pnlField</at> |
215 |
<at name="width">883</at>
|
|
215 |
<at name="width">886</at>
|
|
216 | 216 |
<at name="height">12</at> |
217 | 217 |
</object> |
218 | 218 |
</at> |
... | ... | |
238 | 238 |
</at> |
239 | 239 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
240 | 240 |
</super> |
241 |
<at name="id">embedded.406471071</at>
|
|
242 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0)</at>
|
|
241 |
<at name="id">embedded.1045919040</at>
|
|
242 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,FILL:DEFAULT:GROW(1.0)</at> |
|
243 | 243 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at> |
244 | 244 |
<at name="components"> |
245 | 245 |
<object classname="java.util.LinkedList"> |
... | ... | |
289 | 289 |
</at> |
290 | 290 |
<at name="actionCommand">_New</at> |
291 | 291 |
<at name="name">btnNew</at> |
292 |
<at name="width">84</at>
|
|
292 |
<at name="width">81</at>
|
|
293 | 293 |
<at name="text">_New</at> |
294 | 294 |
<at name="height">22</at> |
295 | 295 |
</object> |
... | ... | |
345 | 345 |
</at> |
346 | 346 |
<at name="actionCommand">_Delete</at> |
347 | 347 |
<at name="name">btnDelete</at> |
348 |
<at name="width">84</at>
|
|
348 |
<at name="width">81</at>
|
|
349 | 349 |
<at name="text">_Delete</at> |
350 | 350 |
<at name="height">22</at> |
351 | 351 |
</object> |
... | ... | |
355 | 355 |
</object> |
356 | 356 |
</at> |
357 | 357 |
</item> |
358 |
<item > |
|
359 |
<at name="value"> |
|
360 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
361 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
362 |
<at name="cellconstraints"> |
|
363 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
364 |
<at name="column">2</at> |
|
365 |
<at name="row">5</at> |
|
366 |
<at name="colspan">1</at> |
|
367 |
<at name="rowspan">1</at> |
|
368 |
<at name="halign">default</at> |
|
369 |
<at name="valign">default</at> |
|
370 |
<at name="insets" object="insets">0,0,0,0</at> |
|
371 |
</object> |
|
372 |
</at> |
|
373 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
374 |
</super> |
|
375 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
376 |
<at name="beanclass">javax.swing.JButton</at> |
|
377 |
<at name="beanproperties"> |
|
378 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
379 |
<at name="classname">javax.swing.JButton</at> |
|
380 |
<at name="properties"> |
|
381 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
382 |
<at name="border"> |
|
383 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
384 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
385 |
<at name="name">border</at> |
|
386 |
</super> |
|
387 |
<at name="borders"> |
|
388 |
<object classname="java.util.LinkedList"> |
|
389 |
<item > |
|
390 |
<at name="value"> |
|
391 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
392 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
393 |
<at name="name">border</at> |
|
394 |
</super> |
|
395 |
</object> |
|
396 |
</at> |
|
397 |
</item> |
|
398 |
</object> |
|
399 |
</at> |
|
400 |
</object> |
|
401 |
</at> |
|
402 |
<at name="actionCommand">_Rename</at> |
|
403 |
<at name="name">btnRename</at> |
|
404 |
<at name="width">84</at> |
|
405 |
<at name="text">_Rename</at> |
|
406 |
<at name="height">22</at> |
|
407 |
</object> |
|
408 |
</at> |
|
409 |
</object> |
|
410 |
</at> |
|
411 |
</object> |
|
412 |
</at> |
|
413 |
</item> |
|
414 | 358 |
</object> |
415 | 359 |
</at> |
416 | 360 |
<at name="properties"> |
... | ... | |
468 | 412 |
<at name="cellpainters"> |
469 | 413 |
<object classname="com.jeta.forms.store.support.Matrix"> |
470 | 414 |
<at name="rows"> |
471 |
<object classname="[Ljava.lang.Object;" size="6">
|
|
415 |
<object classname="[Ljava.lang.Object;" size="5">
|
|
472 | 416 |
<at name="item" index="0"> |
473 | 417 |
<object classname="[Ljava.lang.Object;" size="3"/> |
474 | 418 |
</at> |
... | ... | |
484 | 428 |
<at name="item" index="4"> |
485 | 429 |
<object classname="[Ljava.lang.Object;" size="3"/> |
486 | 430 |
</at> |
487 |
<at name="item" index="5"> |
|
488 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
489 |
</at> |
|
490 | 431 |
</object> |
491 | 432 |
</at> |
492 | 433 |
</object> |
... | ... | |
525 | 466 |
</at> |
526 | 467 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
527 | 468 |
</super> |
528 |
<at name="id">embedded.2064566679</at>
|
|
469 |
<at name="id">embedded.1803134228</at>
|
|
529 | 470 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,FILL:2DLU:GROW(1.0)</at> |
530 | 471 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at> |
531 | 472 |
<at name="components"> |
... | ... | |
575 | 516 |
</object> |
576 | 517 |
</at> |
577 | 518 |
<at name="actionCommand">JButton</at> |
578 |
<at name="name">btnAccept</at> |
|
579 |
<at name="width">84</at>
|
|
519 |
<at name="name">btnFormFieldAccept</at>
|
|
520 |
<at name="width">81</at>
|
|
580 | 521 |
<at name="text">_Accept</at> |
581 | 522 |
<at name="height">22</at> |
582 | 523 |
</object> |
... | ... | |
631 | 572 |
</object> |
632 | 573 |
</at> |
633 | 574 |
<at name="actionCommand">JButton</at> |
634 |
<at name="name">btnDiscard</at> |
|
635 |
<at name="width">84</at>
|
|
575 |
<at name="name">btnFormFieldDiscard</at>
|
|
576 |
<at name="width">81</at>
|
|
636 | 577 |
<at name="text">_Discard</at> |
637 | 578 |
<at name="height">22</at> |
638 | 579 |
</object> |
... | ... | |
659 | 600 |
</at> |
660 | 601 |
</object> |
661 | 602 |
</at> |
662 |
<at name="name"></at>
|
|
603 |
<at name="name"/>
|
|
663 | 604 |
<at name="fill"> |
664 | 605 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
665 | 606 |
<at name="name">fill</at> |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretype/FeatureTypePanelView.java | ||
---|---|---|
24 | 24 |
JPanel pnlField = new JPanel(); |
25 | 25 |
JButton btnNew = new JButton(); |
26 | 26 |
JButton btnDelete = new JButton(); |
27 |
JButton btnRename = new JButton(); |
|
28 |
JButton btnAccept = new JButton(); |
|
29 |
JButton btnDiscard = new JButton(); |
|
27 |
JButton btnFormFieldAccept = new JButton(); |
|
28 |
JButton btnFormFieldDiscard = new JButton(); |
|
30 | 29 |
|
31 | 30 |
/** |
32 | 31 |
* Default constructor |
... | ... | |
143 | 142 |
public JPanel createPanel1() |
144 | 143 |
{ |
145 | 144 |
JPanel jpanel1 = new JPanel(); |
146 |
FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE","CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0)");
|
|
145 |
FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE","CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,FILL:DEFAULT:GROW(1.0)"); |
|
147 | 146 |
CellConstraints cc = new CellConstraints(); |
148 | 147 |
jpanel1.setLayout(formlayout1); |
149 | 148 |
|
... | ... | |
157 | 156 |
btnDelete.setText("_Delete"); |
158 | 157 |
jpanel1.add(btnDelete,cc.xy(2,3)); |
159 | 158 |
|
160 |
btnRename.setActionCommand("_Rename"); |
|
161 |
btnRename.setName("btnRename"); |
|
162 |
btnRename.setText("_Rename"); |
|
163 |
jpanel1.add(btnRename,cc.xy(2,5)); |
|
164 |
|
|
165 |
addFillComponents(jpanel1,new int[]{ 1,3 },new int[]{ 1,2,3,4,5,6 }); |
|
159 |
addFillComponents(jpanel1,new int[]{ 1,3 },new int[]{ 1,2,3,4,5 }); |
|
166 | 160 |
return jpanel1; |
167 | 161 |
} |
168 | 162 |
|
... | ... | |
173 | 167 |
CellConstraints cc = new CellConstraints(); |
174 | 168 |
jpanel1.setLayout(formlayout1); |
175 | 169 |
|
176 |
btnAccept.setActionCommand("JButton"); |
|
177 |
btnAccept.setName("btnAccept");
|
|
178 |
btnAccept.setText("_Accept"); |
|
179 |
jpanel1.add(btnAccept,cc.xy(2,1)); |
|
170 |
btnFormFieldAccept.setActionCommand("JButton");
|
|
171 |
btnFormFieldAccept.setName("btnFormFieldAccept");
|
|
172 |
btnFormFieldAccept.setText("_Accept");
|
|
173 |
jpanel1.add(btnFormFieldAccept,cc.xy(2,1));
|
|
180 | 174 |
|
181 |
btnDiscard.setActionCommand("JButton"); |
|
182 |
btnDiscard.setName("btnDiscard");
|
|
183 |
btnDiscard.setText("_Discard"); |
|
184 |
jpanel1.add(btnDiscard,cc.xy(2,3)); |
|
175 |
btnFormFieldDiscard.setActionCommand("JButton");
|
|
176 |
btnFormFieldDiscard.setName("btnFormFieldDiscard");
|
|
177 |
btnFormFieldDiscard.setText("_Discard");
|
|
178 |
jpanel1.add(btnFormFieldDiscard,cc.xy(2,3));
|
|
185 | 179 |
|
186 | 180 |
addFillComponents(jpanel1,new int[]{ 1,3 },new int[]{ 1,2,3,4 }); |
187 | 181 |
return jpanel1; |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretype/FeatureTypeAttributePanelView.xml | ||
---|---|---|
341 | 341 |
</at> |
342 | 342 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
343 | 343 |
</super> |
344 |
<at name="id">embedded.1961517027</at>
|
|
344 |
<at name="id">embedded.442378372</at>
|
|
345 | 345 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at> |
346 | 346 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at> |
347 | 347 |
<at name="components"> |
... | ... | |
818 | 818 |
</at> |
819 | 819 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
820 | 820 |
</super> |
821 |
<at name="id">embedded.281442349</at>
|
|
821 |
<at name="id">embedded.707717678</at>
|
|
822 | 822 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at> |
823 | 823 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at> |
824 | 824 |
<at name="components"> |
... | ... | |
1138 | 1138 |
</at> |
1139 | 1139 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
1140 | 1140 |
</super> |
1141 |
<at name="id">embedded.H69d02188B168b2d22e86SZ7ffc</at>
|
|
1141 |
<at name="id">embedded.1129449780</at>
|
|
1142 | 1142 |
<at name="rowspecs">CENTER:DEFAULT:NONE</at> |
1143 | 1143 |
<at name="colspecs">FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE</at> |
1144 | 1144 |
<at name="components"> |
... | ... | |
1274 | 1274 |
</at> |
1275 | 1275 |
</object> |
1276 | 1276 |
</at> |
1277 |
<at name="name"></at>
|
|
1277 |
<at name="name"/>
|
|
1278 | 1278 |
<at name="fill"> |
1279 | 1279 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
1280 | 1280 |
<at name="name">fill</at> |
... | ... | |
1285 | 1285 |
<at name="name">scollBars</at> |
1286 | 1286 |
<at name="verticalpolicy">21</at> |
1287 | 1287 |
<at name="horizontalpolicy">31</at> |
1288 |
<at name="border"> |
|
1289 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
1290 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
1291 |
<at name="name">border</at> |
|
1292 |
</super> |
|
1293 |
<at name="borders"> |
|
1294 |
<object classname="java.util.LinkedList"> |
|
1295 |
<item > |
|
1296 |
<at name="value"> |
|
1297 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
1298 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
1299 |
<at name="name">border</at> |
|
1300 |
</super> |
|
1301 |
</object> |
|
1302 |
</at> |
|
1303 |
</item> |
|
1304 |
</object> |
|
1305 |
</at> |
|
1306 |
</object> |
|
1307 |
</at> |
|
1288 | 1308 |
</object> |
1289 | 1309 |
</at> |
1290 | 1310 |
</object> |
... | ... | |
1336 | 1356 |
</at> |
1337 | 1357 |
</object> |
1338 | 1358 |
</at> |
1339 |
<at name="name"></at>
|
|
1359 |
<at name="name"/>
|
|
1340 | 1360 |
<at name="fill"> |
1341 | 1361 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
1342 | 1362 |
<at name="name">fill</at> |
... | ... | |
1449 | 1469 |
</at> |
1450 | 1470 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
1451 | 1471 |
</super> |
1452 |
<at name="id">embedded.1760028212</at>
|
|
1453 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at>
|
|
1472 |
<at name="id">embedded.667447837</at>
|
|
1473 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at>
|
|
1454 | 1474 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at> |
1455 | 1475 |
<at name="components"> |
1456 | 1476 |
<object classname="java.util.LinkedList"> |
... | ... | |
1653 | 1673 |
</at> |
1654 | 1674 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
1655 | 1675 |
</super> |
1656 |
<at name="id">embedded.1189665299</at>
|
|
1676 |
<at name="id">embedded.1031029466</at>
|
|
1657 | 1677 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE</at> |
1658 | 1678 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE</at> |
1659 | 1679 |
<at name="components"> |
... | ... | |
2199 | 2219 |
</at> |
2200 | 2220 |
<at name="width">997</at> |
2201 | 2221 |
<at name="tabCount">3</at> |
2202 |
<at name="height">212</at>
|
|
2222 |
<at name="height">199</at>
|
|
2203 | 2223 |
</object> |
2204 | 2224 |
</at> |
2205 | 2225 |
</object> |
... | ... | |
2280 | 2300 |
</at> |
2281 | 2301 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
2282 | 2302 |
</super> |
2283 |
<at name="id">embedded.1381694878</at>
|
|
2303 |
<at name="id">embedded.1927495917</at>
|
|
2284 | 2304 |
<at name="rowspecs">CENTER:DEFAULT:NONE</at> |
2285 | 2305 |
<at name="colspecs">FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE</at> |
2286 | 2306 |
<at name="components"> |
... | ... | |
2416 | 2436 |
</at> |
2417 | 2437 |
</object> |
2418 | 2438 |
</at> |
2419 |
<at name="name"></at>
|
|
2439 |
<at name="name"/>
|
|
2420 | 2440 |
<at name="fill"> |
2421 | 2441 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
2422 | 2442 |
<at name="name">fill</at> |
... | ... | |
2498 | 2518 |
</at> |
2499 | 2519 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
2500 | 2520 |
</super> |
2501 |
<at name="id">embedded.N69d02188A168b2d22e86CE7ffa</at>
|
|
2521 |
<at name="id">embedded.1977188865</at>
|
|
2502 | 2522 |
<at name="rowspecs">CENTER:DEFAULT:NONE</at> |
2503 | 2523 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE</at> |
2504 | 2524 |
<at name="components"> |
... | ... | |
2862 | 2882 |
</at> |
2863 | 2883 |
</object> |
2864 | 2884 |
</at> |
2865 |
<at name="name"></at>
|
|
2885 |
<at name="name"/>
|
|
2866 | 2886 |
<at name="fill"> |
2867 | 2887 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
2868 | 2888 |
<at name="name">fill</at> |
... | ... | |
2873 | 2893 |
<at name="name">scollBars</at> |
2874 | 2894 |
<at name="verticalpolicy">21</at> |
2875 | 2895 |
<at name="horizontalpolicy">31</at> |
2896 |
<at name="border"> |
|
2897 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
2898 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
2899 |
<at name="name">border</at> |
|
2900 |
</super> |
|
2901 |
<at name="borders"> |
|
2902 |
<object classname="java.util.LinkedList"> |
|
2903 |
<item > |
|
2904 |
<at name="value"> |
|
2905 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
2906 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
2907 |
<at name="name">border</at> |
|
2908 |
</super> |
|
2909 |
</object> |
|
2910 |
</at> |
|
2911 |
</item> |
|
2912 |
</object> |
|
2913 |
</at> |
|
2914 |
</object> |
|
2915 |
</at> |
|
2876 | 2916 |
</object> |
2877 | 2917 |
</at> |
2878 | 2918 |
</object> |
... | ... | |
2924 | 2964 |
</at> |
2925 | 2965 |
</object> |
2926 | 2966 |
</at> |
2927 |
<at name="name"></at>
|
|
2967 |
<at name="name"/>
|
|
2928 | 2968 |
<at name="fill"> |
2929 | 2969 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
2930 | 2970 |
<at name="name">fill</at> |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretype/FeatureTypePanel.java | ||
---|---|---|
14 | 14 |
|
15 | 15 |
public void put(FeatureType type); |
16 | 16 |
|
17 |
public void setReadonly(boolean readonly);
|
|
17 |
public void setEditable(boolean editable);
|
|
18 | 18 |
|
19 | 19 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretype/FeatureTypeAttributePanel.java | ||
---|---|---|
14 | 14 |
|
15 | 15 |
public void put(FeatureAttributeDescriptor descriptor); |
16 | 16 |
|
17 |
public void setReadonly(boolean readonly);
|
|
17 |
public void setEditable(boolean editable);
|
|
18 | 18 |
|
19 | 19 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretype/DefaultFeatureTypePanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.swing.impl.featuretype; |
2 | 2 |
|
3 | 3 |
import java.awt.BorderLayout; |
4 |
import java.awt.Dimension; |
|
5 |
import java.awt.event.ActionEvent; |
|
6 |
import java.awt.event.ActionListener; |
|
7 |
import java.util.Date; |
|
4 | 8 |
import java.util.Objects; |
5 | 9 |
import javax.swing.JComponent; |
6 | 10 |
import javax.swing.event.ListSelectionEvent; |
7 | 11 |
import javax.swing.event.ListSelectionListener; |
12 |
import javax.swing.event.TableModelEvent; |
|
8 | 13 |
import javax.swing.table.AbstractTableModel; |
9 | 14 |
import javax.swing.table.TableModel; |
15 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
|
10 | 16 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
11 | 17 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
18 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
12 | 19 |
import org.gvsig.fmap.dal.feature.FeatureType; |
20 |
import org.gvsig.tools.ToolsLocator; |
|
21 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
22 |
import org.gvsig.tools.i18n.I18nManager; |
|
13 | 23 |
|
14 | 24 |
/** |
15 | 25 |
* |
... | ... | |
29 | 39 |
"Size", |
30 | 40 |
"Precision", |
31 | 41 |
"Default value", |
32 |
"Calcualed"
|
|
42 |
"Calculated"
|
|
33 | 43 |
}; |
34 | 44 |
private final Class[] columnClasses = new Class[] { |
35 | 45 |
String.class, |
... | ... | |
112 | 122 |
@Override |
113 | 123 |
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { |
114 | 124 |
} |
115 |
|
|
125 |
|
|
126 |
public void fireUpdateEvent() { |
|
127 |
this.fireTableChanged(new TableModelEvent(this)); |
|
128 |
} |
|
116 | 129 |
} |
117 | 130 |
|
118 | 131 |
private DefaultFeatureTypeAttributePanel descriptorPanel; |
119 | 132 |
private FeatureType featureType; |
133 |
private boolean editable; |
|
134 |
private FeatureTypeTableModel tableModel; |
|
135 |
private FeatureStore store; |
|
120 | 136 |
|
121 | 137 |
public DefaultFeatureTypePanel() { |
138 |
this.editable = true; |
|
122 | 139 |
this.initComponents(); |
123 | 140 |
} |
124 | 141 |
|
125 | 142 |
private void initComponents() { |
126 |
TableModel model = new FeatureTypeTableModel();
|
|
127 |
this.tblFields.setModel(model);
|
|
143 |
this.tableModel = new FeatureTypeTableModel();
|
|
144 |
this.tblFields.setModel(this.tableModel);
|
|
128 | 145 |
this.tblFields.getSelectionModel().addListSelectionListener(new ListSelectionListener() { |
129 | 146 |
@Override |
130 | 147 |
public void valueChanged(ListSelectionEvent e) { |
131 |
doRowSelected();
|
|
148 |
doFormFieldPut();
|
|
132 | 149 |
} |
133 | 150 |
}); |
134 | 151 |
this.descriptorPanel = new DefaultFeatureTypeAttributePanel(); |
135 | 152 |
this.pnlField.setLayout(new BorderLayout()); |
136 | 153 |
this.pnlField.add(this.descriptorPanel, BorderLayout.CENTER); |
137 | 154 |
this.descriptorPanel.setEnabled(false); |
155 |
|
|
156 |
this.btnFormFieldDiscard.addActionListener(new ActionListener() { |
|
157 |
@Override |
|
158 |
public void actionPerformed(ActionEvent e) { |
|
159 |
doFormFieldPut(); |
|
160 |
} |
|
161 |
}); |
|
162 |
this.btnFormFieldAccept.addActionListener(new ActionListener() { |
|
163 |
@Override |
|
164 |
public void actionPerformed(ActionEvent e) { |
|
165 |
doFormFieldFetch(); |
|
166 |
} |
|
167 |
}); |
|
168 |
this.btnNew.addActionListener(new ActionListener() { |
|
169 |
@Override |
|
170 |
public void actionPerformed(ActionEvent e) { |
|
171 |
doNewField(); |
|
172 |
} |
|
173 |
}); |
|
174 |
this.btnDelete.addActionListener(new ActionListener() { |
|
175 |
@Override |
|
176 |
public void actionPerformed(ActionEvent e) { |
|
177 |
doDeleteField(); |
|
178 |
} |
|
179 |
}); |
|
180 |
|
|
181 |
this.setPreferredSize(new Dimension(700, 500)); |
|
138 | 182 |
} |
139 | 183 |
|
140 |
private void doRowSelected() {
|
|
184 |
private void doFormFieldFetch() {
|
|
141 | 185 |
int row = this.tblFields.getSelectedRow(); |
142 | 186 |
if( row<0 ) { |
143 | 187 |
return; |
144 | 188 |
} |
145 | 189 |
FeatureAttributeDescriptor descriptor = this.featureType.getAttributeDescriptor(row); |
190 |
if( descriptor instanceof EditableFeatureAttributeDescriptor ) { |
|
191 |
this.descriptorPanel.fetch((EditableFeatureAttributeDescriptor) descriptor); |
|
192 |
this.tableModel.fireUpdateEvent(); |
|
193 |
} |
|
194 |
} |
|
195 |
|
|
196 |
private void doFormFieldPut() { |
|
197 |
int row = this.tblFields.getSelectedRow(); |
|
198 |
if( row<0 ) { |
|
199 |
return; |
|
200 |
} |
|
201 |
FeatureAttributeDescriptor descriptor = this.featureType.getAttributeDescriptor(row); |
|
146 | 202 |
this.descriptorPanel.put(descriptor); |
147 | 203 |
this.descriptorPanel.setEnabled(true); |
204 |
if( descriptor instanceof EditableFeatureAttributeDescriptor ) { |
|
205 |
this.btnFormFieldAccept.setEnabled(this.editable); |
|
206 |
this.descriptorPanel.setEditable(this.editable); |
|
207 |
} else { |
|
208 |
this.btnFormFieldAccept.setEnabled(false); |
|
209 |
this.descriptorPanel.setEditable(false); |
|
210 |
} |
|
148 | 211 |
} |
149 | 212 |
|
213 |
|
|
150 | 214 |
@Override |
151 | 215 |
public JComponent asJComponent() { |
152 | 216 |
return this; |
153 | 217 |
} |
154 | 218 |
|
155 |
public void setReadonly(boolean readonly) { |
|
156 |
|
|
219 |
public void setEditable(boolean editable) { |
|
220 |
this.editable = editable; |
|
221 |
this.btnFormFieldAccept.setEnabled(editable); |
|
222 |
this.btnFormFieldDiscard.setEnabled(editable); |
|
223 |
this.btnNew.setEnabled(editable); |
|
224 |
this.btnDelete.setEnabled(editable); |
|
225 |
this.descriptorPanel.setEnabled(editable); |
|
157 | 226 |
} |
158 | 227 |
|
159 | 228 |
@Override |
... | ... | |
164 | 233 |
@Override |
165 | 234 |
public void put(FeatureType type) { |
166 | 235 |
this.featureType = type; |
167 |
TableModel model = new FeatureTypeTableModel(type); |
|
168 |
this.tblFields.setModel(model); |
|
236 |
if( type == null ) { |
|
237 |
this.store = null; |
|
238 |
} else { |
|
239 |
// Nos quedamos una referencia para evitar que se destruya, ya que |
|
240 |
// el featureTyper se guarda solo una WeakReference. |
|
241 |
this.store = type.getStore(); |
|
242 |
} |
|
243 |
if( !(type instanceof EditableFeatureType) ) { |
|
244 |
this.setEditable(false); |
|
245 |
} |
|
246 |
this.tableModel = new FeatureTypeTableModel(type); |
|
247 |
this.tblFields.setModel(this.tableModel); |
|
169 | 248 |
if( type.size()>0 ) { |
170 | 249 |
this.tblFields.getSelectionModel().setSelectionInterval(0, 0); |
171 | 250 |
} |
172 | 251 |
} |
173 | 252 |
|
253 |
private void doNewField() { |
|
254 |
EditableFeatureType eft = (EditableFeatureType)this.featureType; |
|
255 |
EditableFeatureAttributeDescriptor descriptor = eft.add( |
|
256 |
this.getNewFieldName(), |
|
257 |
DataTypes.STRING |
|
258 |
); |
|
259 |
this.tableModel.fireUpdateEvent(); |
|
260 |
int row = descriptor.getIndex(); |
|
261 |
this.tblFields.getSelectionModel().addSelectionInterval(row,row); |
|
262 |
} |
|
263 |
|
|
264 |
private void doDeleteField() { |
|
265 |
int row = this.tblFields.getSelectedRow(); |
|
266 |
if( row<0 ) { |
|
267 |
return; |
|
268 |
} |
|
269 |
FeatureAttributeDescriptor descriptor = this.featureType.getAttributeDescriptor(row); |
|
270 |
((EditableFeatureType)this.featureType).remove(row); |
|
271 |
this.tableModel.fireUpdateEvent(); |
|
272 |
if( row >= this.tblFields.getRowCount()) { |
|
273 |
row = this.tblFields.getRowCount()-1; |
|
274 |
} |
|
275 |
this.tblFields.getSelectionModel().addSelectionInterval(row,row); |
|
276 |
} |
|
277 |
|
|
278 |
private String getNewFieldName() { |
|
279 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
280 |
String prefix = i18n.getTranslation("_Field"); |
|
281 |
String fieldName; |
|
282 |
for (int i = 1; i < 1000; i++) { |
|
283 |
fieldName = prefix +"-"+i; |
|
284 |
if( this.featureType.get(fieldName)==null ) { |
|
285 |
return fieldName; |
|
286 |
} |
|
287 |
} |
|
288 |
fieldName = prefix + "-" + (new Date()).getTime(); |
|
289 |
return fieldName; |
|
290 |
} |
|
291 |
|
|
174 | 292 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/test/java/org/gvsig/fmap/dal/swing/impl/featuretype/Test.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.swing.impl.featuretype; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
|
6 |
import org.gvsig.fmap.dal.DALLocator; |
|
7 |
import org.gvsig.fmap.dal.DataManager; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
9 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
10 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
|
11 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
12 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
13 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
14 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
15 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
16 |
|
|
17 |
/** |
|
18 |
* |
|
19 |
* @author jjdelcerro |
|
20 |
*/ |
|
21 |
public class Test { |
|
22 |
|
|
23 |
/** |
|
24 |
* @param args the command line arguments |
|
25 |
*/ |
|
26 |
public static void main(String[] args) throws Exception { |
|
27 |
Test test = new Test(); |
|
28 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
29 |
test.run(); |
|
30 |
} |
|
31 |
|
|
32 |
public void run() throws Exception { |
|
33 |
WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
34 |
DataSwingManager manager = DALSwingLocator.getSwingManager(); |
|
35 |
|
|
36 |
URL resource = this.getClass().getResource("/org/gvsig/esp_comaut/esp_comaut.dbf"); |
|
37 |
FeatureStore store = openShape(resource); |
|
38 |
FeatureTypePanel panel = new DefaultFeatureTypePanel(); |
|
39 |
panel.put(store.getDefaultFeatureType()); |
|
40 |
|
|
41 |
Dialog dialog = windowManager.createDialog( |
|
42 |
panel.asJComponent(), |
|
43 |
"Test", |
|
44 |
null, |
|
45 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
46 |
); |
|
47 |
dialog.show(WindowManager.MODE.WINDOW); |
|
48 |
} |
|
49 |
|
|
50 |
public FeatureStore openShape(URL resource) throws Exception { |
|
51 |
DataManager dataManager = DALLocator.getDataManager(); |
|
52 |
FeatureStore store = (FeatureStore) dataManager.openStore( |
|
53 |
"DBF", |
|
54 |
"dbffile", new File(resource.toURI()) |
|
55 |
// "CRS", CRSFactory.getCRS("EPSG:23030") |
|
56 |
); |
|
57 |
return store; |
|
58 |
} |
|
59 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/test/java/org/gvsig/fmap/dal/swing/impl/featuretype/TestEditable.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.swing.impl.featuretype; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import org.gvsig.fmap.dal.DALLocator; |
|
6 |
import org.gvsig.fmap.dal.DataManager; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
8 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
9 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
|
10 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
11 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
12 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
13 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
14 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
15 |
|
|
16 |
/** |
|
17 |
* |
|
18 |
* @author jjdelcerro |
|
19 |
*/ |
|
20 |
public class TestEditable { |
|
21 |
|
|
22 |
/** |
|
23 |
* @param args the command line arguments |
|
24 |
*/ |
|
25 |
public static void main(String[] args) throws Exception { |
|
26 |
TestEditable test = new TestEditable(); |
|
27 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
28 |
test.run(); |
|
29 |
} |
|
30 |
|
|
31 |
public void run() throws Exception { |
|
32 |
WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
33 |
DataSwingManager manager = DALSwingLocator.getSwingManager(); |
|
34 |
|
|
35 |
URL resource = this.getClass().getResource("/org/gvsig/esp_comaut/esp_comaut.dbf"); |
|
36 |
FeatureStore store = openShape(resource); |
|
37 |
FeatureTypePanel panel = new DefaultFeatureTypePanel(); |
|
38 |
panel.put(store.getDefaultFeatureType().getEditable()); |
|
39 |
|
|
40 |
Dialog dialog = windowManager.createDialog( |
|
41 |
panel.asJComponent(), |
|
42 |
"Test", |
|
43 |
null, |
|
44 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
45 |
); |
|
46 |
dialog.show(WindowManager.MODE.WINDOW); |
|
47 |
} |
|
48 |
|
|
49 |
public FeatureStore openShape(URL resource) throws Exception { |
|
50 |
DataManager dataManager = DALLocator.getDataManager(); |
|
51 |
FeatureStore store = (FeatureStore) dataManager.openStore( |
|
52 |
"DBF", |
|
53 |
"dbffile", new File(resource.toURI()) |
|
54 |
// "CRS", CRSFactory.getCRS("EPSG:23030") |
|
55 |
); |
|
56 |
return store; |
|
57 |
} |
|
58 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/test/java/org/gvsig/fmap/dal/swing/impl/featuretype/TestNotEditable.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.swing.impl.featuretype; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import org.gvsig.fmap.dal.DALLocator; |
|
6 |
import org.gvsig.fmap.dal.DataManager; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
8 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
9 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
|
10 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
11 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
12 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
13 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
14 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
15 |
|
|
16 |
/** |
|
17 |
* |
|
18 |
* @author jjdelcerro |
|
19 |
*/ |
|
20 |
public class TestNotEditable { |
|
21 |
|
|
22 |
/** |
|
23 |
* @param args the command line arguments |
|
24 |
*/ |
|
25 |
public static void main(String[] args) throws Exception { |
|
26 |
TestNotEditable test = new TestNotEditable(); |
|
27 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
28 |
test.run(); |
|
29 |
} |
|
30 |
|
|
31 |
public void run() throws Exception { |
|
32 |
WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
33 |
DataSwingManager manager = DALSwingLocator.getSwingManager(); |
|
34 |
|
|
35 |
URL resource = this.getClass().getResource("/org/gvsig/esp_comaut/esp_comaut.dbf"); |
|
36 |
FeatureStore store = openShape(resource); |
|
37 |
FeatureTypePanel panel = new DefaultFeatureTypePanel(); |
|
38 |
panel.put(store.getDefaultFeatureType()); |
|
39 |
|
|
40 |
Dialog dialog = windowManager.createDialog( |
|
41 |
panel.asJComponent(), |
|
42 |
"Test", |
|
43 |
null, |
|
44 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
45 |
); |
|
46 |
dialog.show(WindowManager.MODE.WINDOW); |
|
47 |
} |
|
48 |
|
|
49 |
public FeatureStore openShape(URL resource) throws Exception { |
|
50 |
DataManager dataManager = DALLocator.getDataManager(); |
|
51 |
FeatureStore store = (FeatureStore) dataManager.openStore( |
|
52 |
"DBF", |
|
53 |
"dbffile", new File(resource.toURI()) |
|
54 |
// "CRS", CRSFactory.getCRS("EPSG:23030") |
|
55 |
); |
|
56 |
return store; |
|
57 |
} |
|
58 |
} |
Also available in: Unified diff