|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fdda.graphics.java2d.Component | +--fdda.graphics.java2d.Node
Implementation of the graphical representation of nodes for Java2D. A node is drawn as a filled circle, the label inside. Not working nodes are crossed out.
Field Summary | |
(package private) static double |
RADIUS
default radius for nodes |
static Color |
RED_CROSS_COLOR
color of the cross that shows not working nodes |
(package private) static double |
REPEATER_RADIUS
radius for repeaters |
Fields inherited from class fdda.graphics.java2d.Component |
COLOR_NORMAL, COLOR_SELECTED, dirtyShape, selected, shape, x, y |
Fields inherited from interface fdda.graphics.Component |
SEL_ALL, SEL_EQUALS, SEL_MOVABLES, SEL_NOTHING |
Constructor Summary | |
Node(double x,
double y)
Default connstructor. |
|
Node(double x,
double y,
boolean selected)
Constructor |
Method Summary | |
void |
addProperty(Property property)
Adds a property to the holder. |
void |
addPropertyListener(PropertyListener pl)
Adds a PropertyListener (Observer pattern). |
protected void |
calcShape()
Recalculates the shape. |
void |
changeProperty(Property property)
Changes a property of the holder - i.e., replaces the property with the name of the parameter property with the parameter. |
Object |
clone()
Clones the component |
void |
draw(Graphics2D graphContext)
Draws the component, using the given graphics. |
void |
firePropertyChanged(Property property)
Informs the listeners that a property has been changed. |
double |
getLineStartX()
Returns the x coordinate of the point where lines should start. |
double |
getLineStartY()
Returns the y coordinate of the point where lines should start. |
Node |
getModelNode()
Returns the model node which is symbolized by this node. |
Color |
getPrimaryColor()
Returns the main color of the node. |
Iterator |
getProperties()
Returns an Iterator over the properties of the holder. |
Property |
getProperty(String name)
Returns a property of the holder. |
double |
getRadius()
Returns the radius of the node |
Color |
getSecondaryColor()
Returns the secondary color of the node. |
boolean |
isMovable()
Returns true. |
boolean |
isWorking()
Returns whether the component is working. |
void |
move(double x,
double y)
Move the component (or its most prominent point). |
void |
removeProperty(Property property)
Removes a property from the holder. |
void |
removePropertyListener(PropertyListener listener)
Removes a PropertyListener (Observer pattern). |
void |
repaint()
Refreshes the graphics. |
int |
selectableWith()
Returns SEL_MOVABLES |
void |
setModelNode(Node modelNode)
Sets the model node which is symbolized by this node. |
void |
setPrimaryColor(Color color)
Sets the main color of the node. |
void |
setSecondaryColor(Color color)
Sets the secondary color of the node. |
void |
setWorking(boolean working)
Sets whether the component is working. |
Object |
visit(ComponentVisitor visitor)
Calls visitNode according to visitor pattern |
Methods inherited from class fdda.graphics.java2d.Component |
deselect, getGraphicalSystem, getShape, getX, getY, isSelected, recalculateShape, select, setGraphicalSystem, setXY |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface fdda.graphics.Component |
deselect, getGraphicalSystem, getShape, getX, getY, isSelected, recalculateShape, select, setGraphicalSystem, setXY |
Field Detail |
static final double RADIUS
static final double REPEATER_RADIUS
public static final Color RED_CROSS_COLOR
Constructor Detail |
public Node(double x, double y)
x
- the x coordinatey
- the y coordinatepublic Node(double x, double y, boolean selected)
x
- the x coordinatey
- the y coordinateselected
- whether the node shall be selectedMethod Detail |
public Object clone()
Component
clone
in interface Component
clone
in class Component
public boolean isMovable()
isMovable
in interface Component
Component.isMovable()
public void move(double x, double y)
Component
move
in interface Component
x
- offset for move in x directiony
- offset for move in y directionpublic int selectableWith()
selectableWith
in interface Component
Component.selectableWith()
public void draw(Graphics2D graphContext)
Component
draw
in class Component
graphContext
- the graphicspublic void repaint()
Node
repaint
in interface Node
public double getLineStartX()
Node
getLineStartX
in interface Node
public double getLineStartY()
Node
getLineStartY
in interface Node
public double getRadius()
public Object visit(ComponentVisitor visitor)
visit
in interface Component
visitor
- the visitor
Component.visit(fdda.graphics.ComponentVisitor)
public void setModelNode(Node modelNode)
Node
setModelNode
in interface Node
modelNode
- the model nodepublic Node getModelNode()
Node
getModelNode
in interface Node
public Color getPrimaryColor()
Node
getPrimaryColor
in interface Node
public void setPrimaryColor(Color color)
Node
setPrimaryColor
in interface Node
color
- the main colorpublic Color getSecondaryColor()
Node
getSecondaryColor
in interface Node
public void setSecondaryColor(Color color)
Node
setSecondaryColor
in interface Node
color
- the secondary color.public void addProperty(Property property)
PropertyHolder
addProperty
in interface PropertyHolder
public void removeProperty(Property property)
PropertyHolder
removeProperty
in interface PropertyHolder
property
- the property to be removed, must not be nullpublic void changeProperty(Property property)
PropertyHolder
changeProperty
in interface PropertyHolder
property
- the new property, must not be nullpublic Property getProperty(String name)
PropertyHolder
getProperty
in interface PropertyHolder
name
- the name of the property
public Iterator getProperties()
PropertyHolder
getProperties
in interface PropertyHolder
public void addPropertyListener(PropertyListener pl)
PropertyHolder
addPropertyListener
in interface PropertyHolder
pl
- the listener to be addedEventListenerList
public void removePropertyListener(PropertyListener listener)
PropertyHolder
removePropertyListener
in interface PropertyHolder
listener
- the listener to be removedEventListenerList
public void firePropertyChanged(Property property)
PropertyHolder
firePropertyChanged
in interface PropertyHolder
property
- the property that was changed.public boolean isWorking()
WorkingPart
isWorking
in interface WorkingPart
public void setWorking(boolean working)
WorkingPart
setWorking
in interface WorkingPart
working
- whether the component is workingprotected void calcShape()
Component
calcShape
in class Component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |