Revision 44338 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/expressionevaluator/DefaultFeatureStoreElement2.java
DefaultFeatureStoreElement2.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.swing.impl.expressionevaluator; |
2 | 2 |
|
3 |
import java.net.URL; |
|
4 | 3 |
import java.util.ArrayList; |
5 | 4 |
import java.util.Collection; |
6 | 5 |
import java.util.Iterator; |
... | ... | |
22 | 21 |
import org.gvsig.fmap.dal.swing.expressionevaluator.FeatureStoreElement; |
23 | 22 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.AdvancedAttributeSelectionTreeModel; |
24 | 23 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.AdvancedAttributeSelectionTreeModel.Node; |
25 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
26 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
|
27 | 24 |
|
28 | 25 |
/** |
29 | 26 |
* |
... | ... | |
55 | 52 |
public String getLabel() { |
56 | 53 |
FeatureAttributeDescriptor attribute = this.node.getValue(); |
57 | 54 |
if( attribute!=null && attribute.isForeingKey() ) { |
58 |
IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
|
59 |
String theIconName = attribute.getDataType().getIconName(); |
|
60 |
IconTheme.Icon theIcon = iconTheme.getThemeIcon(theIconName); |
|
61 |
URL iconUrl = null; |
|
62 |
if( theIcon!=null && theIcon.getURL()!=null ) { |
|
63 |
iconUrl = theIcon.getURL(); |
|
64 |
} |
|
65 | 55 |
ForeingKey foreingKey = attribute.getForeingKey(); |
66 | 56 |
if (getConfig().getPreferences().getShowLabelsOfElements()) { |
67 | 57 |
if (!StringUtils.equals(attrdesc.getName(), attrdesc.getLabel())) { |
68 |
if( iconUrl!=null ) { |
|
69 |
return String.format( |
|
70 |
"<html><img src=\"%s\"/> %s [%s]<br><font size=\"2\"><i>(%s)</i></font></html>", |
|
71 |
iconUrl.toString(), |
|
72 |
attribute.getLabel(), |
|
73 |
attribute.getName(), |
|
74 |
foreingKey.getTableName() |
|
75 |
); |
|
76 |
} |
|
77 | 58 |
return String.format( |
78 |
"<html>%s [%s]<br><font size=\"2\"><i>(%s)</i></font></html>",
|
|
79 |
attribute.getLabel(),
|
|
80 |
attribute.getName(),
|
|
59 |
"<html>%s<br><font size=\"2\"><i>(%s[%s])</i></font></html>",
|
|
60 |
attrdesc.getLocalizedLabel(),
|
|
61 |
attrdesc.getName(),
|
|
81 | 62 |
foreingKey.getTableName() |
82 | 63 |
); |
83 | 64 |
} |
84 |
} |
|
85 |
if( iconUrl!=null ) { |
|
86 | 65 |
return String.format( |
87 |
"<html><img src=\"%s\"/> %s [%s]</html>", |
|
88 |
theIcon.getURL().toString(), |
|
89 |
attribute.getLabel(), |
|
90 |
foreingKey.getTableName() |
|
66 |
"<html>%s<br><font size=\"2\"><i>([%s])</i></font></html>", |
|
67 |
attrdesc.getLocalizedLabel(), |
|
68 |
foreingKey.getTableName() |
|
91 | 69 |
); |
92 | 70 |
} |
93 | 71 |
return String.format( |
94 |
"<html>%s [%s]</html>",
|
|
95 |
attribute.getLabel(),
|
|
96 |
foreingKey.getTableName()
|
|
72 |
"<html>%s<br><font size=\"2\"><i>([%s])</i></font></html>",
|
|
73 |
attrdesc.getName(),
|
|
74 |
foreingKey.getTableName() |
|
97 | 75 |
); |
98 | 76 |
} |
99 | 77 |
return super.getLabel(); |
Also available in: Unified diff