Class LayerVisibilityAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.gui.dialogs.layer.LayerVisibilityAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
,IEnabledStateUpdating
,Layer.LayerAction
public final class LayerVisibilityAction extends javax.swing.AbstractAction implements IEnabledStateUpdating, Layer.LayerAction
This is a menu that includes all settings for the layer visibility. It combines gamma/opacity sliders and the visible-checkbox.- Since:
- 10144
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
LayerVisibilityAction.AbstractFilterSlider
This is a slider for a filter value.private class
LayerVisibilityAction.ColorfulnessSlider
This slider allows you to change the colorfulness.private class
LayerVisibilityAction.ColorSelector
Allows to select the color of a layerprivate class
LayerVisibilityAction.GammaFilterSlider
This slider allows you to change the gamma value.(package private) class
LayerVisibilityAction.OpacitySlider
This slider allows you to change the opacity of a layer.private class
LayerVisibilityAction.SharpnessSlider
This slider allows you to change the sharpness.private class
LayerVisibilityAction.VisibilityCheckbox
protected static interface
LayerVisibilityAction.VisibilityMenuEntry
An entry in the visibility settings dropdown.
-
Field Summary
Fields Modifier and Type Field Description (package private) javax.swing.JPanel
content
The real content, just to add a borderprivate static double
DEFAULT_COLORFUL_FACTOR
private static double
DEFAULT_GAMMA_VALUE
private static double
DEFAULT_OPACITY
private static double
DEFAULT_SHARPNESS_FACTOR
private static java.lang.String
DIALOGS_LAYERLIST
private java.util.function.Supplier<java.util.Collection<ImageryFilterSettings>>
filterSettingsSupplier
private java.util.function.Supplier<java.util.Collection<Layer>>
layerSupplier
private static double
MAX_COLORFUL_FACTOR
private static double
MAX_SHARPNESS_FACTOR
private javax.swing.JPopupMenu
popup
private SideButton
sideButton
private static int
SLIDER_STEPS
private static int
SLIDER_WHEEL_INCREMENT
Steps the value is changed by a mouse wheel change (one full click)(package private) java.util.List<LayerVisibilityAction.VisibilityMenuEntry>
sliders
-
Constructor Summary
Constructors Constructor Description LayerVisibilityAction(java.util.function.Supplier<java.util.Collection<Layer>> layerSupplier, java.util.function.Supplier<java.util.Collection<ImageryFilterSettings>> filterSettingsSupplier)
Creates a newLayerVisibilityAction
LayerVisibilityAction(LayerListDialog.LayerListModel model)
Creates a newLayerVisibilityAction
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
private void
addContentEntry(LayerVisibilityAction.VisibilityMenuEntry slider)
java.awt.Component
createMenuComponent()
Creates and return the menu component.void
setCorrespondingSideButton(SideButton sideButton)
Sets the corresponding side button.(package private) void
setVisibleFlag(boolean visible)
boolean
supportLayers(java.util.List<Layer> layers)
Determines if this action supports a given list of layers.void
updateEnabledState()
Called after the layer model has changed.(package private) void
updateValues()
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
DIALOGS_LAYERLIST
private static final java.lang.String DIALOGS_LAYERLIST
- See Also:
- Constant Field Values
-
SLIDER_STEPS
private static final int SLIDER_STEPS
- See Also:
- Constant Field Values
-
SLIDER_WHEEL_INCREMENT
private static final int SLIDER_WHEEL_INCREMENT
Steps the value is changed by a mouse wheel change (one full click)- See Also:
- Constant Field Values
-
DEFAULT_OPACITY
private static final double DEFAULT_OPACITY
- See Also:
- Constant Field Values
-
DEFAULT_GAMMA_VALUE
private static final double DEFAULT_GAMMA_VALUE
- See Also:
- Constant Field Values
-
DEFAULT_SHARPNESS_FACTOR
private static final double DEFAULT_SHARPNESS_FACTOR
- See Also:
- Constant Field Values
-
MAX_SHARPNESS_FACTOR
private static final double MAX_SHARPNESS_FACTOR
- See Also:
- Constant Field Values
-
DEFAULT_COLORFUL_FACTOR
private static final double DEFAULT_COLORFUL_FACTOR
- See Also:
- Constant Field Values
-
MAX_COLORFUL_FACTOR
private static final double MAX_COLORFUL_FACTOR
- See Also:
- Constant Field Values
-
layerSupplier
private final java.util.function.Supplier<java.util.Collection<Layer>> layerSupplier
-
filterSettingsSupplier
private final java.util.function.Supplier<java.util.Collection<ImageryFilterSettings>> filterSettingsSupplier
-
popup
private final javax.swing.JPopupMenu popup
-
sideButton
private SideButton sideButton
-
content
final javax.swing.JPanel content
The real content, just to add a border
-
sliders
final java.util.List<LayerVisibilityAction.VisibilityMenuEntry> sliders
-
-
Constructor Detail
-
LayerVisibilityAction
public LayerVisibilityAction(LayerListDialog.LayerListModel model)
Creates a newLayerVisibilityAction
- Parameters:
model
- The list to get the selection from.
-
LayerVisibilityAction
public LayerVisibilityAction(java.util.function.Supplier<java.util.Collection<Layer>> layerSupplier, java.util.function.Supplier<java.util.Collection<ImageryFilterSettings>> filterSettingsSupplier)
Creates a newLayerVisibilityAction
- Parameters:
layerSupplier
- supplies the layers which should be affectedfilterSettingsSupplier
- supplies the filter settings which should be affecgted
-
-
Method Detail
-
addContentEntry
private void addContentEntry(LayerVisibilityAction.VisibilityMenuEntry slider)
-
setVisibleFlag
void setVisibleFlag(boolean visible)
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
updateValues
void updateValues()
-
supportLayers
public boolean supportLayers(java.util.List<Layer> layers)
Description copied from interface:Layer.LayerAction
Determines if this action supports a given list of layers.- Specified by:
supportLayers
in interfaceLayer.LayerAction
- Parameters:
layers
- list of layers- Returns:
true
if this action supports the given list of layers,false
otherwise
-
createMenuComponent
public java.awt.Component createMenuComponent()
Description copied from interface:Layer.LayerAction
Creates and return the menu component.- Specified by:
createMenuComponent
in interfaceLayer.LayerAction
- Returns:
- the menu component
-
updateEnabledState
public void updateEnabledState()
Description copied from interface:IEnabledStateUpdating
Called after the layer model has changed.- Specified by:
updateEnabledState
in interfaceIEnabledStateUpdating
-
setCorrespondingSideButton
public void setCorrespondingSideButton(SideButton sideButton)
Sets the corresponding side button.- Parameters:
sideButton
- the corresponding side button
-
-