|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--fdda.graphics.java2d.Component
Implementation of the component interface. Provides several standard implementations of abstract methods. Most notably implements a mechanism for the calculation of the shape: calcShape() is _only_ called by getShape(), and _only_ if the shape has changed. A change of the shape is signalled by the attribute dirtyShape.
| Field Summary | |
protected static Color |
COLOR_NORMAL
normal drawing color |
protected static Color |
COLOR_SELECTED
color for selected elements |
protected boolean |
dirtyShape
must the shape be recalculated? |
protected boolean |
selected
whether the component is selected |
protected Shape |
shape
the shape of the component |
protected double |
x
the x coordinate |
protected double |
y
the y coordinate |
| Fields inherited from interface fdda.graphics.Component |
SEL_ALL, SEL_EQUALS, SEL_MOVABLES, SEL_NOTHING |
| Constructor Summary | |
Component(double x,
double y)
Default constructor. |
|
Component(double x,
double y,
boolean selected)
Constructor. |
|
| Method Summary | |
protected abstract void |
calcShape()
Recalculates the shape. |
Object |
clone()
Clones the component |
void |
deselect()
Unsets the selected flag. |
abstract void |
draw(Graphics2D graphContext)
Draws the component, using the given graphics. |
GraphicalSystem |
getGraphicalSystem()
Returns the system which includes the component. |
Shape |
getShape()
Returns the shape of the component. |
double |
getX()
Returns the x coordinate of the component (or its most prominent point). |
double |
getY()
Returns the y coordinate of the component (or its most prominent point). |
boolean |
isSelected()
Returns whether the component is currently selected. |
void |
recalculateShape()
Recalculates the shape of the component. |
void |
select()
Sets the selected flag. |
void |
setGraphicalSystem(GraphicalSystem graphicalSystem)
Sets the system which includes the component |
void |
setXY(double x,
double y)
Sets the coordinates of the component (or of its most prominent point). |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface fdda.graphics.Component |
isMovable, move, selectableWith, visit |
| Field Detail |
protected double x
protected double y
protected Shape shape
protected boolean selected
protected static final Color COLOR_NORMAL
protected static final Color COLOR_SELECTED
protected boolean dirtyShape
| Constructor Detail |
public Component(double x,
double y)
x - the x coordinatey - the y coordinate
public Component(double x,
double y,
boolean selected)
x - the x coordinatey - the y coordinateselected - whether the component is selected| Method Detail |
public Object clone()
Component
clone in interface Componentclone in class Objectpublic void select()
select in interface ComponentComponent.select()public void deselect()
deselect in interface ComponentComponent.deselect()public double getX()
Component
getX in interface Componentpublic double getY()
Component
getY in interface Component
public void setXY(double x,
double y)
Component
setXY in interface Componentx - the x coordinatey - the y coordinatepublic Shape getShape()
Component
getShape in interface Componentpublic void recalculateShape()
Component
recalculateShape in interface Componentprotected abstract void calcShape()
public boolean isSelected()
Component
isSelected in interface Componentpublic abstract void draw(Graphics2D graphContext)
graphContext - the graphicspublic GraphicalSystem getGraphicalSystem()
Component
getGraphicalSystem in interface Componentpublic void setGraphicalSystem(GraphicalSystem graphicalSystem)
Component
setGraphicalSystem in interface ComponentgraphicalSystem - the graphical system
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||