Class 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.
    • 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: 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 java.lang.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:
        child - the child that sent the change-event.
        eventType - the event type
      • 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