public class TLcdLayeredEvent extends ALcdDispatchableEvent
TLcdLayeredEvent
implements dispatchable events
for an ILcdLayered
.Modifier and Type | Field and Description |
---|---|
static int |
ALL_REMOVED
Deprecated.
Use multiple
LAYER_REMOVED events instead, so that the listener knows
what layers were removed. |
static int |
LAYER_ADDED
Event ID to indicate that a
ILcdLayer has been added to an ILcdLayered . |
static int |
LAYER_MOVED
Event ID to indicate that the position of a
ILcdLayer in a ILcdLayered has
changed. |
static int |
LAYER_REMOVED
Event ID to indicate that a
ILcdLayer has been removed from an ILcdLayered . |
static int |
STATE_CHANGED
Event ID to indicate that something has changed.
|
source
Constructor and Description |
---|
TLcdLayeredEvent() |
TLcdLayeredEvent(ILcdLayered source,
int id)
Creates an event with given source and change type.
|
TLcdLayeredEvent(ILcdLayered source,
int id,
ILcdLayer aLayer)
Creates an event with given source, change type and layer for which the change occurred.
|
TLcdLayeredEvent(ILcdLayered source,
int id,
ILcdLayer aLayer,
int aOriginalIndex,
int aNewIndex)
Creates an event with given source, change type, layer and index for which the change occurred.
|
Modifier and Type | Method and Description |
---|---|
void |
dispatch(EventListener listener)
Sends this
ILcdDispatchableEvent to the given listener. |
int |
getID()
Returns an ID indicating the type of event.
|
ILcdLayer |
getLayer()
Returns the
ILcdLayer which caused a change on the ILcdLayered , or
null when no layer was set during the construction of this event. |
ILcdLayered |
getLayered()
Returns the
ILcdLayered the change causing this event has occurred on. |
int |
getNewIndex()
Returns the index of the layer in
getLayered() after the event occured. |
int |
getOriginalIndex()
Returns the index of the layer in
getLayered() before the event occurred. |
String |
toString()
Returns the source and a string representation of the type of event.
|
paramString
getSource
public static final int STATE_CHANGED
public static final int LAYER_ADDED
ILcdLayer
has been added to an ILcdLayered
.
This ID contains the STATE_CHANGED ID.public static final int LAYER_REMOVED
ILcdLayer
has been removed from an ILcdLayered
.
This ID contains the STATE_CHANGED ID.public static final int LAYER_MOVED
ILcdLayer
in a ILcdLayered
has
changed.
This ID contains the STATE_CHANGED ID.@Deprecated public static final int ALL_REMOVED
LAYER_REMOVED
events instead, so that the listener knows
what layers were removed.ILcdLayer
have been removed from an ILcdLayered
.
This ID contains the STATE_CHANGED ID.public TLcdLayeredEvent()
public TLcdLayeredEvent(ILcdLayered source, int id)
source
- the originating ILcdLayered
of this event.id
- the type of change of this event. Can be one of
STATE_CHANGED, LAYER_ADDED, LAYER_MOVED, LAYER_REMOVED, ALL_REMOVED.public TLcdLayeredEvent(ILcdLayered source, int id, ILcdLayer aLayer)
source
- the originating ILcdLayered
of this event.id
- the type of change of this event. Can be one of
STATE_CHANGED, LAYER_ADDED, LAYER_MOVED, LAYER_REMOVED, ALL_REMOVED.aLayer
- the ILcdLayer
for which a change occurred.public TLcdLayeredEvent(ILcdLayered source, int id, ILcdLayer aLayer, int aOriginalIndex, int aNewIndex)
source
- the originating ILcdLayered
of this eventid
- the type of change of this event. Can be one of
STATE_CHANGED, LAYER_ADDED, LAYER_MOVED, LAYER_REMOVED, ALL_REMOVED.aLayer
- the ILcdLayer
for which a change occurredaOriginalIndex
- the index of the layer in the ILcdLayered
before the change, or -1 when the id
is
ALL_REMOVED
or when the layer was added to the ILcdLayered
aNewIndex
- the index of the layer in the ILcdLayered
after the change, or -1 when the id
is
ALL_REMOVED
or when the layer is removed from the ILcdLayered
getOriginalIndex()
,
getNewIndex()
public void dispatch(EventListener listener)
ILcdDispatchableEvent
ILcdDispatchableEvent
to the given listener.dispatch
in interface ILcdDispatchableEvent
dispatch
in class ALcdDispatchableEvent
listener
- the listener that will receive this ILcdDispatchableEvent
.public int getID()
public ILcdLayered getLayered()
ILcdLayered
the change causing this event has occurred on.ILcdLayered
the change causing this event has occurred on.public ILcdLayer getLayer()
ILcdLayer
which caused a change on the ILcdLayered
, or
null
when no layer was set during the construction of this event.ILcdLayer
which caused a change on the ILcdLayered
, or
null
when no layer was set during the construction of this event.public String toString()
toString
in class ALcdDispatchableEvent
public int getOriginalIndex()
Returns the index of the layer in getLayered()
before the event occurred. In case of:
LAYER_ADDED
: the index will be -1, since the layer was not a part of the ILcdLayered
before the eventLAYER_REMOVED
: the index is the old index of the removed layer,
before the remove operation took placeLAYER_MOVED
: the index is the original index of the layer,
before the move operation took placeALL_REMOVED
: the index is irrelevant, and -1 will be returnedILcdLayer
in the ILcdLayered
before the event occurred, or -1 if no index was setpublic int getNewIndex()
Returns the index of the layer in getLayered()
after the event occured. In case of:
LAYER_ADDED
: the index will be the index on which the layer was added.LAYER_REMOVED
: the index will be -1, since the layer is no longer part of the ILcdLayered
LAYER_MOVED
: the index will be the new index of the layer, after the move operation took placeALL_REMOVED
: the index is irrelevant, and -1 will be returnedILcdLayer
in the ILcdLayered
after the event occured, or -1 if no index was set