com.nwoods.jgo
Class JGoDocumentEvent

java.lang.Object
  extended byjava.util.EventObject
      extended bycom.nwoods.jgo.JGoDocumentEvent
All Implemented Interfaces:
java.io.Serializable

public class JGoDocumentEvent
extends java.util.EventObject

This class defines the event object passed to JGoDocumentListeners when events of interest occur on the JGoDocument.

The nature of the event is determined by the Hint value. Some events will be about changes to a JGoObject in the document; in such cases the JGoObject property will not be null. For other events, an Object may provide useful information; in such cases the Object property will not be null. Some events may need additional descriptive information; the Flags property can provide that.

In particular, a CHANGED event uses the Flags property as a sub-hint to indicate the kind of change that happened to the JGoObject, and a previous value may be available. Depending on the type of the previous value, you will have to use the appropriate method. Typically integer and boolean properties will have the previous value accessible via getPreviousValueInt(); all other data types will be stored as Objects that can be accessed via getPreviousValue().

You may define your own hint values greater than LAST.

See Also:
JGoDocumentListener, JGoDocument, JGoViewEvent, Serialized Form

Field Summary
static int ABORTED_TRANSACTION
          Raised by JGoDocument.endTransaction(false) for an outer-level transaction that is aborted
static int ARRANGED
          The top-level objects of the document have been moved/rearranged
static int BEFORE_CHANGING
          A special hint modifier used before a change occurs when passing all of the previous state information as part of a regular document event would be impractical.
static int CHANGED
          An object was modified
static int FINISHED_REDO
           
static int FINISHED_TRANSACTION
          Raised by JGoDocument.endTransaction after committing an outer-level transaction
static int FINISHED_UNDO
           
static int INSERTED
          An object was added to the document
static int LAST
          The end of the predefined hints
static int LAYER_IDENTIFIER_CHANGED
          A layer's identifier property has been changed
static int LAYER_INSERTED
          A layer has been added
static int LAYER_MODIFIABLE_CHANGED
          A layer's modifiable property has been changed
static int LAYER_MOVED
          A layer has been moved in the Z-order
static int LAYER_REMOVED
          A layer has been removed
static int LAYER_TRANSPARENCY_CHANGED
          A layer's transparency property has been changed
static int LAYER_VISIBLE_CHANGED
          A layer's visibility has been changed
static int MAINTAINS_PARTID_CHANGED
          Whether the document keeps track of JGoIdentifiableParts has changed
static int MODIFIABLE_CHANGED
          The user-modifiable property was changed
static int PAPER_COLOR_CHANGED
          The paper color was changed
static int REMOVED
          An object was removed from the document
static int SIZE_CHANGED
          The size of the document changed
static int STARTED_TRANSACTION
          Raised by JGoDocument.startTransaction after starting an outer-level transaction
static int STARTING_REDO
           
static int STARTING_UNDO
           
static int TOPLEFT_CHANGED
          The top-left corner for the document was changed
static int UPDATE_ALL
          The document changed a lot; all listeners need to refresh.
static int VALID_CYCLE_CHANGED
          Whether the document keeps permits users to draw cycles of links has changed
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
JGoDocumentEvent(JGoDocument source, int hint, int flags, java.lang.Object obj)
          Construct a new JGoDocument event without previous value information.
JGoDocumentEvent(JGoDocument source, int hint, int flags, java.lang.Object obj, int prevInt, java.lang.Object prevObj)
          Construct a new JGoDocument event with previous property value information.
 
Method Summary
 int getFlags()
          Return the flags assocated with this event.
 int getHint()
          Return the hint assocated with this event.
 JGoObject getJGoObject()
          Return the JGoObject assocated with this event or null if there is no particular JGoObject associated with the event.
 java.lang.Object getObject()
          Return the Object assocated with this event or null if there is no particular object associated with the event.
 java.lang.Object getPreviousValue()
          For events describing an object that has changed (i.e., the hint is CHANGED), the original value of the property described by the sub-hint/flags may be available as an Object, depending on the sub-hint and property type.
 int getPreviousValueInt()
          For events describing an object that has changed (i.e., the hint is CHANGED), the original value of the property described by the sub-hint/flags may be available as an integer, depending on the sub-hint and property type.
 boolean isBeforeChanging()
          This predicate returns true when representing an event that occurs before the described change has happened.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UPDATE_ALL

public static final int UPDATE_ALL
The document changed a lot; all listeners need to refresh.

See Also:
Constant Field Values

STARTED_TRANSACTION

public static final int STARTED_TRANSACTION
Raised by JGoDocument.startTransaction after starting an outer-level transaction

See Also:
Constant Field Values

FINISHED_TRANSACTION

public static final int FINISHED_TRANSACTION
Raised by JGoDocument.endTransaction after committing an outer-level transaction

See Also:
Constant Field Values

ABORTED_TRANSACTION

public static final int ABORTED_TRANSACTION
Raised by JGoDocument.endTransaction(false) for an outer-level transaction that is aborted

See Also:
Constant Field Values

STARTING_UNDO

public static final int STARTING_UNDO
See Also:
Constant Field Values

FINISHED_UNDO

public static final int FINISHED_UNDO
See Also:
Constant Field Values

STARTING_REDO

public static final int STARTING_REDO
See Also:
Constant Field Values

FINISHED_REDO

public static final int FINISHED_REDO
See Also:
Constant Field Values

INSERTED

