http://www.jpicedt.org

jpicedt.graphic.model
Class Drawing.RootElement

java.lang.Object
  extended byjpicedt.graphic.model.AbstractElement
      extended byjpicedt.graphic.model.BranchElement
          extended byjpicedt.graphic.model.Drawing.RootElement
All Implemented Interfaces:
Collection, Element, PicObjectConstants
Enclosing class:
Drawing

public class Drawing.RootElement
extends BranchElement

the Element that is the root of the tree of Element's in this Drawing. Children can be directly added to this RootElement (i.e. instead of using the Drawing API), since changed-update are always forwarded to the hosting drawing.


Field Summary
 
Fields inherited from class jpicedt.graphic.model.BranchElement
changeLock, children, ptsX, ptsY
 
Fields inherited from class jpicedt.graphic.model.AbstractElement
attributeSet, parent, view
 
Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
ARROW_GLOBAL_SCALE_LENGTH, ARROW_GLOBAL_SCALE_WIDTH, ARROW_INSET_SCALE, ARROW_LENGTH_SCALE, ARROW_WIDTH_LINEWIDTH_SCALE, ARROW_WIDTH_MINIMUM_MM, BRACKET_LENGTH_SCALE, CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MIDDLE, NONE, OUTER, OVER_STRIKE, OVER_STRIKE_COLOR, OVER_STRIKE_WIDTH, POLYDOTS_ANGLE, POLYDOTS_CIRCLE, POLYDOTS_DISK, POLYDOTS_PENTAGON, POLYDOTS_PENTAGON_FILLED, POLYDOTS_PLUS, POLYDOTS_SCALE_H, POLYDOTS_SCALE_V, POLYDOTS_SIZE_LINEWIDTH_SCALE, POLYDOTS_SIZE_MINIMUM_MM, POLYDOTS_SQUARE, POLYDOTS_SQUARE_FILLED, POLYDOTS_STYLE, POLYDOTS_SUPERIMPOSE, POLYDOTS_TRIANGLE, POLYDOTS_TRIANGLE_FILLED, PS_POINT, PST_CUSTOM, RBRACKET_LENGTH_SCALE, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, TBAR_WIDTH_LINEWIDTH_SCALE, TBAR_WIDTH_MINIMUM_MM, TEXT_BOX_CIRCLE, TEXT_BOX_NO_FRAME, TEXT_BOX_OVAL, TEXT_BOX_RECTANGLE, TEXT_FRAME, TEXT_HALIGN_CENTER, TEXT_HALIGN_LEFT, TEXT_HALIGN_RIGHT, TEXT_HOR_ALIGN, TEXT_ROTATION, TEXT_VALIGN_BASELINE, TEXT_VALIGN_BOTTOM, TEXT_VALIGN_CENTER, TEXT_VALIGN_TOP, TEXT_VERT_ALIGN, VLINES, VLINES_FILLED
 
Constructor Summary
Drawing.RootElement()
          Construct a new empty RootElement
Drawing.RootElement(BranchElement e)
          construct a new RootElement whose content is initialized from the content of the given BranchElement Children are cloned beforehands, so it's perfectly safe to use this constructor when one doesn't want to modify the initial content of the given BranchElement.
Drawing.RootElement(Collection c)
          create a new BranchElement from the content of the given Collection of Element's.
 
Method Summary
 Object clone()
          Returns a clone of this Element
protected  void fireChangedUpdate(DrawingEvent.EventType eventType)
          Called each time the content of this RootElement has changed.
 void forwardChangedUpdate(Element child, DrawingEvent.EventType eventType)
          Called by a child to inform of some change that occured to it or one of its children.
 Drawing getDrawing()
          Retrieves the underlying drawing Overriden to return this.
 int getFirstPointIndex()
          Return 0
 int getLastPointIndex()
          Return 0
 String getName()
          Return a non-localised string representing this element's name.
 Element getParent()
          Gets the parent of the element.
 PicPoint getPoint(int numPoint, PicPoint src)
          return null
 void setParent(Element p)
          Sets the parent of the element.
 void setPoint(int numPoint, PicPoint src)
          Deprecated. use setPoint(int, PicPoint, EditPointConstraint) instead
 void setPoint(int numPoint, PicPoint src, EditPointConstraint c)
          does nothing
 
