Revision 2675
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/vectorediting/app/mainplugin/EditingToolOptionsPanel.java | ||
---|---|---|
20 | 20 |
import javax.swing.JPanel; |
21 | 21 |
import javax.swing.JTabbedPane; |
22 | 22 |
import javax.swing.SwingConstants; |
23 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator; |
|
24 | 23 |
import org.gvsig.featureform.swing.JFeatureForm; |
25 |
import org.gvsig.featureform.swing.JFeaturesForm; |
|
26 | 24 |
import org.gvsig.fmap.dal.DALLocator; |
27 | 25 |
import org.gvsig.fmap.dal.DataTypes; |
28 |
import org.gvsig.fmap.dal.StoresRepository; |
|
29 | 26 |
import org.gvsig.fmap.dal.exception.DataException; |
30 | 27 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
31 | 28 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
... | ... | |
33 | 30 |
import org.gvsig.fmap.dal.feature.FeatureType; |
34 | 31 |
import org.gvsig.fmap.dal.feature.FeatureTypeDefinitionsManager; |
35 | 32 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
33 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
|
36 | 34 |
import org.gvsig.tools.ToolsLocator; |
37 | 35 |
import org.gvsig.tools.dynform.DynFormDefinition; |
38 | 36 |
import org.gvsig.tools.dynform.DynFormFieldDefinition; |
... | ... | |
49 | 47 |
import org.gvsig.tools.observer.Notification; |
50 | 48 |
import org.gvsig.tools.observer.Observable; |
51 | 49 |
import org.gvsig.tools.observer.Observer; |
52 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
|
53 |
import org.gvsig.tools.script.ScriptManager; |
|
54 | 50 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
55 | 51 |
import org.gvsig.tools.swing.api.ToolsSwingUtils; |
56 | 52 |
import org.gvsig.vectorediting.app.mainplugin.dynformfield.point.JDynFormFieldPointFactory; |
... | ... | |
82 | 78 |
private JButton applyDefaultValuesButton; |
83 | 79 |
private ImageIcon confirmIcon; |
84 | 80 |
|
85 |
private static Map<String, JsonObject> defaultValues = new HashMap<>(); |
|
81 |
private static final Map<String, JsonObject> defaultValues = new HashMap<>();
|
|
86 | 82 |
private JTabbedPane tab; |
87 | 83 |
private int currentTab; |
88 | 84 |
|
... | ... | |
108 | 104 |
this.service.deleteObserver(this.serviceObserver); |
109 | 105 |
} |
110 | 106 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
107 |
DataSwingManager dataSwingManager = DALSwingLocator.getDataSwingManager(); |
|
111 | 108 |
if (service == null) { |
112 | 109 |
if(this.tab != null){ |
113 | 110 |
this.currentTab = this.tab.getSelectedIndex(); |
... | ... | |
192 | 189 |
f.copyFrom(xx); |
193 | 190 |
} |
194 | 191 |
DynFormDefinition formdef = this.createFormDefinition(service); |
195 |
this.featureform = DALSwingLocator.getDataSwingManager().createJFeatureForm(formdef);
|
|
196 |
this.featureform.getDynForm().setContext(new DefaultFeaturesFormContext(store));
|
|
192 |
this.featureform = dataSwingManager.createJFeatureForm(formdef);
|
|
193 |
this.featureform.getDynForm().setContext(dataSwingManager.createFeaturesFormContext(store));
|
|
197 | 194 |
this.featureform.setFeature(f); |
198 | 195 |
JPanel valuesPanel = new JPanel(); |
199 | 196 |
valuesPanel.setLayout(new BorderLayout()); |
... | ... | |
512 | 509 |
} |
513 | 510 |
return params; |
514 | 511 |
} |
515 |
|
|
516 |
private static class DefaultFeaturesFormContext implements JFeaturesForm.FeaturesFormContext { |
|
517 |
|
|
518 |
private FeatureStore store; |
|
519 |
|
|
520 |
DefaultFeaturesFormContext(FeatureStore store){ |
|
521 |
this.store = store; |
|
522 |
} |
|
523 |
|
|
524 |
private DefaultFeaturesFormContext() { |
|
525 |
|
|
526 |
} |
|
527 |
|
|
528 |
@Override |
|
529 |
public FeatureStore getFeatureStore() { |
|
530 |
return store; |
|
531 |
} |
|
532 |
|
|
533 |
@Override |
|
534 |
public FeatureType getFeatureType() { |
|
535 |
try { |
|
536 |
return store.getDefaultFeatureType(); |
|
537 |
} catch (DataException ex) { |
|
538 |
return null; |
|
539 |
} |
|
540 |
} |
|
541 |
|
|
542 |
@Override |
|
543 |
public ResourcesStorage getResourcesStorage() { |
|
544 |
if (store == null) { |
|
545 |
return null; |
|
546 |
} |
|
547 |
return store.getResourcesStorage(); |
|
548 |
} |
|
549 |
|
|
550 |
@Override |
|
551 |
public StoresRepository getStoresRepository() { |
|
552 |
if (store == null) { |
|
553 |
return null; |
|
554 |
} |
|
555 |
return store.getStoresRepository(); |
|
556 |
} |
|
557 |
|
|
558 |
@Override |
|
559 |
public ScriptManager getScriptManager() { |
|
560 |
return ExpressionEvaluatorLocator.getExpressionEvaluatorManager(); |
|
561 |
} |
|
562 |
|
|
563 |
} |
|
564 |
|
|
565 | 512 |
} |
Also available in: Unified diff