Revision 47403
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/DefaultFeatureAttributePanel.java | ||
---|---|---|
133 | 133 |
private String previousDefaultValue; |
134 | 134 |
private ToManyController toManyController; |
135 | 135 |
private JSplitPane splAttrTags; |
136 |
private FeatureType featureType; |
|
136 | 137 |
|
137 | 138 |
private static class ToOneController { |
138 | 139 |
|
... | ... | |
379 | 380 |
private AttributeDescriptorPickerController pickerMyField; |
380 | 381 |
private boolean editable; |
381 | 382 |
private boolean disableEvents; |
383 |
private FeatureType featureType; |
|
382 | 384 |
|
383 | 385 |
public ToManyController( |
384 | 386 |
JComboBox cboRelationType, |
... | ... | |
627 | 629 |
boolean prevDisableEvents = this.disableEvents; |
628 | 630 |
try { |
629 | 631 |
this.disableEvents = true; |
630 |
this.pickerMyField.setFeatureType(descriptor.getFeatureType());
|
|
632 |
this.pickerMyField.setFeatureType(getFeatureType(descriptor));
|
|
631 | 633 |
ListElement.setSelected(this.cboRelationType, descriptor.getRelationType()); |
632 | 634 |
FeatureAttributeEmulator attrEmulator = descriptor.getFeatureAttributeEmulator(); |
633 | 635 |
if (attrEmulator instanceof FeatureAttributeEmulatorExpression) { |
... | ... | |
653 | 655 |
} |
654 | 656 |
} |
655 | 657 |
|
658 |
public void setFeatureType(FeatureType featureType){ |
|
659 |
this.featureType = featureType; |
|
660 |
} |
|
661 |
|
|
662 |
private FeatureType getFeatureType(FeatureAttributeDescriptor descriptor) { |
|
663 |
if(descriptor == null || descriptor.getFeatureType() == null){ |
|
664 |
return this.featureType; |
|
665 |
} |
|
666 |
return descriptor.getFeatureType(); |
|
667 |
} |
|
668 |
|
|
656 | 669 |
public void fetch(EditableFeatureAttributeDescriptor descriptor) { |
657 | 670 |
if( descriptor == null ) { |
658 | 671 |
this.clean(); |
... | ... | |
1521 | 1534 |
} else { |
1522 | 1535 |
DataManager dataManager = DALLocator.getDataManager(); |
1523 | 1536 |
FeatureAttributeEmulatorExpression emulator = dataManager.createFeatureAttributeEmulatorExpression( |
1524 |
descriptor.getFeatureType(),
|
|
1537 |
getFeatureType(descriptor),
|
|
1525 | 1538 |
expression |
1526 | 1539 |
); |
1527 | 1540 |
if (!emulator.isValid()) { |
... | ... | |
1867 | 1880 |
} |
1868 | 1881 |
this.updateEditableStates(); |
1869 | 1882 |
} |
1883 |
|
|
1884 |
public void setFeatureType(FeatureType featureType){ |
|
1885 |
this.featureType = featureType; |
|
1886 |
this.toManyController.setFeatureType(featureType); |
|
1887 |
} |
|
1888 |
|
|
1889 |
private FeatureType getFeatureType(FeatureAttributeDescriptor descriptor) { |
|
1890 |
if(descriptor == null || descriptor.getFeatureType() == null){ |
|
1891 |
return this.featureType; |
|
1892 |
} |
|
1893 |
return descriptor.getFeatureType(); |
|
1894 |
} |
|
1870 | 1895 |
|
1871 | 1896 |
private DataType getDataType() { |
1872 | 1897 |
Integer fieldType = (Integer) ListElement.getSelected(this.cboFieldType); |
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/featurequery/DefaultFeatureQueryCalculatedColumnsPanel.java | ||
---|---|---|
3 | 3 |
import java.awt.Dimension; |
4 | 4 |
import java.awt.event.ActionEvent; |
5 | 5 |
import java.awt.event.ActionListener; |
6 |
import java.net.URL; |
|
7 | 6 |
import java.util.List; |
8 |
import java.util.logging.Level; |
|
9 | 7 |
import javax.swing.DefaultListModel; |
10 | 8 |
import javax.swing.DefaultListSelectionModel; |
11 | 9 |
import javax.swing.ImageIcon; |
... | ... | |
22 | 20 |
import javax.swing.event.DocumentListener; |
23 | 21 |
import javax.swing.event.ListSelectionEvent; |
24 | 22 |
import javax.swing.text.JTextComponent; |
25 |
import org.apache.commons.io.FilenameUtils; |
|
26 | 23 |
import org.apache.commons.lang.StringUtils; |
27 |
import org.gvsig.configurableactions.ConfigurableActionsMamager; |
|
28 | 24 |
import org.gvsig.expressionevaluator.Expression; |
29 | 25 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator; |
30 | 26 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager; |
... | ... | |
40 | 36 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
41 | 37 |
import org.gvsig.fmap.dal.swing.featurequery.FeatureQueryCalculatedColumnsPanel; |
42 | 38 |
import org.gvsig.fmap.dal.swing.featuretype.FeatureTypeAttributePanel; |
43 |
import org.gvsig.fmap.dal.swing.featuretype.FeatureTypePanel; |
|
44 | 39 |
import static org.gvsig.fmap.dal.swing.impl.DefaultDALSwingLibrary.LIBRARY_NAME; |
45 |
import org.gvsig.fmap.dal.swing.impl.expressionevaluator.FeatureStoreElementFactory; |
|
46 | 40 |
import org.gvsig.tools.ToolsLocator; |
47 | 41 |
import org.gvsig.tools.dataTypes.Coercion; |
48 | 42 |
import org.gvsig.tools.dataTypes.CoercionException; |
49 | 43 |
import org.gvsig.tools.dataTypes.DataType; |
50 | 44 |
import org.gvsig.tools.dataTypes.DataTypes; |
51 | 45 |
import org.gvsig.tools.i18n.I18nManager; |
52 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
53 | 46 |
import org.gvsig.tools.swing.api.ListElement; |
54 | 47 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
55 | 48 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
... | ... | |
60 | 53 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
61 | 54 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
62 | 55 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
63 |
import org.gvsig.tools.util.ToolsUtilLocator; |
|
64 | 56 |
import org.slf4j.Logger; |
65 | 57 |
import org.slf4j.LoggerFactory; |
66 | 58 |
|
... | ... | |
509 | 501 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
510 | 502 |
final FeatureTypeAttributePanel panel = DALSwingLocator.getSwingManager().createFeatureTypeAttributePanel(); |
511 | 503 |
panel.clean(); |
512 |
// panel.setNameAsNew(featureType);
|
|
504 |
panel.setFeatureType(featureType);
|
|
513 | 505 |
panel.put(actualEditableAttribute); |
514 | 506 |
panel.setMode(FeatureTypeAttributePanel.MODE_VIRTUAL_FIELD); |
515 | 507 |
final Dialog dialog = winManager.createDialog( |
... | ... | |
518 | 510 |
null, |
519 | 511 |
WindowManager_v2.BUTTONS_OK_CANCEL |
520 | 512 |
); |
521 |
dialog.addActionListener(new ActionListener() { |
|
522 |
@Override |
|
523 |
public void actionPerformed(ActionEvent e) { |
|
524 |
if (dialog.getAction() != WindowManager_v2.BUTTONS_OK) { |
|
525 |
return; |
|
513 |
dialog.addActionListener((ActionEvent e) -> { |
|
514 |
if (dialog.getAction() != WindowManager_v2.BUTTONS_OK) { |
|
515 |
return; |
|
516 |
} |
|
517 |
try { |
|
518 |
FeatureAttributeDescriptor prev = actualEditableAttribute.getCopy(); |
|
519 |
panel.fetch(actualEditableAttribute); |
|
520 |
columnController.put(actualEditableAttribute); |
|
521 |
if (!prev.equals(actualEditableAttribute)) { |
|
522 |
columnController.doHasChanges(); |
|
526 | 523 |
} |
527 |
try { |
|
528 |
FeatureAttributeDescriptor prev = actualEditableAttribute.getCopy(); |
|
529 |
panel.fetch(actualEditableAttribute); |
|
530 |
columnController.put(actualEditableAttribute); |
|
531 |
if (!prev.equals(actualEditableAttribute)) { |
|
532 |
columnController.doHasChanges(); |
|
533 |
} |
|
534 |
} catch (Exception ex) { |
|
535 |
LOGGER.warn("Problems updating feature descriptor.", ex); |
|
536 |
} |
|
524 |
} catch (Exception ex) { |
|
525 |
LOGGER.warn("Problems updating feature descriptor.", ex); |
|
537 | 526 |
} |
538 | 527 |
}); |
539 | 528 |
dialog.show(WindowManager.MODE.DIALOG); |
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/featuretype/FeatureTypeAttributePanel.java | ||
---|---|---|
19 | 19 |
public EditableFeatureAttributeDescriptor fetch(EditableFeatureAttributeDescriptor descriptor); |
20 | 20 |
|
21 | 21 |
public void put(FeatureAttributeDescriptor descriptor); |
22 |
|
|
23 |
public void setFeatureType(FeatureType featureType); |
|
22 | 24 |
|
23 | 25 |
public void clean(); |
24 | 26 |
|
Also available in: Unified diff