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
ConstructorsConstructorDescriptionTLcdSelectionSupport(ILcdSelection<T> aSelection) Creates a new TLcdSelectionSupport for the given ILcdSelection. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSelectionListener(ILcdSelectionListener<T> aSelectionListener) Adds the given listener to the list of objects that will be notified by any selection changed passed infireSelectionEvent(TLcdSelectionChangedEvent).voidclearSelection(int aDispatchEventMode) Clears the selection.voidFires aTLcdSelectionChangedEventthat contains all the collected selection changes.protected voidfireSelectionEvent(TLcdSelectionChangedEvent<T> aSelectionEvent) Fires aTLcdSelectionChangedEventto all the registered listeners.intReturns the number of objects in this selection.booleanisSelected(Object aObject) Checks whether the givenObjectis currently in the set of selected objects.booleanDeprecated.This method has been deprecated.voidlog()voidremoveSelectionListener(ILcdSelectionListener<T> aSelectionListener) Removes anILcdSelectionListenerfrom thisILcdSelection.Returns the objects in this selection.voidselectObject(T aObject, boolean aSelection, int aDispatchEventMode) Adds/removes the given Object to/from the selection.voidselectObjects(Collection<? extends T> aObjects, boolean aSelection, int aDispatchEventMode) Adds/removes the given Objects to/from the selection.static voidsetClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated.voidsetTraceOn(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, waitMethods 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 istruethen 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 eithertrueorfalseas argument automatically turns off tracing for all other class instances for whichsetTraceOnhas not been called. If the argument isfalsethen 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.Returnstrueif 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:ILcdSelectionReturns the number of objects in this selection.- Specified by:
getSelectionCountin interfaceILcdSelection<T>- Returns:
- the number of objects in this
ILcdSelection.
-
selectedObjects
Description copied from interface:ILcdSelectionReturns the objects in this selection.- Specified by:
selectedObjectsin interfaceILcdSelection<T>- Returns:
- the objects currently in this
ILcdSelection.
-
isSelected
Checks whether the givenObjectis currently in the set of selected objects.- Specified by:
isSelectedin interfaceILcdSelection<T>- Parameters:
aObject- theObjectto be checked.- Returns:
trueif theObjectis in thisILcdSelection, as determined by the equals method;falseotherwise.
-
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:
addSelectionListenerin 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:ILcdSelectionRemoves anILcdSelectionListenerfrom thisILcdSelection.- Specified by:
removeSelectionListenerin interfaceILcdSelection<T>- Parameters:
aSelectionListener- theILcdSelectionListenerto 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-trueif the given Objects have to be added to the selection,falseif 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 aTLcdSelectionChangedEventto all the registered listeners.- Parameters:
aSelectionEvent- the event to be sent out.
-
fireCollectedSelectionChanges
public void fireCollectedSelectionChanges()Fires aTLcdSelectionChangedEventthat contains all the collected selection changes. -
log
public void log()
-