Revision 43981 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/gui/CreateNewAttributePanel.java
CreateNewAttributePanel.java | ||
---|---|---|
47 | 47 |
import org.gvsig.andami.messages.NotificationManager; |
48 | 48 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
49 | 49 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
50 |
import org.gvsig.app.ApplicationLocator; |
|
51 |
import org.gvsig.app.ApplicationManager; |
|
50 | 52 |
import org.gvsig.fmap.dal.DataTypes; |
51 | 53 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
52 | 54 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
... | ... | |
56 | 58 |
import org.gvsig.i18n.Messages; |
57 | 59 |
import org.gvsig.tools.ToolsLocator; |
58 | 60 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
61 |
import org.gvsig.tools.i18n.I18nManager; |
|
59 | 62 |
|
60 | 63 |
/** |
61 | 64 |
* To create new FeatureAttributeDescriptor from the interface. |
... | ... | |
331 | 334 |
PluginServices.getText(this, "field_already_exists"), null); |
332 | 335 |
return null; |
333 | 336 |
} |
334 |
EditableFeatureAttributeDescriptor ead; |
|
337 |
EditableFeatureAttributeDescriptor ead = null;
|
|
335 | 338 |
if (getJRdbFieldVirtual().isSelected()) { |
336 | 339 |
String code = getJTxtExpression().getText(); |
337 |
FeatureAttributeDescriptor[] descriptors = |
|
338 |
featureType.getAttributeDescriptors(); |
|
339 |
String[] fields = new String[descriptors.length]; |
|
340 |
for (int i = 0; i < descriptors.length; i++) { |
|
341 |
FeatureAttributeDescriptor descriptor = descriptors[i]; |
|
342 |
fields[i] = descriptor.getName(); |
|
343 |
} |
|
344 |
FeatureAttributeEmulator myEmulated = |
|
340 |
EmulatedFieldExpression myEmulated = |
|
345 | 341 |
new EmulatedFieldExpression( |
346 |
fields,
|
|
342 |
featureType,
|
|
347 | 343 |
code); |
344 |
if (!myEmulated.isValid()) { |
|
345 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
346 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
347 |
int x = application.confirmDialog( |
|
348 |
"The expression used in this field is not valid."+ |
|
349 |
"\n\n"+ |
|
350 |
myEmulated.getErrorMessage()+ |
|
351 |
"\n\n"+ |
|
352 |
"Do you want add this field anyway?", |
|
353 |
"Add invalid field", |
|
354 |
JOptionPane.YES_NO_OPTION, |
|
355 |
JOptionPane.QUESTION_MESSAGE, |
|
356 |
"_AddingInvalidField.DoYouWantAddAnyway"); |
|
357 |
if (x==JOptionPane.YES_OPTION) { |
|
358 |
ead = featureType.add(nameAttr, typeAttr, myEmulated) |
|
359 |
.setSize(sizeAttr); |
|
360 |
} |
|
361 |
} else { |
|
348 | 362 |
ead = featureType.add(nameAttr, typeAttr, myEmulated) |
349 | 363 |
.setSize(sizeAttr); |
364 |
} |
|
350 | 365 |
} else { |
351 | 366 |
defaultValueAttr = getJTxtDefaultValue().getText(); |
352 | 367 |
if (defaultValueAttr.equals("")) { |
Also available in: Unified diff