Class AbstractMergeAction

All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action, Destroyable
Direct Known Subclasses:
MergeLayerAction, MergeSelectionAction

public abstract class AbstractMergeAction extends JosmAction
Abstract superclass of different "Merge" actions.
Since:
1890
See Also:
  • Constructor Details

    • AbstractMergeAction

      protected AbstractMergeAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register)
      Constructs a new AbstractMergeAction.
      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 use
      tooltip - 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 new AbstractMergeAction.
      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 use
      tooltip - 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 null
      installAdapters - 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 shown
      checkbox - The text of the checkbox shown to the user.
      checkboxDefault - whether the checkbox is ticked by default
      buttonText - 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, 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 layers
      label - label displayed in dialog
      title - title of dialog
      buttonText - text of button used to select target layer
      buttonIcon - 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 layers
      label - label displayed in dialog
      checkbox - text of the checkbox displayed
      title - title of dialog
      buttonText - text of button used to select target layer
      buttonIcon - icon name of button used to select target layer
      showCheckbox - whether the checkbox is shown
      checkboxDefault - 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