org.tigris.gef.presentation
Class Fig

java.lang.Object
  extended by org.tigris.gef.presentation.Fig
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, PopupGenerator
Direct Known Subclasses:
FigCircle, FigCube, FigDiamond, FigEdge, FigGroup, FigImage, FigLine, FigPoly, FigRect, FigText

public class Fig
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, java.beans.PropertyChangeListener, PopupGenerator

This class is the base class for basic drawing objects such as rectangles, lines, text, circles, etc. Also, class FigGroup implements a composite figure. Fig's are Diagram elements that can be placed in any LayerDiagram. Fig's are also used to define the look of FigNodes on NetNodes.

See Also:
Serialized Form

Field Summary
protected  boolean _allowsSaving
           
protected  java.lang.String _context
           
protected  float[] _dashes
           
protected  int _dashPeriod
           
protected  int _dashStyle
           
protected  boolean _filled
          True if the object should fill in its area.
protected  int _h
          Height of the Fig's bounding box.
protected  int _w
          Width of the Fig's bounding box.
protected  int _x
          X coordinate of the Fig's bounding box.
protected  int _y
          Y coordinate of the Fig's bounding box.
protected  AnnotationStrategy an
           
protected  Fig annotationOwner
           
protected  boolean annotationStatus
           
 int BORDER
          Margin between this Fig and automatically routed arcs.
 int MIN_SIZE
          The smallest size that the user can drag this Fig.
 
Constructor Summary
Fig()
          Most subclasses will not use this constructor, it is only useful for subclasses that redefine most of the infrastructure provided by class Fig.
Fig(int x, int y, int w, int h)
          Construct a new Fig with the given bounds.
Fig(int x, int y, int w, int h, java.awt.Color lineColor, java.awt.Color fillColor)
          Construct a new Fig with the given bounds and colors.
Fig(int x, int y, int w, int h, java.awt.Color lineColor, java.awt.Color fillColor, java.lang.Object own)
          Construct a new Fig with the given bounds, colors, and owner.
 
Method Summary
 void addAnnotation(Fig annotation, java.lang.String type, java.lang.String context)
          Adds a new Annotation of type "text" to fig.
 void addPoint(int x, int y)
           
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          The specified PropertyChangeListeners propertyChange method will be called each time the value of any bound property is changed.
 void align(java.awt.Rectangle r, int direction, Editor ed)
          Align this Fig with the given rectangle.
 void calcBounds()
          Update the bounds of this Fig.
 java.awt.Point center()
          Return the center of the given Fig.
 java.lang.String classNameAndBounds()
          USED BY PGML.tee
 void cleanUp()
           
 java.lang.Object clone()
           
 java.awt.Point connectionPoint(java.awt.Point anotherPt)
          Return a point that should be used for arcs that to toward the given point.
 boolean contains(int x, int y)
          Reply true if the given point is inside the given Fig.
 boolean contains(java.awt.Point p)
          Reply true if the given point is inside this Fig by calling contains(int x, int y).
 boolean contains(java.awt.Rectangle r)
          Reply true if the all four corners of the given rectangle are inside this Fig, as determined by contains(int x, int y).
protected  int countCornersContained(int x, int y, int w, int h)
          Reply the number of corners of the given rectangle that are inside this Fig, as determined by contains(int x, int y).
 void createDrag(int anchorX, int anchorY, int x, int y, int snapX, int snapY)
          Resize the object for drag on creation.
 void damage()
          This Fig has changed in some way, tell its Layer to record my bounding box as a damageAll region so that I will eventualy be redrawn.
 void deleteFromModel()
          Delete whatever application object this Fig is representing, the Fig itself should automatically be deleted as a side-effect.
protected  int drawDashedLine(java.awt.Graphics g, int phase, int x1, int y1, int x2, int y2)
           
