xArch/xADL 2.0 Data Binding Library

edu.uci.isr.xarch
Class XArchEvent

java.lang.Object
  extended byedu.uci.isr.xarch.XArchEvent

public class XArchEvent
extends Object

An event object that is broadcast to XArchListeners when an xArch element changes.

Author:
Eric M. Dashofy [edashofy@ics.uci.edu]

Field Summary
static int ADD_EVENT
          Event type used when an element is added.
static int ATTRIBUTE_CHANGED
          Source type used when an attribute changes.
static int CLEAR_EVENT
          Event type used when an element or set of elements is cleared.
static int ELEMENT_CHANGED
          Source type used when an element changes.
protected  int eventType
           
protected  boolean isAttached
          true if the source of the event is attached to the xArch element in the context, false otherwise.
static int PROMOTE_EVENT
          Event type used when an element is promoted
static int REMOVE_EVENT
          Event type used when an element is removed.
static int SET_EVENT
          Event type used when an element is set
static int SIMPLE_TYPE_VALUE_CHANGED
          Source type used when a simple type's value changes.
protected  IXArchElement src
           
protected  int srcType
           
protected  Object target
          This is a string with the value if srcType = ATTRIBUTE_CHANGED, a string with the value srcType = SIMPLE_TYPE_VALUE_CHANGED, otherwise it's an IXArchElement if srcType = ELEMENT_CHANGED.
protected  String targetName
           
 
Constructor Summary
XArchEvent(IXArchElement src, int eventType, int srcType, String targetName, Object target, boolean isAttached)
          Create a new xArch event.
 
Method Summary
 int getEventType()
          Get the event type of this event.
 boolean getIsAttached()
          Determine whether the changed xArch element is currently attached to (has as an ancestor) the xArch element that emits this event.
 IXArchElement getSource()
          Get the source xArch element of this event.
 int getSourceType()
          Get the source type of this event.
 Object getTarget()
          Get the target of this event.
 String getTargetName()
          Get the target name of this event.
 void setEventType(int eventType)
          Set the event type of this event.
 void setIsAttached(boolean isAttached)
          Set whether the changed xArch element is currently attached to (has as an ancestor) the xArch element that emitted this event.
 void setSource(IXArchElement src)
          Set the source of this event.
 void setSourceType(int srcType)
          Set the source type of this event.
 void setTarget(Object target)
          Set the target of this event.
 void setTargetName(String targetName)
          Set the target name of this event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SET_EVENT

public static final int SET_EVENT
Event type used when an element is set

See Also:
Constant Field Values

CLEAR_EVENT

public static final int CLEAR_EVENT
Event type used when an element or set of elements is cleared.

See Also:
Constant Field Values

ADD_EVENT

public static final int ADD_EVENT
Event type used when an element is added.

See Also:
Constant Field Values

REMOVE_EVENT

public static final int REMOVE_EVENT
Event type used when an element is removed.

See Also:
Constant Field Values

PROMOTE_EVENT

public static final int PROMOTE_EVENT
Event type used when an element is promoted

See Also:
Constant Field Values

ATTRIBUTE_CHANGED

public static final int ATTRIBUTE_CHANGED
Source type used when an attribute changes.

See Also:
Constant Field Values

ELEMENT_CHANGED

public static final int ELEMENT_CHANGED
Source type used when an element changes.

See Also:
Constant Field Values

SIMPLE_TYPE_VALUE_CHANGED

public static final int SIMPLE_TYPE_VALUE_CHANGED
Source type used when a simple type's value changes.

See Also:
Constant Field Values

src

protected IXArchElement src

eventType

protected int eventType

srcType

protected int srcType

targetName

protected String targetName

target

protected Object target
This is a string with the value if srcType = ATTRIBUTE_CHANGED, a string with the value srcType = SIMPLE_TYPE_VALUE_CHANGED, otherwise it's an IXArchElement if srcType = ELEMENT_CHANGED.


isAttached

protected boolean isAttached
true if the source of the event is attached to the xArch element in the context, false otherwise.

Constructor Detail

XArchEvent

public XArchEvent(IXArchElement src,
                  int eventType,
                  int srcType,
                  String targetName,
                  Object target,
                  boolean isAttached)
Create a new xArch event.

Parameters:
src - xArch element that is the source of this event (i.e. that changed.)
eventType - One of the event types (above) that indicates what happened.
srcType - One of the event types (above) that indicates what changed.
targetName - Name of the element or attribute that was set/added/cleared/removed.
target - The attribute/element/value that was set/added/cleared/removed.
isAttached - true if the element that was changed is actually connected to the xArch element emitting this event or not.
Method Detail

setSource

public void setSource(IXArchElement src)
Set the source of this event.

Parameters:
src - Source of this event.

getSource

public IXArchElement getSource()
Get the source xArch element of this event.

Returns:
source of this event.

setEventType

public void setEventType(int eventType)
Set the event type of this event.

Parameters:
eventType - Event type.

getEventType

public int getEventType()
Get the event type of this event.

Returns:
Event type.

setSourceType

public void setSourceType(int srcType)
Set the source type of this event.

Parameters:
srcType - Source type.

getSourceType

public int getSourceType()
Get the source type of this event.

Returns:
Source type.

setTargetName

public void setTargetName(String targetName)
Set the target name of this event.

Parameters:
targetName - Target name.

getTargetName

public String getTargetName()
Get the target name of this event. Returns the tag name if the target is an element, the attribute name if the target is an attribute, or an undefined value if the target is a simple type.

Returns:
Target name.

setTarget

public void setTarget(Object target)
Set the target of this event.

Parameters:
target - Event target.

getTarget

public Object getTarget()
Get the target of this event.

Returns:
Event target.

setIsAttached

public void setIsAttached(boolean isAttached)
Set whether the changed xArch element is currently attached to (has as an ancestor) the xArch element that emitted this event.

Parameters:
isAttached - Whether the changed element is attached or not.

getIsAttached

public boolean getIsAttached()
Determine whether the changed xArch element is currently attached to (has as an ancestor) the xArch element that emits this event.

Returns:
true if it is attached, false otherwise.

xArch/xADL 2.0 Data Binding Library