Revision 45726
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/featureform/swing/impl/DefaultJFeatureForm.java | ||
---|---|---|
1 | 1 |
|
2 | 2 |
package org.gvsig.featureform.swing.impl; |
3 | 3 |
|
4 |
import java.util.Objects; |
|
4 | 5 |
import javax.swing.JComponent; |
5 | 6 |
import org.gvsig.featureform.swing.JFeatureForm; |
6 | 7 |
import org.gvsig.fmap.dal.DALLocator; |
... | ... | |
9 | 10 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
10 | 11 |
import org.gvsig.fmap.dal.feature.FeatureType; |
11 | 12 |
import org.gvsig.fmap.dal.feature.FeatureTypeDefinitionsManager; |
13 |
import org.gvsig.tools.dynform.DynFormDefinition; |
|
12 | 14 |
import org.gvsig.tools.dynform.DynFormLocator; |
13 | 15 |
import org.gvsig.tools.dynform.JDynForm; |
14 | 16 |
import org.gvsig.tools.dynobject.DynClass; |
17 |
import org.gvsig.tools.dynobject.DynStruct; |
|
15 | 18 |
import org.slf4j.Logger; |
16 | 19 |
import org.slf4j.LoggerFactory; |
17 | 20 |
|
18 | 21 |
|
22 |
@SuppressWarnings("UseSpecificCatch") |
|
19 | 23 |
public class DefaultJFeatureForm implements JFeatureForm { |
20 | 24 |
private static final Logger logger = LoggerFactory.getLogger(DefaultJFeatureForm.class); |
21 | 25 |
|
22 | 26 |
Feature feature; |
23 | 27 |
FeatureStore store; |
28 |
DynFormDefinition definition; |
|
24 | 29 |
JDynForm form; |
25 | 30 |
|
26 | 31 |
@Override |
... | ... | |
40 | 45 |
|
41 | 46 |
@Override |
42 | 47 |
public void setStore(FeatureStore store) { |
43 |
if( java.util.Objects.equals(this.store, store) ) {
|
|
48 |
if( Objects.equals(this.store, store) ) { |
|
44 | 49 |
return; |
45 | 50 |
} |
46 | 51 |
this.store = store; |
... | ... | |
60 | 65 |
} |
61 | 66 |
|
62 | 67 |
@Override |
68 |
public void setDefinition(DynFormDefinition definition) { |
|
69 |
try { |
|
70 |
this.form = DynFormLocator.getDynFormManager().createJDynForm(definition); |
|
71 |
this.definition = definition; |
|
72 |
} catch (Exception ex) { |
|
73 |
logger.warn("Can't create form.",ex); |
|
74 |
throw new RuntimeException("Can't create form.",ex); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
63 | 79 |
public void setFeature(Feature feature) { |
64 | 80 |
this.feature = feature; |
65 |
this.setStore(this.feature.getStore()); |
|
81 |
if( this.definition==null ) { |
|
82 |
this.setStore(this.feature.getStore()); |
|
83 |
} |
|
66 | 84 |
this.form.setValues(feature.getAsDynObject()); |
67 | 85 |
} |
68 | 86 |
|
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/DefaultDataSwingManager.java | ||
---|---|---|
110 | 110 |
import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.StorePointFieldSuggestionProviderFactory; |
111 | 111 |
import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.WrongNameFieldSuggestionProviderFactory; |
112 | 112 |
import org.gvsig.fmap.dal.swing.searchPostProcess.SearchPostProcessFactory; |
113 |
import org.gvsig.tools.dynform.DynFormDefinition; |
|
113 | 114 |
|
114 | 115 |
|
115 | 116 |
/** |
... | ... | |
249 | 250 |
} |
250 | 251 |
|
251 | 252 |
@Override |
253 |
public JFeatureForm createJFeatureForm(DynFormDefinition definicion) throws CreateJFeatureFormException { |
|
254 |
JFeatureForm form = new DefaultJFeatureForm(); |
|
255 |
form.setDefinition(definicion); |
|
256 |
return form; |
|
257 |
} |
|
258 |
|
|
259 |
@Override |
|
252 | 260 |
public JFeatureTable createJFeatureTable(FeatureTableModel model) { |
253 | 261 |
return this.createJFeatureTable(model, true); |
254 | 262 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.api/src/main/java/org/gvsig/featureform/swing/JFeatureForm.java | ||
---|---|---|
4 | 4 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
5 | 5 |
import org.gvsig.fmap.dal.feature.Feature; |
6 | 6 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
7 |
import org.gvsig.tools.dynform.DynFormDefinition; |
|
7 | 8 |
import org.gvsig.tools.dynform.JDynForm; |
8 | 9 |
import org.gvsig.tools.swing.api.Component; |
9 | 10 |
|
... | ... | |
14 | 15 |
|
15 | 16 |
public void setStore(FeatureStore store); |
16 | 17 |
|
18 |
public void setDefinition(DynFormDefinition definition); |
|
19 |
|
|
17 | 20 |
public void setFeature(Feature feature); |
18 | 21 |
|
19 | 22 |
public JDynForm getDynForm(); |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.api/src/main/java/org/gvsig/fmap/dal/swing/DataSwingManager.java | ||
---|---|---|
63 | 63 |
import org.gvsig.fmap.dal.swing.featuretype.FeatureAttributesSelectionPanel; |
64 | 64 |
|
65 | 65 |
import org.gvsig.fmap.dal.swing.searchPostProcess.SearchPostProcessFactory; |
66 |
import org.gvsig.tools.dynform.DynFormDefinition; |
|
66 | 67 |
|
67 | 68 |
|
68 | 69 |
/** |
... | ... | |
78 | 79 |
|
79 | 80 |
public JFeatureForm createJFeatureForm(FeatureStore store) throws CreateJFeatureFormException; |
80 | 81 |
|
82 |
public JFeatureForm createJFeatureForm(DynFormDefinition definicion) throws CreateJFeatureFormException; |
|
83 |
|
|
81 | 84 |
public JFeatureForm createJFeatureForm(Feature feature) throws CreateJFeatureFormException; |
82 | 85 |
|
83 | 86 |
public JDBCConnectionPanel createJDBCConnectionPanel(); |
Also available in: Unified diff