public static final int INSERTED
An object was added to the document

See Also:
Constant Field Values

CHANGED

public static final int CHANGED
An object was modified

See Also:
Constant Field Values

REMOVED

public static final int REMOVED
An object was removed from the document

See Also:
Constant Field Values

SIZE_CHANGED

public static final int SIZE_CHANGED
The size of the document changed

See Also:
Constant Field Values

PAPER_COLOR_CHANGED

public static final int PAPER_COLOR_CHANGED
The paper color was changed

See Also:
Constant Field Values

MODIFIABLE_CHANGED

public static final int MODIFIABLE_CHANGED
The user-modifiable property was changed

See Also:
Constant Field Values

TOPLEFT_CHANGED

public static final int TOPLEFT_CHANGED
The top-left corner for the document was changed

See Also:
Constant Field Values

LAYER_INSERTED

public static final int LAYER_INSERTED
A layer has been added

See Also:
Constant Field Values

LAYER_REMOVED

public static final int LAYER_REMOVED
A layer has been removed

See Also:
Constant Field Values

LAYER_MOVED

public static final int LAYER_MOVED
A layer has been moved in the Z-order

See Also:
Constant Field Values

LAYER_VISIBLE_CHANGED

public static final int LAYER_VISIBLE_CHANGED
A layer's visibility has been changed

See Also:
Constant Field Values

LAYER_MODIFIABLE_CHANGED

public static final int LAYER_MODIFIABLE_CHANGED
A layer's modifiable property has been changed

See Also:
Constant Field Values

LAYER_TRANSPARENCY_CHANGED

public static final int LAYER_TRANSPARENCY_CHANGED
A layer's transparency property has been changed

See Also:
Constant Field Values

LAYER_IDENTIFIER_CHANGED

public static final int LAYER_IDENTIFIER_CHANGED
A layer's identifier property has been changed

See Also:
Constant Field Values

ARRANGED

public static final int ARRANGED
The top-level objects of the document have been moved/rearranged

See Also:
Constant Field Values

MAINTAINS_PARTID_CHANGED

public static final int MAINTAINS_PARTID_CHANGED
Whether the document keeps track of JGoIdentifiableParts has changed

See Also:
Constant Field Values

VALID_CYCLE_CHANGED

public static final int VALID_CYCLE_CHANGED
Whether the document keeps permits users to draw cycles of links has changed

See Also:
Constant Field Values

BEFORE_CHANGING

public static final int BEFORE_CHANGING
A special hint modifier used before a change occurs when passing all of the previous state information as part of a regular document event would be impractical. This flag should be OR'ed with the regular event hint if invoked by JGoDocument.fireForedate (or, indirectly, by JGoObject.foredate).

This is basically useful for Undo processing, to record the state of the document or layer or object before anything happens. Listeners other than Undo/Redo listeners may choose to ignore all events whose hint has this flag turned on.

See Also:
Constant Field Values

LAST

public static final int LAST
The end of the predefined hints

See Also:
Constant Field Values
Constructor Detail

JGoDocumentEvent

public JGoDocumentEvent(JGoDocument source,
                        int hint,
                        int flags,
                        java.lang.Object obj)
Construct a new JGoDocument event without previous value information.

Parameters:
source - the JGoDocument that is the source of the event.
hint - identifies the type of event.
flags - additional information about the event.
obj - the Object, sometimes a JGoObject, associated with the event.

JGoDocumentEvent

public JGoDocumentEvent(JGoDocument source,
                        int hint,
                        int flags,
                        java.lang.Object obj,
                        int prevInt,
                        java.lang.Object prevObj)
Construct a new JGoDocument event with previous property value information.

Parameters:
source - the JGoDocument that is the source of the event.
hint - identifies the type of event.
flags - additional information about the event.
obj - the Object, sometimes a JGoObject, associated with the event.
prevInt - the previous integer value for an object's property if specified by the flags sub-hint
prevObj - the previous object value for an object's property if specified by the flags sub-hint
Method Detail

getHint

public int getHint()
Return the hint assocated with this event. The hint identifies what type of update is occurring. Predefined hints, such as a document object having been CHANGED, are defined in this class.

The value will not have the BEFORE_CHANGING flag turned on. Use the isBeforeChanging() predicate to determine if this document event was fired by JGoDocument.fireForedate instead of fireUpdate.


getFlags

public int getFlags()
Return the flags assocated with this event. The flags value is dependent on the kind of event, and is usually a subhint.


getJGoObject

public JGoObject getJGoObject()
Return the JGoObject assocated with this event or null if there is no particular JGoObject associated with the event.


getObject

public java.lang.Object getObject()
Return the Object assocated with this event or null if there is no particular object associated with the event.


getPreviousValue

public java.lang.Object getPreviousValue()
For events describing an object that has changed (i.e., the hint is CHANGED), the original value of the property described by the sub-hint/flags may be available as an Object, depending on the sub-hint and property type.


getPreviousValueInt

public int getPreviousValueInt()
For events describing an object that has changed (i.e., the hint is CHANGED), the original value of the property described by the sub-hint/flags may be available as an integer, depending on the sub-hint and property type.


isBeforeChanging

public boolean isBeforeChanging()
This predicate returns true when representing an event that occurs before the described change has happened. Such events only occur for the benefit of document listeners that are undo/redo managers. These events also only happen for those document and/or object mutations that are too complicated or expensive to describe with the previous values normally passed by update or fireUpdate methods through the document event.