Package jpicedt.graphic.model
Class Drawing.RootElement
- java.lang.Object
-
- jpicedt.graphic.model.AbstractElement
-
- jpicedt.graphic.model.BranchElement
-
- jpicedt.graphic.model.Drawing.RootElement
-
- All Implemented Interfaces:
java.lang.Iterable,java.util.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
Constructors Constructor Description RootElement()Construct a new empty RootElementRootElement(java.util.Collection c)create a new BranchElement from the content of the given Collection of Element's.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Objectclone()Returns a clone of this Elementprotected voidfireChangedUpdate(DrawingEvent.EventType eventType)Called each time the content of this RootElement has changed.voidforwardChangedUpdate(Element child, DrawingEvent.EventType eventType)Called by a child to inform of some change that occured to it or one of its children.DrawinggetDrawing()Retrieves the underlying drawing Overriden to return this.intgetFirstPointIndex()Return 0intgetLastPointIndex()Return 0java.lang.StringgetName()Return a non-localised string representing this element's name.ElementgetParent()Gets the parent of the element.PicPointgetPoint(int numPoint, PicPoint src)return nullvoidsetParent(Element p)Sets the parent of the element.voidsetPoint(int numPoint, PicPoint src)Deprecated.use setPoint(int, PicPoint, EditPointConstraint) insteadvoidsetPoint(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
-
-
-
-
Constructor Detail
-
RootElement
public RootElement()
Construct a new empty RootElement
-
RootElement
public 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.- Parameters:
The- Drawing object to clone
-
RootElement
public RootElement(java.util.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 java.lang.String getName()
Description copied from interface:ElementReturn 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 java.lang.Object clone()
Description copied from class:AbstractElementReturns a clone of this Element- Specified by:
clonein interfaceElement- Specified by:
clonein classBranchElement- Returns:
- a deep copy of this Drawing
-
getDrawing
public Drawing getDrawing()
Retrieves the underlying drawing Overriden to return this.- Specified by:
getDrawingin interfaceElement- Overrides:
getDrawingin classAbstractElement- 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:
getParentin interfaceElement- Overrides:
getParentin classAbstractElement- 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:
setParentin interfaceElement- Overrides:
setParentin classAbstractElement
-
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:
fireChangedUpdatein classAbstractElement
-
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 givenchildas the element that changed. This mainly occurs when the geometry of an element is modified.- Specified by:
forwardChangedUpdatein interfaceElement- Overrides:
forwardChangedUpdatein classBranchElement- Parameters:
child- the child that sent the change-event.eventType- the event type
-
getPoint
public PicPoint getPoint(int numPoint, PicPoint src)
return null- Specified by:
getPointin interfaceElement- Overrides:
getPointin classBranchElement- Parameters:
numPoint- the point index, should be greater or equal to the value returned bygetFirstPointIndex, and lower or equal togetLastPointIndex.- Returns:
- the point indexed by
numPoint; ifsrcis null, allocates a new PicPoint and return it, otherwise directly modifiessrcand returns it as well for convenience.
-
setPoint
public void setPoint(int numPoint, PicPoint src)Deprecated.use setPoint(int, PicPoint, EditPointConstraint) insteaddoes nothing- Specified by:
setPointin interfaceElement- Overrides:
setPointin classBranchElement
-
setPoint
public void setPoint(int numPoint, PicPoint src, EditPointConstraint c)does nothing- Specified by:
setPointin interfaceElement- Overrides:
setPointin classBranchElementc- a geometry constraint, or null if no particular constraint is being imposed (aka default).
-
getFirstPointIndex
public int getFirstPointIndex()
Return 0- Specified by:
getFirstPointIndexin interfaceElement- Overrides:
getFirstPointIndexin classBranchElement- 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:
getLastPointIndexin interfaceElement- Overrides:
getLastPointIndexin classBranchElement- Returns:
- the index of the last point that can be retrieved by getPoint This returns PT_ANCHOR.
-
-