public abstract class GEvent extends Object implements IPostEventProcessing
Modifier and Type | Class and Description |
---|---|
static class |
GEvent.Operation
Operations enumeration when sending the from the
GProp.onEvent method. |
Modifier and Type | Field and Description |
---|---|
static int |
PROP_ADDED
Event ID for property added event.
|
static int |
PROP_ATTR_CHANGED
Event ID for property attribute changed event.
|
static int |
PROP_CNR_ADDED
Event ID for property container added.
|
static int |
PROP_CNR_FOCUS
Event ID for resolve references.
|
static int |
PROP_CNR_MOVED
Event ID for a property container move to another container event.
|
static int |
PROP_CNR_RENAMED
Event ID for property name changed event of a container.
|
static int |
PROP_DESIGNER_ASSET_CHANGED
Event ID for Asset files changes in conjunction with AssetReference (only in the Designer).
|
static int |
PROP_DESIGNER_JAVA_CLASS_CHANGED
Event ID for Java Class changes in conjunction with ClassReference (only in the Designer).
|
static int |
PROP_DESIGNER_JAVA_METHOD_RENAMED
Event ID for Java Method renamed in conjunction with ClassReference (only in the Designer).
|
static int |
PROP_DESIGNER_KSTRING
Event ID for KString event.
|
static int |
PROP_DESIGNER_VIEWER_UPDATE
Event ID for property update for the Eclipse Common Navigator viewer (only in the Designer).
|
static int |
PROP_DESIGNER_VS_REFERENCE
Event ID for VSReference resolving in conjunction with VSRelativeReference (only in the Designer).
|
static int |
PROP_DISPOSED
Event ID for property disposed changed event.
|
static int |
PROP_FOCUS
Event ID for focus.
|
static int |
PROP_MOVED_FROM
Event ID for property moved from container event.
|
static int |
PROP_MOVED_TO
Event ID for property moved to container event.
|
static int |
PROP_PROJECT_RENAMED
Event ID for project renamed.
|
static int |
PROP_QUERY_DESIGNER_PROPS
Event ID to query properties for references.
|
static int |
PROP_REFRESH
Event ID for a RefreshEvent.
|
static int |
PROP_REMOVED
Event ID for property removed event.
|
static int |
PROP_RENAMED
Event ID for property name changed event.
|
static int |
PROP_REORDERED
Event ID for property container reordered.
|
static int |
PROP_RESOLVE_REFERENCES_DIRECT
Event ID for resolve references.
|
static int |
PROP_VALUE_CHANGED
Event ID for property value changed event.
|
static int |
REMOTE
Event ID for Remote Property Event.
|
Constructor and Description |
---|
GEvent(GProp<?> source,
int eventID,
boolean isRemoteInduced)
Constructs the generic event with specified originator without progress monitor.
|
GEvent(GProp<?> source,
int eventID,
boolean isRemoteInduced,
IPropProgressMonitor monitor)
Constructs the generic event with specified originator.
|
GEvent(GProp<?> source,
int eventID,
IPropProgressMonitor monitor)
Constructs the generic event with specified originator that has a progress monitor and
is not remote induced.
|
Modifier and Type | Method and Description |
---|---|
void |
addPostProcessor(EventListener postProcessor)
Adds a post-event processor that will be called when the event has completed its notification process.
|
void |
cancel()
Cancel even propagation of this event.
|
void |
consume()
Consumes this event.
|
protected EventListener |
getAlternateDestination(GProp<?> destination,
GEvent.Operation operation,
int operationIndex)
Gets the alternate property destination for an event about to be sent.
|
int |
getEventID()
Gets the event ID.
|
String |
getEventName()
Gets the name string of the event.
|
static String |
getEventName(int eventID)
Gets the name of an
eventID . |
GProp<?> |
getEventTarget()
Gets the event owner.
|
GEvent.Operation |
getOperation()
Gets the current operation.
|
abstract GEvent.Operation[] |
getOperations()
Gets the Operations order describing what Operation the property that receives the event should process.
|
EventListener[] |
getPostProcessors(GProp<?> dispatcher)
Gets the post-processors.
|
GProp<?> |
getSender()
Gets the current sender of the event.
|
GProp<?> |
getSource()
Gets the source of the event.
|
IGProp<?> |
getTrigger()
Returns the trigger of this event, if any.
|
boolean |
isCancelled()
Checks if this event has been cancelled.
|
boolean |
isClearCacheEvent()
Returns the state for a property container if this event is received in the
onEventSelf method
as a helper for it would need to clear the property container cache. |
boolean |
isConsumed()
Checks if this event has been consumed.
|
boolean |
isEventProcessed(GProp<?> property,
GEvent.Operation operation,
int operationIndex)
Checks if this Operation at specified index should be processed or not by the
specified property.
|
boolean |
isPropertyChange(IGProp<?> property)
Checks if the event is a property value change.
|
boolean |
isPropertyChange(PropCnr pc,
Atom name)
Checks if the event is a modification change of any property in the specified container.
|
boolean |
isPropertyChange(PropCnr pc,
String name)
Checks if the event is a modification change of any property in the specified container.
|
boolean |
isPropertyChangeIn(PropCnr pc)
Checks if the event is a modification change of any property in the specified container.
|
boolean |
isPropertyChangeInTree(PropCnr pc)
Checks if the event is a modification change of any property in the specified container or
any of its children.
|
boolean |
isRefreshEvent()
Returns true if this is a refresh event.
|
boolean |
isRemoteInduced()
Flag indicating this change is induced from a remote party.
|
boolean |
isVerifyEvent()
Returns if this event is a verify event for a container that processes verification.
|
protected StringBuilder |
paramString(StringBuilder buf)
Returns the parameter string representing the state of this event.
|
void |
send(GProp<?> sender,
EventListener listener)
Sends this event to the event listener in question, with "safe" processing,
i.e.
|
void |
send(GProp<?> sender,
GProp<?> receiver,
GEvent.Operation operation,
int operationIndex)
Sends this event to the property in question, with "safe" processing,
i.e.
|
void |
sendSelf(GProp<?> senderAndReceiver,
GEvent.Operation operation,
int operationIndex)
Sends this event to the property itself in question, with "safe" processing,
i.e.
|
void |
setInitialProperty(GProp<?> initialDispatcher)
Assigns the initial sender property that should perform post processing of events.
|
void |
setOperation(GEvent.Operation operation)
Sets the current operation.
|
void |
setProgressMonitor(IPropProgressMonitor monitor)
Sets the progress monitor if not already done.
|
String |
toString()
Returns a string representation of this component and its values.
|
public static final int PROP_ATTR_CHANGED
It is a bubbling event.
Event class: com.iizix.event.PropAttrEvent
.
public static final int PROP_VALUE_CHANGED
It is a bubbling event.
Event class: com.iizix.event.PropValueEvent
.
public static final int PROP_ADDED
It is a bubbling event.
Event class: com.iizix.event.PropCnrEvent
.
public static final int PROP_REMOVED
It is a bubbling event.
Event class: com.iizix.event.PropCnrEvent
.
public static final int PROP_RENAMED
It is a bubbling event.
Event class: com.iizix.event.PropNameEvent
.
public static final int PROP_DISPOSED
It is a bubbling event.
Event class: com.iizix.event.PropDisposeEvent
.
public static final int PROP_MOVED_FROM
It is a bubbling event.
Event class: com.iizix.event.PropMoveEvent
.
public static final int PROP_MOVED_TO
It is a bubbling event.
Event class: com.iizix.event.PropMoveEvent
.
public static final int PROP_REORDERED
It is a bubbling event.
Event class: com.iizix.event.PropReorderEvent
.
public static final int PROP_CNR_ADDED
This is a sinking event.
Event class: com.iizix.event.ParentCnrAddedEvent
.
public static final int PROP_CNR_RENAMED
This is a sinking event.
Event class: com.iizix.event.PropNameEvent
.
public static final int PROP_CNR_MOVED
This is a sinking event.
Event class: com.iizix.event.ParentCnrMoveEvent
.
public static final int PROP_FOCUS
This is a bubbling event.
Event class: com.iizix.event.PropFocusEvent
.
public static final int PROP_CNR_FOCUS
This is a sinking event.
Event class: com.iizix.event.PropCnrFocusEvent
.
public static final int PROP_RESOLVE_REFERENCES_DIRECT
This is a sinking event.
Event class: com.iizix.event.ResolveReferencesEvent
.
public static final int PROP_PROJECT_RENAMED
This is a sinking event.
Event class: com.iizix.event.ProjectNameEvent
.
public static final int PROP_QUERY_DESIGNER_PROPS
This is a sinking event.
Event class: com.iizigo.event.QueryDesignerPropEvent
.
public static final int PROP_DESIGNER_VIEWER_UPDATE
It is a bubbling event.
Event class: com.iizigo.event.CommonDesignerEvent
.
public static final int PROP_DESIGNER_VS_REFERENCE
It is a sinking event.
Event class: com.iizix.event.VSReferenceEvent
.
public static final int PROP_DESIGNER_ASSET_CHANGED
It is a sinking event.
Event class: com.iizix.event.AssetEvent
.
public static final int PROP_DESIGNER_JAVA_CLASS_CHANGED
It is a sinking event.
Event class: com.iizigo.java.event.JavaClassEvent
.
public static final int PROP_DESIGNER_JAVA_METHOD_RENAMED
It is a sinking event.
Event class: com.iizigo.java.event.JavaMethodEvent
.
public static final int PROP_DESIGNER_KSTRING
It is a sinking event.
Event class: com.iizigo.java.event.KStringEvent
.
public static final int PROP_REFRESH
It is a sinking event.
Event class: com.iizix.event.RefreshEvent
.
public static final int REMOTE
It is a bubbling event.
Event class: com.iizix.event.RemoteEvent
.
public GEvent(GProp<?> source, int eventID, boolean isRemoteInduced)
source
- The source object.eventID
- The event ID, see GEvent.PROP_*
.isRemoteInduced
- Flag indicating this change is induced from a remote party.NullPointerException
- If source is null
.public GEvent(GProp<?> source, int eventID, IPropProgressMonitor monitor)
source
- The source object.eventID
- The event ID, see GEvent.PROP_*
.monitor
- The progress monitor, null for none.NullPointerException
- If source is null
.public GEvent(GProp<?> source, int eventID, boolean isRemoteInduced, IPropProgressMonitor monitor)
source
- The source object.eventID
- The event ID, see GEvent.PROP_*
.isRemoteInduced
- Flag indicating this change is induced from a remote party.monitor
- The progress monitor, null for none.NullPointerException
- If source is null
.public static String getEventName(int eventID)
eventID
.public void setProgressMonitor(IPropProgressMonitor monitor)
public final int getEventID()
public String getEventName()
GEvent.getEventName(event.getEventID())
.public final GProp<?> getSource()
public GProp<?> getEventTarget()
public final boolean isRemoteInduced()
public GEvent.Operation getOperation()
public void setOperation(GEvent.Operation operation)
GProp.onEvent
.NullPointerException
- If operation
is null.public final boolean isConsumed()
Consumed events are still propagating, so this flag is more of informational purpose.
public final void consume()
Consumed events are still propagating, so this flag is more of informational purpose.
public final boolean isCancelled()
public final void cancel()
public abstract GEvent.Operation[] getOperations()
Subclasses must implement this Operations order. They should NOT use both Sinking and Bubbling Operations, this will cause an infinite loop or stack overflow due to recursion.
public String toString()
protected StringBuilder paramString(StringBuilder buf)
buf
- The StringBuilder to append the string to.buf
input parameter.public final void send(GProp<?> sender, EventListener listener)
This method is intended to be called from GProp.onEvent(event)
.
Do not call this method.
This event's operation, retrieved by getOperation()
is set to LISTENERS.
sender
- The sender property.listener
- The event listener.public final void send(GProp<?> sender, GProp<?> receiver, GEvent.Operation operation, int operationIndex)
This method is intended to be called from GProp.onEvent(event)
.
Do not call this method.
sender
- The sender property.receiver
- The receiving property.operation
- The Operation.operationIndex
- The current index in the Operation array provided by this event's
getOperations()
method.public final void sendSelf(GProp<?> senderAndReceiver, GEvent.Operation operation, int operationIndex)
onEventSelf
rather than onEvent
.
This method is intended to be called from GProp.onEvent(event)
.
Do not call this method.
senderAndReceiver
- The sender and received property.operation
- The Operation.operationIndex
- The current index in the Operation array provided by this event's
getOperations()
method.public final GProp<?> getSender()
protected EventListener getAlternateDestination(GProp<?> destination, GEvent.Operation operation, int operationIndex)
This method also enables an event to skip sending the event to a property by
returning null
in this method.
Subclasses can override this method to provide fine-tuned behavior.
destination
- The destination property.operation
- The Operation.operationIndex
- The current index in the Operation array provided by this event's
getOperations()
method.destination
by default. If null
is returned,
this event will not be sent.public boolean isEventProcessed(GProp<?> property, GEvent.Operation operation, int operationIndex)
An event can fine-tune event distribution with this mechanism, thus improving performance.
This method is intended to be called from GProp.onEvent(event)
.
Do not call this method.
property
- The property processing the event in GEvent.onEvent(event)
.operation
- The Operation.operationIndex
- The current index in the Operation array provided by this event's
getOperations()
method.public boolean isClearCacheEvent()
onEventSelf
method
as a helper for it would need to clear the property container cache.public boolean isVerifyEvent()
public void addPostProcessor(EventListener postProcessor)
postProcessor
not be called.
Note: the post-processors are called no matter if the event has been canceled, so the processor may have to check the cancel state.
Calling this method with the same postProcessor
more than once does not add it again.
addPostProcessor
in interface IPostEventProcessing
postProcessor
- Processor to add.NullPointerException
- If the postProcessor
is null.public void setInitialProperty(GProp<?> initialDispatcher)
setInitialProperty
in interface IPostEventProcessing
initialDispatcher
- The initial dispatcher.public EventListener[] getPostProcessors(GProp<?> dispatcher)
getPostProcessors
in interface IPostEventProcessing
dispatcher
- The property retrieving the post-processors, null for none.public boolean isPropertyChange(IGProp<?> property)
property
- The property.public boolean isPropertyChange(PropCnr pc, Atom name)
pc
- The property container.name
- The property name to check for change.public boolean isPropertyChange(PropCnr pc, String name)
pc
- The property container.name
- The property name to check for change.public boolean isPropertyChangeIn(PropCnr pc)
pc
- The property container.public IGProp<?> getTrigger()
public boolean isPropertyChangeInTree(PropCnr pc)
pc
- The property container.public boolean isRefreshEvent()
RefreshEvent
.iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.