Methods inherited from class jpicedt.graphic.model.BranchElement
add, addAll, addChild, addChild, bringBackward, bringForward, bringToBack, bringToFront, children, clear, contains, contains, containsAll, containsClass, createFilteredCollection, equals, getAllowsChildren, getBoundingBox, getChildAt, getChildCount, getChildIndex, getPointX, getPointY, isEmpty, isToBack, isToFront, iterator, remove, removeAll, removeAllChildren, removeChild, removeView, replaceChild, retainAll, rotate, scale, scale, setAttribute, setAttributeSet, setViewFromFactory, shear, size, toArray, toArray, toString, translate, updateBoundingBox
 
Methods inherited from class jpicedt.graphic.model.AbstractElement
anchorPointsIterator, getAttribute, getAttributeSet, getView
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
hashCode
 

Constructor Detail

Drawing.RootElement

public Drawing.RootElement()
Construct a new empty RootElement


Drawing.RootElement

public Drawing.RootElement(BranchElement e)
construct a new RootElement whose content is initialized from the content of the given BranchElement Children are cloned beforehands, so it's perfectly safe to use this constructor when one doesn't want to modify the initial content of the given BranchElement.


Drawing.RootElement

public Drawing.RootElement(Collection c)
create a new BranchElement from the content of the given Collection of Element's. Children are cloned as well (i.e. this isa deep copy).

Method Detail

getName

public String getName()
Description copied from interface: Element
Return a non-localised string representing this element's name. This may be used by a UI to display some information related to this element, or by a localizer to fetch a i18n'd string.

Returns:
the name of this element

clone

public Object clone()
Description copied from class: AbstractElement
Returns a clone of this Element

Specified by:
clone in interface Element
Specified by:
clone in class BranchElement
Returns:
a deep copy of this Drawing

getDrawing

public Drawing getDrawing()
Retrieves the underlying drawing Overriden to return this.

Specified by:
getDrawing in interface Element
Overrides:
getDrawing in class AbstractElement
Returns:
the drawing ; null if this AbstractElement doesn't belong to any drawing yet.

getParent

public Element getParent()
Gets the parent of the element. Overriden to return null (root element has no parent)

Specified by:
getParent in interface Element
Overrides:
getParent in class AbstractElement
Returns:
the parent

setParent

public void setParent(Element p)
Sets the parent of the element. This implementation does nothing, since this root-element has no parent.

Specified by:
setParent in interface Element
Overrides:
setParent in class AbstractElement

fireChangedUpdate

protected void fireChangedUpdate(DrawingEvent.EventType eventType)
Called each time the content of this RootElement has changed. This fires the change to the hosting drawing.
Ex : called addChild() on this RootElement -> fires an INSERT event.

Overrides:
fireChangedUpdate in class AbstractElement

forwardChangedUpdate

public void forwardChangedUpdate(Element child,
                                 DrawingEvent.EventType eventType)
Called by a child to inform of some change that occured to it or one of its children. This fires a DrawingEvent with the given child as the element that changed. This mainly occurs when the geometry of an element is modified.

Specified by:
forwardChangedUpdate in interface Element
Overrides:
forwardChangedUpdate in class BranchElement
Parameters:
eventType - the event type
child -

getPoint

public PicPoint getPoint(int numPoint,
                         PicPoint src)
return null

Specified by:
getPoint in interface Element
Overrides:
getPoint in class BranchElement
Parameters:
numPoint - the point index, should be greater or equal to the value returned by getFirstPointIndex, and lower or equal to getLastPointIndex.
Returns:
the point indexed by numPoint ; if src is null, allocates a new PicPoint and return it, otherwise directly modifies src and returns it as well for convenience.

setPoint

public void setPoint(int numPoint,
                     PicPoint src)
Deprecated. use setPoint(int, PicPoint, EditPointConstraint) instead

does nothing

Specified by:
setPoint in interface Element
Overrides:
setPoint in class BranchElement

setPoint

public void setPoint(int numPoint,
                     PicPoint src,
                     EditPointConstraint c)
does nothing

Specified by:
setPoint in interface Element
Overrides:
setPoint in class BranchElement

getFirstPointIndex

public int getFirstPointIndex()
Return 0

Specified by:
getFirstPointIndex in interface Element
Overrides:
getFirstPointIndex in class BranchElement
Returns:
the index of the first point that can be retrieved by getPoint This returns PT_ANCHOR.

getLastPointIndex

public int getLastPointIndex()
Return 0

Specified by:
getLastPointIndex in interface Element
Overrides:
getLastPointIndex in class BranchElement
Returns:
the index of the last point that can be retrieved by getPoint This returns PT_ANCHOR.

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org