Changeset 12831 in josm for trunk


Ignore:
Timestamp:
2017-09-12T19:35:55+02:00 (7 years ago)
Author:
bastiK
Message:

see #15229 - extract GUI from StyleSetting class

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r12651 r12831  
    6868import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
    6969import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference;
     70import org.openstreetmap.josm.gui.mappaint.StyleSettingGuiFactory;
    7071import org.openstreetmap.josm.gui.util.FileFilterAllFiles;
    7172import org.openstreetmap.josm.gui.util.GuiHelper;
     
    700701            } else {
    701702                for (StyleSetting s : style.settings) {
    702                     s.addMenuEntry(setMenu);
     703                    StyleSettingGuiFactory.getStyleSettingGui(s).addMenuEntry(setMenu);
    703704                }
    704705            }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSetting.java

    r12651 r12831  
    22package org.openstreetmap.josm.gui.mappaint;
    33
    4 import java.awt.event.ActionEvent;
    5 import java.util.Arrays;
    6 
    7 import javax.swing.AbstractAction;
    8 import javax.swing.Action;
    9 import javax.swing.JCheckBoxMenuItem;
    10 import javax.swing.JMenu;
    11 
    124import org.openstreetmap.josm.Main;
    13 import org.openstreetmap.josm.gui.MainApplication;
    14 import org.openstreetmap.josm.gui.mappaint.loader.MapPaintStyleLoader;
    155import org.openstreetmap.josm.tools.Logging;
    166
     
    3828
    3929    /**
    40      * Adds the menu entry for this style setting to the menu
    41      * @param menu The menu to add the setting to
    42      */
    43     void addMenuEntry(JMenu menu);
    44 
    45     /**
    4630     * gets the value for this setting
    4731     * @return The value the user selected
     
    6347            this.label = label;
    6448            this.def = def;
    65         }
    66 
    67         @Override
    68         public void addMenuEntry(JMenu menu) {
    69             final JCheckBoxMenuItem item = new JCheckBoxMenuItem();
    70             Action a = new AbstractAction(label) {
    71                 @Override
    72                 public void actionPerformed(ActionEvent e) {
    73                     setValue(item.isSelected());
    74                     MainApplication.worker.submit(new MapPaintStyleLoader(Arrays.asList(parentStyle)));
    75                 }
    76             };
    77             item.setAction(a);
    78             item.setSelected((boolean) getValue());
    79             menu.add(item);
    8049        }
    8150
Note: See TracChangeset for help on using the changeset viewer.