Class Shape

    • Constructor Detail

      • Shape

        public Shape​(String resourceId,
                     StencilType stencil)
        Constructs a new shape with id and stencil
        Parameters:
        resourceId - unique shape id, generated by the editor
        stencil - StencilType with stencilId
      • Shape

        public Shape​(String resourceId)
        set a new id for the shape
        Parameters:
        resourceId -
    • Method Detail

      • getParent

        public Shape getParent()
        Returns:
        the parent
      • setParent

        public void setParent​(Shape parent)
        Parameters:
        parent - the parent to set
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getStencilId

        public String getStencilId()
        Description copied from interface: Stencil
        Gives the stencil id of an object
        Specified by:
        getStencilId in interface Stencil
        Returns:
        the id of an associated stencil
      • getResourceId

        public String getResourceId()
        returns the unique shape id, generated by the editor
        Returns:
        the resourceId
      • setResourceId

        public void setResourceId​(String resourceId)
        set unique shape id, usually generated by the editor
        Parameters:
        resourceId - the resourceId to set
      • getProperty

        public String getProperty​(String name)
        Gives the value of the property with the given name
        Parameters:
        name - name of the property
        Returns:
        value of the property or null if no mapping available for the name
      • getProperties

        public HashMap<String,​String> getProperties()
        return a HashMap with all properties, name as key, value as value
        Returns:
        the properties
      • setProperties

        public void setProperties​(HashMap<String,​String> properties)
        set a new property hash map
        Parameters:
        properties - the properties to set
      • putProperty

        public String putProperty​(String key,
                                  String value)
        changes an existing property with the same name, or adds a new one
        Parameters:
        key - property name with which the specified value is to be associated
        value - value to be associated with the specified property name
        Returns:
        the previous value associated with property name, or null if there was no mapping for property name. (A null return can also indicate that the map previously associated null with key.)
      • getStencil

        public StencilType getStencil()
        Gives the Stencil object of the shape
        Returns:
        the stencil associated with the shape
      • setStencil

        public void setStencil​(StencilType stencil)
        Set a new Stencil Object for the shape
        Parameters:
        stencil - the stencil to set
      • getChildShapes

        public ArrayList<Shape> getChildShapes()
        Returns:
        the childShapes
      • setChildShapes

        public void setChildShapes​(ArrayList<Shape> childShapes)
        Parameters:
        childShapes - the childShapes to set
      • getOutgoings

        public ArrayList<Shape> getOutgoings()
        Give an array of outgoing shapes
        Returns:
        the outgoing shape objects of the shape
      • setOutgoings

        public void setOutgoings​(ArrayList<Shape> outgoings)
        Set a new array of outgoing shapes
        Parameters:
        outgoings - the outgoing shapes to set
      • addOutgoing

        public boolean addOutgoing​(Shape out)
        Adds a new shape to the outgoings
        Parameters:
        out - shape to append
        Returns:
        true if add was successful
      • getDockers

        public ArrayList<Point> getDockers()
        Gives the point list of dockers for a shape, dockers usually appears on edges
        Returns:
        the dockers, a list of points
      • setDockers

        public void setDockers​(ArrayList<Point> dockers)
        set a ArrayList with all attached dockers for a shape, dockers usually appears on edges A docker is a point on the canvas
        Parameters:
        dockers - the list of points to set
      • getTarget

        public Shape getTarget()
        Gives the target of shape, which defined another associated shape
        Returns:
        the target shape
      • setTarget

        public void setTarget​(Shape target)
        Set a new target shape for a shape
        Parameters:
        target - the target shape to set
      • getBounds

        public Bounds getBounds()
        Returns the bounds of a shape. Bounds defined the space a shape spans over the canvas
        Returns:
        the bounds object of a shape
      • setBounds

        public void setBounds​(Bounds bounds)
        Set a new bounds for a shape
        Parameters:
        bounds - the bounds to set
      • getUpperLeft

        public Point getUpperLeft()
        Specified by:
        getUpperLeft in interface Bounded
        Returns:
        Point Object of the upper left
      • getLowerRight

        public Point getLowerRight()
        Specified by:
        getLowerRight in interface Bounded
        Returns:
        Point Object of the lower right
      • getGlossaryIds

        public ArrayList<String> getGlossaryIds()
        Returns:
        the glossaryIds
      • setGlossaryIds

        public void setGlossaryIds​(ArrayList<String> glossaryIds)
        Parameters:
        glossaryIds - the glossaryIds to set
      • addGlossaryIds

        public boolean addGlossaryIds​(String id)
      • addIncoming

        public boolean addIncoming​(Shape current)
      • getHeight

        public double getHeight()
        Specified by:
        getHeight in interface Bounded
        Returns:
        The height of the spanned area
      • getWidth

        public double getWidth()
        Specified by:
        getWidth in interface Bounded
        Returns:
        The width of the spanned area