Class TLcdDeleteSelectionAction

All Implemented Interfaces:
ILcdAction, ILcdUndoableSource, ILcdPropertyChangeSource, ActionListener, Serializable, EventListener

public class TLcdDeleteSelectionAction extends ALcdObjectSelectionAction implements ILcdUndoableSource
An ILcdAction that deletes all objects that were selected in a ILcdLayer from their respective ILcdModel.

The ILcdView is updated after deletion of the objects.

Since:
2016.0
See Also:
  • Constructor Details

    • TLcdDeleteSelectionAction

      public TLcdDeleteSelectionAction(ILcdView aView)
      Creates a new selection action for the given view.
      Parameters:
      aView - the for which the selection can be deleted. Layers should be editable and their model should allow removal of elements.
      See Also:
  • Method Details

    • setStringTranslator

      public void setStringTranslator(ILcdStringTranslator aStringTranslator)

      Sets the ILcdStringTranslator that this action should use to translate the Strings that will be visible in the user interface.

      This method should be called before this action is used. Any Strings already created by this action will not be translated with the specified translator.

      The following list of Strings are translated by the given instance:

      • "Delete objects"
      • "Undo {0}". {0} will be replaced by the display name of the action that is to be undone. E.g. "Undo Delete objects".
      • "Redo {0}". {0} will be replaced by the display name of the action that is to be redone. E.g. "Redo Delete objects".
      The ILcdStringTranslator needs to be able to translate what is passed in {0}, but not the entire formatted String. For example, for "Undo {0}" it needs to be able to translate "Undo {0}" itself and "Delete objects", but not "Undo Delete objects".
      Parameters:
      aStringTranslator - The ILcdStringTranslator that should be used. Must not be null.
    • getStringTranslator

      public ILcdStringTranslator getStringTranslator()

      Returns the ILcdStringTranslator set on this action.

      Returns:
      The translator set on this action. Never null.
    • actionPerformed

      protected void actionPerformed(ActionEvent aActionEvent, List<TLcdDomainObjectContext> aSelection)
      Description copied from class: ALcdObjectSelectionAction
      Performs what the action should do. Only invoked when the selection is compliant with the restrictions imposed by the filter, min/max interval and the strict setting of the constructor.
      Specified by:
      actionPerformed in class ALcdObjectSelectionAction
      Parameters:
      aActionEvent - The action event.
      aSelection - The list with selected objects that were accepted by the filter. They are provided as TLcdDomainObjectContext instances, so that their layer and model is also available. Never contains null values. The size of the list is within the min/max interval specified in the constructor. When using the constructor that does not specify this interval, the list size is always 1.
    • remove

      protected void remove(List<TLcdDomainObjectContext> aSelection)
      Deselects the given objects and removes them from their model. This method is called when performing the action or when performing a redo-operation.
      Parameters:
      aSelection - the list of objects to be removed
    • undoRemove

      protected void undoRemove(List<TLcdDomainObjectContext> aSelection)
      Re-adds the given objects to their model and selects the newly added objects. This method is called when an undo-operation is performed.
      Parameters:
      aSelection - the list of objects to be removed