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:
ActionListener,Serializable,Cloneable,EventListener,Action,Destroyable
- Direct Known Subclasses:
MergeLayerAction,MergeSelectionAction
Abstract superclass of different "Merge" actions.
- Since:
- 1890
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classthe list cell renderer used to render layer list entriesstatic classTargetLayerDialogResultreturned 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 tickedNested 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
scFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMergeAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register) Constructs a newAbstractMergeAction.protectedAbstractMergeAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, String toolbar, boolean installAdapters) Constructs a newAbstractMergeAction. -
Method Summary
Modifier and TypeMethodDescriptionprotected static AbstractMergeAction.TargetLayerDialogResult<Layer>askTargetLayer(List<? extends Layer> targetLayers, boolean showCheckbox, String checkbox, boolean checkboxDefault, String buttonText) Ask user to choose the target layer and shows a checkbox.static <T extends Layer>
TaskTargetLayer(T[] targetLayers, String label, String title, String buttonText, String buttonIcon) Ask user to choose the target layer.static <T extends Layer>
AbstractMergeAction.TargetLayerDialogResult<T>askTargetLayer(T[] targetLayers, String label, String checkbox, String title, String buttonText, String buttonIcon, boolean showCheckbox, boolean checkboxDefault) Ask user to choose the target layer.protected voidwarnNoTargetLayersForSourceLayer(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, waitFutureMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.awt.event.ActionListener
actionPerformed
-
Constructor Details
-
AbstractMergeAction
protected AbstractMergeAction(String name, String iconName, 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(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, 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 Details
-
askTargetLayer
protected static AbstractMergeAction.TargetLayerDialogResult<Layer> askTargetLayer(List<? extends Layer> targetLayers, boolean showCheckbox, String checkbox, boolean checkboxDefault, 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.TargetLayerDialogResultcontaining the chosen target layer and the state of the checkbox - Since:
- 15450
-
askTargetLayer
public static <T extends Layer> T askTargetLayer(T[] targetLayers, String label, String title, String buttonText, 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, String label, String checkbox, String title, String buttonText, 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.TargetLayerDialogResultcontaining the chosen target layer and the state of the checkbox - Since:
- 14338
-
warnNoTargetLayersForSourceLayer
Warns user when there no layers the source layer could be merged to.- Parameters:
sourceLayer- source layer
-