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/FeatureAttributeElement.java

View differences:

FeatureAttributeElement.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.HashMap;
6 5
import java.util.List;
7 6
import java.util.Map;
8 7
import java.util.Objects;
8
import javax.swing.SwingUtilities;
9 9
import org.apache.commons.lang3.StringUtils;
10 10
import org.gvsig.expressionevaluator.ExpressionBuilder;
11 11
import org.gvsig.expressionevaluator.ExpressionUtils;
......
19 19
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
20 20
import org.gvsig.fmap.dal.feature.FeatureSet;
21 21
import org.gvsig.fmap.dal.feature.FeatureStore;
22
import org.gvsig.fmap.dal.swing.impl.searchpanel.AdvancedAttributeSelectionTreeModel;
23 22
import org.gvsig.tools.ToolsLocator;
24 23
import org.gvsig.tools.exception.BaseException;
25 24
import org.gvsig.tools.i18n.I18nManager;
......
55 54
        this.store = store;
56 55
        this.attrdesc = attrdesc;
57 56
        this.hasMoreValues = false;
57

  
58
        IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent();
59
        String theIconName = attrdesc.getDataType().getIconName();
60
        IconTheme.Icon theIcon = iconTheme.getThemeIcon(theIconName);
61
        if( theIcon!=null && theIcon.getURL()!=null ) {
62
            this.icon = ToolsSwingLocator.getToolsSwingManager().createCompoundIcon(
63
                    SwingUtilities.HORIZONTAL, 
64
                    1, 
65
                    SwingUtilities.LEFT, 
66
                    SwingUtilities.TOP,
67
                    this.getIcon(),
68
                    theIcon.getImageIcon()
69
            );
70
        }
58 71
    }
59 72

  
60 73
    public Element getParent() {
......
172 185
    
173 186
    @Override
174 187
    public String getLabel() {
175
        IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent();
176
        String theIconName = attrdesc.getDataType().getIconName();
177
        IconTheme.Icon theIcon = iconTheme.getThemeIcon(theIconName);
178
        URL iconUrl = null;
179
        if( theIcon!=null && theIcon.getURL()!=null ) {
180
            iconUrl = theIcon.getURL();
181
        }
182 188
        if (getConfig().getPreferences().getShowLabelsOfElements()) {
183 189
            if (!StringUtils.equals(attrdesc.getName(), attrdesc.getLabel())) {
184
                if( iconUrl!=null ) {
185
                    return String.format(
186
                        "<html><img src=\"%s\">&nbsp;%s<br><font size=\"2\"><i>(%s)</i></font></html>", 
187
                        iconUrl.toString(),
188
                        attrdesc.getLabel(), 
189
                        attrdesc.getName()
190
                    );
191
                }
192 190
                return String.format(
193 191
                    "<html>%s<br><font size=\"2\"><i>(%s)</i></font></html>", 
194
                    attrdesc.getLabel(), 
192
                    attrdesc.getLocalizedLabel(), 
195 193
                    attrdesc.getName()
196 194
                );
197 195
            }
198
        }
199
        if( iconUrl!=null ) {
200 196
            return String.format(
201
                "<html><img src=\"%s\">&nbsp;%s</html>", 
202
                iconUrl.toString(),
203
                attrdesc.getName()
197
                "<html>%s</html>", 
198
                attrdesc.getLocalizedLabel()
204 199
            );
205 200
        }
206 201
        return String.format(
......
223 218
        html.append("<br>\n");
224 219
        html.append("<b>").append(i18n.getTranslation("_Source")).append("</b> ").append(this.store.getName()).append("<br>\n");
225 220
        html.append("<b>").append(i18n.getTranslation("_Name")).append("</b> ").append(this.getName()).append("<br>\n");
221
        html.append("<b>").append(i18n.getTranslation("_Label")).append("</b> ").append(this.attrdesc.getLocalizedLabel()).append("<br>\n");
226 222
        html.append("<b>").append(i18n.getTranslation("_Type")).append("</b> ").append(this.attrdesc.getDataTypeName()).append("<br>\n");
227 223
        if (!StringUtils.isBlank(this.attrdesc.getDescription())
228 224
                && StringUtils.equalsAnyIgnoreCase(this.getName(), this.attrdesc.getDescription())) {

Also available in: Unified diff