Class ALcyObjectSelectionAction<S extends ILcdView & ILcdTreeLayered>
- All Implemented Interfaces:
ILcdAction
,ILcdUndoableSource
,ILcdPropertyChangeSource
,ActionListener
,Serializable
,EventListener
Action that works on the current map selection. It is typically used as an action in a right click menu.
Extensions can provide a filter that decides on which objects to work. The action disables
itself when no suitable objects are selected. Depending on isAutoHide()
, the action also
makes itself invisible when not applicable (useful for pop-up menus, enabled by default).
Optionally, implementations can support undo/redo by invoking fireUndoableHappened(com.luciad.gui.ILcdUndoable)
when they change state.
- Since:
- 2012.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
ConstructorDescriptionALcyObjectSelectionAction
(S aView, ILcdFilter<TLcyDomainObjectContext> aObjectFilter) Deprecated.Constructs a newALcyLspObjectSelectionAction
.ALcyObjectSelectionAction
(S aView, ILcdFilter<TLcyDomainObjectContext> aObjectFilter, int aMinObjectCount, int aMaxObjectCount, boolean aStrict) Deprecated.Constructs a newALcyLspObjectSelectionAction
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.protected abstract void
actionPerformed
(ActionEvent aActionEvent, List<TLcyDomainObjectContext> aSelection) Deprecated.Performs what the action should do.void
addUndoableListener
(ILcdUndoableListener aUndoableListener) Deprecated.Adds a listener to this source, so this listener is notified when something undoable has happened.protected final void
fireUndoableHappened
(ILcdUndoable aUndoable) Deprecated.Fires the givenILcdUndoable
to all associatedILcdUndoableListener
s.getView()
Deprecated.Returns the view as it was provided to the constructor.boolean
Deprecated.Returns the auto hide property, seesetAutoHide(boolean)
.void
removeUndoableListener
(ILcdUndoableListener aUndoableListener) Deprecated.Removes the specified listener so it is no longer notified.void
setAutoHide
(boolean aAutoHide) Deprecated.Sets if the action should hide itself when it is disabled.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
-
Constructor Details
-
ALcyObjectSelectionAction
Deprecated.Constructs a newALcyLspObjectSelectionAction
. It takes a filter to decide which objects should be taken into account. The action is enabled when exactly one object is selected and when that object is accepted by the filter, disabled otherwise.- Parameters:
aView
- The view to work on.aObjectFilter
- Sets the object filter. The filter is used to detect if the objects of the map selection are recognized (accepted) by this action. The object given to the filter is nevernull
.
-
ALcyObjectSelectionAction
public ALcyObjectSelectionAction(S aView, ILcdFilter<TLcyDomainObjectContext> aObjectFilter, int aMinObjectCount, int aMaxObjectCount, boolean aStrict) Deprecated.Constructs a newALcyLspObjectSelectionAction
. It takes a filter to decide which objects should be taken into account. The action is enabled if the number of objects that are accepted by the filter is in the given min/max interval, disabled otherwise.- Parameters:
aView
- The view to work on.aObjectFilter
- Sets the object filter. The filter is used to detect if the objects of the map selection are recognized (accepted) by this action. If all objects of the map selection are recognized, the action is enabled. The given object is nevernull
.aMinObjectCount
- Defines the minimum number of objects that should pass the filter for the action to be enabled.aMaxObjectCount
- Defines the maximum number of objects that should pass the filter for the action to be enabled. You can use-1
as a short cut forInteger.MAX_VALUE
, to leave the maximum unbounded.aStrict
-True
means the action disables itself when one or more objects that are selected, were not accepted by the filter. Whenfalse
, the action simply ignores the objects that weren't accepted by the filter.
-
-
Method Details
-
getView
Deprecated.Returns the view as it was provided to the constructor.- Returns:
- the view as it was provided to the constructor.
-
addUndoableListener
Deprecated.Description copied from interface:ILcdUndoableSource
Adds a listener to this source, so this listener is notified when something undoable has happened.- Specified by:
addUndoableListener
in interfaceILcdUndoableSource
- Parameters:
aUndoableListener
- The listener to be notified when something undoable has happened.
-
removeUndoableListener
Deprecated.Description copied from interface:ILcdUndoableSource
Removes the specified listener so it is no longer notified.- Specified by:
removeUndoableListener
in interfaceILcdUndoableSource
- Parameters:
aUndoableListener
- The listener to remove.
-
fireUndoableHappened
Deprecated.Fires the givenILcdUndoable
to all associatedILcdUndoableListener
s. Extensions of this class should use this method if they want to support undo/redo.- Parameters:
aUndoable
- TheILcdUndoable
to fire. All registeredILcdUndoableListener
instances will be notified of this undoable.
-
isAutoHide
public boolean isAutoHide()Deprecated.Returns the auto hide property, seesetAutoHide(boolean)
.- Returns:
- the auto hide property.
-
setAutoHide
public void setAutoHide(boolean aAutoHide) Deprecated.Sets if the action should hide itself when it is disabled. This is convenient when used in a context menu.
Hiding means the
ILcdAction.VISIBLE
key is changed tofalse
, it is up to the container of this action to effectively hide it from the UI. This shouldn't be an issue as all providedILcyActionBar
implementations do so.- Parameters:
aAutoHide
-True
to automatically hide the action when it is disabled,false
to avoid that the action changes its visibility.
-
actionPerformed
Deprecated.- Specified by:
actionPerformed
in interfaceActionListener
-
actionPerformed
protected abstract void actionPerformed(ActionEvent aActionEvent, List<TLcyDomainObjectContext> aSelection) Deprecated.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.- Parameters:
aActionEvent
- The action event.aSelection
- The list with selected objects that were accepted by the filter. They are provided asTLcyDomainObjectContext
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.
-
ALcdObjectSelectionAction
instead.