Documentation of 'org.jhotdraw.draw.GraphicalCompositeFigure' Java class
GraphicalCompositeFigure
org.jhotdraw.draw

Class GraphicalCompositeFigure

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, CompositeFigure, Figure, DOMStorable
    Direct Known Subclasses:
    ListFigure, TaskFigure


    public class GraphicalCompositeFigure
    extends AbstractCompositeFigure
    The GraphicalCompositeFigure fills in the gap between a CompositeFigure and other figures which mainly have a presentation purpose. The GraphicalCompositeFigure can be configured with any Figure which takes over the task for rendering the graphical presentation for a CompositeFigure. Therefore, the GraphicalCompositeFigure manages contained figures like a CompositeFigure does, but delegates its graphical presentation to another (graphical) figure which purpose it is to draw the container for all contained figures. The GraphicalCompositeFigure adds to the CompositeFigure by containing a presentation figure by default which can not be removed. Normally, the CompositeFigure can not be seen without containing a figure because it has no mechanism to draw itself. It instead relies on its contained figures to draw themselves thereby giving the CompositeFigure its appearance. However, the GraphicalCompositeFigure's presentation figure can draw itself even when the GraphicalCompositeFigure contains no other figures. The GraphicalCompositeFigure also uses a Layouter to lay out its child figures.
    See Also:
    Serialized Form
    • Constructor Detail

      • GraphicalCompositeFigure

        public GraphicalCompositeFigure()
        Default constructor which uses nothing as presentation figure. This constructor is needed by the Storable mechanism.
      • GraphicalCompositeFigure

        public GraphicalCompositeFigure(@Nullable
                                        Figure newPresentationFigure)
        Constructor which creates a GraphicalCompositeFigure with a given graphical figure for presenting it.
        Parameters:
        newPresentationFigure - figure which renders the container
    • Method Detail

      • getBounds

        public java.awt.geom.Rectangle2D.Double getBounds()
        Return the logcal display area. This method is delegated to the encapsulated presentation figure.
        Specified by:
        getBounds in interface Figure
        Overrides:
        getBounds in class AbstractCompositeFigure
      • contains

        public boolean contains(java.awt.geom.Point2D.Double p)
        Description copied from interface: Figure
        Checks if a point is contained by the figure.

        This is used for hit testing by Tool's.

        Specified by:
        contains in interface Figure
        Overrides:
        contains in class AbstractCompositeFigure
      • addNotify

        public void addNotify(Drawing drawing)
        Description copied from interface: Figure
        Informs a figure, that it has been added to a drawing. The figure must inform all FigureListeners that it has been added.
        Specified by:
        addNotify in interface Figure
        Overrides:
        addNotify in class AbstractCompositeFigure
      • removeNotify

        public void removeNotify(Drawing drawing)
        Description copied from interface: Figure
        Informs a figure, that it has been removed from a drawing. The figure must inform all FigureListeners that it has been removed.
        Specified by:
        removeNotify in interface Figure
        Overrides:
        removeNotify in class AbstractCompositeFigure
      • setBounds

        public void setBounds(java.awt.geom.Point2D.Double anchor,
                              java.awt.geom.Point2D.Double lead)
        Moves the figure. This is the method that subclassers override. Clients usually call displayBox.
        Specified by:
        setBounds in interface Figure
        Overrides:
        setBounds in class AbstractCompositeFigure
        Parameters:
        anchor - the start point of the bounds
        lead - the end point of the bounds
        See Also:
        Figure.getBounds()
      • draw

        public void draw(java.awt.Graphics2D g)
        Draw the figure. This method is delegated to the encapsulated presentation figure.
        Specified by:
        draw in interface Figure
        Overrides:
        draw in class AbstractCompositeFigure
        Parameters:
        g - The Graphics2D to draw to.
      • createHandles

        public java.util.Collection<Handle> createHandles(int detailLevel)
        Return default handles from the presentation figure.
        Specified by:
        createHandles in interface Figure
        Overrides:
        createHandles in class AbstractCompositeFigure
        Parameters:
        detailLevel - The detail level of the handles. Usually this is 0 for bounding box handles and 1 for point handles. The value -1 is used by the SelectAreaTracker and the HandleTracker to highlight figures, over which the mouse pointer is hovering.
        Returns:
        a Collection of handles
        See Also:
        Handle
      • setPresentationFigure

        public void setPresentationFigure(@Nullable
                                          Figure newPresentationFigure)
        Set a figure which renders this BasicCompositeFigure. The presentation tasks for the BasicCompositeFigure are delegated to this presentation figure.
        Parameters:
        newPresentationFigure - figure takes over the presentation tasks
      • getPresentationFigure

        public Figure getPresentationFigure()
        Get a figure which renders this BasicCompositeFigure. The presentation tasks for the BasicCompositeFigure are delegated to this presentation figure.
        Returns:
        figure takes over the presentation tasks
      • clone

        public GraphicalCompositeFigure clone()
        Description copied from interface: Figure
        Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators. The cloned figure does not clone the list of FigureListeners from its original.
        Specified by:
        clone in interface Figure
        Overrides:
        clone in class AbstractCompositeFigure
      • remap

        public void remap(java.util.HashMap<Figure,Figure> oldToNew,
                          boolean disconnectIfNotInMap)
      • setAttributeEnabled

        public void setAttributeEnabled(AttributeKey key,
                                        boolean b)
      • chop

        public java.awt.geom.Point2D.Double chop(java.awt.geom.Point2D.Double from)
        This is a default implementation that chops the point at the rectangle returned by getBounds() of the figure.

        Figures which have a non-rectangular shape need to override this method.

        This method takes the following attributes into account: AttributeKeys.STROKE_COLOR, AttributeKeys.STROKE_PLACEMENT, and AttributeKeys.StrokeTotalWidth.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.