Package com.luciad.view
Class TLcdDeleteSelectionAction
java.lang.Object
com.luciad.gui.ALcdAction
com.luciad.view.ALcdObjectSelectionAction
com.luciad.view.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:
-
Field Summary
Fields inherited from class com.luciad.gui.ALcdAction
changeSupport
Fields inherited from interface com.luciad.gui.ILcdAction
DEFAULT, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, VISIBLE
-
Constructor Summary
ConstructorDescriptionCreates a new selection action for the given view. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
actionPerformed
(ActionEvent aActionEvent, List<TLcdDomainObjectContext> aSelection) Performs what the action should do.Returns theILcdStringTranslator
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 theILcdStringTranslator
that this action should use to translate theStrings
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.Methods inherited from class com.luciad.view.ALcdObjectSelectionAction
actionPerformed, addUndoableListener, fireUndoableHappened, getObjectFilter, getView, isAutoHide, removeUndoableListener, setAutoHide
Methods inherited from class com.luciad.gui.ALcdAction
addPropertyChangeListener, firePropertyChange, getDisplayName, getIcon, getLongDescription, getName, getShortDescription, getValue, isEnabled, isTraceOn, putValue, registerInstance, removePropertyChangeListener, setClassTraceOn, setDisplayName, setEnabled, setIcon, setLongDescription, setName, setShortDescription, setTraceOn
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.gui.ILcdUndoableSource
addUndoableListener, removeUndoableListener
-
Constructor Details
-
TLcdDeleteSelectionAction
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
Sets the
ILcdStringTranslator
that this action should use to translate theStrings
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".
ILcdStringTranslator
needs to be able to translate what is passed in{0}
, but not the entire formattedString
. 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
- TheILcdStringTranslator
that should be used. Must not benull
.
-
getStringTranslator
Returns the
ILcdStringTranslator
set on this action.- Returns:
- The translator set on this action. Never
null
.
-
actionPerformed
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 classALcdObjectSelectionAction
- Parameters:
aActionEvent
- The action event.aSelection
- The list with selected objects that were accepted by the filter. They are provided asTLcdDomainObjectContext
instances, so that their layer and model is also available. Never containsnull
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
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
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
-