protected  void drawDashedPerimeter(java.awt.Graphics g)
           
 void endTrans()
          This is called after an Cmd modifies a Fig and the Fig needs to be redrawn in its new position.
 void firePropChange(java.lang.String propName, boolean oldV, boolean newV)
           
 void firePropChange(java.lang.String propName, int oldV, int newV)
           
 void firePropChange(java.lang.String propName, java.lang.Object oldV, java.lang.Object newV)
          Creates a PropertyChangeEvent and calls all registered listeners propertyChanged() method.
 Fig getAnnotationOwner()
           
 AnnotationStrategy getAnnotationStrategy()
          USED BY PGML.tee
 java.awt.Rectangle getBounds()
          Return a Rectangle that completely encloses this Fig.
 java.awt.Rectangle getBounds(java.awt.Rectangle r)
          Stores the Rectangle that completely encloses this Fig into "return value" r and return r.
 java.awt.Point getClosestPoint(java.awt.Point anotherPt)
           
 java.lang.String getContext()
          TODO must determine the purpose of this.
 boolean getDashed()
          Get the dashed attribute
 int getDashed01()
           
 java.lang.String getDashedString()
           
 java.util.Vector getEnclosedFigs()
           
 Fig getEnclosingFig()
          USED BY PGML.tee
 java.awt.Color getFillColor()
           
 boolean getFilled()
           
 int getFilled01()
           
 java.awt.Point getFirstPoint()
           
 java.util.List getGravityPoints()
           
 Fig getGroup()
           
 int getHalfHeight()
           
 int getHalfWidth()
           
 java.awt.Rectangle getHandleBox()
          Get the rectangle on whose corners the dragging handles are to be drawn.
 int getHeight()
          USED BY PGML.tee
 java.lang.String getId()
           
 java.awt.Point getLastPoint()
           
 Layer getLayer()
           
 java.awt.Color getLineColor()
          USED BY SVG.tee
 int getLineWidth()
          USED BY SVG.tee
 java.awt.Point getLocation()
          Returns a point that is the upper left corner of the Fig's bounding box.
 boolean getLocked()
           
 java.awt.Dimension getMinimumSize()
          Returns the minimum size of the Fig.
 int getNumPoints()
           
 java.lang.Object getOwner()
          USED BY PGML.tee
 int getPerimeterLength()
          Return the length of the path around this Fig.
 java.awt.Point getPoint(int i)
           
 java.awt.Point[] getPoints()
           
 java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)
           
 java.awt.Dimension getPreferredSize()
          Returns the prefered size of the Fig.
 java.lang.String getPrivateData()
          TODO document Used in SVG.TEE
 java.lang.String getResource()
           
 boolean getSingle()
          Returns the single flag of the Fig
 java.awt.Dimension getSize()
          Returns the size of the Fig.
 java.lang.String getTipString(java.awt.event.MouseEvent me)
           
 java.awt.Rectangle getTrapRect()
           
 boolean getUseTrapRect()
           
 int getVisState()
          USED BY PGML.tee
 int getWidth()
          USED BY PGML.tee
 int getX()
          USED BY PGML.tee
 int[] getXs()
           
 int getY()
          USED BY PGML.tee
 int[] getYs()
           
 boolean hasFillColor()
          Does this Fig support the concept of "fill color" in principle
 boolean hasLineColor()
          Does this Fig support the concept of "line color" in principle
 boolean hit(java.awt.Rectangle r)
          Determine if the given rectangle contains some pixels of the Fig.
 void initAnnotations()
           
 void insertPoint(int i, int x, int y)
           
 boolean intersects(java.awt.Rectangle r)
          Reply true if the object intersects the given rectangle.
 boolean intersectsPerimeter(java.awt.Rectangle r)
          Reply true if the object's perimeter intersects the given rectangle.
 boolean isAnnotation()
           
 boolean isCopyable()
          Can the fig can be copied and pasted
 boolean isCutable()
          Can the fig can be cut and pasted
 boolean isLowerRightResizable()
          Returns true if this Fig can be resized by the user.
 boolean isMovable()
          Returns true if this Fig can be moved around by the user.
 boolean isReshapable()
          Returns true if this Fig can be reshaped by the user.
 boolean isResizable()
          Determine if this Fig can be resized
 boolean isRotatable()
          Returns true if this Fig can be rotated by the user.
 boolean isSelected()
          Returns the current selection state for this item
 boolean isVisible()
          Returns true if the fig is visible
 Selection makeSelection()
          SelectionManager calls this to attempt to create a custom Selection object when selecting a Fig.
 boolean OK()
          Check class invariants to make sure the Fig is in a valid state.
 void paint(java.awt.Graphics g)
          Method to paint this Fig.
 java.awt.Point pointAlongPerimeter(int dist)
          Return a point at the given distance along the path around this Fig.
 void postLoad()
           
 void postSave()
           
 void preSave()
           
 void print(java.awt.Graphics g)
          Draw the Fig on a PrintGraphics.
 void propertyChange(java.beans.PropertyChangeEvent pce)
          By default just pass it up to enclosing groups.
 void redraw()
          Force recalculating of bounds and redraw of fig.
 void removeAnnotation(Fig annotationFig)
           
 void removeAnnotation(java.lang.String context)
           
 void removeFromDiagram()
          Remove this Fig from the Layer it belongs to.
 void removePoint(int i)
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Remove this PropertyChangeListener from the JellyBeans internal list.
 void reorder(int func, Layer lay)
          Change the back-to-front ordering of a Fig in LayerDiagram.
 java.awt.Rectangle routingRect()
          Reply a rectangle that arcs should not route through.
 boolean savingAllowed()
           
 void setAnnotationOwner(Fig f)
           
 void setAnnotationStatus(boolean newValue)
           
 void setAnnotationStrategy(AnnotationStrategy a)
           
 void setBounds(int x, int y, int w, int h)
          Set the bounds of this Fig.
 void setBounds(java.awt.Rectangle r)
          Change my bounding box to the given Rectangle.
 void setCenter(java.awt.Point p)
           
 void setContext(java.lang.String context)
           
 void setDashed(boolean now_dashed)
          Set line to be dashed or not
 void setDashedString(java.lang.String dashString)
           
 void setEnclosingFig(Fig f)
          USED BY PGML.tee
 void setFillColor(java.awt.Color col)
          Sets the color that will be used if the Fig is filled.
 void setFilled(boolean f)
          Sets a flag to either fill the Fig with its fillColor or not.
 void setGroup(Fig f)
          Sets the enclosing FigGroup of this Fig.
 void setHandleBox(int x, int y, int w, int h)
          Set the HandleBox.
 void setHeight(int h)
           
 void setLayer(Layer lay)
          Sets the Layer that this Fig belongs to.
 void setLineColor(java.awt.Color col)
          Sets the color to be used if the lineWidth is > 0.
 void setLineWidth(int w)
          Set the line width.
 void setLocation(int x, int y)
          Move the Fig to the given position.
 void setLocation(java.awt.Point p)
          Move the Fig to the given position.
 void setLocked(boolean b)
          Sets whether this Fig is locked or not.
 void setMovable(boolean movable)
          Set whether this Fig can be moved
 void setNumPoints(int npoints)
           
 void setOwner(java.lang.Object own)
          Sets the owner object of this Fig.
 void setPoint(Handle h, int x, int y)
           
 void setPoint(Handle h, java.awt.Point p)
           
 void setPoint(int i, int x, int y)
           
 void setPoint(int i, java.awt.Point p)
           
 void setPoints(java.awt.Point[] ps)
          Get and set the points along a path for Figs that are path-like.
 void setPrivateData(java.lang.String data)
          Derived classes should implement this method
 void setResizable(boolean resizable)
          Set whether this Fig can be resized
 void setResource(java.lang.String resource)
           
 void setSavingAllowed(boolean newValue)
           
 void setSingle(java.lang.String single)
          Sets the single flag of the Fig.
 void setSize(java.awt.Dimension d)
          Sets the size of the Fig.
 void setSize(int w, int h)
          Sets the size of the Fig.
 void setVisible(boolean isDisplayed)
          Set the visible status of the fig
 void setVisState(int visState)
          USED BY PGML.tee
 void setWidth(int w)
           
 void setX(int x)
           
 void setXs(int[] xs)
           
 void setY(int y)
           
 void setYs(int[] ys)
           
 void stuffBounds(java.awt.Rectangle r)
          Reshape the given rectangle to be my bounding box.
 void stuffPointAlongPerimeter(int dist, java.awt.Point res)
           
 void translate(int dx, int dy)
          Change the position of the object from were it is to were it is plus dx and dy.
 void translateAnnotations()
          Fig has been moved: Adjust the annotation positions Extracted from endTrans() so that annotation positions can be updated without redrawing everything.
 void unsetAnnotationOwner()
           
 void updateAnnotationPositions()
          Updates the positions of the connected annotations.
 void updateVisState()
           
 boolean within(java.awt.Rectangle r)
          Reply true if the entire Fig is contained within the given Rectangle.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_SIZE

