Package org.pathvisio.libgpml.model
Class PathwayObjectEvent
java.lang.Object
org.pathvisio.libgpml.model.PathwayObjectEvent
public final class PathwayObjectEvent
extends java.lang.Object
This event is used to notify
PathwayObjectListener
s of changes to
properties of a PathwayElement.
There are three variations on this event:
- Only a single, known property may have changed, that is not a coordinate change.
- Only one of the coordinate properties (x, y, width, height) may have changed.
- Any property may have changed.
isCoordinateChange()
property. Listeners
that are not interested in coordinate changes may use the
affectsProperty(Property)
method to find out if a property of
interest may have changed.- Author:
- Mark Woon
-
Field Summary
Fields Modifier and Type Field Description private boolean
coordinateChange
private java.lang.Object
property
private PathwayObject
pwElement
-
Constructor Summary
Constructors Modifier Constructor Description private
PathwayObjectEvent(PathwayObject elem, java.lang.Object prop, boolean coordinateChange)
Constructor. -
Method Summary
Modifier and Type Method Description boolean
affectsProperty(java.lang.String prop)
Checks if the given dynamic property may have been modified in this event.boolean
affectsProperty(Property prop)
Check if the given static property may have been modified in this event.protected static PathwayObjectEvent
createAllPropertiesEvent(PathwayObject pathwayObject)
Creates an all properties event.protected static PathwayObjectEvent
createCoordinatePropertyEvent(PathwayObject pathwayObject)
Creates a coordinate property event.protected static PathwayObjectEvent
createSinglePropertyEvent(PathwayObject pathwayObject, java.lang.Object property)
Creates a single property event.PathwayObject
getModifiedPathwayObject()
Gets the PathwayElement whose properties have been modified.boolean
isCoordinateChange()
Returns true if this event was caused by a coordinate change (e.g.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
pwElement
-
property
private final java.lang.Object property -
coordinateChange
private final boolean coordinateChange
-
-
Constructor Details
-
PathwayObjectEvent
Constructor.- Parameters:
elem
- the PathwayElement that's been modifiedprop
- the Property on the element that's been modifiedcoordinateChange
- Flag to indicate this event applies to a coordinate change.
-
-
Method Details
-
createSinglePropertyEvent
protected static PathwayObjectEvent createSinglePropertyEvent(PathwayObject pathwayObject, java.lang.Object property)Creates a single property event.- Parameters:
pathwayObject
- the pathway object.property
- the property.- Returns:
- the pathway object event.
-
createAllPropertiesEvent
Creates an all properties event.- Parameters:
pathwayObject
- the pathway object.- Returns:
- the pathway object event.
-
createCoordinatePropertyEvent
Creates a coordinate property event.- Parameters:
pathwayObject
- the pathway object.- Returns:
- the pathway object event.
-
isCoordinateChange
public boolean isCoordinateChange()Returns true if this event was caused by a coordinate change (e.g. movement or resize operation). -
getModifiedPathwayObject
Gets the PathwayElement whose properties have been modified. -
affectsProperty
Check if the given static property may have been modified in this event. Note that this method does not apply to coordinate properties (position, size), these need to be checked withisCoordinateChange()
.- Parameters:
prop
- The property to check.- Returns:
- true if the property may have been modified, false if not.
-
affectsProperty
public boolean affectsProperty(java.lang.String prop)Checks if the given dynamic property may have been modified in this event. Note that this method does not apply to coordinate properties (position, size), these need to be checked withisCoordinateChange()
.- Parameters:
prop
- The property to check.- Returns:
- true if the property may have been modified, false if not.
-