|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tigris.gef.presentation.Fig
public class Fig
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.
| 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 |
|---|
public final int MIN_SIZE
protected int _x
protected int _y
protected int _w
protected int _h
protected float[] _dashes
protected int _dashStyle
protected int _dashPeriod
protected boolean _filled
protected java.lang.String _context
protected boolean _allowsSaving
public final int BORDER
protected AnnotationStrategy an
protected boolean annotationStatus
protected Fig annotationOwner
| Constructor Detail |
|---|
public Fig()
public Fig(int x,
int y,
int w,
int h)
public Fig(int x,
int y,
int w,
int h,
java.awt.Color lineColor,
java.awt.Color fillColor)
public Fig(int x,
int y,
int w,
int h,
java.awt.Color lineColor,
java.awt.Color fillColor,
java.lang.Object own)
| Method Detail |
|---|
public void setResource(java.lang.String resource)
public java.lang.String getResource()
public void setAnnotationOwner(Fig f)
public void unsetAnnotationOwner()
public Fig getAnnotationOwner()
public AnnotationStrategy getAnnotationStrategy()
public void setAnnotationStrategy(AnnotationStrategy a)
public boolean isAnnotation()
public void setAnnotationStatus(boolean newValue)
public void addAnnotation(Fig annotation,
java.lang.String type,
java.lang.String context)
public void removeAnnotation(java.lang.String context)
public void removeAnnotation(Fig annotationFig)
public void translateAnnotations()
public void updateAnnotationPositions()
public void initAnnotations()
public void addPoint(int x,
int y)
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
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.
public void align(java.awt.Rectangle r,
int direction,
Editor ed)
public void calcBounds()
FigText.calcBounds()public java.awt.Point center()
public java.lang.String classNameAndBounds()
public void cleanUp()
public java.lang.Object clone()
clone in class java.lang.Objectpublic boolean isCopyable()
public boolean isCutable()
public java.awt.Point connectionPoint(java.awt.Point anotherPt)
public boolean contains(int x,
int y)
FigCircle,
FigEdgepublic final boolean contains(java.awt.Point p)
public boolean contains(java.awt.Rectangle r)
protected int countCornersContained(int x,
int y,
int w,
int h)
public void createDrag(int anchorX,
int anchorY,
int x,
int y,
int snapX,
int snapY)
FigLine.createDrag(int, int, int, int, int, int)public void endTrans()
public void damage()
public java.awt.Rectangle getHandleBox()
public void setHandleBox(int x,
int y,
int w,
int h)
public void removeFromDiagram()
public void deleteFromModel()
protected int drawDashedLine(java.awt.Graphics g,
int phase,
int x1,
int y1,
int x2,
int y2)
protected void drawDashedPerimeter(java.awt.Graphics g)
public void firePropChange(java.lang.String propName,
int oldV,
int newV)
public void firePropChange(java.lang.String propName,
java.lang.Object oldV,
java.lang.Object newV)
public void firePropChange(java.lang.String propName,
boolean oldV,
boolean newV)
public java.awt.Rectangle getBounds()
public java.awt.Rectangle getBounds(java.awt.Rectangle r)
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.
r - the return value, modified to the components bounds
public java.awt.Point getClosestPoint(java.awt.Point anotherPt)
public boolean getDashed()
public int getDashed01()
public java.lang.String getDashedString()
public java.util.Vector getEnclosedFigs()
public Fig getEnclosingFig()
public boolean hasFillColor()
public java.awt.Color getFillColor()
public boolean getFilled()
public int getFilled01()
public boolean hasLineColor()
public java.awt.Color getLineColor()
public int getLineWidth()
public java.awt.Point getFirstPoint()
public java.util.List getGravityPoints()
public Fig getGroup()
public java.lang.String getContext()
public int getHalfHeight()
public int getHalfWidth()
public int getHeight()
public java.lang.String getId()
public java.awt.Point getLastPoint()
public Layer getLayer()
public java.awt.Point getLocation()
public boolean getLocked()
public java.awt.Dimension getMinimumSize()
public int getNumPoints()
public java.lang.Object getOwner()
public int getPerimeterLength()
public java.awt.Point[] getPoints()
public java.awt.Point getPoint(int i)
public java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)
getPopUpActions in interface PopupGeneratorpublic java.awt.Dimension getPreferredSize()
public java.lang.String getPrivateData()
public boolean getSingle()
public java.awt.Dimension getSize()
public java.lang.String getTipString(java.awt.event.MouseEvent me)
public java.awt.Rectangle getTrapRect()
public boolean getUseTrapRect()
public int getVisState()
public int getWidth()
public int getX()
public int[] getXs()
public int getY()
public int[] getYs()
public boolean hit(java.awt.Rectangle r)
r - the rectangular hit area
public void insertPoint(int i,
int x,
int y)
public boolean intersects(java.awt.Rectangle r)
public boolean intersectsPerimeter(java.awt.Rectangle r)
public boolean isLowerRightResizable()
public boolean isMovable()
public boolean isReshapable()
public boolean isResizable()
public boolean isRotatable()
public boolean isSelected()
public Selection makeSelection()
public boolean OK()
public void paint(java.awt.Graphics g)
public java.awt.Point pointAlongPerimeter(int dist)
public void postLoad()
public void postSave()
public void preSave()
public void print(java.awt.Graphics g)
public void propertyChange(java.beans.PropertyChangeEvent pce)
propertyChange in interface java.beans.PropertyChangeListenerpublic void redraw()
public void removePoint(int i)
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
public void reorder(int func,
Layer lay)
LayerDiagram.reorder(org.tigris.gef.presentation.Fig, int),
CmdReorderpublic java.awt.Rectangle routingRect()
public boolean savingAllowed()
public void setSavingAllowed(boolean newValue)
public void setBounds(int x,
int y,
int w,
int h)
public final void setBounds(java.awt.Rectangle r)
public final void setCenter(java.awt.Point p)
public void setEnclosingFig(Fig f)
public void setGroup(Fig f)
public void setContext(java.lang.String context)
public void setHeight(int h)
public void setLayer(Layer lay)
public void setFillColor(java.awt.Color col)
public void setFilled(boolean f)
public void setLineColor(java.awt.Color col)
public void setLineWidth(int w)
w - The new lineWidth valuepublic void setDashed(boolean now_dashed)
public void setDashedString(java.lang.String dashString)
public void setLocation(int x,
int y)
public final void setLocation(java.awt.Point p)
public void setLocked(boolean b)
public void setNumPoints(int npoints)
public void setOwner(java.lang.Object own)
public void setPoints(java.awt.Point[] ps)
public void setPoint(int i,
int x,
int y)
public final void setPoint(int i,
java.awt.Point p)
public void setPoint(Handle h,
int x,
int y)
public final void setPoint(Handle h,
java.awt.Point p)
public void setPrivateData(java.lang.String data)
public void setSingle(java.lang.String single)
public void setSize(int w,
int h)
public final void setSize(java.awt.Dimension d)
public void setVisState(int visState)
public void setWidth(int w)
public void setX(int x)
public void setXs(int[] xs)
public void setY(int y)
public void setYs(int[] ys)
public void stuffBounds(java.awt.Rectangle r)
public void stuffPointAlongPerimeter(int dist,
java.awt.Point res)
public void translate(int dx,
int dy)
public void updateVisState()
public boolean within(java.awt.Rectangle r)
public boolean isVisible()
public void setVisible(boolean isDisplayed)
public void setResizable(boolean resizable)
resizable - true to make this Fig resizablepublic void setMovable(boolean movable)
movable - true to make this Fig movable
| ||||