Back to index

moin  1.9.0~rc2
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes
CH.ifa.draw.standard.DecoratorFigure Class Reference

DecoratorFigure can be used to decorate other figures with decorations like borders. More...

Inheritance diagram for CH.ifa.draw.standard.DecoratorFigure:
Inheritance graph
[legend]
Collaboration diagram for CH.ifa.draw.standard.DecoratorFigure:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DecoratorFigure ()
 DecoratorFigure (Figure figure)
 Constructs a DecoratorFigure and decorates the passed in figure.
Insets connectionInsets ()
 Forwards the connection insets to its contained figure.
boolean canConnect ()
 Forwards the canConnect to its contained figure.
boolean containsPoint (int x, int y)
 Forwards containsPoint to its contained figure.
void decorate (Figure figure)
 Decorates the given figure.
Figure peelDecoration ()
 Removes the decoration from the contained figure.
Rectangle displayBox ()
 Forwards displayBox to its contained figure.
void basicDisplayBox (Point origin, Point corner)
 Forwards basicDisplayBox to its contained figure.
void draw (Graphics g, boolean showGuides)
 Forwards draw to its contained figure.
Figure findFigureInside (int x, int y)
 Forwards findFigureInside to its contained figure.
Vector handles ()
 Forwards handles to its contained figure.
boolean includes (Figure figure)
 Forwards includes to its contained figure.
void moveBy (int x, int y)
 Forwards moveBy to its contained figure.
void release ()
 Releases itself and the contained figure.
void figureInvalidated (FigureChangeEvent e)
 Propagates invalidate up the container chain.
void figureChanged (FigureChangeEvent e)
void figureRemoved (FigureChangeEvent e)
void figureRequestUpdate (FigureChangeEvent e)
 Propagates figureRequestUpdate up the container chain.
void figureRequestRemove (FigureChangeEvent e)
 Propagates the removeFromDrawing request up to the container.
FigureEnumeration figures ()
 Forwards figures to its contained figure.
FigureEnumeration decompose ()
 Forwards decompose to its contained figure.
void setAttribute (String name, Object value)
 Forwards setAttribute to its contained figure.
Object getAttribute (String name)
 Forwards getAttribute to its contained figure.
Locator connectedTextLocator (Figure text)
 Returns the locator used to located connected text.
Connector connectorAt (int x, int y)
 Returns the Connector for the given location.
void connectorVisibility (boolean isVisible)
 Forwards the connector visibility request to its component.
void write (StorableOutput dw)
 Writes itself and the contained figure to the StorableOutput.
String getMap ()
void read (StorableInput dr) throws IOException
 Reads itself and the contained figure from the StorableInput.
void displayBox (Point origin, Point corner)
 Changes the display box of a figure.
void displayBox (Rectangle r)
 Changes the display box of a figure.
Dimension size ()
 Gets the size of the figure.
boolean isEmpty ()
 Checks if the figure is empty.
void addToContainer (FigureChangeListener c)
 Sets the Figure's container and registers the container as a figure change listener.
void removeFromContainer (FigureChangeListener c)
 Removes a figure from the given container and unregisters it as a change listener.
void addFigureChangeListener (FigureChangeListener l)
 Adds a listener for this figure.
void removeFigureChangeListener (FigureChangeListener l)
 Removes a listener for this figure.
FigureChangeListener listener ()
 Gets the figure's listners.
void invalidate ()
 Invalidates the figure.
void willChange ()
 Informes that a figure is about to change something that affects the contents of its display box.
void changed ()
 Informs that a figure changed the area of its display box.
Point center ()
 Gets the center of a figure.
Object defaultAttribute (String name)
 Gets a the default value for a named attribute.
Object clone ()
 Clones a figure.

Protected Member Functions

void basicMoveBy (int x, int y)
 Forwards basicMoveBy to its contained figure.

Protected Attributes

Figure fComponent
 The decorated figure.

Static Protected Attributes

static Font dialogFont = Font.decode("dialog-PLAIN-12")

Private Member Functions

void readObject (ObjectInputStream s) throws ClassNotFoundException, IOException

Private Attributes

int decoratorFigureSerializedDataVersion = 1

Static Private Attributes

static final long serialVersionUID = 8993011151564573288L

Detailed Description

DecoratorFigure can be used to decorate other figures with decorations like borders.

Decorator forwards all the methods to their contained figure. Subclasses can selectively override these methods to extend and filter their behavior.


Design Patterns

 o

Decorator
DecoratorFigure is a decorator.

See also:
Figure

Definition at line 29 of file DecoratorFigure.java.


Constructor & Destructor Documentation

Definition at line 44 of file DecoratorFigure.java.

{ }

Constructs a DecoratorFigure and decorates the passed in figure.