public final int MIN_SIZE
The smallest size that the user can drag this Fig.

See Also:
Constant Field Values

_x

protected int _x
X coordinate of the Fig's bounding box. It is the responsibility of subclasses to make sure this value is ALWAYS up-to-date.


_y

protected int _y
Y coordinate of the Fig's bounding box. It is the responsibility of subclasses to make sure this value is ALWAYS up-to-date.


_w

protected int _w
Width of the Fig's bounding box. It is the responsibility of subclasses to make sure this value is ALWAYS up-to-date.


_h

protected int _h
Height of the Fig's bounding box. It is the responsibility of subclasses to make sure this value is ALWAYS up-to-date.


_dashes

protected float[] _dashes

_dashStyle

protected int _dashStyle

_dashPeriod

protected int _dashPeriod

_filled

protected boolean _filled
True if the object should fill in its area.


_context

protected java.lang.String _context

_allowsSaving

protected boolean _allowsSaving

BORDER

public final int BORDER
Margin between this Fig and automatically routed arcs.

See Also:
Constant Field Values

an

protected AnnotationStrategy an

annotationStatus

protected boolean annotationStatus

annotationOwner

protected Fig annotationOwner
Constructor Detail

Fig

public Fig()
Most subclasses will not use this constructor, it is only useful for subclasses that redefine most of the infrastructure provided by class Fig.


