Changeset 6499 in josm
- Timestamp:
- 2013-12-19T20:56:03+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/PreferenceToggleAction.java
r5927 r6499 7 7 import org.openstreetmap.josm.data.Preferences; 8 8 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 9 import org.openstreetmap.josm.data.preferences.BooleanProperty; 10 import org.openstreetmap.josm.tools.CheckParameterUtil; 9 11 10 12 public class PreferenceToggleAction extends JosmAction implements PreferenceChangedListener { 11 13 12 private final JCheckBoxMenuItem checkbox; 13 private final String prefKey; 14 private final boolean prefDefault; 14 protected final JCheckBoxMenuItem checkbox; 15 protected final BooleanProperty property; 15 16 16 17 public PreferenceToggleAction(String name, String tooltip, String prefKey, boolean prefDefault) { 18 this(name, tooltip, new BooleanProperty(prefKey, prefDefault)); 19 } 20 21 public PreferenceToggleAction(String name, String tooltip, BooleanProperty property) { 17 22 super(name, null, tooltip, null, false); 18 putValue("toolbar", "toggle-" + prefKey);19 this.prefKey = prefKey;20 this.pr efDefault = prefDefault;23 CheckParameterUtil.ensureParameterNotNull(property, "property"); 24 putValue("toolbar", "toggle-" + property.getKey()); 25 this.property = property; 21 26 this.checkbox = new JCheckBoxMenuItem(this); 22 this.checkbox.setSelected( Main.pref.getBoolean(prefKey, prefDefault));27 this.checkbox.setSelected(property.get()); 23 28 Main.pref.addPreferenceChangeListener(this); 24 29 } … … 26 31 @Override 27 32 public void actionPerformed(ActionEvent e) { 28 Main.pref.put(prefKey,checkbox.isSelected());33 property.put(checkbox.isSelected()); 29 34 } 30 35 … … 35 40 @Override 36 41 public void preferenceChanged(Preferences.PreferenceChangeEvent e) { 37 if (pr efKey.equals(e.getKey())) {38 checkbox.setSelected( Main.pref.getBoolean(prefKey, prefDefault));42 if (property.getKey().equals(e.getKey())) { 43 checkbox.setSelected(property.get()); 39 44 } 40 45 } -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r6426 r6499 47 47 import org.openstreetmap.josm.actions.FullscreenToggleAction; 48 48 import org.openstreetmap.josm.actions.GpxExportAction; 49 import org.openstreetmap.josm.actions.HatchAreaOutsideDownloadAction; 49 50 import org.openstreetmap.josm.actions.HelpAction; 50 51 import org.openstreetmap.josm.actions.HistoryInfoAction; … … 199 200 /** View -> Wireframe View */ 200 201 public final WireframeToggleAction wireFrameToggleAction = new WireframeToggleAction(); 202 public final HatchAreaOutsideDownloadAction hatchAreaOutsideDownloadAction = new HatchAreaOutsideDownloadAction(); 201 203 public final JosmAction toggleGPXLines = new ToggleGPXLinesAction(); 202 204 /** View -> Advanced info */ … … 643 645 wireframe.setAccelerator(wireFrameToggleAction.getShortcut().getKeyStroke()); 644 646 wireFrameToggleAction.addButtonModel(wireframe.getModel()); 647 final JCheckBoxMenuItem hatchAreaOutsideDownloadMenuItem = hatchAreaOutsideDownloadAction.getCheckbox(); 648 viewMenu.add(hatchAreaOutsideDownloadMenuItem); 649 ExpertToggleAction.addVisibilitySwitcher(hatchAreaOutsideDownloadMenuItem); 645 650 646 651 viewMenu.add(new MapPaintMenu()); -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r6436 r6499 41 41 import org.openstreetmap.josm.Main; 42 42 import org.openstreetmap.josm.actions.ExpertToggleAction; 43 import org.openstreetmap.josm.actions.HatchAreaOutsideDownloadAction; 43 44 import org.openstreetmap.josm.actions.RenameLayerAction; 44 45 import org.openstreetmap.josm.actions.SaveActionBase; … … 317 318 318 319 // paint remainder 319 g.setPaint(hatched); 320 g.fill(a); 320 if (HatchAreaOutsideDownloadAction.isHatchEnabled()) { 321 g.setPaint(hatched); 322 g.fill(a); 323 } 321 324 } 322 325
Note:
See TracChangeset
for help on using the changeset viewer.