|
||||||||||
| 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.Container
|
+--fdda.graphics.java2d.Line
A line between two nodes. The line consists of one or more segments, leading from the start node through one ore more intermediate points to the end node. Implemented is the line as a container in which both the segments and the points (which are components) are stored. Since the points must be drawn after the segments (to be above them), the storage order is LineSegment (LineSegment Point)*; i.e. a point is always directly after the two segments it connects. The coordinates of a line are the coordinates of its start point
| Field Summary | |
static double |
NORM_DIST_PER_CYCLE
norm value for the speed of messages |
| Fields inherited from class fdda.graphics.java2d.Container |
elements |
| 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 | |
Line(double startX,
double startY,
double endX,
double endY)
Constructor. |
|
| Method Summary | |
Point |
addPoint(double x,
double y)
Adds a point to the line. |
void |
addProperty(Property property)
Adds a property to the holder. |
void |
addPropertyListener(PropertyListener pl)
Adds a PropertyListener (Observer pattern). |
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 |
deselect()
Deselects only the line segments |
void |
draw(Graphics2D graphContext)
Draws all elements in the container. |
void |
firePropertyChanged(Property property)
Informs the listeners that a property has been changed. |
Color |
getColor()
Returns the color of the line. |
Connection |
getConnection()
Returns the connection that is symbolized by this line. |
double |
getEndX()
Returns the x coordinate of the end point of the line |
double |
getEndY()
Returns the y coordinate of the end point of the line |
double |
getLength()
Returns the length of the line |
double |
getMessageDistancePerCycle()
Returns how far a message moves in one cycle. |
double |
getMessageEndX()
Returns the x coordinate of the end point for messages |
double |
getMessageEndY()
Returns the y coordinate of the end point for messages |
double |
getMessageStartX()
Returns the x coordinate of start end point for messages |
double |
getMessageStartY()
Returns the y coordinate of the start point for messages |
Iterator |
getProperties()
Returns an Iterator over the properties of the holder. |
Property |
getProperty(String name)
Returns a property of the holder. |
double |
getX()
Overwritten again since the container class changes default implementation. |
double |
getY()
Overwritten again since the container class changes default implementation. |
boolean |
isDirected()
Returns whether the line is directed. |
boolean |
isFlatteningAllowed()
Returns false. |
boolean |
isMovable()
Returns false. |
boolean |
isWorking()
Returns whether the component is working. |
void |
move(double x,
double y)
Moves all line segments and all points. |
void |
moveEndPoint(double x,
double y)
Moves the end point of the line |
void |
moveMessage(Message message)
Moves a message on the line. |
void |
moveStartPoint(double x,
double y)
Moves the start point of the line. |
void |
pointMoved(Point point)
Informs the line that a point has been moved. |
void |
removePoint(Point point)
Removes a point from the line. |
void |
removeProperty(Property property)
Removes a property from the holder. |
void |
removePropertyListener(PropertyListener listener)
Removes a PropertyListener (Observer pattern). |
void |
select()
Selects only the line segements |
int |
selectableWith()
Returns SEL_EQUALS |
void |
setColor(Color color)
Sets the color of the line. |
void |
setConnection(Connection connection)
Sets the connection that is symbolized by this line. |
void |
setDirected(boolean directed)
Sets whether the line is directed. |
void |
setEndXY(double x,
double y)
Sets the end point of the line |
void |
setWorking(boolean working)
Sets whether the component is working. |
void |
setXY(double x,
double y)
Sets the coordinates of the component (or of its most prominent point). |
| Methods inherited from class fdda.graphics.java2d.Container |
addElement, clear, flatten, getIterator, getSize, hasElement, removeElement, setGraphicalSystem, visit |
| Methods inherited from class fdda.graphics.java2d.Component |
getGraphicalSystem, getShape, isSelected, recalculateShape, setGraphicalSystem |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface fdda.graphics.Component |
getGraphicalSystem, getShape, isSelected, recalculateShape, setGraphicalSystem, visit |
| Field Detail |
public static final double NORM_DIST_PER_CYCLE
| Constructor Detail |
public Line(double startX,
double startY,
double endX,
double endY)
startX - x coordinate of start pointstartY - y coordinate of start pointendX - x coordinate of end pointendY - y coordinate of end point| Method Detail |
public double getX()
getX in interface ComponentgetX in class ContainerComponent.getX()public double getY()
getY in interface ComponentgetY in class ContainerComponent.getY()public double getLength()
Line
getLength in interface Linepublic double getEndX()
Line
getEndX in interface Linepublic double getEndY()
Line
getEndY in interface Linepublic void setConnection(Connection connection)
Line
setConnection in interface Lineconnection - the connectionpublic Connection getConnection()
Line
getConnection in interface Linepublic void setWorking(boolean working)
WorkingPart
setWorking in interface WorkingPartworking - whether the component is workingpublic boolean isWorking()
WorkingPart
isWorking in interface WorkingPart
public Point addPoint(double x,
double y)
x - the x coordinate of the new pointy - the y coordinate of the new point
public void removePoint(Point point)
point - the pointpublic void select()
select in interface Componentselect in class ContainerComponent.select()public void deselect()
deselect in interface Componentdeselect in class ContainerComponent.deselect()public void setColor(Color color)
Line
setColor in interface Linecolor - the colorpublic Color getColor()
Line
getColor in interface Line
public void move(double x,
double y)
move in interface Componentmove in class Containerx - offset for move in x directiony - offset for move in y directionComponent.move(double, double)
public void moveStartPoint(double x,
double y)
Line
moveStartPoint in interface Linex - the x offsety - the y offset
public void moveEndPoint(double x,
double y)
Line
moveEndPoint in interface Linex - the x offsety - the y offsetpublic void pointMoved(Point point)
point - the pointpublic void setDirected(boolean directed)
Line
setDirected in interface Linedirected - whether the line is directedpublic boolean isDirected()
Line
isDirected in interface Linepublic Object clone()
Component
clone in interface Componentclone in class Containerpublic void draw(Graphics2D graphContext)
Container
draw in class ContainerComponent.draw(java.awt.Graphics2D)
public void setEndXY(double x,
double y)
Line
setEndXY in interface Linex - the x coordinatey - the y coordinate
public void setXY(double x,
double y)
Component
setXY in interface ComponentsetXY in class Componentx - the x coordinatey - the y coordinatepublic boolean isFlatteningAllowed()
isFlatteningAllowed in interface ContainerisFlatteningAllowed in class ContainerContainer.isFlatteningAllowed()public int selectableWith()
selectableWith in interface ComponentselectableWith in class ContainerComponent.selectableWith()public boolean isMovable()
isMovable in interface ComponentisMovable in class ContainerComponent.isMovable()public void calcShape()
Component
calcShape in class Containerpublic double getMessageStartX()
public double getMessageEndX()
public double getMessageStartY()
public double getMessageEndY()
public double getMessageDistancePerCycle()
getMessageDistancePerCycle in interface Linepublic void moveMessage(Message message)
message - the messagepublic void addProperty(Property property)
PropertyHolder
addProperty in interface PropertyHolderpublic void removeProperty(Property property)
PropertyHolder
removeProperty in interface PropertyHolderproperty - the property to be removed, must not be nullpublic void changeProperty(Property property)
PropertyHolder
changeProperty in interface PropertyHolderproperty - the new property, must not be nullpublic Property getProperty(String name)
PropertyHolder
getProperty in interface PropertyHoldername - the name of the property
public Iterator getProperties()
PropertyHolder
getProperties in interface PropertyHolderpublic void addPropertyListener(PropertyListener pl)
PropertyHolder
addPropertyListener in interface PropertyHolderpl - the listener to be addedEventListenerListpublic void removePropertyListener(PropertyListener listener)
PropertyHolder
removePropertyListener in interface PropertyHolderlistener - the listener to be removedEventListenerListpublic void firePropertyChanged(Property property)
PropertyHolder
firePropertyChanged in interface PropertyHolderproperty - the property that was changed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||