gishur.x2.gui
Class DisplayXSegment

java.lang.Object
  |
  +--gishur.gui2.DrawAtom
        |
        +--gishur.gui2.DrawObject
              |
              +--gishur.gui2.DisplayObject
                    |
                    +--gishur.gui2.DisplayInteractiveObject
                          |
                          +--gishur.gui2.DisplayInteractiveModel
                                |
                                +--gishur.x2.gui.DisplayXObject
                                      |
                                      +--gishur.x2.gui.DisplayXSegment

public class DisplayXSegment
extends DisplayXObject

This class is a simple visualization class for geometric segments, rays, and straight lines represented by the XSegment class of the core package. The appeareance of the segment is highly configurable by the use of painter classes of the type BasePointPainter and LineSegmentPainter. The painter objects are not locally stored - they are stored in the properties. So it is possible to visualize large sets of segments with this class with almost no overhead. If no point or line painter is specified via properties, a new painter of the type PointPainter/LineSegmentPainter will be created and stored at the local properties list of this object. To use another point/line painter defined in properties higher in the hierachy, one has to remove the automatically created property entry at this objects properties.

Properties Summary
Used Prefix Meaning
xsegment Prefix for all properties used at this class.
xsegment.point Prefix for all properties of the PointPainter used for (real) endpoints (see property point.style at this class).
xsegment.onpoint Prefix for all properties of the PointPainter used for open endpoints (see property onpoint.style at this class).
xsegment.line Prefix for all properties of the LinePainter used for the line segment (see property line.style at this class).
Key Value Type Default value Meaning
point.style Style None The Style which defines the shape of the endpoints and which creates the Painters for them. A point is an endpoint if the line really ends there, i.e. the line must represent a segment or a ray. Otherwise the point is an onpoint (see below).
onpoint.style Style None The Style which defines the shape of the points on the line and which creates the Painters for them.
line.style LineStyle None The Style which defines the shape of the line and which creates the Painter for it.

Created Painters
Painting order Name Type Tasks
1 line LinePainter Recalculates and draws the line.
2 source Painter Recalculates and redraws the source point of the line.
3 target Painter Recalculates and redraws the target point of the line.

Version:
1.0
Author:
Thomas Wolf

Fields inherited from class gishur.gui2.DisplayInteractiveObject
ACTIVE, ACTIVE1, ACTIVE2, ACTIVE3, ACTIVE4, NORMAL, 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
DisplayXSegment(ModelController model)
          Constructs a new DisplayXSegment and connects it with the given ModelController (that must have a XSegment object as source object (model).
DisplayXSegment(XSegment source)
          Constructs a new DisplayXSegment and connects it with the given XSegment via the construction of a new ModelController.
 
Method Summary
protected  void checkActiveElement(java.lang.String element)
          This method is called by DisplayInteractiveObject.activate().
protected  ElementTransform createElementTransform()
          Creates a new element transformation object.
protected  void recalculate(RenderContext context, PropertyStatusReader properties)
          Forces the DrawAtom to recalculate its representation.
 
Methods inherited from class gishur.x2.gui.DisplayXObject
screenX2Transformation
 
Methods inherited from class gishur.gui2.DisplayInteractiveModel
controller, setContoller, setSource, source
 
Methods inherited from class gishur.gui2.DisplayInteractiveObject
activate, activate, active, deactivate, elementTransform, refreshPropertyStatus, select, selected, setActiveElement, setSupportActivation, setSupportElementTransform, setSupportSelection, supportActivation, supportElementTransform, supportSelection, unselect
 
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, 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

DisplayXSegment

public DisplayXSegment(ModelController model)
Constructs a new DisplayXSegment and connects it with the given ModelController (that must have a XSegment object as source object (model).
Parameters:
model - the ModelController that controls the source.

DisplayXSegment

public DisplayXSegment(XSegment source)
Constructs a new DisplayXSegment and connects it with the given XSegment via the construction of a new ModelController.
Parameters:
source - the source object.
Method Detail

recalculate

protected void recalculate(RenderContext context,
                           PropertyStatusReader properties)
Forces the DrawAtom to recalculate its representation. This method will only be called, if it became dirty via a call to the DrawObject.makeDirty(boolean) method or something has happened, that causes all DrawAtoms to recalculate their representation. This method should only be called by the render system.
Overrides:
recalculate in class DrawObject
Parameters:
context - the RenderContext to use
properties - the PropertyStatusReader to use for reading properties

checkActiveElement

protected void checkActiveElement(java.lang.String element)
This method is called by DisplayInteractiveObject.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 DisplayInteractiveObject.setActiveElement(java.lang.String, byte) for each element. Override this method in order to implement element activation correctly.
Overrides:
checkActiveElement in class DisplayInteractiveObject
Parameters:
element - the element name

createElementTransform

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