Definition at line 49 of file DecoratorFigure.java.

                                          {
        decorate(figure);
    }

Here is the call graph for this function:


Member Function Documentation

void CH.ifa.draw.standard.AbstractFigure.addFigureChangeListener ( FigureChangeListener  l) [inline, inherited]

Adds a listener for this figure.

Definition at line 211 of file AbstractFigure.java.

                                                                {
        fListener = FigureChangeEventMulticaster.add(fListener, l);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void CH.ifa.draw.standard.AbstractFigure.addToContainer ( FigureChangeListener  c) [inline, inherited]

Sets the Figure's container and registers the container as a figure change listener.

A figure's container can be any kind of FigureChangeListener. A figure is not restricted to have a single container.

Definition at line 193 of file AbstractFigure.java.

Here is the call graph for this function:

void CH.ifa.draw.standard.DecoratorFigure.basicDisplayBox ( Point  origin,
Point  corner 
) [inline, virtual]

Forwards basicDisplayBox to its contained figure.

Implements CH.ifa.draw.standard.AbstractFigure.

Definition at line 100 of file DecoratorFigure.java.

                                                            {
        fComponent.basicDisplayBox(origin, corner);
    }
void CH.ifa.draw.standard.DecoratorFigure.basicMoveBy ( int  x,
int  y 
) [inline, protected, virtual]

Forwards basicMoveBy to its contained figure.

Implements CH.ifa.draw.standard.AbstractFigure.

Definition at line 142 of file DecoratorFigure.java.

                                             {
        // this will never be called
    }

Forwards the canConnect to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 63 of file DecoratorFigure.java.

                                {
        return fComponent.canConnect();
    }
Point CH.ifa.draw.standard.AbstractFigure.center ( ) [inline, inherited]

Gets the center of a figure.

A convenice method that is rarely overridden.

Definition at line 279 of file AbstractFigure.java.

                          {
        return Geom.center(displayBox());
    }

Here is the call graph for this function:

void CH.ifa.draw.standard.AbstractFigure.changed ( ) [inline, inherited]

Informs that a figure changed the area of its display box.

See also:
FigureChangeEvent
Figure::changed

Definition at line 268 of file AbstractFigure.java.

                          {
        invalidate();
        if (fListener != null)
            fListener.figureChanged(new FigureChangeEvent(this));

    }

Here is the call graph for this function:

Here is the caller graph for this function:

Object CH.ifa.draw.standard.AbstractFigure.clone ( ) [inline, inherited]

Clones a figure.

Creates a clone by using the storable mechanism to flatten the Figure to stream followed by resurrecting it from the same stream.

See also:
Figure::clone

Definition at line 364 of file AbstractFigure.java.

                          {
        Object clone = null;
        ByteArrayOutputStream output = new ByteArrayOutputStream(200);
        try {
            ObjectOutput writer = new ObjectOutputStream(output);
            writer.writeObject(this);
            writer.close();
        } catch (IOException e) {
            System.out.println("Class not found: " + e);
        }

        InputStream input = new ByteArrayInputStream(output.toByteArray());
        try {
            ObjectInput reader = new ObjectInputStream(input);
            clone = (Object) reader.readObject();
        } catch (IOException e) {
            System.out.println(e.toString());
        }
        catch (ClassNotFoundException e) {
            System.out.println("Class not found: " + e);
        }
        return clone;
    }

Returns the locator used to located connected text.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 219 of file DecoratorFigure.java.

                                                     {
        return fComponent.connectedTextLocator(text);
    }

Forwards the connection insets to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 56 of file DecoratorFigure.java.

                                     {
        return fComponent.connectionInsets();
    }
Connector CH.ifa.draw.standard.DecoratorFigure.connectorAt ( int  x,
int  y 
) [inline]

Returns the Connector for the given location.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 226 of file DecoratorFigure.java.

                                               {
        return fComponent.connectorAt(x, y);
    }
void CH.ifa.draw.standard.DecoratorFigure.connectorVisibility ( boolean  isVisible) [inline]

Forwards the connector visibility request to its component.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 233 of file DecoratorFigure.java.

                                                       {
        fComponent.connectorVisibility(isVisible);
    }
boolean CH.ifa.draw.standard.DecoratorFigure.containsPoint ( int  x,
int  y 
) [inline]

Forwards containsPoint to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 70 of file DecoratorFigure.java.

                                               {
        return fComponent.containsPoint(x, y);
    }
FigureEnumeration CH.ifa.draw.standard.DecoratorFigure.decompose ( ) [inline]

Forwards decompose to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 198 of file DecoratorFigure.java.

                                         {
        return fComponent.decompose();
    }
void CH.ifa.draw.standard.DecoratorFigure.decorate ( Figure  figure) [inline]

Decorates the given figure.

Definition at line 77 of file DecoratorFigure.java.

                                        {
        fComponent = figure;
        fComponent.addToContainer(this);
    }

Here is the caller graph for this function:

Object CH.ifa.draw.standard.AbstractFigure.defaultAttribute ( String  name) [inline, inherited]

Gets a the default value for a named attribute.

See also:
getAttribute

Definition at line 329 of file AbstractFigure.java.

                                                {
       return null;
    }

Here is the caller graph for this function:

void CH.ifa.draw.standard.AbstractFigure.displayBox ( Point  origin,
Point  corner 
) [inline, inherited]

Changes the display box of a figure.

Clients usually call this method. It changes the display box and announces the corresponding change.

Parameters:
originthe new origin
cornerthe new corner
See also:
displayBox

Definition at line 85 of file AbstractFigure.java.

                                                       {
        willChange();
        basicDisplayBox(origin, corner);
        changed();
    }

Here is the call graph for this function:

Rectangle CH.ifa.draw.standard.DecoratorFigure.displayBox ( ) [inline, virtual]

Forwards displayBox to its contained figure.

Implements CH.ifa.draw.standard.AbstractFigure.

Definition at line 93 of file DecoratorFigure.java.

                                  {
        return fComponent.displayBox();
    }
void CH.ifa.draw.standard.AbstractFigure.displayBox ( Rectangle  r) [inline, inherited]

Changes the display box of a figure.

This is a convenience method. Implementors should only have to override basicDisplayBox

See also:
displayBox

Definition at line 164 of file AbstractFigure.java.

                                        {
        displayBox(new Point(r.x, r.y), new Point(r.x+r.width, r.y+r.height));
    }

Here is the call graph for this function:

void CH.ifa.draw.standard.DecoratorFigure.draw ( Graphics  g,
boolean  showGuides 
) [inline]

Forwards draw to its contained figure.

Definition at line 107 of file DecoratorFigure.java.

                                                     {
        fComponent.draw(g, showGuides);
    }
void CH.ifa.draw.standard.DecoratorFigure.figureChanged ( FigureChangeEvent  e) [inline]

Definition at line 164 of file DecoratorFigure.java.

                                                   {
    }
void CH.ifa.draw.standard.DecoratorFigure.figureInvalidated ( FigureChangeEvent  e) [inline]

Propagates invalidate up the container chain.

See also:
FigureChangeListener

Definition at line 159 of file DecoratorFigure.java.

                                                       {
        if (listener() != null)
            listener().figureInvalidated(e);
    }

Here is the call graph for this function:

void CH.ifa.draw.standard.DecoratorFigure.figureRemoved ( FigureChangeEvent  e) [inline]

Definition at line 167 of file DecoratorFigure.java.

                                                   {
    }
void CH.ifa.draw.standard.DecoratorFigure.figureRequestRemove ( FigureChangeEvent  e) [inline]

Propagates the removeFromDrawing request up to the container.

See also:
FigureChangeListener

Definition at line 183 of file DecoratorFigure.java.

                                                         {
        if (listener() != null)
            listener().figureRequestRemove(new FigureChangeEvent(this));
    }

Here is the call graph for this function:

void CH.ifa.draw.standard.DecoratorFigure.figureRequestUpdate ( FigureChangeEvent  e) [inline]

Propagates figureRequestUpdate up the container chain.

See also:
FigureChangeListener

Definition at line 174 of file DecoratorFigure.java.

                                                          {
        if (listener() != null)
            listener().figureRequestUpdate(e);
    }

Here is the call graph for this function:

FigureEnumeration CH.ifa.draw.standard.DecoratorFigure.figures ( ) [inline]

Forwards figures to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 191 of file DecoratorFigure.java.

                                       {
        return fComponent.figures();
    }
Figure CH.ifa.draw.standard.DecoratorFigure.findFigureInside ( int  x,
int  y 
) [inline]

Forwards findFigureInside to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 114 of file DecoratorFigure.java.

                                                 {
        return fComponent.findFigureInside(x, y);
    }
Object CH.ifa.draw.standard.DecoratorFigure.getAttribute ( String  name) [inline]

Forwards getAttribute to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 212 of file DecoratorFigure.java.

                                            {
        return fComponent.getAttribute(name);
    }

Definition at line 245 of file DecoratorFigure.java.

                           {
       return "";
    }
Vector CH.ifa.draw.standard.DecoratorFigure.handles ( ) [inline, virtual]

Forwards handles to its contained figure.

Implements CH.ifa.draw.standard.AbstractFigure.

Definition at line 121 of file DecoratorFigure.java.

                            {
        return fComponent.handles();
    }
boolean CH.ifa.draw.standard.DecoratorFigure.includes ( Figure  figure) [inline]

Forwards includes to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 128 of file DecoratorFigure.java.

                                           {
        return (super.includes(figure) || fComponent.includes(figure));
    }
void CH.ifa.draw.standard.AbstractFigure.invalidate ( ) [inline, inherited]

Invalidates the figure.

This method informs the listeners that the figure's current display box is invalid and should be refreshed.

Definition at line 244 of file AbstractFigure.java.

                             {
        if (fListener != null) {
            Rectangle r = displayBox();
            r.grow(Handle.HANDLESIZE, Handle.HANDLESIZE);
            fListener.figureInvalidated(new FigureChangeEvent(this, r));
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

boolean CH.ifa.draw.standard.AbstractFigure.isEmpty ( ) [inline, inherited]

Checks if the figure is empty.

The default implementation returns true if the width or height of its display box is < 3

See also:
Figure::isEmpty

Definition at line 134 of file AbstractFigure.java.

                             {
        return (size().width < 3) || (size().height < 3);
    }

Here is the call graph for this function:

FigureChangeListener CH.ifa.draw.standard.AbstractFigure.listener ( ) [inline, inherited]

Gets the figure's listners.

Definition at line 225 of file AbstractFigure.java.

                                           {
        return fListener;
    }

Here is the caller graph for this function:

void CH.ifa.draw.standard.DecoratorFigure.moveBy ( int  x,
int  y 
) [inline]

Forwards moveBy to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 135 of file DecoratorFigure.java.

                                     {
        fComponent.moveBy(x, y);
    }

Removes the decoration from the contained figure.

Definition at line 85 of file DecoratorFigure.java.

                                   {
        fComponent.removeFromContainer(this); //??? set the container to the listener()?
        return fComponent;
    }
void CH.ifa.draw.standard.DecoratorFigure.read ( StorableInput  dr) throws IOException [inline]

Reads itself and the contained figure from the StorableInput.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 252 of file DecoratorFigure.java.

                                                          {
        super.read(dr);
        decorate((Figure)dr.readStorable());
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void CH.ifa.draw.standard.DecoratorFigure.readObject ( ObjectInputStream  s) throws ClassNotFoundException, IOException [inline, private]

Definition at line 257 of file DecoratorFigure.java.

                                                   {

        s.defaultReadObject();

        fComponent.addToContainer(this);
    }

Releases itself and the contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 149 of file DecoratorFigure.java.

                          {
        super.release();
        fComponent.removeFromContainer(this);
        fComponent.release();
    }

Here is the caller graph for this function:

void CH.ifa.draw.standard.AbstractFigure.removeFigureChangeListener ( FigureChangeListener  l) [inline, inherited]

Removes a listener for this figure.

Definition at line 218 of file AbstractFigure.java.

                                                                   {
        fListener = FigureChangeEventMulticaster.remove(fListener, l);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void CH.ifa.draw.standard.AbstractFigure.removeFromContainer ( FigureChangeListener  c) [inline, inherited]

Removes a figure from the given container and unregisters it as a change listener.

Definition at line 202 of file AbstractFigure.java.

Here is the call graph for this function:

void CH.ifa.draw.standard.DecoratorFigure.setAttribute ( String  name,
Object  value 
) [inline]

Forwards setAttribute to its contained figure.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 205 of file DecoratorFigure.java.

                                                        {
        fComponent.setAttribute(name, value);
    }
Dimension CH.ifa.draw.standard.AbstractFigure.size ( ) [inline, inherited]

Gets the size of the figure.

A convenience method.

Definition at line 125 of file AbstractFigure.java.

                            {
        return new Dimension(displayBox().width, displayBox().height);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void CH.ifa.draw.standard.AbstractFigure.willChange ( ) [inline, inherited]

Informes that a figure is about to change something that affects the contents of its display box.

See also:
Figure::willChange

Definition at line 258 of file AbstractFigure.java.

                             {
        invalidate();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void CH.ifa.draw.standard.DecoratorFigure.write ( StorableOutput  dw) [inline]

Writes itself and the contained figure to the StorableOutput.

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 240 of file DecoratorFigure.java.

                                         {
        super.write(dw);
        dw.writeStorable(fComponent);
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 42 of file DecoratorFigure.java.

Font CH.ifa.draw.standard.AbstractFigure.dialogFont = Font.decode("dialog-PLAIN-12") [static, protected, inherited]

Definition at line 56 of file AbstractFigure.java.

The decorated figure.

Definition at line 36 of file DecoratorFigure.java.

final long CH.ifa.draw.standard.DecoratorFigure.serialVersionUID = 8993011151564573288L [static, private]

Reimplemented from CH.ifa.draw.standard.AbstractFigure.

Definition at line 41 of file DecoratorFigure.java.


The documentation for this class was generated from the following file: