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 classLayerVisibilityAction.AbstractFilterSliderThis is a slider for a filter value.private classLayerVisibilityAction.ColorfulnessSliderThis slider allows you to change the colorfulness.private classLayerVisibilityAction.ColorSelectorAllows to select the color of a layerprivate classLayerVisibilityAction.GammaFilterSliderThis slider allows you to change the gamma value.(package private) classLayerVisibilityAction.OpacitySliderThis slider allows you to change the opacity of a layer.private classLayerVisibilityAction.SharpnessSliderThis slider allows you to change the sharpness.private classLayerVisibilityAction.VisibilityCheckboxprotected static interfaceLayerVisibilityAction.VisibilityMenuEntryAn entry in the visibility settings dropdown.
-
Field Summary
Fields Modifier and Type Field Description (package private) javax.swing.JPanelcontentThe real content, just to add a borderprivate static doubleDEFAULT_COLORFUL_FACTORprivate static doubleDEFAULT_GAMMA_VALUEprivate static doubleDEFAULT_OPACITYprivate static doubleDEFAULT_SHARPNESS_FACTORprivate static java.lang.StringDIALOGS_LAYERLISTprivate java.util.function.Supplier<java.util.Collection<ImageryFilterSettings>>filterSettingsSupplierprivate java.util.function.Supplier<java.util.Collection<Layer>>layerSupplierprivate static doubleMAX_COLORFUL_FACTORprivate static doubleMAX_SHARPNESS_FACTORprivate javax.swing.JPopupMenupopupprivate SideButtonsideButtonprivate static intSLIDER_STEPSprivate static intSLIDER_WHEEL_INCREMENTSteps 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 newLayerVisibilityActionLayerVisibilityAction(LayerListDialog.LayerListModel model)Creates a newLayerVisibilityAction
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)private voidaddContentEntry(LayerVisibilityAction.VisibilityMenuEntry slider)java.awt.ComponentcreateMenuComponent()Creates and return the menu component.voidsetCorrespondingSideButton(SideButton sideButton)Sets the corresponding side button.(package private) voidsetVisibleFlag(boolean visible)booleansupportLayers(java.util.List<Layer> layers)Determines if this action supports a given list of layers.voidupdateEnabledState()Called after the layer model has changed.(package private) voidupdateValues()-
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:
actionPerformedin interfacejava.awt.event.ActionListener
-
updateValues
void updateValues()
-
supportLayers
public boolean supportLayers(java.util.List<Layer> layers)
Description copied from interface:Layer.LayerActionDetermines if this action supports a given list of layers.- Specified by:
supportLayersin interfaceLayer.LayerAction- Parameters:
layers- list of layers- Returns:
trueif this action supports the given list of layers,falseotherwise
-
createMenuComponent
public java.awt.Component createMenuComponent()
Description copied from interface:Layer.LayerActionCreates and return the menu component.- Specified by:
createMenuComponentin interfaceLayer.LayerAction- Returns:
- the menu component
-
updateEnabledState
public void updateEnabledState()
Description copied from interface:IEnabledStateUpdatingCalled after the layer model has changed.- Specified by:
updateEnabledStatein interfaceIEnabledStateUpdating
-
setCorrespondingSideButton
public void setCorrespondingSideButton(SideButton sideButton)
Sets the corresponding side button.- Parameters:
sideButton- the corresponding side button
-
-