Interface BaseElement

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void accept​(AbstractVisitor visitor)
      Method accepts visitor, and calls method visit < class name > ( this ) of visitor .
      void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
      Registers the listener to the element.
      void atInsert()
      This method is called then this element is added into the project.
      boolean canAdd​(BaseElement element)
      Checks if this element can add given element.
      boolean canAdd​(BaseElement element, boolean checkPermissions)
      Checks if this element can add given element.
      boolean canAddChild()
      Checks if new elements can be added to this element
      boolean canAddInstance​(BaseElement o)
      Checks if this object can add element of given type.
      boolean canBeDeleted()
      Checks if element can be deleted from project.
      boolean canChangeParent​(java.util.Collection elements, BaseElement newParent)
      Returns true, if element can change parent.
      boolean canDeleteChild​(BaseElement child)
      Checks if given element can be deleted from this element.
      java.lang.Object clone()  
      void dispose()
      This method is called when element is removed from the project.
      void firePropertyChange​(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
      Delegates firePropertyChange to the PropertyChangeSupport, the member of this class, which reports a bound property update to any registered listeners.
      java.lang.Class getClassType()
      Gets the type of the element class.
      java.lang.String getHumanName()
      Returns human representation of the element.
      java.lang.String getHumanType()
      Returns human representation of the element type.
      java.lang.String getID()
      Returns the ID of the Element.
      BaseElement getObjectParent()
      Returns the element parent.
      boolean isEditable()
      Checks if element can be edited.
      boolean isParentOf​(BaseElement obj)
      Returns true, if current element is parent of given element.
      void removeAllPropertyChangeListeners()
      Removes all property change listeners from this element.
      void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
      Unregisters the given listener from the element.
      void setID​(java.lang.String id)
      Sets the specified ID to the Element.
      java.lang.String sGetID()
      Returns the actual ID of the Element.
      • Methods inherited from interface java.lang.Comparable

        compareTo
    • Method Detail

      • getID

        @OpenApi
        java.lang.String getID()
        Returns the ID of the Element. If the ID is null, new id for element is generated. Element id is persistence and do not changes during project save/load.
        Returns:
        the ID of the Element.
      • sGetID

        @OpenApi
        java.lang.String sGetID()
        Returns the actual ID of the Element. May return null if ID was not generated or set for this element.
        Returns:
        the ID of the Element.
        See Also:
        getID()
      • setID

        @OpenApi
        void setID​(java.lang.String id)
        Sets the specified ID to the Element.
        Parameters:
        id - the id to be set.
      • getClassType

        @OpenApi
        java.lang.Class getClassType()
        Gets the type of the element class. Every element has its own ClassType. Usually this class type is class of element or class interface of element. All types are registered in ClassTypes.
        Returns:
        the type of the element.
      • addPropertyChangeListener

        @OpenApi
        void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Registers the listener to the element. The given listener will get notifications about property changes in this element.
        Parameters:
        listener - the PropertyChangeListener to be added.
        See Also:
        PropertyChangeSupport
      • removePropertyChangeListener

        @OpenApi
        void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Unregisters the given listener from the element. The given listener will not get any notifications about property changes in this element.
        Parameters:
        listener - the PropertyChangeListener to be removed.
        See Also:
        PropertyChangeSupport
      • removeAllPropertyChangeListeners

        void removeAllPropertyChangeListeners()
        Removes all property change listeners from this element.
      • firePropertyChange

        @OpenApi
        void firePropertyChange​(java.lang.String propertyName,
                                java.lang.Object oldValue,
                                java.lang.Object newValue)
        Delegates firePropertyChange to the PropertyChangeSupport, the member of this class, which reports a bound property update to any registered listeners. No event is fired if old and new values are equal or null.
        Parameters:
        propertyName - the programmatic name of the property that was changed.
        oldValue - the old value of the property
        newValue - the new value of the property
        See Also:
        PropertyChangeSupport
      • atInsert

        void atInsert()
        This method is called then this element is added into the project.
      • dispose

        void dispose()
        This method is called when element is removed from the project.
      • accept

        @OpenApi
        void accept​(AbstractVisitor visitor)
             throws java.lang.Exception
        Method accepts visitor, and calls method visit < class name > ( this ) of visitor . (see Visitor pattern for more details).
        Parameters:
        visitor - which visits this element.
        Throws:
        java.lang.Exception
      • getHumanName

        @OpenApi
        java.lang.String getHumanName()
        Returns human representation of the element. Usually human name is constructed from element class type and name.
        Returns:
        the human name of the element.
      • getHumanType

        @OpenApi
        java.lang.String getHumanType()
        Returns human representation of the element type. Contains only element type without element name.
        Returns:
        the human type of the element.
      • canAdd

        @OpenApi
        boolean canAdd​(BaseElement element)
        Checks if this element can add given element.
        Parameters:
        element - the given element.
        Returns:
        true if this element can add given element.
        See Also:
        canAdd(BaseElement, boolean)
      • canAdd

        @OpenApi
        boolean canAdd​(BaseElement element,
                       boolean checkPermissions)
        Checks if this element can add given element.
        Following rules must be true in order to have result true:
        1.if checkTeamworkLock == true, this element must be locked for edit.
        2.element can add given element as instance (class types are checked).
        3.element can add given element as child (given element is not a parent of current element and etc).
        Parameters:
        element - the element to add.
        checkPermissions - check or not permissions.
        Returns:
        true if element can add given element as child.
      • canDeleteChild

        boolean canDeleteChild​(BaseElement child)
        Checks if given element can be deleted from this element. Follofing rules must be true in order to have result true: 1.this element must be editable. 2.project must be editable. 3.the type of given child must be valid for teamwork lock for edit operation (for example class, package and etc, not Attribute).
        Parameters:
        child - a given child
        Returns:
        true, if given element can be deleted from current element.
      • canBeDeleted

        @OpenApi
        boolean canBeDeleted()
        Checks if element can be deleted from project. Element cannot be deleted if it is not isEditable(), parent is not set or parent does not allow to remove this element.
        Returns:
        true, if element can be deleted from project.
        See Also:
        isEditable()
      • canAddInstance

        boolean canAddInstance​(BaseElement o)
        Checks if this object can add element of given type. Current implementation returns false.
        Returns:
        true if this object can elements of given type.
      • isEditable

        @OpenApi
        boolean isEditable()
        Checks if element can be edited. Element can not be edited in teamwork project, or it is used "by reference" from module.
        Returns:
        true, if element can be edited.
      • canAddChild

        @OpenApi
        boolean canAddChild()
        Checks if new elements can be added to this element
        Returns:
        true, if new sub elements can be added.
      • getObjectParent

        @OpenApi
        BaseElement getObjectParent()
        Returns the element parent. This implementation returns null. Should be overridden in subclasses.
        Returns:
        the parent of the element.
      • isParentOf

        boolean isParentOf​(BaseElement obj)
        Returns true, if current element is parent of given element. Return false in this implementation.
        Parameters:
        obj - the given element(possible child).
        Returns:
        true if obj is parent of this object.
      • canChangeParent

        boolean canChangeParent​(java.util.Collection elements,
                                BaseElement newParent)
        Returns true, if element can change parent.
        Parameters:
        elements - collection of the elements, whose will change the parent together with this.
        newParent - new parent object.
        Returns:
        true if element can change parent.
      • clone

        java.lang.Object clone()
                        throws java.lang.CloneNotSupportedException
        Throws:
        java.lang.CloneNotSupportedException