public class TLcdSelectionSupport<T> extends Object implements ILcdSelection<T>
TLcdSelectionChangedEvent
,
ILcdSelectionListener
Constructor and Description |
---|
TLcdSelectionSupport(ILcdSelection<T> aSelection)
Creates a new TLcdSelectionSupport for the given ILcdSelection.
|
Modifier and Type | Method and Description |
---|---|
void |
addSelectionListener(ILcdSelectionListener<T> aSelectionListener)
Adds the given listener to the list of objects that will be notified by any selection changed
passed in
fireSelectionEvent(TLcdSelectionChangedEvent) . |
void |
clearSelection(int aDispatchEventMode)
Clears the selection.
|
void |
fireCollectedSelectionChanges()
Fires a
TLcdSelectionChangedEvent that contains all the collected
selection changes. |
protected void |
fireSelectionEvent(TLcdSelectionChangedEvent<T> aSelectionEvent)
Fires a
TLcdSelectionChangedEvent to all the registered listeners. |
int |
getSelectionCount()
Returns the number of objects in this selection.
|
boolean |
isSelected(Object aObject)
Checks whether the given
Object is currently in the set of
selected objects. |
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
log() |
void |
removeSelectionListener(ILcdSelectionListener<T> aSelectionListener)
Removes an
ILcdSelectionListener from this ILcdSelection . |
Enumeration<T> |
selectedObjects()
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. It is recommended to use the
standard Java logging framework directly.
|
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSelectedObjects
public TLcdSelectionSupport(ILcdSelection<T> aSelection)
aSelection
- the ILcdSelection that will be specified in any
TLcdSelectionChangedEvent objects that are sent out.NullPointerException
- when the selection passed is null.public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.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.public boolean isTraceOn()
true
if tracing is enabled for this class.public int getSelectionCount()
ILcdSelection
getSelectionCount
in interface ILcdSelection<T>
ILcdSelection
.public Enumeration<T> selectedObjects()
ILcdSelection
selectedObjects
in interface ILcdSelection<T>
ILcdSelection
.public boolean isSelected(Object aObject)
Object
is currently in the set of
selected objects.isSelected
in interface ILcdSelection<T>
aObject
- the Object
to be checked.true
if the Object
is in this ILcdSelection
,
as determined by the equals method; false
otherwise.public void addSelectionListener(ILcdSelectionListener<T> aSelectionListener)
fireSelectionEvent(TLcdSelectionChangedEvent)
. The listener must not be null.addSelectionListener
in interface ILcdSelection<T>
aSelectionListener
- the object that will be notified of any changes to the selection set.NullPointerException
- when null is passed as a listener.public void removeSelectionListener(ILcdSelectionListener<T> aSelectionListener)
ILcdSelection
ILcdSelectionListener
from this ILcdSelection
.removeSelectionListener
in interface ILcdSelection<T>
aSelectionListener
- the ILcdSelectionListener
to be removed.public void selectObject(T aObject, boolean aSelection, int aDispatchEventMode)
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.ILcdFireEventMode
public void selectObjects(Collection<? extends T> aObjects, boolean aSelection, int aDispatchEventMode)
aObjects
- the Objects to be added or removed. There must not be any duplicate objects
in this list, nor should it be null
.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
, or
ILcdFireEventMode.FIRE_LATER
.ILcdFireEventMode
public void clearSelection(int aDispatchEventMode)
aDispatchEventMode
- the mode for sending out the event:
ILcdFireEventMode.NO_EVENT
,
ILcdFireEventMode.FIRE_NOW
, or
ILcdFireEventMode.FIRE_LATER
.ILcdFireEventMode
protected void fireSelectionEvent(TLcdSelectionChangedEvent<T> aSelectionEvent)
TLcdSelectionChangedEvent
to all the registered listeners.aSelectionEvent
- the event to be sent out.public void fireCollectedSelectionChanges()
TLcdSelectionChangedEvent
that contains all the collected
selection changes.public void log()