gishur.gui2
Class DisplayObject

java.lang.Object
  |
  +--gishur.gui2.DrawAtom
        |
        +--gishur.gui2.DrawObject
              |
              +--gishur.gui2.DisplayObject
Direct Known Subclasses:
DisplayInteractiveObject, DisplayModel

public abstract class DisplayObject
extends DrawObject

The basis class for all higher-level drawable objects. DisplayObjects can be inserted into Layers and DisplayGroups. DisplayObject extends DrawObject by the support of Painters for flexible and easy drawing, a PropertyStatusReader that can be used to read properties easily and EventListeners to process internal DrawEvents outside of the DisplayObject.

Version:
1.0
Author:
Thomas Wolf
See Also:
Layer, DisplayGroup

Fields inherited from class gishur.gui2.DrawAtom
BLOCK_REPAINT, MARK_RECALC, MARK_REPAINT, MARK_SIZE, REPAINT, UNBLOCK_REPAINT, USER_STATES_FIRST, USER_STATES_MASK
 
Constructor Summary
protected DisplayObject(java.lang.String property_prefix)
          Constructs a new DisplayObject which uses the given prefix for all properties.
 
Method Summary
 void addEventListener(java.util.EventListener listener)
          Adds the given EventListener to this DisplayObject.
 java.awt.Point calculateDockingPoint(int x, int y)
          Calculates a docking point, that means a point on the outline of the DisplayObject, that lies nearest to the given point.
 java.awt.Point calculateDockingPoint(java.awt.Point p)
          Calculates a docking point, that means a point on the outline of the DisplayObject, that lies nearest to the given point.
 DrawObject next()
          Returns the next DrawObject in the group or null if it is the last group element.
 DrawObject parent()
          Returns the parent group of this DrawObject.
 DrawObject prev()
          Returns the previous DrawObject in the group or null if it is the first group element.
protected  void processDrawEvent(DrawEvent e)
          Processes DrawEvents occuring on this DisplayObject.
 void removeEventListener(java.util.EventListener listener)
          Removes the specified EventListener from this DisplayObject.
 
Methods inherited from class gishur.gui2.DrawObject
addDrawDependency, addPainter, blockRepaint, checkState, checkStateCleared, child, clear, clearCache, clearState, dependency, dirty, disableEvents, draw, draw, enableEvents, ensureRecalculate, findPainter, firstPainter, fullscreen, hide, hide, insert, levelMask, levelUsed, locate, makeDirty, makeDirty, next, nextPainter, prepeareRenderContext, prev, processEvent, propertyReader, recalculate, recalculate, remove, removeDrawDependency, repaint, screenTransformation, setFullscreen, setPaintBeforeMembers, setScreenTransformation, setState, show, show, state, state, unblockRepaint, unblockRepaint, visible
 
Methods inherited from class gishur.gui2.DrawAtom
addProperties, collectHits, dispatchEvent, displayManager, drawComponent, getBounds, getLocalProperty, getProperty, getProperty, getRequiredProperty, preprocessEvent, processMessage, properties, removeProperty, sendEvent, sendMessage, setBounds, setPropertiesTo, setProperty, setProperty, setProperty, setProperty, toString, toString, toStringDetail, toTreeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DisplayObject

protected DisplayObject(java.lang.String property_prefix)
Constructs a new DisplayObject which uses the given prefix for all properties.
Parameters:
property_prefix - the prefix string used for all read properties
Method Detail

calculateDockingPoint

public java.awt.Point calculateDockingPoint(int x,
                                            int y)
Calculates a docking point, that means a point on the outline of the DisplayObject, that lies nearest to the given point. The implementation of this method calls Painter.calculateDockingPoint(int, int) of the first Painter of this DisplayObject. Overwrite this method in order to return correct docking points.
Parameters:
x,y - point, where to come from for docking.
Returns:
docking point

calculateDockingPoint

public final java.awt.Point calculateDockingPoint(java.awt.Point p)
Calculates a docking point, that means a point on the outline of the DisplayObject, that lies nearest to the given point. The implementation of this method calls Painter.calculateDockingPoint(int, int) of the first Painter of this DisplayObject. Overwrite this method in order to return correct docking points.
Parameters:
x,y - point, where to come from for docking.
Returns:
docking point

addEventListener

public void addEventListener(java.util.EventListener listener)
Adds the given EventListener to this DisplayObject. Known listeners will cause this method to enable the appropriate event types to be delivered to DrawObject.processEvent(java.awt.AWTEvent). Event processing to the registered listeners works only with known event listeners.

The supported listeners are:

Parameters:
listener - new EventListener

removeEventListener

public void removeEventListener(java.util.EventListener listener)
Removes the specified EventListener from this DisplayObject.
Parameters:
listener - the EventListener to remove

processDrawEvent

protected void processDrawEvent(DrawEvent e)
Processes DrawEvents occuring on this DisplayObject. This methods delivers the events to all registered EventListeners.

The supported listeners are:

Overrides:
processDrawEvent in class DrawObject
Parameters:
e - DrawEvent to process

next

public DrawObject next()
Returns the next DrawObject in the group or null if it is the last group element.
Overrides:
next in class DrawObject
Returns:
next DrawObject

prev

public DrawObject prev()
Returns the previous DrawObject in the group or null if it is the first group element.
Overrides:
prev in class DrawObject
Returns:
previous DrawObject

parent

public DrawObject parent()
Returns the parent group of this DrawObject.
Overrides:
parent in class DrawObject
Returns:
parent