Package org.eclipse.birt.report.model.api.activity

# Class NotificationEvent

java.lang.Object
org.eclipse.birt.report.model.api.activity.NotificationEvent

Direct Known Subclasses:
  `AttributeEvent`, `ContentEvent`, `ContentReplaceEvent`, `CssEvent`, `CssReloadedEvent`, `CustomMsgEvent`, `DisposeEvent`, `ElementDeletedEvent`, `ElementLocalizeEvent`, `EncryptionEvent`, `ExtendsEvent`, `ExtensionPropertyDefinitionEvent`, `LayoutChangedEvent`, `LibraryEvent`, `LibraryReloadedEvent`, `NameEvent`, `NameSpaceEvent`, `PropertyEvent`, `ResourceChangeEvent`, `StyleEvent`, `TemplateTransformEvent`, `ThemeEvent`, `UserPropertyEvent`, `ValidationEvent`, `ViewsContentEvent`

public abstract class NotificationEvent extends Object
The base class of the notification hierarchy. Every notification describes one change to one element called the target element.

A notification specifies the kind of change by its class. Subclasses provide additional context information appropriate for that specific event.

Notifications are routed to listeners though a number of delivery paths. For example, a listener may hear about changes to an element itself, to an ancestor element, to an associated style, and so on. Some listeners may want to react differently depending on the element that actually changed. The `getDeliveryPath( )`method lets the listener determine which path this event has taken.

Notifications are created in response to a model change. The UI that triggers the change can identify itself as the sender of the event. This allows the UI to ignore events that represent changes that it, itself, made. Using the sender attribute is purely optional, and is for the convenience of each particular bit of UI.

There are several constants defined in this class. Each of them is corresponding to a kind of Event. When doing some operations, specified command and record are invoked and the record will eventually send out a kind of NotificationEvent, when calling the `getEventType()`of the event, the return value will be one of the constants defined here.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`ATTRIBUTE_EVENT`
The event type of attributeEvent.
`static final int`
`CONTAINER`
Event is being sent to the elements that contains the current element.
`static final int`
`CONTENT_EVENT`
The event type of ContentEvent.
`static final int`
`CONTENT_REPLACE_EVENT`
The event type of CONTENT_REPLACE_EVENT.
`static final int`
`CONTENTS`
Event is being sent to the contents of the target.
`static final int`
`CSS_EVENT`
The event type of css CRUD event
`static final int`
`CSS_RELOADED_EVENT`
The event type of css reload event
`static final int`
`CUSTOM_MSG_EVENT`
The event type of CustomMsgEvent.
`static final int`
`DATA_DESIGN_RELOADED_EVENT`
The event type of event that the data design is reloaded.
`static final int`
`DATA_MART_PROPERTY_EVENT`
The event type of DataMartPropertyEvent.
`protected int`
`deliveryPath`
The current delivery path for the notification.
`static final int`
`DESCENDENT`
Event is being sent to the descendants of the object.
`static final int`
`DIRECT`
Event is being sent to the listeners of the object itself.
`static final int`
`DISPOSE_EVENT`
The event type of DISPOSE_EVENT.
`static final int`
`ELEMENT_CLIENT`
Event is being sent to the elements that use an element.
`static final int`
`ELEMENT_DELETE_EVENT`
The event type of ElementDeletedEvent.
`static final int`
`ELEMENT_LOCALIZE_EVENT`
The event type of ELEMENT_LOCALIZE_EVENT
`static final int`
`ENCRYPTION_EVENT`
The event type of encryption change event.
`static final int`
`EXTENDS_EVENT`
The event type of ExtendsEvent.
`static final int`
`EXTENSION_PROPERTY_DEFINITION_EVENT`
The event type of PropertyListEvent.
`static final int`
`LAYOUT_CHANGED_EVENT`
The event type of LAYOUT_CHANGED_EVENT.
`static final int`
`LIBRARY_CHANGE_EVENT`
The event type of LIBRARY_CHANGE_EVENT
`static final int`
`LIBRARY_EVENT`
The event type of LibraryEvent
`static final int`
`LIBRARY_RELOADED_EVENT`
The event type of LIBRARY_RELOADED_EVENT
`static final int`
`NAME_EVENT`
The event type of NameEvent.
`static final int`
`NAME_SPACE_EVENT`
Deprecated.
since BIRT 2.1
`static final int`
`PROPERTY_EVENT`
The event type of PrpertyEvent.
`protected Object`
`sender`
The sender of the event.
`static final int`
`STRUCTURE_CLIENT`
Event is being sent to the elements that use a structure defined in report design.
`static final int`
`STYLE_CLIENT`
Event is being sent to elements that use a style.
`static final int`
`STYLE_EVENT`
The event type of StyleEvent.
`protected org.eclipse.birt.report.model.core.DesignElement`
`target`
The design element that changed.
`static final int`
`TEMPLATE_TRANSFORM_EVENT`
The event type of TEMPLATE_TRANSFORM_EVENT.
`static final int`
`THEME_EVENT`
The event type of THEME_EVENT.
`static final int`
`USER_PROP_EVENT`
The event type of UserPropertyEvent.
`static final int`
`VALIDATION_EVENT`
The event type of ValidationEvent
`static final int`
`VIEWS_CONTENT_EVENT`
The event type of multiple views event.

