|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jdraw.graphicalobjects.GraphicalObject
The abstract parent class of all graphical objects.
Field Summary | |
private boolean |
bDragInProgress
Flag indicating whether this graphical object is currently dragged. |
private Color |
colColor
The color of this object. |
private int |
iX
The abscissa of this object. |
private int |
iY
The ordinate of this object. |
private ArrayList |
lstPropertyChangeListeners
|
private Point |
ptDragAndDropStartPosition
The position from where the drag and drop started. |
private Point |
ptInitialObjectPosition
The position where this graphical object was at the beginning of the drag and drop. |
private Rectangle |
rectInitialBoundingBox
|
Constructor Summary | |
GraphicalObject(int iX,
int iY,
Color colColor)
Creates a new GraphicalObject with specified position and color. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener pplListener)
Adds a BoudingBoxListener to this graphical object. |
void |
commitDragAndDrop(int iMouseX,
int iMouseY)
Stops the drag and drop process, commiting changes. |
void |
drag(int iMouseX,
int iMouseY)
Updates this graphical object position, relatively to its position at the beginning of the drag and drop process. |
protected void |
fireBoudingBoxChange()
Fires a BoudingBox property change event. |
abstract Rectangle |
getBoundingBox()
Returns the bounding box of this graphical object. |
Color |
getColor()
Returns the color of this graphical object. |
abstract Cursor |
getCursor()
Returns the mouse cursor for this object. |
int |
getDistance(Point ptPoint)
Returns the minimal distance between this object and the specified point. |
static int |
getDistanceSq(double dblX1,
double dblY1,
double dblX2,
double dblY2)
Returns the square of the distance between two points, stated by their coordinates (doubles). |
static int |
getDistanceSq(int iX1,
int iY1,
int iX2,
int iY2)
Returns the square of the distance between two points, stated by their coordinates (integers). |
abstract int |
getDistanceSq(Point ptPoint)
Returns the square of the minimal distance between this object and the specified point. |
abstract String |
getFriendlyName()
Returns the friendly name of this graphical object. |
GraphicalObjectProperties |
getPropertyDialog(Frame frmOwner)
Returns a dialog box used to set the properties of this graphical object. |
int |
getX()
Returns the abscissa of this graphical object. |
int |
getY()
Returns the ordinate of this graphical object. |
boolean |
isDragInProgress()
Indicates whether this graphical object is currently dragged. |
protected void |
moveTo_silent(int iNewX,
int iNewY)
Moves this graphical object to the specified position, without firing any event. |
void |
moveTo(int iNewX,
int iNewY)
Moves this graphical object to the specified position. |
void |
openPropertyDialog(Frame frmOwner)
Opens a dialog box used to set the properties of this graphical object. |
abstract void |
paint(Graphics g)
Paints this graphical object. |
protected void |
prepareBoudingBoxEvent()
Prepares the firing of a BoudingBoxEvent by saving the current bounding box. |
void |
removePropertyChangeListener(PropertyChangeListener pplListener)
Removes a BoudingBoxListener from this graphical object. |
void |
rollbackDragAndDrop()
Stops the drag and drop process, cancelling changes. |
protected void |
setColor_silent(Color colNewColor)
Sets the color of this graphical object, without firing any event. |
void |
setColor(Color colNewColor)
Sets the color of this graphical object. |
protected void |
setX_silent(int iNewX)
Sets the abscissa of this graphical object, without firing any event. |
void |
setX(int iNewX)
Sets the abscissa of this graphical object. |
protected void |
setY_silent(int iNewY)
Sets the ordinate of this graphical object, without firing any event. |
void |
setY(int iNewY)
Sets the ordinate of this graphical object. |
void |
startDragAndDrop(int iMouseX,
int iMouseY)
Starts the drag and drop process. |
void |
suspendDragAndDrop()
Suspends the drag and drop process. |
protected void |
updateCachedData()
Invoked when cached data have to be updated. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private int iX
private int iY
private Color colColor
private final ArrayList lstPropertyChangeListeners
private Rectangle rectInitialBoundingBox
private boolean bDragInProgress
private final Point ptInitialObjectPosition
private final Point ptDragAndDropStartPosition
Constructor Detail |
public GraphicalObject(int iX, int iY, Color colColor)
GraphicalObject
with specified position and color.Method Detail |
public abstract Rectangle getBoundingBox()
public abstract Cursor getCursor()
public abstract String getFriendlyName()
public GraphicalObjectProperties getPropertyDialog(Frame frmOwner)
public void openPropertyDialog(Frame frmOwner)
public abstract void paint(Graphics g)
public int getDistance(Point ptPoint)
public abstract int getDistanceSq(Point ptPoint)
public static int getDistanceSq(int iX1, int iY1, int iX2, int iY2)
iX1
- the abscissa of the first pointiY1
- the ordinate of the first pointiX2
- the abscissa of the second pointiY2
- the ordinate of the second pointpublic static int getDistanceSq(double dblX1, double dblY1, double dblX2, double dblY2)
dblX1
- the abscissa of the first pointdblY1
- the ordinate of the first pointdblX2
- the abscissa of the second pointdblY2
- the ordinate of the second pointpublic int getX()
public void setX(int iNewX)
protected void setX_silent(int iNewX)
public int getY()
public void setY(int iNewY)
protected void setY_silent(int iNewY)
public void moveTo(int iNewX, int iNewY)
protected void moveTo_silent(int iNewX, int iNewY)
public Color getColor()
public void setColor(Color colNewColor)
protected void setColor_silent(Color colNewColor)
public void addPropertyChangeListener(PropertyChangeListener pplListener)
public void removePropertyChangeListener(PropertyChangeListener pplListener)
protected void prepareBoudingBoxEvent()
protected void fireBoudingBoxChange()
protected void updateCachedData()
public boolean isDragInProgress()
public void startDragAndDrop(int iMouseX, int iMouseY)
public void drag(int iMouseX, int iMouseY)
public void suspendDragAndDrop()
public void commitDragAndDrop(int iMouseX, int iMouseY)
public void rollbackDragAndDrop()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |