|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--uci.gef.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 int[] |
_dashes
|
protected Color |
_fillColor
Fill color of fig object. |
protected boolean |
_filled
True if the object should fill in its area. |
protected Fig |
_group
|
protected int |
_h
|
protected Layer |
_layer
The Layer that this Fig is in. |
protected Color |
_lineColor
Outline color of fig object. |
protected int |
_lineWidth
Thickness of line around object, for now limited to 0 or 1. |
protected boolean |
_locked
True if this object is locked and cannot be moved by the user. |
protected int |
_w
|
protected int |
_x
Coordinates of the Fig's bounding box. |
protected int |
_y
|
int |
BORDER
Margin between this Fig and automatically routed arcs. |
static int[][] |
DASH_ARRAYS
|
static String[] |
DASHED_CHOICES
The size of the dashes drawn when the Fig is dashed. |
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,
Color lineColor,
Color fillColor)
Construct a new Fig with the given bounds and colors. |
|
Fig(int x,
int y,
int w,
int h,
Color lineColor,
Color fillColor,
Object own)
Construct a new Fig with the given bounds, colors, and owner. |
|
| Method Summary | |
void |
addPoint(int x,
int y)
|
void |
addPropertyChangeListener(PropertyChangeListener l)
The specified PropertyChangeListeners propertyChange method will be called each time the value of any bound property is changed. |
void |
align(Rectangle r,
int direction,
Editor ed)
Align this Fig with the given rectangle. |
void |
calcBounds()
Update the bounds of this Fig. |
Point |
center()
Return the center of the given Fig. |
String |
classNameAndBounds()
|
void |
cleanUp()
|
Object |
clone()
|
Point |
connectionPoint(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(Point p)
Reply true if the given point is inside this Fig by calling contains(int x, int y). |
boolean |
contains(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 damaged region so that I will eventualy be redrawn. |
void |
delete()
Remove this Fig from the Layer being edited by the given editor. |
void |
dispose()
Delete whatever application object this Fig is representing, the Fig itself should automatically be deleted as a side-effect. |
protected int |
drawDashedLine(Graphics g,
int phase,
int x1,
int y1,
int x2,
int y2)
|
protected void |
drawDashedPerimeter(Graphics g)
|
void |
endTrans()
This is called after an Cmd mondifies a Fig and the Fig needs to be redrawn in its new position. |
protected void |
firePropChange(String propName,
boolean oldV,
boolean newV)
|
protected void |
firePropChange(String propName,
int oldV,
int newV)
|
protected void |
firePropChange(String propName,
Object oldV,
Object newV)
Creates a PropertyChangeEvent and calls all registered listeners propertyChanged() method. |
Rectangle |
getBounds()
Return a Rectangle that completely encloses this Fig. |
Point |
getClosestPoint(Point anotherPt)
|
boolean |
getDashed()
Get the dashed attribute |
int |
getDashed01()
|
String |
getDashedString()
|
Vector |
getEnclosedFigs()
|
Fig |
getEnclosingFig()
|
Color |
getFillColor()
|
boolean |
getFilled()
|
int |
getFilled01()
|
Point |
getFirstPoint()
|
Vector |
getGravityPoints()
|
Fig |
getGroup()
|
int |
getHalfHeight()
|
int |
getHalfWidth()
|
int |
getHeight()
|
String |
getId()
|
Point |
getLastPoint()
|
Layer |
getLayer()
|
Color |
getLineColor()
|
int |
getLineWidth()
|
Point |
getLocation()
Returns a point that is the upper left corner of the Fig's bounding box. |
boolean |
getLocked()
|
Dimension |
getMinimumSize()
Returns the minimum size of the Fig. |
int |
getNumPoints()
|
Object |
getOwner()
|
int |
getPerimeterLength()
Return the length of the path around this Fig. |
Point[] |
getPoints()
|
Point |
getPoints(int i)
|
Vector |
getPopUpActions(MouseEvent me)
|
Dimension |
getPreferedSize()
Returns the prefered size of the Fig. |
Dimension |
getSize()
Returns the size of the Fig. |
String |
getTipString(MouseEvent me)
|
Rectangle |
getTrapRect()
|
boolean |
getUseTrapRect()
|
int |
getWidth()
|
int |
getX()
|
int[] |
getXs()
|
int |
getY()
|
int[] |
getYs()
|
boolean |
hit(Rectangle r)
Reply true if the given rectangle contains some pixels of the Fig. |
void |
insertPoint(int i,
int x,
int y)
|
boolean |
intersects(Rectangle r)
Reply true if the object intersects the given rectangle. |
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()
Returns true if this Fig can be resized by the user. |
boolean |
isRotatable()
Returns true if this Fig can be rotated by the user. |
Selection |
makeSelection()
Returns a custom Selection object for use when this Fig is selected by the user. |
boolean |
OK()
Check class invariants to make sure the Fig is in a valid state. |
void |
paint(Graphics g)
Method to paint this Fig. |
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(Graphics g)
Draw the Fig on a PrintGraphics. |
void |
propertyChange(PropertyChangeEvent pce)
By default just pass it up to enclosing groups. |
void |
removePoint(int i)
|
void |
removePropertyChangeListener(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. |
Rectangle |
routingRect()
Reply a rectangle that arcs should not route through. |
void |
setBounds(int x,
int y,
int w,
int h)
Set the bounds of this Fig. |
void |
setBounds(Rectangle r)
Change my bounding box to the given Rectangle. |
void |
setDashed(boolean now_dashed)
Set line to be dashed or not |
void |
setDashedString(String dashString)
|
void |
setEnclosingFig(Fig f)
|
void |
setFillColor(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 |
setHeight(int h)
|
void |
setLayer(Layer lay)
Sets the Layer that this Fig belongs to. |
void |
setLineColor(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(Point p)
Move the Fig to the given position. |
void |
setLocked(boolean b)
Sets whether this Fig is locked or not. |
void |
setNumPoints(int npoints)
|
void |
setOwner(Object own)
Sets the owner object of this Fig. |
void |
setPoints(Handle h,
int x,
int y)
|
void |
setPoints(Handle h,
Point p)
|
void |
setPoints(int i,
int x,
int y)
|
void |
setPoints(int i,
Point p)
|
void |
setPoints(Point[] ps)
Get and set the points along a path for Figs that are path-like. |
void |
setSize(Dimension d)
Sets the size of the Fig. |
void |
setSize(int w,
int h)
Sets the size of the Fig. |
void |
setWidth(int w)
|
void |
setX(int x)
|
void |
setXs(int[] xs)
|
void |
setY(int y)
|
void |
setYs(int[] ys)
|
void |
startTrans()
This indicates that some Cmd is starting a manipulation on the receiving Fig and that redrawing must take place at the objects old location. |
void |
stuffBounds(Rectangle r)
Reshape the given rectangle to be my bounding box. |
void |
stuffPointAlongPerimeter(int dist,
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. |
boolean |
within(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
public static String[] DASHED_CHOICES
public static int[][] DASH_ARRAYS
protected Layer _layer
protected boolean _locked
protected int _x
protected int _y
protected int _w
protected int _h
protected Color _lineColor
protected Color _fillColor
protected int _lineWidth
protected int[] _dashes
protected boolean _filled
protected Fig _group
public final int BORDER
| Constructor Detail |
public Fig(int x,
int y,
int w,
int h,
Color lineColor,
Color fillColor,
Object own)
public Fig(int x,
int y,
int w,
int h,
Color lineColor,
Color fillColor)
public Fig(int x,
int y,
int w,
int h)
public Fig()
| Method Detail |
public Object clone()
public boolean OK()
public void setLayer(Layer lay)
public Layer getLayer()
public void setLocked(boolean b)
public boolean getLocked()
public Rectangle getTrapRect()
public boolean getUseTrapRect()
public Fig getEnclosingFig()
public void setEnclosingFig(Fig f)
public Vector getEnclosedFigs()
public void setOwner(Object own)
public Object getOwner()
public String getId()
public void setGroup(Fig f)
public Fig getGroup()
public void setLineColor(Color col)
public Color getLineColor()
public void setFillColor(Color col)
public Color getFillColor()
public void setFilled(boolean f)
public boolean getFilled()
public int getFilled01()
public void setLineWidth(int w)
public int getLineWidth()
public void setDashedString(String dashString)
public String getDashedString()
public void setDashed(boolean now_dashed)
public boolean getDashed()
public int getDashed01()
public String getTipString(MouseEvent me)
public void print(Graphics g)
public void paint(Graphics g)
protected void drawDashedPerimeter(Graphics g)
protected int drawDashedLine(Graphics g,
int phase,
int x1,
int y1,
int x2,
int y2)
public String classNameAndBounds()
public Rectangle getBounds()
public void stuffBounds(Rectangle r)
public final void setBounds(Rectangle r)
public void setBounds(int x,
int y,
int w,
int h)
public void delete()
public void dispose()
public Selection makeSelection()
public boolean isMovable()
public boolean isResizable()
public boolean isLowerRightResizable()
public boolean isReshapable()
public boolean isRotatable()
public void damage()
public void startTrans()
public void endTrans()
public Rectangle routingRect()
public void reorder(int func,
Layer lay)
LayerDiagram.reorder(uci.gef.Fig, int),
CmdReorder
public void translate(int dx,
int dy)
public final void setLocation(Point p)
public void setLocation(int x,
int y)
public Point getLocation()
public Dimension getSize()
public final void setSize(Dimension d)
public void setSize(int w,
int h)
public Dimension getMinimumSize()
public Dimension getPreferedSize()
public Vector getPopUpActions(MouseEvent me)
public void setX(int x)
public int getX()
public void setY(int y)
public int getY()
public void setWidth(int w)
public int getWidth()
public int getHalfWidth()
public void setHeight(int h)
public int getHeight()
public int getHalfHeight()
public void setPoints(Point[] ps)
public Point getFirstPoint()
public Point getLastPoint()
public Point[] getPoints()
public final void setPoints(int i,
Point p)
public final void setPoints(Handle h,
Point p)
public void setPoints(int i,
int x,
int y)
public void setPoints(Handle h,
int x,
int y)
public Point getPoints(int i)
public int getNumPoints()
public void setNumPoints(int npoints)
public int[] getXs()
public void setXs(int[] xs)
public int[] getYs()
public void setYs(int[] ys)
public void addPoint(int x,
int y)
public void insertPoint(int i,
int x,
int y)
public void removePoint(int i)
public int getPerimeterLength()
public Point pointAlongPerimeter(int dist)
public void stuffPointAlongPerimeter(int dist,
Point res)
public void align(Rectangle r,
int direction,
Editor ed)
public boolean contains(int x,
int y)
FigCircle,
FigEdgepublic final boolean contains(Point p)
public boolean contains(Rectangle r)
public boolean within(Rectangle r)
public boolean hit(Rectangle r)
protected int countCornersContained(int x,
int y,
int w,
int h)
public boolean intersects(Rectangle r)
public Point center()
public Point connectionPoint(Point anotherPt)
public Vector getGravityPoints()
public Point getClosestPoint(Point anotherPt)
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 calcBounds()
FigText.calcBounds()public void addPropertyChangeListener(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 removePropertyChangeListener(PropertyChangeListener l)
protected void firePropChange(String propName,
Object oldV,
Object newV)
protected void firePropChange(String propName,
int oldV,
int newV)
protected void firePropChange(String propName,
boolean oldV,
boolean newV)
public void propertyChange(PropertyChangeEvent pce)
public void preSave()
public void postSave()
public void postLoad()
public void cleanUp()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||