Fig

public Fig(int x,
           int y,
           int w,
           int h)
Construct a new Fig with the given bounds.


Fig

public Fig(int x,
           int y,
           int w,
           int h,
           java.awt.Color lineColor,
           java.awt.Color fillColor)
Construct a new Fig with the given bounds and colors.


Fig

public Fig(int x,
           int y,
           int w,
           int h,
           java.awt.Color lineColor,
           java.awt.Color fillColor,
           java.lang.Object own)
Construct a new Fig with the given bounds, colors, and owner.

Method Detail

setResource

public void setResource(java.lang.String resource)

getResource

public java.lang.String getResource()

setAnnotationOwner

public void setAnnotationOwner(Fig f)

unsetAnnotationOwner

public void unsetAnnotationOwner()

getAnnotationOwner

public Fig getAnnotationOwner()

getAnnotationStrategy

public AnnotationStrategy getAnnotationStrategy()
USED BY PGML.tee


setAnnotationStrategy

public void setAnnotationStrategy(AnnotationStrategy a)

isAnnotation

public boolean isAnnotation()

setAnnotationStatus

public void setAnnotationStatus(boolean newValue)

addAnnotation

public void addAnnotation(Fig annotation,
                          java.lang.String type,
                          java.lang.String context)
Adds a new Annotation of type "text" to fig.


removeAnnotation

public void removeAnnotation(java.lang.String context)

removeAnnotation

public void removeAnnotation(Fig annotationFig)

translateAnnotations

public void translateAnnotations()
Fig has been moved: Adjust the annotation positions Extracted from endTrans() so that annotation positions can be updated without redrawing everything.


updateAnnotationPositions

public void updateAnnotationPositions()
Updates the positions of the connected annotations.


initAnnotations

public void initAnnotations()

addPoint

public void addPoint(int x,
                     int y)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
The specified PropertyChangeListeners propertyChange method will be called each time the value of any bound property is changed. Note: the JavaBeans specification does not require PropertyChangeListeners to run in any particular order.

Since most Fig's will never have any listeners, and I want Figs to be fairly light-weight objects, listeners are kept in a global Hashtable, keyed by Fig. NOTE: It is important that all listeners eventually remove themselves, otherwise this will prevent garbage collection.


align

public void align(java.awt.Rectangle r,
                  int direction,
                  Editor ed)
Align this Fig with the given rectangle. Some subclasses may need to know the editor that initiated this action.


calcBounds

public void calcBounds()
Update the bounds of this Fig. By default it is assumed that the bounds have already been updated, so this does nothing.

See Also:
FigText.calcBounds()

center

public java.awt.Point center()
Return the center of the given Fig. By default the center is the center of its bounding box. Subclasses may want to define something else. USED BY PGML.tee


classNameAndBounds

public java.lang.String classNameAndBounds()
USED BY PGML.tee


cleanUp

public void cleanUp()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

isCopyable

public boolean isCopyable()
Can the fig can be copied and pasted


isCutable

public boolean isCutable()
Can the fig can be cut and pasted


connectionPoint

public java.awt.Point connectionPoint(java.awt.Point anotherPt)
Return a point that should be used for arcs that to toward the given point. By default, this makes arcs end on the edge that is nearest the given point. needs-more-work: define gravity points, berths


contains

public boolean contains(int x,
                        int y)
Reply true if the given point is inside the given Fig. By default reply true if the point is in my bounding box. Subclasses like FigCircle and FigEdge do more specific checks.

See Also:
FigCircle, FigEdge

contains

public final boolean contains(java.awt.Point p)
Reply true if the given point is inside this Fig by calling contains(int x, int y).


contains

public boolean contains(java.awt.Rectangle r)
Reply true if the all four corners of the given rectangle are inside this Fig, as determined by contains(int x, int y).


countCornersContained

protected int countCornersContained(int x,
                                    int y,
                                    int w,
                                    int h)
Reply the number of corners of the given rectangle that are inside this Fig, as determined by contains(int x, int y).


createDrag

public void createDrag(int anchorX,
                       int anchorY,
                       int x,
                       int y,
                       int snapX,
                       int snapY)
Resize the object for drag on creation. It bypasses the things done in resize so that the position of the object can be kept as the anchor point. Needs-More-Work: do I really need this function?

See Also:
FigLine.createDrag(int, int, int, int, int, int)

endTrans

public void endTrans()
This is called after an Cmd modifies a Fig and the Fig needs to be redrawn in its new position.


damage

public void damage()
This Fig has changed in some way, tell its Layer to record my bounding box as a damageAll region so that I will eventualy be redrawn.


getHandleBox

public java.awt.Rectangle getHandleBox()
Get the rectangle on whose corners the dragging handles are to be drawn. Should be overwritten by Figures with Bounds larger than the HandleBox. Normally these should be identical.


setHandleBox

public void setHandleBox(int x,
                         int y,
                         int w,
                         int h)
Set the HandleBox. Normally this should not be used. It is intended for figures where the Handlebox is different from the Bounds. Overide this method if HandleBox and bounds differ


removeFromDiagram

public void removeFromDiagram()
Remove this Fig from the Layer it belongs to.


deleteFromModel

public void deleteFromModel()
Delete whatever application object this Fig is representing, the Fig itself should automatically be deleted as a side-effect. Simple Figs have no underlying model, so they are just deleted. Figs that graphically present some part of an underlying model should NOT delete themselves, instead they should ask the model to dispose, and IF it does then the figs will be notified.


drawDashedLine

protected int drawDashedLine(java.awt.Graphics g,
                             int phase,
                             int x1,
                             int y1,
                             int x2,
                             int y2)

drawDashedPerimeter

protected void drawDashedPerimeter(java.awt.Graphics g)

firePropChange

public void firePropChange(java.lang.String propName,
                           int oldV,
                           int newV)

firePropChange

public void firePropChange(java.lang.String propName,
                           java.lang.Object oldV,
                           java.lang.Object newV)
Creates a PropertyChangeEvent and calls all registered listeners propertyChanged() method.


firePropChange

