Revision 44263 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 | ||
---|---|---|
15 | 15 |
import java.util.Objects; |
16 | 16 |
import javax.swing.ComboBoxModel; |
17 | 17 |
import javax.swing.DefaultComboBoxModel; |
18 |
import javax.swing.ImageIcon; |
|
18 | 19 |
import javax.swing.JComboBox; |
19 | 20 |
import javax.swing.JLabel; |
20 | 21 |
import javax.swing.JScrollPane; |
... | ... | |
44 | 45 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
45 | 46 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
46 | 47 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
48 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
|
47 | 49 |
import org.gvsig.tools.util.LabeledValue; |
48 | 50 |
import org.gvsig.tools.util.LabeledValueImpl; |
49 | 51 |
import org.gvsig.tools.visitor.VisitCanceledException; |
... | ... | |
177 | 179 |
Search.STR_INT_LONG_LABEL_ORDER, |
178 | 180 |
20 |
179 | 181 |
); |
182 |
List<ImageIcon>icons = new ArrayList<>(); |
|
183 |
DataTypesManager dataTypeManager = ToolsLocator.getDataTypesManager(); |
|
184 |
IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
|
180 | 185 |
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
181 | 186 |
for (FeatureAttributeDescriptor attrdesc : orderedAttributes) { |
182 | 187 |
model.addElement(new FeatureAttribute(this.store, attrdesc)); |
188 |
String iconName = attrdesc.getDataType().getIconName(); |
|
189 |
if( iconTheme.exists(iconName) ) { |
|
190 |
icons.add(iconTheme.get(iconName)); |
|
191 |
} else { |
|
192 |
icons.add(null); |
|
193 |
} |
|
183 | 194 |
} |
184 |
|
|
195 |
this.ddnFields.setIcons(icons); |
|
185 | 196 |
this.ddnFields.setModel(model); |
186 | 197 |
this.ddnFields.addItemListener(new ItemListener() { |
187 | 198 |
@Override |
... | ... | |
215 | 226 |
|
216 | 227 |
private void doSelectExtraField() { |
217 | 228 |
FeatureType featureType = this.getFeatureType(); |
218 |
Search search = (Search) ToolsLocator.getComplementsManager().get( |
|
219 |
Search.COMPLEMENT_MANE, featureType |
|
220 |
); |
|
221 |
List<FeatureAttributeDescriptor> orderedAttributes = search.getOrderedAttributes( |
|
222 |
Search.BASIC_TYPES_FILTER, |
|
223 |
Search.LABEL_ORDER, |
|
224 |
-1 |
|
225 |
); |
|
226 | 229 |
AdvancedAttributeSelectionTreeModel treeModel = new AdvancedAttributeSelectionTreeModel( |
227 | 230 |
this.store, |
228 |
orderedAttributes
|
|
231 |
Search.BASIC_TYPES_FILTER
|
|
229 | 232 |
); |
230 | 233 |
final JTree tree = new JTree(); |
231 | 234 |
tree.setCellRenderer(new AdvancedAttributeSelectionTreeCellRenderer()); |
... | ... | |
285 | 288 |
} |
286 | 289 |
FeatureAttribute attribute = new FeatureAttribute(theStore, attrdesc, label, formula); |
287 | 290 |
model.addElement(attribute); |
291 |
IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
|
292 |
this.ddnFields.getIcons().add(iconTheme.get(attrdesc.getDataType().getIconName())); |
|
288 | 293 |
this.setAttribute(model.getSize() - 1); |
289 | 294 |
} |
290 | 295 |
|
... | ... | |
437 | 442 |
if (attribute == null) { |
438 | 443 |
return null; |
439 | 444 |
} |
440 |
attribute.getDescriptor().recentUsed(); |
|
445 |
if( this.getValue()!=null ) { |
|
446 |
attribute.getDescriptor().recentUsed(); |
|
447 |
} |
|
441 | 448 |
return attribute.getValue(); |
442 | 449 |
} |
443 | 450 |
|
Also available in: Unified diff