gishur.gui2
Class DisplayInteractiveObject

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

public abstract class DisplayInteractiveObject
extends DisplayObject

DisplayInteractiveObjects extend DisplayObjects by some methods for interaction. They support selection and activation.

Properties Summary
Key Value Type Default value Meaning
active_element java.util.Hashtable - All actual active elements and their active levels.
element_transform gishur.gui2.ElementTransform - The element transformation object for this DisplayObject.

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

Field Summary
static byte ACTIVE
          Layout state constant: object is activated
static byte ACTIVE1
          Layout state constant: Painter active level 1.
static byte ACTIVE2
          Layout state constant: Painter active level 2.
static byte ACTIVE3
          Layout state constant: Painter active level 3.
static byte ACTIVE4
          Layout state constant: Painter active level 4.
static byte NORMAL
          Layout state constant: normal state
static byte SELECTED
          Layout state constant: object is selected
 
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 DisplayInteractiveObject(java.lang.String propertyprefix)
          Constructs a new DisplayInteractiveObject which uses the specified property prefix for all properties it needs.
 
Method Summary
 void activate()
          Activates this DisplayInteractiveObject if it supports activation.
 void activate(java.lang.String active_element)
          Activates this DisplayInteractiveObject if it supports activation.
 boolean active()
          Returns true, if this DisplayInteractiveObject is active.
protected  void checkActiveElement(java.lang.String element)
          This method is called by activate().
protected  ElementTransform createElementTransform()
          Creates a new element transformation object.
 void deactivate()
          Deactivates this DisplayObject.
 ElementTransform elementTransform()
          Returns the element transformation object for this object.
protected  void refreshPropertyStatus(PropertyStatusReader prop, java.lang.String element_name)
          Refreshes the state of the given PropertyStatusReader according to the state of this DisplayInteractiveObject and to the given element.
 void select()
          Selects this DisplayInteractiveObject if it supports selection.
 boolean selected()
          Returns true, if this DisplayObject is selected.
protected  void setActiveElement(java.lang.String element_name, byte active_level)
          Sets the activated elements and their active levels.
protected  boolean setSupportActivation(boolean activation)
          Permits or denies the DisplayInteractiveObject to support activation.
 boolean setSupportElementTransform(boolean element_transform)
          Permits or denies the DisplayObject to support element transformation.
protected  boolean setSupportSelection(boolean selection)
          Permits or denies the DisplayObject to support selection.
 java.lang.Object source()
          Returns the source object of this DisplayInteractiveObject This method must be overwritten properly.
 boolean supportActivation()
          Returns true, if the DisplayInteractiveObject supports activation.
 boolean supportElementTransform()
          Returns true, if this object supports element transformations.
 boolean supportSelection()
          Returns true, if the DisplayInteractiveObject supports selection.
 void unselect()
          Unselects this DisplayInteractiveObject.
 
Methods inherited from class gishur.gui2.DisplayObject
addEventListener, calculateDockingPoint, calculateDockingPoint, next, parent, prev, processDrawEvent, removeEventListener
 
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
 

Field Detail

NORMAL

public static final byte NORMAL
Layout state constant: normal state

SELECTED

public static final byte SELECTED
Layout state constant: object is selected

ACTIVE

public static final byte ACTIVE
Layout state constant: object is activated

ACTIVE1

public static final byte ACTIVE1
Layout state constant: Painter active level 1.

ACTIVE2

public static final byte ACTIVE2
Layout state constant: Painter active level 2.

ACTIVE3

public static final byte ACTIVE3
Layout state constant: Painter active level 3.

ACTIVE4

public static final byte ACTIVE4
Layout state constant: Painter active level 4.
Constructor Detail

DisplayInteractiveObject

protected DisplayInteractiveObject(java.lang.String propertyprefix)
Constructs a new DisplayInteractiveObject which uses the specified property prefix for all properties it needs. Selection support, activation support and element transformation support will be enabled by default.
Parameters:
propertyprefix - the prefix string for all properties used
Method Detail

source

public java.lang.Object source()
Returns the source object of this DisplayInteractiveObject This method must be overwritten properly. The default implementation returns null.
Returns:
source object.

supportSelection

public boolean supportSelection()
Returns true, if the DisplayInteractiveObject supports selection.
Returns:
true, if the DisplayInteractiveObject supports selection.

setSupportSelection

protected boolean setSupportSelection(boolean selection)
Permits or denies the DisplayObject to support selection.
Parameters:
selection - if true selection will be supported
Returns:
Old status of selection support.