public void firePropChange(java.lang.String propName,
                           boolean oldV,
                           boolean newV)

getBounds

public java.awt.Rectangle getBounds()
Return a Rectangle that completely encloses this Fig. Subclasses may override getBounds(Rectangle). USED BY PGML.tee


getBounds

public java.awt.Rectangle getBounds(java.awt.Rectangle r)
Stores the Rectangle that completely encloses this Fig into "return value" r and return r. If r is null a new Rectangle is allocated. This version of getBounds is useful if the caller wants to avoid allocating a new Rectangle object on the heap.

Parameters:
r - the return value, modified to the components bounds
Returns:
r

getClosestPoint

public java.awt.Point getClosestPoint(java.awt.Point anotherPt)

getDashed

public boolean getDashed()
Get the dashed attribute


getDashed01

public int getDashed01()

getDashedString

public java.lang.String getDashedString()

getEnclosedFigs

public java.util.Vector getEnclosedFigs()

getEnclosingFig

public Fig getEnclosingFig()
USED BY PGML.tee


hasFillColor

public boolean hasFillColor()
Does this Fig support the concept of "fill color" in principle

Returns:
true if the Fig can be filled

getFillColor

public java.awt.Color getFillColor()

getFilled

public boolean getFilled()

getFilled01

public int getFilled01()

hasLineColor

public boolean hasLineColor()
Does this Fig support the concept of "line color" in principle

Returns:
true if the Fig can have a line color

getLineColor

public java.awt.Color getLineColor()
USED BY SVG.tee


getLineWidth

public int getLineWidth()
USED BY SVG.tee


getFirstPoint

public java.awt.Point getFirstPoint()

getGravityPoints

public java.util.List getGravityPoints()

getGroup

public Fig getGroup()

getContext

public java.lang.String getContext()
TODO must determine the purpose of this.

Returns:
the context of the Fig.

getHalfHeight

public int getHalfHeight()

getHalfWidth

public int getHalfWidth()

getHeight

public int getHeight()
USED BY PGML.tee


getId

public java.lang.String getId()

getLastPoint

public java.awt.Point getLastPoint()

getLayer

public Layer getLayer()

getLocation

public java.awt.Point getLocation()
Returns a point that is the upper left corner of the Fig's bounding box.


getLocked

public boolean getLocked()

getMinimumSize

public java.awt.Dimension getMinimumSize()
Returns the minimum size of the Fig. This is the smallest size that the user can make this Fig by dragging. You can ignore this and make Figs smaller programmitically if you must.


getNumPoints

public int getNumPoints()

getOwner

public java.lang.Object getOwner()
USED BY PGML.tee


getPerimeterLength

public int getPerimeterLength()
Return the length of the path around this Fig. By default, returns the perimeter of the Fig's bounding box. Subclasses like FigPoly have more specific logic.


getPoints

public java.awt.Point[] getPoints()

getPoint

public java.awt.Point getPoint(int i)

getPopUpActions

public java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)
Specified by:
getPopUpActions in interface PopupGenerator

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the prefered size of the Fig. This will be useful for automated layout. By default just uses the current size. Subclasses must override to return something useful.


getPrivateData

public java.lang.String getPrivateData()
TODO document Used in SVG.TEE


getSingle

public boolean getSingle()
Returns the single flag of the Fig


getSize

public java.awt.Dimension getSize()
Returns the size of the Fig.


getTipString

public java.lang.String getTipString(java.awt.event.MouseEvent me)

getTrapRect

public java.awt.Rectangle getTrapRect()

getUseTrapRect

public boolean getUseTrapRect()

getVisState

public int getVisState()
USED BY PGML.tee


getWidth

public int getWidth()
USED BY PGML.tee


getX

public int getX()
USED BY PGML.tee


getXs

public int[] getXs()

getY

public int getY()
USED BY PGML.tee


getYs

public int[] getYs()

hit

public boolean hit(java.awt.Rectangle r)
Determine if the given rectangle contains some pixels of the Fig. This is used to determine if the user is trying to select this Fig. Rather than ask if the mouse point is in the Fig, I use a small rectangle around the mouse point so that small objects and lines are easier to select. If the fig is invisible this method always returns false.

