Class AbstractFeature

    • Method Detail

      • canUndo

        public boolean canUndo​(IContext context)
        Description copied from interface: IFeature
        Decides if the current feature can be undone - this is the undo of the execute operation.
        Specified by:
        canUndo in interface IFeature
        Parameters:
        context - this is the general input for this method
        Returns:
        true if the feature can be undone, false if not
        See Also:
        IContext
      • hasDoneChanges

        public boolean hasDoneChanges()
        Description copied from interface: IFeature
        Is queried by the framework after a feature has been executed to find out if this feature should appear in the undo stack of e.g. an editor. By default all features should appear there (see implementation in AbstractFeature), but features may decide to override this behavior. Note that this is a dynamic attribute of the feature that is queried each time after the feature has been executed.

        IMPORTANT NOTE: The implementor of the feature is responsible for correctly implementing this method! It might lead to inconsistencies in the command stack if this method returns false although the feature did changes.

        Specified by:
        hasDoneChanges in interface IFeature
        Returns:
        true if the feature should appear in the undo stack, false otherwise
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: IDescription
        Gets the description.
        Specified by:
        getDescription in interface IDescription
        Returns:
        the description
      • getName

        public java.lang.String getName()
        Description copied from interface: IName
        Gets the name.
        Specified by:
        getName in interface IName
        Returns:
        the name
      • isAvailable

        public boolean isAvailable​(IContext context)
        Description copied from interface: IFeature
        Decides if the current feature is available with the given context.
        Specified by:
        isAvailable in interface IFeature
        Parameters:
        context - this is the general input for this method
        Returns:
        true if it is available, false if not
        See Also:
        IContext
      • setProgressCallback

        public void setProgressCallback​(IProgress progress)
        Sets the progress callback.
        Parameters:
        progress - the new progress callback
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • addGraphicalRepresentation

        protected PictogramElement addGraphicalRepresentation​(IAreaContext context,
                                                              java.lang.Object newObject)
        Adds the graphical representation.
        Parameters:
        context - the context
        newObject - the new object
        Returns:
        the added pictogram element
      • getAllBusinessObjectsForPictogramElement

        protected java.lang.Object[] getAllBusinessObjectsForPictogramElement​(PictogramElement pe)
        Gets the all business objects for pictogram element.
        Parameters:
        pe - the pe
        Returns:
        the all business objects for pictogram element
      • getBusinessObjectForPictogramElement

        protected java.lang.Object getBusinessObjectForPictogramElement​(PictogramElement pe)
        Gets the business object for pictogram element.
        Parameters:
        pe - the pe
        Returns:
        the business object for pictogram element
      • getDiagram

        protected Diagram getDiagram()
        Gets the diagram.
        Returns:
        the diagram
      • getDiagramBehavior

        protected IDiagramBehavior getDiagramBehavior()
        Gets the diagram behavior.
        Returns:
        the diagram behavior
        Since:
        0.10
      • getProgressCallback

        protected IProgress getProgressCallback()
        Gets the progress callback.
        Returns:
        the progress callback
      • getUserDecision

        protected boolean getUserDecision()
        Gets the user decision.
        Returns:
        the user decision
      • layoutPictogramElement

        protected IReason layoutPictogramElement​(PictogramElement pe)
        Layouts the given PictogramElement. This implementation asks the feature provider for available layout features and processes the first one.
        Parameters:
        pe - the PictogramElement to layout
        Returns:
        a IReason object that indicates if a layout operation has been performed (IReason.toBoolean() is true)
        Since:
        0.9 this method returns now the IReason object, before it simply returned null
      • manageColor

        protected Color manageColor​(IColorConstant colorConstant)
        Manage color.
        Parameters:
        colorConstant - the color constant
        Returns:
        the color
      • manageColor

        protected Color manageColor​(int red,
                                    int green,
                                    int blue)
        Manage color.
        Parameters:
        red - the red
        green - the green
        blue - the blue
        Returns:
        the color
      • manageDefaultFont

        protected Font manageDefaultFont​(Diagram diagram)
        Provides the font instance for the default font (Arial in size 8) by either creating a new one and aggregating it to the diagram or finding it in the diagrams list of fonts.
        Parameters:
        diagram - the diagram that aggregates the fonts
        Returns:
        the font instance
        Since:
        0.10
      • manageFont

        public Font manageFont​(Diagram diagram,
                               java.lang.String name,
                               int size)
        Provides a font instance by either creating a new one and aggregating it to the diagram or finding it in the diagrams list of fonts.
        Parameters:
        diagram - the diagram that aggregates the fonts
        name - the name of the font
        size - the size of the font
        Returns:
        the font instance
        Since:
        0.10
      • manageFont

        public Font manageFont​(Diagram diagram,
                               java.lang.String name,
                               int size,
                               boolean isItalic,
                               boolean isBold)
        Provides a font instance by either creating a new one and aggregating it to the diagram or finding it in the diagrams list of fonts.
        Parameters:
        diagram - the diagram that aggregates the fonts
        name - the name of the font
        size - the size of the font
        isItalic - the is italic
        isBold - the is bold
        Returns:
        the font instance
        Since:
        0.10
      • updatePictogramElement

        protected void updatePictogramElement​(PictogramElement pe)
        Updates the given pictogram element. This implementation asks the feature provider for available update features and processes the first one.
        Parameters:
        pe - the pe