Package com.luciad.util
Class TLcdSelectionSupport<T>
java.lang.Object
com.luciad.util.TLcdSelectionSupport<T>
- All Implemented Interfaces:
ILcdSelection<T>
This class provides support for implementing ILcdSelection. Classes can extend it,
or they can create an instance of it and delegate methods to the instance.
A TLcdSelectionSupport maintains a selection of objects. It can send out
TLcdSelectionChangedEvent objects to a list of ILcdSelectionListener objects
whenever the selection is changed.
- See Also:
-
Constructor Summary
ConstructorDescriptionTLcdSelectionSupport
(ILcdSelection<T> aSelection) Creates a new TLcdSelectionSupport for the given ILcdSelection. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSelectionListener
(ILcdSelectionListener<T> aSelectionListener) Adds the given listener to the list of objects that will be notified by any selection changed passed infireSelectionEvent(TLcdSelectionChangedEvent)
.void
clearSelection
(int aDispatchEventMode) Clears the selection.void
Fires aTLcdSelectionChangedEvent
that contains all the collected selection changes.protected void
fireSelectionEvent
(TLcdSelectionChangedEvent<T> aSelectionEvent) Fires aTLcdSelectionChangedEvent
to all the registered listeners.int
Returns the number of objects in this selection.boolean
isSelected
(Object aObject) Checks whether the givenObject
is currently in the set of selected objects.boolean
Deprecated.This method has been deprecated.void
log()
void
removeSelectionListener
(ILcdSelectionListener<T> aSelectionListener) Removes anILcdSelectionListener
from thisILcdSelection
.Returns the objects in this selection.void
selectObject
(T aObject, boolean aSelection, int aDispatchEventMode) Adds/removes the given Object to/from the selection.void
selectObjects
(Collection<? extends T> aObjects, boolean aSelection, int aDispatchEventMode) Adds/removes the given Objects to/from the selection.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.util.ILcdSelection
getSelectedObjects
-
Constructor Details
-
TLcdSelectionSupport
Creates a new TLcdSelectionSupport for the given ILcdSelection. The selection must not be null.- Parameters:
aSelection
- the ILcdSelection that will be specified in any TLcdSelectionChangedEvent objects that are sent out.- Throws:
NullPointerException
- when the selection passed is null.
-
-
Method Details
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istrue
then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn
- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn
- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
getSelectionCount
public int getSelectionCount()Description copied from interface:ILcdSelection
Returns the number of objects in this selection.- Specified by:
getSelectionCount
in interfaceILcdSelection<T>
- Returns:
- the number of objects in this
ILcdSelection
.
-
selectedObjects
Description copied from interface:ILcdSelection
Returns the objects in this selection.- Specified by:
selectedObjects
in interfaceILcdSelection<T>
- Returns:
- the objects currently in this
ILcdSelection
.
-
isSelected
Checks whether the givenObject
is currently in the set of selected objects.- Specified by:
isSelected
in interfaceILcdSelection<T>
- Parameters:
aObject
- theObject
to be checked.- Returns:
true
if theObject
is in thisILcdSelection
, as determined by the equals method;false
otherwise.
-
addSelectionListener
Adds the given listener to the list of objects that will be notified by any selection changed passed infireSelectionEvent(TLcdSelectionChangedEvent)
. The listener must not be null.- Specified by:
addSelectionListener
in interfaceILcdSelection<T>
- Parameters:
aSelectionListener
- the object that will be notified of any changes to the selection set.- Throws:
NullPointerException
- when null is passed as a listener.
-
removeSelectionListener
Description copied from interface:ILcdSelection
Removes anILcdSelectionListener
from thisILcdSelection
.- Specified by:
removeSelectionListener
in interfaceILcdSelection<T>
- Parameters:
aSelectionListener
- theILcdSelectionListener
to be removed.
-
selectObject
Adds/removes the given Object to/from the selection.- Parameters:
aObject
- the Object to be added or removed.aSelection
- true if the given Object has to be added, false if it has to be removed.aDispatchEventMode
- the mode for sending out the event: ILcdFireEventMode.NO_EVENT, ILcdFireEventMode.FIRE_NOW, or ILcdFireEventMode.FIRE_LATER.- See Also:
-
selectObjects
public void selectObjects(Collection<? extends T> aObjects, boolean aSelection, int aDispatchEventMode) Adds/removes the given Objects to/from the selection.- Parameters:
aObjects
- the Objects to be added or removed. There must not be any duplicate objects in this list, nor should it benull
.aSelection
-true
if the given Objects have to be added to the selection,false
if they have to be removed.aDispatchEventMode
- the mode for sending out the event:ILcdFireEventMode.NO_EVENT
,ILcdFireEventMode.FIRE_NOW
, orILcdFireEventMode.FIRE_LATER
.- See Also:
-
clearSelection
public void clearSelection(int aDispatchEventMode) Clears the selection.- Parameters:
aDispatchEventMode
- the mode for sending out the event:ILcdFireEventMode.NO_EVENT
,ILcdFireEventMode.FIRE_NOW
, orILcdFireEventMode.FIRE_LATER
.- See Also:
-
fireSelectionEvent
Fires aTLcdSelectionChangedEvent
to all the registered listeners.- Parameters:
aSelectionEvent
- the event to be sent out.
-
fireCollectedSelectionChanges
public void fireCollectedSelectionChanges()Fires aTLcdSelectionChangedEvent
that contains all the collected selection changes. -
log
public void log()
-