Parameters:
r - the rectangular hit area
Returns:
true if the hit rectangle strikes this fig

insertPoint

public void insertPoint(int i,
                        int x,
                        int y)

intersects

public boolean intersects(java.awt.Rectangle r)
Reply true if the object intersects the given rectangle. Used for selective redrawing and by ModeSelect to select all Figs that are partly within the selection rectangle. Note: comparisons are strict (e.g. '<' instead of '<='), so that figs with zero height or width are handled correctly.


intersectsPerimeter

public boolean intersectsPerimeter(java.awt.Rectangle r)
Reply true if the object's perimeter intersects the given rectangle. Used for selective redrawing and by ModeSelect to select all Figs that are partly within the selection rectangle. Note: comparisons are strict (e.g. '<' instead of '<='), so that figs with zero height or width are handled correctly.


isLowerRightResizable

public boolean isLowerRightResizable()
Returns true if this Fig can be resized by the user.


isMovable

public boolean isMovable()
Returns true if this Fig can be moved around by the user.


isReshapable

public boolean isReshapable()
Returns true if this Fig can be reshaped by the user.


isResizable

public boolean isResizable()
Determine if this Fig can be resized

Returns:
true if this Fig can be resized by the user.

isRotatable

public boolean isRotatable()
Returns true if this Fig can be rotated by the user.


isSelected

public boolean isSelected()
Returns the current selection state for this item

Returns:
True, if the item is currently selected, otherwise false.

makeSelection

public Selection makeSelection()
SelectionManager calls this to attempt to create a custom Selection object when selecting a Fig. Override this only if you have specialist requirements For a selected Fig. SelectionManger uses its own rules if this method returns null.

Returns:
a specialist Selection class or null to delegate creation to the Selection Manager.

OK

public boolean OK()
Check class invariants to make sure the Fig is in a valid state. This is useful for debugging. needs-more-work.


paint

public void paint(java.awt.Graphics g)
Method to paint this Fig. By default it paints an "empty" space, subclasses should override this method.


pointAlongPerimeter

public java.awt.Point pointAlongPerimeter(int dist)
Return a point at the given distance along the path around this Fig. By default, uses perimeter of the Fig's bounding box. Subclasses like FigPoly have more specific logic.


postLoad

public void postLoad()

postSave

public void postSave()

preSave

public void preSave()

print

public void print(java.awt.Graphics g)
Draw the Fig on a PrintGraphics. This just calls paint.


propertyChange

public void propertyChange(java.beans.PropertyChangeEvent pce)
By default just pass it up to enclosing groups. Subclasses of FigNode may want to override this method.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

redraw

public void redraw()
Force recalculating of bounds and redraw of fig.


removePoint

public void removePoint(int i)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove this PropertyChangeListener from the JellyBeans internal list. If the PropertyChangeListener isn't on the list, silently do nothing.


reorder

public void reorder(int func,
                    Layer lay)
Change the back-to-front ordering of a Fig in LayerDiagram. Should the Fig have any say in it?

See Also:
LayerDiagram.reorder(org.tigris.gef.presentation.Fig, int), CmdReorder

routingRect

public java.awt.Rectangle routingRect()
Reply a rectangle that arcs should not route through. Basically this is the bounding box plus some margin around all egdes.


savingAllowed

public boolean savingAllowed()

setSavingAllowed

public void setSavingAllowed(boolean newValue)

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Set the bounds of this Fig. Fires PropertyChangeEvent "bounds".


setBounds

public final void setBounds(java.awt.Rectangle r)
Change my bounding box to the given Rectangle. Just calls setBounds(x, y, w, h).


setCenter

public final void setCenter(java.awt.Point p)

setEnclosingFig

public void setEnclosingFig(Fig f)
USED BY PGML.tee


setGroup

public void setGroup(Fig f)
Sets the enclosing FigGroup of this Fig. The enclosing group is always notified of property changes, without need to add a listener.


setContext

public void setContext(java.lang.String context)

setHeight

public void setHeight(int h)

