# com.bea.ide.element
ElementChangeEvent Class

public class ElementChangeEvent
extends `EventObject`

This class represents a change to an element within the IDE. Listeners may be registered using the IElementChangeListener class to be notified of these events. Events fall into three basic categories: New root, property changed, children changed. Methods may be used to access extra information. The information available depends on the type of event.

Hierarchy
  `Object`
  `EventObject`
  `ElementChangeEvent`

All Implemented Interfaces
  `Serializable`

## Field Summary

`public static final int` | `CHILD_CHANGE_ADDED` Pass this value in the appropriate constructor to indicate that the event is a child being added
`public static final int` | `CHILD_CHANGE_REMOVED` Pass this value in the appropriate constructor to indicate that the event is a child being removed
`public static final int` | `ELEMENT_CHANGE_CHILDREN` A child was added or removed from the given element
`public static final int` | `ELEMENT_CHANGE_COLLECTION` A collection of element changes grouped together
`public static final int` | `ELEMENT_CHANGE_NEWROOT` The entire tree has been replaced.
`public static final int` | `ELEMENT_CHANGE_PROPERTY` A single property in the given element was changed.

Fields from java.util`.`EventObject``
`source`

## Constructor Summary

ElementChangeEvent(`Object` source, `IElement` el, `IElement` elChanged, int childChange) This constructs an event of the children changed type
ElementChangeEvent(`Object` source, `IElement` elOldRoot, `IElement` elNewRoot) This constructs an event of the New Root type.
ElementChangeEvent(`Object` source, `IElement` el, `String` sProperty, `Object` oldValue, `Object` newValue) This constructs an event of the Property changed type
ElementChangeEvent(`Object` source, `Collection` changes) This constructs an event of the Collection type.

## Method Summary

`public `Object`` | `getChangeData`() Get the data associated with this event.
`public `IElement`` | `getElement`() Get the element associated with this event
`public `Object`` | `getNewValue`() Get the new value associated with this event.
`public `Object`` | `getOldValue`() Get the old value associated with this event.
`public int` | `getType`() Get the type of the element change event.
`public `String`` | `toString`()

Methods from `java.util.`EventObject``
`getSource,`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Detail

### CHILD_CHANGE_ADDED

    public static final int CHILD_CHANGE_ADDED

  Pass this value in the appropriate constructor to indicate that the event is a child being added

### CHILD_CHANGE_REMOVED

    public static final int CHILD_CHANGE_REMOVED

  Pass this value in the appropriate constructor to indicate that the event is a child being removed

### ELEMENT_CHANGE_CHILDREN

    public static final int ELEMENT_CHANGE_CHILDREN

  A child was added or removed from the given element

### ELEMENT_CHANGE_COLLECTION

    public static final int ELEMENT_CHANGE_COLLECTION

  A collection of element changes grouped together

### ELEMENT_CHANGE_NEWROOT

    public static final int ELEMENT_CHANGE_NEWROOT

  The entire tree has been replaced.

### ELEMENT_CHANGE_PROPERTY

    public static final int ELEMENT_CHANGE_PROPERTY

  A single property in the given element was changed.

## Constructor Detail

### ElementChangeEvent

    public ElementChangeEvent(Object source,
                              IElement el,
                              IElement elChanged,
                              int childChange)

  This constructs an event of the children changed type

### ElementChangeEvent

    public ElementChangeEvent(Object source,
                              IElement elOldRoot,
                              IElement elNewRoot)

  This constructs an event of the New Root type.

### ElementChangeEvent

    public ElementChangeEvent(Object source,
                              IElement el,
                              String sProperty,
                              Object oldValue,
                              Object newValue)

  This constructs an event of the Property changed type

### ElementChangeEvent

    public ElementChangeEvent(Object source,
                              Collection changes)

  This constructs an event of the Collection type.

## Method Detail

### getChangeData() Method

    public Object getChangeData()

Get the data associated with this event. Currently, this is only used for `ElementChangeEvent.ELEMENT_CHANGE_PROPERTY``` events. It stores the String name of the property that was changed.

#### Returns

the changeData object for this event

### getElement() Method

    public IElement getElement()

Get the element associated with this event

#### Returns

the Element that this change applies to. This will be null for `ElementChangeEvent.ELEMENT_CHANGE_NEWROOT``` events

### getNewValue() Method

    public Object getNewValue()

Get the new value associated with this event. For each event type, it has a different meaning: `ElementChangeEvent.ELEMENT_CHANGE_NEWROOT``` -- This is the new root of the metadata tree. `ElementChangeEvent.ELEMENT_CHANGE_PROPERTY``` -- This is the new value of the specified property. `ElementChangeEvent.ELEMENT_CHANGE_CHILDREN``` -- This is the child that was added (null, if this is event indicates a child was removed).

#### Returns

the oldValue object for this event

### getOldValue() Method

    public Object getOldValue()

Get the old value associated with this event. For each event type, it has a different meaning: `ElementChangeEvent.ELEMENT_CHANGE_NEWROOT``` -- This is the old root of the metadata tree. `ElementChangeEvent.ELEMENT_CHANGE_PROPERTY``` -- This is the old value of the specified property. `ElementChangeEvent.ELEMENT_CHANGE_CHILDREN``` -- This is the child that was removed (null, if this is event indicates a child was added).

#### Returns

the oldValue object for this event

### getType() Method

    public int getType()

Get the type of the element change event.

#### Returns

one of `ElementChangeEvent.ELEMENT_CHANGE_NEWROOT```, `ElementChangeEvent.ELEMENT_CHANGE_PROPERTY```, `ElementChangeEvent.ELEMENT_CHANGE_CHILDREN```

### toString() Method

    public String toString()

Overrides
  `EventObject.toString()`