Revision 44351 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/searchpanel/SearchFieldController.java
SearchFieldController.java | ||
---|---|---|
35 | 35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
36 | 36 |
import org.gvsig.fmap.dal.feature.FeatureType; |
37 | 37 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.AdvancedAttributeSelectionTreeModel.Node; |
38 |
import static org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchPanel.getAttributeDescriptorLabel; |
|
38 | 39 |
import org.gvsig.tools.ToolsLocator; |
39 | 40 |
import org.gvsig.tools.dataTypes.CoercionException; |
40 | 41 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
... | ... | |
67 | 68 |
FeatureAttributeDescriptor attrdesc; |
68 | 69 |
private final FeatureStore store; |
69 | 70 |
private final int type; |
71 |
private final boolean showStoreName; |
|
70 | 72 |
|
71 | 73 |
public FeatureAttribute(FeatureStore store, FeatureAttributeDescriptor attrdesc, int type) { |
72 |
this(store, attrdesc, null, null, type);
|
|
74 |
this(store, attrdesc, null, type, false);
|
|
73 | 75 |
} |
74 | 76 |
|
75 | 77 |
public FeatureAttribute( |
76 | 78 |
FeatureStore store, |
77 | 79 |
FeatureAttributeDescriptor attrdesc, |
78 |
String label, |
|
79 | 80 |
String value, |
80 |
int type |
|
81 |
int type, |
|
82 |
boolean showStoreName |
|
81 | 83 |
) { |
82 | 84 |
super( |
83 |
ObjectUtils.defaultIfNull(label, attrdesc.getLocalizedLabel()),
|
|
85 |
getAttributeDescriptorLabel(attrdesc, store.getName()),
|
|
84 | 86 |
ObjectUtils.defaultIfNull(value, attrdesc.getName()) |
85 | 87 |
); |
86 | 88 |
this.store = store; |
87 | 89 |
this.attrdesc = attrdesc; |
88 | 90 |
this.type = type; |
91 |
this.showStoreName = showStoreName; |
|
89 | 92 |
} |
90 | 93 |
|
91 | 94 |
@Override |
92 | 95 |
public String getLabel() { |
93 |
String theLabel = super.getLabel();
|
|
96 |
String theLabel = getAttributeDescriptorLabel(attrdesc, showStoreName? store.getName():null);
|
|
94 | 97 |
switch(this.type) { |
95 | 98 |
case Search.OrderedAttribute.TYPE_REGURAL: |
96 | 99 |
break; |
... | ... | |
317 | 320 |
return; |
318 | 321 |
} |
319 | 322 |
} |
320 |
String formula = builder.function(DataManager.FUNCTION_FOREING_VALUE, list).toString();
|
|
321 |
String label = attrdesc.getLabel() + " [" + theStore.getName() + "]";
|
|
323 |
String formula; |
|
324 |
boolean showStoreName;
|
|
322 | 325 |
if (StringUtils.equalsIgnoreCase(storeFullName, this.store.getFullName())) { |
323 |
label = attrdesc.getLocalizedLabel(); |
|
324 | 326 |
formula = attrdesc.getName(); |
327 |
showStoreName = false; |
|
328 |
} else { |
|
329 |
formula = builder.function(DataManager.FUNCTION_FOREING_VALUE, list).toString(); |
|
330 |
showStoreName = true; |
|
325 | 331 |
} |
326 |
FeatureAttribute attribute = new FeatureAttribute(theStore, attrdesc, label, formula, Search.OrderedAttribute.TYPE_REGURAL);
|
|
332 |
FeatureAttribute attribute = new FeatureAttribute(theStore, attrdesc, formula, Search.OrderedAttribute.TYPE_REGURAL, showStoreName);
|
|
327 | 333 |
model.addElement(attribute); |
328 | 334 |
IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
329 | 335 |
this.ddnFields.getIcons().add(iconTheme.get(attrdesc.getDataType().getIconName())); |
... | ... | |
531 | 537 |
doUpdateValuesList(); |
532 | 538 |
} |
533 | 539 |
|
534 |
}; |
|
540 |
} |
Also available in: Unified diff