Revision 44154 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
DefaultFeatureTypeAttributePanel.java | ||
---|---|---|
12 | 12 |
import javax.swing.SwingUtilities; |
13 | 13 |
import javax.swing.event.ChangeEvent; |
14 | 14 |
import javax.swing.event.ChangeListener; |
15 |
import org.apache.commons.lang3.ArrayUtils; |
|
15 | 16 |
import org.apache.commons.lang3.StringUtils; |
16 | 17 |
import org.cresques.cts.IProjection; |
17 | 18 |
import org.gvsig.expressionevaluator.Expression; |
... | ... | |
304 | 305 |
default: |
305 | 306 |
break; |
306 | 307 |
} |
308 |
descriptor.setDataProfileName( |
|
309 |
StringUtils.defaultIfBlank((String) this.cboDataProfile.getSelectedItem(),null) |
|
310 |
); |
|
311 |
|
|
307 | 312 |
if( this.chkVirtualField.isSelected() && this.pickerVirtualField.isEnabled() ) { |
308 | 313 |
Expression expression = this.pickerVirtualField.get(); |
309 | 314 |
if( expression==null ) { |
... | ... | |
314 | 319 |
descriptor.getFeatureType(), |
315 | 320 |
expression |
316 | 321 |
); |
317 |
descriptor.setFeatureAttributeEmulator(emulator); |
|
322 |
if( !emulator.isValid() ) { |
|
323 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
324 |
dialogs.messageDialog( |
|
325 |
i18n.getTranslation("_The_expression_of_virtual_field_is_not_valid")+ |
|
326 |
"\n"+ |
|
327 |
emulator.getErrorMessage(), |
|
328 |
i18n.getTranslation("_Warning"), |
|
329 |
JOptionPane.WARNING_MESSAGE |
|
330 |
); |
|
331 |
return null; |
|
332 |
} |
|
333 |
for (String requiredFieldName : emulator.getRequiredFieldNames()) { |
|
334 |
if( StringUtils.equalsIgnoreCase(requiredFieldName, descriptor.getName()) ) { |
|
335 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
336 |
dialogs.messageDialog( |
|
337 |
i18n.getTranslation("_The_expression_of_virtual_field_is_not_valid")+ |
|
338 |
"\n\n"+ |
|
339 |
i18n.getTranslation("_The_expression_contains_a_reference_to_itself"), |
|
340 |
i18n.getTranslation("_Warning"), |
|
341 |
JOptionPane.WARNING_MESSAGE |
|
342 |
); |
|
343 |
return null; |
|
344 |
} |
|
345 |
} |
|
346 |
// |
|
347 |
// No se porque esto de abajo no funciona. |
|
348 |
// Nunca se lanza la excepcion en el get(Feature) de |
|
349 |
// DefaultFeatureAttributeEmulatorExpression. |
|
350 |
// |
|
351 |
// try { |
|
352 |
// emulator.setEnableExceptions(true); |
|
353 |
// descriptor.setFeatureAttributeEmulator(emulator); |
|
354 |
// this.pickerVirtualField.getPreviewSymbolTable().value(descriptor.getName()); |
|
355 |
// } catch(Throwable ex) { |
|
356 |
// emulator.setEnableExceptions(false); |
|
357 |
// descriptor.setFeatureAttributeEmulator(null); |
|
358 |
// ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
359 |
// dialogs.messageDialog( |
|
360 |
// i18n.getTranslation("_The_expression_of_virtual_field_is_not_valid")+ |
|
361 |
// "\n"+ |
|
362 |
// ex.getMessage(), |
|
363 |
// i18n.getTranslation("_Warning"), |
|
364 |
// JOptionPane.WARNING_MESSAGE |
|
365 |
// ); |
|
366 |
// return null; |
|
367 |
// } finally { |
|
368 |
// emulator.setEnableExceptions(false); |
|
369 |
// } |
|
318 | 370 |
} |
319 | 371 |
} |
320 |
descriptor.setDataProfileName( |
|
321 |
StringUtils.defaultIfBlank((String) this.cboDataProfile.getSelectedItem(),null) |
|
322 |
); |
|
323 | 372 |
} catch (Exception ex) { |
324 | 373 |
LOGGER.warn("Can't retrieve information from user form.",ex); |
325 | 374 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
Also available in: Unified diff