## Constructor Summary

Constructors
Constructor
Description
`NotificationEvent()`
Default constructor.
`NotificationEvent(org.eclipse.birt.report.model.core.DesignElement obj)`
Convenience constructor that specifies the target element.

## Method Summary

Modifier and Type
Method
Description
`int`
`getDeliveryPath()`
Returns the delivery path by which the event was sent to the listener.
`abstract int`
`getEventType()`
Returns the event type.
`Object`
`getSender()`
Returns the sender: the UI or other application object that caused the event to be sent.
`org.eclipse.birt.report.model.core.DesignElement`
`getTarget()`
Returns the target element: the part of the design that actually changed.
`boolean`
`isSame(NotificationEvent event)`
Compares and justifies whether this event and the given event is the same.
`void`
`setDeliveryPath(int path)`
Sets the delivery path.
`void`
`setSender(Object sender)`
Sets the sender based on the information provided to the command.
`void`
`setTarget(org.eclipse.birt.report.model.core.DesignElement target)`
Sets the target element.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### CONTENT_EVENT

public static final int CONTENT_EVENT
The event type of ContentEvent.

See Also:
  - Constant Field Values

### ELEMENT_DELETE_EVENT

public static final int ELEMENT_DELETE_EVENT
The event type of ElementDeletedEvent.

See Also:
  - Constant Field Values

### EXTENDS_EVENT

public static final int EXTENDS_EVENT
The event type of ExtendsEvent.

See Also:
  - Constant Field Values

### NAME_EVENT

public static final int NAME_EVENT
The event type of NameEvent.

See Also:
  - Constant Field Values

### NAME_SPACE_EVENT

@Deprecated public static final int NAME_SPACE_EVENT
Deprecated.
since BIRT 2.1
The event type of NameSpaceEvent.

See Also:
  - Constant Field Values

### PROPERTY_EVENT

public static final int PROPERTY_EVENT
The event type of PrpertyEvent.

See Also:
  - Constant Field Values

### STYLE_EVENT

public static final int STYLE_EVENT
The event type of StyleEvent.

See Also:
  - Constant Field Values

### USER_PROP_EVENT

public static final int USER_PROP_EVENT
The event type of UserPropertyEvent.

See Also:
  - Constant Field Values

### CUSTOM_MSG_EVENT

public static final int CUSTOM_MSG_EVENT
The event type of CustomMsgEvent.

See Also:
  - Constant Field Values

### EXTENSION_PROPERTY_DEFINITION_EVENT

public static final int EXTENSION_PROPERTY_DEFINITION_EVENT
The event type of PropertyListEvent.

See Also:
  - Constant Field Values

### VALIDATION_EVENT

public static final int VALIDATION_EVENT
The event type of ValidationEvent

See Also:
  - Constant Field Values

### LIBRARY_EVENT

public static final int LIBRARY_EVENT
The event type of LibraryEvent

See Also:
  - Constant Field Values

### ATTRIBUTE_EVENT

public static final int ATTRIBUTE_EVENT
The event type of attributeEvent.

See Also:
  - Constant Field Values

### DISPOSE_EVENT

public static final int DISPOSE_EVENT
The event type of DISPOSE_EVENT.

See Also:
  - Constant Field Values

### LAYOUT_CHANGED_EVENT

public static final int LAYOUT_CHANGED_EVENT
The event type of LAYOUT_CHANGED_EVENT.

See Also:
  - Constant Field Values

### THEME_EVENT

public static final int THEME_EVENT
The event type of THEME_EVENT.

See Also:
  - Constant Field Values

### CONTENT_REPLACE_EVENT

public static final int CONTENT_REPLACE_EVENT
The event type of CONTENT_REPLACE_EVENT.

See Also:
  - Constant Field Values

### TEMPLATE_TRANSFORM_EVENT

public static final int TEMPLATE_TRANSFORM_EVENT
The event type of TEMPLATE_TRANSFORM_EVENT.

See Also:
  - Constant Field Values

### ELEMENT_LOCALIZE_EVENT

public static final int ELEMENT_LOCALIZE_EVENT
The event type of ELEMENT_LOCALIZE_EVENT

See Also:
  - Constant Field Values

### LIBRARY_RELOADED_EVENT

public static final int LIBRARY_RELOADED_EVENT
The event type of LIBRARY_RELOADED_EVENT

See Also:
  - Constant Field Values