selected

public final boolean selected()
Returns true, if this DisplayObject is selected.
Returns:
the selected status.

select

public final void select()
Selects this DisplayInteractiveObject if it supports selection. This will generate a DrawEvent (if the event mask for selection is enabled) and cause this DisplayInteractiveObject to repaint itself via a call to DrawObject.makeDirty(boolean).
See Also:
supportSelection(), selected(), unselect()

unselect

public final void unselect()
Unselects this DisplayInteractiveObject. This will generate a DrawEvent (if the event mask for selection is enabled) and cause this DisplayInteractiveObject to repaint itself via a call to DrawObject.makeDirty(boolean).
See Also:
selected(), select()

supportActivation

public boolean supportActivation()
Returns true, if the DisplayInteractiveObject supports activation.
Returns:
true, if the DisplayInteractiveObject supports activation.

setSupportActivation

protected boolean setSupportActivation(boolean activation)
Permits or denies the DisplayInteractiveObject to support activation.
Parameters:
activation - if true activation will be supported
Returns:
Old status of activation support.

active

public final boolean active()
Returns true, if this DisplayInteractiveObject is active.
Returns:
the active status.

activate

public final void activate()
Activates this DisplayInteractiveObject if it supports activation. This will generate a DrawEvent (if the event mask for activation is enabled) and cause this DisplayInteractiveObject to repaint itself via a call to DrawObject.makeDirty(boolean).
See Also:
supportActivation(), active(), deactivate()

activate

public final void activate(java.lang.String active_element)
Activates this DisplayInteractiveObject if it supports activation. This will generate a DrawEvent (if the event mask for activation is enabled) and cause this DisplayInteractiveObject to repaint itself via a call to DrawObject.makeDirty(boolean). In addition to activate() this method allows to specify an active element name (that could be a shape name. The checkActiveElement(java.lang.String) method will be called in order to verify the element name and to set elements to various active levels vi the setActiveElement(java.lang.String, byte) method.
Parameters:
active_element - the active element
See Also:
activate(), active(), deactivate()

setActiveElement

protected final void setActiveElement(java.lang.String element_name,
                                      byte active_level)
Sets the activated elements and their active levels. This method should be called by the overwritten checkActiveElement(java.lang.String) method.
Parameters:
element_name - the name of the activated element
active_level - the active level of the element (one of {ACTIVE1,ACTIVE2,ACTIVE3, ACTIVE3})

checkActiveElement

protected void checkActiveElement(java.lang.String element)
This method is called by activate(). It should check, which elements should be set to which activation level if one does activate the element with the given name. To specify the activated elements and their activation levels, call setActiveElement(java.lang.String, byte) for each element. Overwrite this method in order to implement element activation correctly.
Parameters:
element - the element name

deactivate

public final void deactivate()
Deactivates this DisplayObject. This will generate a DrawEvent (if the event mask for activation is enabled) and cause this DisplayObject to repaint itself via a call to DrawObject.makeDirty(boolean).
See Also:
active(), activate()

refreshPropertyStatus

protected void refreshPropertyStatus(PropertyStatusReader prop,
                                     java.lang.String element_name)
Refreshes the state of the given PropertyStatusReader according to the state of this DisplayInteractiveObject and to the given element. This method will be called by PropertyStatusReader#refreshStatus
Parameters:
prop - the PropertyStatusReader to synchronize
element_name - the element name to synchronize

supportElementTransform

public boolean supportElementTransform()
Returns true, if this object supports element transformations. In this case the method createElementTransform() should be overwritten and return a value not null. One can get the element transformation object via elementTransform().
Returns:
true, if this object supports element transformations
See Also:
setSupportElementTransform(boolean)

setSupportElementTransform

public boolean setSupportElementTransform(boolean element_transform)
Permits or denies the DisplayObject to support element transformation.
Parameters:
oldtrans - if true element transformation will be supported
Returns:
Old status of element transformation support.

elementTransform

public ElementTransform elementTransform()
Returns the element transformation object for this object. Only one single object instance will be created for each DisplayObject. The created instance will be stored in the local properties under the key "element_transform".
Returns:
The element transformation object for this object.

createElementTransform

protected ElementTransform createElementTransform()
Creates a new element transformation object. This method will be called by elementTransform() and should be overwritten by subclasses in order to support element transformation objects correctly.
Returns:
new element transformation object for this DisplayInteractiveObject.