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

see #15229 - extract GUI from StyleSetting class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.