- Timestamp:
- 2011-02-04T23:49:33+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r3848 r3854 5 5 import java.util.ArrayList; 6 6 import java.util.Collection; 7 import java.util. HashSet;7 import java.util.Collections; 8 8 import java.util.Iterator; 9 9 import java.util.List; 10 10 import java.util.Map.Entry; 11 import java.util.Set; 12 13 import org.openstreetmap.josm.Main; 11 14 12 import org.openstreetmap.josm.data.osm.Node; 15 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 19 17 import org.openstreetmap.josm.gui.NavigatableComponent; 20 18 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 21 import org.openstreetmap.josm.tools.FilteredCollection;22 19 import org.openstreetmap.josm.tools.Pair; 23 import org.openstreetmap.josm.tools.Predicate;24 20 import org.openstreetmap.josm.tools.Utils; 25 21 … … 44 40 45 41 public Collection<StyleSource> getStyleSources() { 46 return new FilteredCollection<StyleSource>(styleSources, new Predicate<StyleSource>() { 47 48 String name = Main.pref.get("mappaint.style", "standard"); 49 50 @Override 51 public boolean evaluate(StyleSource s) { 52 return Utils.equal(s.getPrefName(), name); 53 } 54 55 }); 56 } 57 58 public Collection<String> getStyleNames() { 59 Set<String> names = new HashSet<String>(); 60 names.add("standard"); 61 for (StyleSource s : styleSources) { 62 if (s.name != null) { 63 names.add(s.name); 64 } 65 } 66 return names; 42 return Collections.<StyleSource>unmodifiableCollection(styleSources); 67 43 } 68 44 -
trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java
r3848 r3854 28 28 private SourceEditor sources; 29 29 private JCheckBox enableIconDefault; 30 private JComboBox styleCombo = new JComboBox();31 30 32 31 public static class Factory implements PreferenceSettingFactory { … … 42 41 sources = new MapPaintSourceEditor(); 43 42 44 Collection<String> styles = new TreeSet<String>(MapPaintStyles.getStyles().getStyleNames());45 String defstyle = Main.pref.get("mappaint.style", "standard");46 styles.add(defstyle);47 for(String style : styles) {48 styleCombo.addItem(style);49 }50 51 styleCombo.setEditable(true);52 for (int i = 0; i < styleCombo.getItemCount(); ++i) {53 if (((String)styleCombo.getItemAt(i)).equals(defstyle)) {54 styleCombo.setSelectedIndex(i);55 break;56 }57 }58 59 43 final JPanel panel = new JPanel(new GridBagLayout()); 60 44 panel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 61 62 panel.add(new JLabel(tr("Used style")), GBC.std().insets(5,5,0,5));63 panel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL));64 panel.add(styleCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,0,5,0));65 45 66 46 panel.add(sources, GBC.eol().fill(GBC.BOTH)); … … 170 150 restart = true; 171 151 } 172 if(Main.pref.put("mappaint.style", styleCombo.getEditor().getItem().toString()) 173 && Main.isDisplayingMapView()) 152 if(Main.isDisplayingMapView()) 174 153 { 175 154 MapPaintStyles.getStyles().clearCached();
Note:
See TracChangeset
for help on using the changeset viewer.