ALcdObjectSelectionAction
instead.@Deprecated public abstract class ALcyObjectSelectionAction<S extends ILcdView & ILcdTreeLayered> extends ALcdAction implements ILcdUndoableSource
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.
changeSupport
DEFAULT, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, VISIBLE
Constructor and Description |
---|
ALcyObjectSelectionAction(S aView,
ILcdFilter<TLcyDomainObjectContext> aObjectFilter)
Deprecated.
Constructs a new
ALcyLspObjectSelectionAction . |
ALcyObjectSelectionAction(S aView,
ILcdFilter<TLcyDomainObjectContext> aObjectFilter,
int aMinObjectCount,
int aMaxObjectCount,
boolean aStrict)
Deprecated.
Constructs a new
ALcyLspObjectSelectionAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
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 void |
fireUndoableHappened(ILcdUndoable aUndoable)
Deprecated.
Fires the given
ILcdUndoable to all associated ILcdUndoableListener s. |
S |
getView()
Deprecated.
Returns the view as it was provided to the constructor.
|
boolean |
isAutoHide()
Deprecated.
Returns the auto hide property, see
setAutoHide(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.
|
addPropertyChangeListener, firePropertyChange, getDisplayName, getIcon, getLongDescription, getName, getShortDescription, getValue, isEnabled, isTraceOn, putValue, registerInstance, removePropertyChangeListener, setClassTraceOn, setDisplayName, setEnabled, setIcon, setLongDescription, setName, setShortDescription, setTraceOn
public ALcyObjectSelectionAction(S aView, ILcdFilter<TLcyDomainObjectContext> aObjectFilter)
ALcyLspObjectSelectionAction
. 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.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 never null
.public ALcyObjectSelectionAction(S aView, ILcdFilter<TLcyDomainObjectContext> aObjectFilter, int aMinObjectCount, int aMaxObjectCount, boolean aStrict)
ALcyLspObjectSelectionAction
. 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.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 never null
.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 for
Integer.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. When false
,
the action simply ignores the objects that weren't accepted by the
filter.public S getView()
public void addUndoableListener(ILcdUndoableListener aUndoableListener)
ILcdUndoableSource
addUndoableListener
in interface ILcdUndoableSource
aUndoableListener
- The listener to be notified when something undoable has happened.public void removeUndoableListener(ILcdUndoableListener aUndoableListener)
ILcdUndoableSource
removeUndoableListener
in interface ILcdUndoableSource
aUndoableListener
- The listener to remove.protected final void fireUndoableHappened(ILcdUndoable aUndoable)
ILcdUndoable
to all associated ILcdUndoableListener
s.
Extensions of this class should use this method if they want to support undo/redo.aUndoable
- The ILcdUndoable
to fire. All registered
ILcdUndoableListener
instances will be notified of this
undoable.public boolean isAutoHide()
setAutoHide(boolean)
.public void setAutoHide(boolean aAutoHide)
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 to false
, it is up to the container of this action to effectively hide it from
the UI. This shouldn't be an issue as all provided ILcyActionBar
implementations do so.
aAutoHide
- True
to automatically hide the action when it is disabled, false
to avoid that the action changes its visibility.public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
protected abstract void actionPerformed(ActionEvent aActionEvent, List<TLcyDomainObjectContext> aSelection)
aActionEvent
- The action event.aSelection
- The list with selected objects that were accepted by the filter. They are
provided as TLcyDomainObjectContext
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.