setLayer

public void setLayer(Layer lay)
Sets the Layer that this Fig belongs to. Fires PropertyChangeEvent "layer".


setFillColor

public void setFillColor(java.awt.Color col)
Sets the color that will be used if the Fig is filled. If col is null, turns off filling. Fires PropertyChangeEvent "fillColor", or "filled".


setFilled

public void setFilled(boolean f)
Sets a flag to either fill the Fig with its fillColor or not. Fires PropertyChangeEvent "filled".


setLineColor

public void setLineColor(java.awt.Color col)
Sets the color to be used if the lineWidth is > 0. If col is null, sets the lineWidth to 0. Fires PropertyChangeEvent "lineColor", or "lineWidth".


setLineWidth

public void setLineWidth(int w)
Set the line width. Zero means lines are not drawn. One draws them one pixel wide. Larger widths are in experimental support stadium (hendrik@freiheit.com, 2003-02-05). Fires PropertyChangeEvent "lineWidth".

Parameters:
w - The new lineWidth value

setDashed

public void setDashed(boolean now_dashed)
Set line to be dashed or not


setDashedString

public void setDashedString(java.lang.String dashString)

setLocation

public void setLocation(int x,
                        int y)
Move the Fig to the given position. By default translates the Fig so that the upper left corner of its bounding box is at the location. Fires property "bounds".


setLocation

public final void setLocation(java.awt.Point p)
Move the Fig to the given position.


setLocked

public void setLocked(boolean b)
Sets whether this Fig is locked or not. Most Cmds check to see if Figs are locked and will not request modifications to locked Figs. Fires PropertyChangeEvent "locked".


setNumPoints

public void setNumPoints(int npoints)

setOwner

public void setOwner(java.lang.Object own)
Sets the owner object of this Fig. Fires PropertyChangeEvent "owner" USED BY PGML.tee


setPoints

public void setPoints(java.awt.Point[] ps)
Get and set the points along a path for Figs that are path-like.


setPoint

public void setPoint(int i,
                     int x,
                     int y)

setPoint

public final void setPoint(int i,
                           java.awt.Point p)

setPoint

public void setPoint(Handle h,
                     int x,
                     int y)

setPoint

public final void setPoint(Handle h,
                           java.awt.Point p)

setPrivateData

public void setPrivateData(java.lang.String data)
Derived classes should implement this method


setSingle

public void setSingle(java.lang.String single)
Sets the single flag of the Fig. Has to be overwritten in subclasses interested in this flag.


setSize

public void setSize(int w,
                    int h)
Sets the size of the Fig. Fires property "bounds".


setSize

public final void setSize(java.awt.Dimension d)
Sets the size of the Fig. Fires property "bounds".


setVisState

public void setVisState(int visState)
USED BY PGML.tee


setWidth

public void setWidth(int w)

setX

public void setX(int x)

setXs

public void setXs(int[] xs)

setY

public void setY(int y)

setYs

public void setYs(int[] ys)

stuffBounds

public void stuffBounds(java.awt.Rectangle r)
Reshape the given rectangle to be my bounding box.


stuffPointAlongPerimeter

public void stuffPointAlongPerimeter(int dist,
                                     java.awt.Point res)

translate

public void translate(int dx,
                      int dy)
Change the position of the object from were it is to were it is plus dx and dy. Often called when an object is dragged. This could be very useful if local-coordinate systems are used because deltas need less transforming... maybe. Fires property "bounds".


updateVisState

public void updateVisState()

within

public boolean within(java.awt.Rectangle r)
Reply true if the entire Fig is contained within the given Rectangle. This can be used by ModeSelect to select Figs that are totally within the selection rectangle.


isVisible

public boolean isVisible()
Returns true if the fig is visible


setVisible

public void setVisible(boolean isDisplayed)
Set the visible status of the fig


setResizable

public void setResizable(boolean resizable)
Set whether this Fig can be resized

Parameters:
resizable - true to make this Fig resizable

setMovable

public void setMovable(boolean movable)
Set whether this Fig can be moved

Parameters:
movable - true to make this Fig movable