public class TLcdDeleteSelectionAction extends ALcdObjectSelectionAction implements ILcdUndoableSource
ILcdAction
that deletes all objects that were selected in a
ILcdLayer
from their respective ILcdModel
.
The ILcdView
is updated after deletion of the objects.changeSupport
DEFAULT, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, VISIBLE
Constructor and Description |
---|
TLcdDeleteSelectionAction(ILcdView aView)
Creates a new selection action for the given view.
|
Modifier and Type | Method and Description |
---|---|
protected void |
actionPerformed(ActionEvent aActionEvent,
List<TLcdDomainObjectContext> aSelection)
Performs what the action should do.
|
ILcdStringTranslator |
getStringTranslator()
Returns the
ILcdStringTranslator set on this action. |
protected void |
remove(List<TLcdDomainObjectContext> aSelection)
Deselects the given objects and removes them from their model.
|
void |
setStringTranslator(ILcdStringTranslator aStringTranslator)
Sets the
ILcdStringTranslator that this action should use to
translate the Strings that will be visible in the user interface. |
protected void |
undoRemove(List<TLcdDomainObjectContext> aSelection)
Re-adds the given objects to their model and selects the newly added objects.
|
actionPerformed, addUndoableListener, fireUndoableHappened, getObjectFilter, getView, isAutoHide, removeUndoableListener, setAutoHide
addPropertyChangeListener, firePropertyChange, getDisplayName, getIcon, getLongDescription, getName, getShortDescription, getValue, isEnabled, isTraceOn, putValue, registerInstance, removePropertyChangeListener, setClassTraceOn, setDisplayName, setEnabled, setIcon, setLongDescription, setName, setShortDescription, setTraceOn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addUndoableListener, removeUndoableListener
public TLcdDeleteSelectionAction(ILcdView aView)
aView
- the for which the selection can be deleted. Layers should be editable and their model should allow
removal of elements.ILcdLayer.isEditable()
,
ILcdModel.canRemoveElement(Object)
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:
{0}
will be replaced by the display name of the action that is to be undone. E.g. "Undo Delete objects".{0}
will be replaced by the display name of the action that is to be redone. E.g. "Redo Delete objects".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".aStringTranslator
- The ILcdStringTranslator
that should be used. Must not be null
.public ILcdStringTranslator getStringTranslator()
Returns the ILcdStringTranslator
set on this action.
null
.protected void actionPerformed(ActionEvent aActionEvent, List<TLcdDomainObjectContext> aSelection)
ALcdObjectSelectionAction
actionPerformed
in class ALcdObjectSelectionAction
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.protected void remove(List<TLcdDomainObjectContext> aSelection)
aSelection
- the list of objects to be removedprotected void undoRemove(List<TLcdDomainObjectContext> aSelection)
aSelection
- the list of objects to be removed