### LIBRARY_CHANGE_EVENT

public static final int LIBRARY_CHANGE_EVENT
The event type of LIBRARY_CHANGE_EVENT

See Also:
  - Constant Field Values

### CSS_RELOADED_EVENT

public static final int CSS_RELOADED_EVENT
The event type of css reload event

See Also:
  - Constant Field Values

### CSS_EVENT

public static final int CSS_EVENT
The event type of css CRUD event

See Also:
  - Constant Field Values

### ENCRYPTION_EVENT

public static final int ENCRYPTION_EVENT
The event type of encryption change event.

See Also:
  - Constant Field Values

### VIEWS_CONTENT_EVENT

public static final int VIEWS_CONTENT_EVENT
The event type of multiple views event.

See Also:
  - Constant Field Values

### DATA_DESIGN_RELOADED_EVENT

public static final int DATA_DESIGN_RELOADED_EVENT
The event type of event that the data design is reloaded.

See Also:
  - Constant Field Values

### DATA_MART_PROPERTY_EVENT

public static final int DATA_MART_PROPERTY_EVENT
The event type of DataMartPropertyEvent.

See Also:
  - Constant Field Values

### DIRECT

public static final int DIRECT
Event is being sent to the listeners of the object itself.

See Also:
  - Constant Field Values

### DESCENDENT

public static final int DESCENDENT
Event is being sent to the descendants of the object. descendants are those that extend the target, directly or indirectly.

See Also:
  - Constant Field Values

### STYLE_CLIENT

public static final int STYLE_CLIENT
Event is being sent to elements that use a style.

See Also:
  - Constant Field Values

### CONTENTS

public static final int CONTENTS
Event is being sent to the contents of the target.

See Also:
  - Constant Field Values

### ELEMENT_CLIENT

public static final int ELEMENT_CLIENT
Event is being sent to the elements that use an element.

See Also:
  - Constant Field Values

### STRUCTURE_CLIENT

public static final int STRUCTURE_CLIENT
Event is being sent to the elements that use a structure defined in report design.

See Also:
  - Constant Field Values

### CONTAINER

public static final int CONTAINER
Event is being sent to the elements that contains the current element.

See Also:
  - Constant Field Values

### target

protected org.eclipse.birt.report.model.core.DesignElement target
The design element that changed.

### sender

protected Object sender
The sender of the event. This is generally the UI that made the change. This allows the UI to ignore, if it chooses, events that indicate changes that the that UI made itself.

### deliveryPath

protected int deliveryPath
The current delivery path for the notification. Updated as the event works though the delivery system.

## Constructor Details

### NotificationEvent

public NotificationEvent()
Default constructor.

### NotificationEvent

public NotificationEvent(org.eclipse.birt.report.model.core.DesignElement obj)
Convenience constructor that specifies the target element.

Parameters:
  `obj` - the target element.

## Method Details

### getDeliveryPath

public int getDeliveryPath()
Returns the delivery path by which the event was sent to the listener.

Returns:
  the Delivery path. One of:
  - DIRECT
  - DESCENDENT
  - STYLE_CLIENT
  - CONTENTS

### setDeliveryPath

public void setDeliveryPath(int path)
Sets the delivery path. Called by the sender to indicate the context.

Parameters:
  `path` - the delivery path to set.

### getSender

public Object getSender()
Returns the sender: the UI or other application object that caused the event to be sent. The UI component can use this to avoid responding to changes that the UI component itself caused.

Returns:
  the sender.

### setSender

public void setSender(Object sender)
Sets the sender based on the information provided to the command.

Parameters:
  `sender` - the sender to set.

### getTarget

public org.eclipse.birt.report.model.core.DesignElement getTarget()
Returns the target element: the part of the design that actually changed.

Returns:
  the target.

### setTarget

public void setTarget(org.eclipse.birt.report.model.core.DesignElement target)
Sets the target element.

Parameters:
  `target` - the target element to set.

### getEventType

public abstract int getEventType()
Returns the event type. The following event types are defined:

- CONTENT_EVENT
- ELEMENT_DELETE_EVENT
- EXTENDS_EVENT
- NAME_EVENT
- NAME_SPACE_EVENT
- PROPERTY_EVENT
- STYLE_EVENT
- USER_PROP_EVENT
- CUSTOM_MSG_EVENT
- EXTENSION_PROPERTY_DEFINITION_EVENT
- NOTIFICATION_EVENT
- VALIDATION_EVENT
- LIBRARY_EVENT
- ATTRIBUTE_EVENT
- DISPOSE_EVENT
- CONTENT_REPLACE_EVENT
- TEMPLATE_TRANSFORM_EVENT

Returns:
  the event type.

### isSame

public boolean isSame(NotificationEvent event)
Compares and justifies whether this event and the given event is the same.

Parameters:
  `event` - the event to compare
Returns:
  true if the two events are the same, otherwise false