Revision 1146 org.gvsig.attributeeditor/trunk/org.gvsig.attributeeditor/org.gvsig.attributeeditor.mapcontrol/src/main/java/org/gvsig/fmap/mapcontrol/tools/Listeners/AttributeEditorPointListener.java
AttributeEditorPointListener.java | ||
---|---|---|
151 | 151 |
if( layer == null || query==null ) { |
152 | 152 |
return; |
153 | 153 |
} |
154 |
String layerName = layer.getName(); |
|
155 |
if( layerName == null ) { |
|
156 |
layerName = ""; |
|
157 |
} |
|
158 |
showOrUpdateForm(layerName, layer.getFeatureStore(), query); |
|
159 |
} |
|
160 |
|
|
161 |
public void showOrUpdateForm(String storeName, FeatureStore featureStore, FeatureQuery query) { |
|
162 |
if( featureStore == null || query==null ) { |
|
163 |
return; |
|
164 |
} |
|
154 | 165 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
155 |
String layerName = ""; |
|
156 | 166 |
try { |
157 |
layerName = layer.getName();
|
|
158 |
FeatureStore featureStore;
|
|
159 |
featureStore = layer.getFeatureStore();
|
|
167 |
if( StringUtils.isBlank(storeName) ) {
|
|
168 |
storeName = featureStore.getLabel();
|
|
169 |
}
|
|
160 | 170 |
try { |
161 | 171 |
synchronized (featureStore) { |
162 | 172 |
FeatureSet featSet = featureStore.getFeatureSet(query); |
... | ... | |
168 | 178 |
selection.select(featSet); |
169 | 179 |
} |
170 | 180 |
} catch (DataException ex) { |
171 |
LOGGER.warn("Can't query layer " + layerName+", query: "+query, ex);
|
|
181 |
LOGGER.warn("Can't query layer " + storeName+", query: "+query, ex);
|
|
172 | 182 |
return; |
173 | 183 |
} |
174 | 184 |
if (this.form == null) { |
175 |
this.form = getForm(layer, query);
|
|
176 |
this.form.showForm(makeTitle("attribute_editor", layerName, featureStore.getName()), MODE.TOOL);
|
|
185 |
this.form = getForm(featureStore, query);
|
|
186 |
this.form.showForm(makeTitle("attribute_editor", storeName, featureStore.getName()), MODE.TOOL);
|
|
177 | 187 |
} else if( this.form.getFeatureStore()!=featureStore ) { |
178 | 188 |
// Dimension size = this.form.asJComponent().getPreferredSize(); |
179 | 189 |
disposeForm(); |
180 |
this.form = getForm(layer, query);
|
|
190 |
this.form = getForm(featureStore, query);
|
|
181 | 191 |
// this.form.asJComponent().setPreferredSize(size); |
182 |
this.form.showForm(makeTitle("attribute_editor", layerName, featureStore.getName()), MODE.TOOL);
|
|
192 |
this.form.showForm(makeTitle("attribute_editor", storeName, featureStore.getName()), MODE.TOOL);
|
|
183 | 193 |
} |
184 | 194 |
this.form.setQuery(query); |
185 | 195 |
} catch (Exception ex) { |
186 |
LOGGER.warn("Can't show attribute information from point on the layer " + layerName, ex);
|
|
196 |
LOGGER.warn("Can't show attribute information from point on the layer " + storeName, ex);
|
|
187 | 197 |
String msg = |
188 | 198 |
i18n.getTranslation("Cant_show_attribute_information_for_layer_%1_on_point", |
189 |
new String[] { layerName });
|
|
199 |
new String[] { storeName });
|
|
190 | 200 |
ToolsSwingLocator.getThreadSafeDialogsManager().messageDialog(msg, |
191 | 201 |
i18n.getTranslation("attribute_editor"), JOptionPane.WARNING_MESSAGE); |
192 | 202 |
disposeForm(); |
... | ... | |
202 | 212 |
this.refreshCallback = refreshCallback; |
203 | 213 |
} |
204 | 214 |
|
205 |
private JFeaturesForm getForm(FLyrVect layer, FeatureQuery query) throws CreateJFeatureFormException, ServiceException, DataException {
|
|
215 |
private JFeaturesForm getForm(FeatureStore store, FeatureQuery query) throws CreateJFeatureFormException, ServiceException, DataException {
|
|
206 | 216 |
if (this.form == null) { |
207 | 217 |
DataSwingManager swingManager = DALSwingLocator.getSwingManager(); |
208 |
FeatureStore store = layer.getFeatureStore(); |
|
209 | 218 |
JFeaturesForm theForm = swingManager.createJFeaturesForm(store, query); |
210 | 219 |
this.form = theForm; |
211 | 220 |
this.form.setTerminateEditingOnClose(false); |
Also available in: Unified diff