Package org.openstreetmap.josm.actions
Class AbstractMergeAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.actions.JosmAction
-
- org.openstreetmap.josm.actions.AbstractMergeAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
,Destroyable
- Direct Known Subclasses:
MergeLayerAction
,MergeSelectionAction
public abstract class AbstractMergeAction extends JosmAction
Abstract superclass of different "Merge" actions.- Since:
- 1890
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractMergeAction.LayerListCellRenderer
the list cell renderer used to render layer list entriesstatic class
AbstractMergeAction.TargetLayerDialogResult<T extends Layer>
TargetLayerDialogResult
returned byaskTargetLayer(java.util.List<? extends org.openstreetmap.josm.gui.layer.Layer>, boolean, java.lang.String, boolean, java.lang.String)
containing the selectedTargetLayer and whether the checkbox is ticked-
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
-
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
sc
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMergeAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean register)
Constructs a newAbstractMergeAction
.protected
AbstractMergeAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean register, java.lang.String toolbar, boolean installAdapters)
Constructs a newAbstractMergeAction
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static AbstractMergeAction.TargetLayerDialogResult<Layer>
askTargetLayer(java.util.List<? extends Layer> targetLayers, boolean showCheckbox, java.lang.String checkbox, boolean checkboxDefault, java.lang.String buttonText)
Ask user to choose the target layer and shows a checkbox.static <T extends Layer>
TaskTargetLayer(T[] targetLayers, java.lang.String label, java.lang.String title, java.lang.String buttonText, java.lang.String buttonIcon)
Ask user to choose the target layer.static <T extends Layer>
AbstractMergeAction.TargetLayerDialogResult<T>askTargetLayer(T[] targetLayers, java.lang.String label, java.lang.String checkbox, java.lang.String title, java.lang.String buttonText, java.lang.String buttonIcon, boolean showCheckbox, boolean checkboxDefault)
Ask user to choose the target layer.protected void
warnNoTargetLayersForSourceLayer(Layer sourceLayer)
Warns user when there no layers the source layer could be merged to.-
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledState, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Constructor Detail
-
AbstractMergeAction
protected AbstractMergeAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean register)
Constructs a newAbstractMergeAction
.- Parameters:
name
- the action's text as displayed on the menu (if it is added to a menu)iconName
- the filename of the icon to usetooltip
- a longer description of the action that will be displayed in the tooltip. Please note that html is not supported for menu actions on some platforms.shortcut
- a ready-created shortcut object or null if you don't want a shortcut. But you always do want a shortcut, remember you can always register it with group=none, so you won't be assigned a shortcut unless the user configures one. If you pass null here, the user CANNOT configure a shortcut for your action.register
- register this action for the toolbar preferences?
-
AbstractMergeAction
protected AbstractMergeAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean register, java.lang.String toolbar, boolean installAdapters)
Constructs a newAbstractMergeAction
.- Parameters:
name
- the action's text as displayed on the menu (if it is added to a menu)iconName
- the filename of the icon to usetooltip
- a longer description of the action that will be displayed in the tooltip. Please note that html is not supported for menu actions on some platforms.shortcut
- a ready-created shortcut object or null if you don't want a shortcut. But you always do want a shortcut, remember you can always register it with group=none, so you won't be assigned a shortcut unless the user configures one. If you pass null here, the user CANNOT configure a shortcut for your action.register
- register this action for the toolbar preferences?toolbar
- identifier for the toolbar preferences. The iconName is used, if this parameter is nullinstallAdapters
- false, if you don't want to install layer changed and selection changed adapters
-
-
Method Detail
-
askTargetLayer
protected static AbstractMergeAction.TargetLayerDialogResult<Layer> askTargetLayer(java.util.List<? extends Layer> targetLayers, boolean showCheckbox, java.lang.String checkbox, boolean checkboxDefault, java.lang.String buttonText)
Ask user to choose the target layer and shows a checkbox.- Parameters:
targetLayers
- list of candidate target layers.showCheckbox
- whether the checkbox is showncheckbox
- The text of the checkbox shown to the user.checkboxDefault
- whether the checkbox is ticked by defaultbuttonText
- text of button used to select target layer- Returns:
- The
AbstractMergeAction.TargetLayerDialogResult
containing the chosen target layer and the state of the checkbox - Since:
- 15450
-
askTargetLayer
public static <T extends Layer> T askTargetLayer(T[] targetLayers, java.lang.String label, java.lang.String title, java.lang.String buttonText, java.lang.String buttonIcon)
Ask user to choose the target layer.- Type Parameters:
T
- type of layer- Parameters:
targetLayers
- array of proposed target layerslabel
- label displayed in dialogtitle
- title of dialogbuttonText
- text of button used to select target layerbuttonIcon
- icon name of button used to select target layer- Returns:
- chosen target layer
-
askTargetLayer
public static <T extends Layer> AbstractMergeAction.TargetLayerDialogResult<T> askTargetLayer(T[] targetLayers, java.lang.String label, java.lang.String checkbox, java.lang.String title, java.lang.String buttonText, java.lang.String buttonIcon, boolean showCheckbox, boolean checkboxDefault)
Ask user to choose the target layer. Can show a checkbox.- Type Parameters:
T
- type of layer- Parameters:
targetLayers
- array of proposed target layerslabel
- label displayed in dialogcheckbox
- text of the checkbox displayedtitle
- title of dialogbuttonText
- text of button used to select target layerbuttonIcon
- icon name of button used to select target layershowCheckbox
- whether the checkbox is showncheckboxDefault
- whether the checkbox is ticked by default- Returns:
- The
AbstractMergeAction.TargetLayerDialogResult
containing the chosen target layer and the state of the checkbox - Since:
- 14338
-
warnNoTargetLayersForSourceLayer
protected void warnNoTargetLayersForSourceLayer(Layer sourceLayer)
Warns user when there no layers the source layer could be merged to.- Parameters:
sourceLayer
- source layer
-
-