|
||||||||||
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 pointMethod Detail |
public double getX()
getX
in interface Component
getX
in class Container
Component.getX()
public double getY()
getY
in interface Component
getY
in class Container
Component.getY()
public double getLength()
Line
getLength
in interface Line
public double getEndX()
Line
getEndX
in interface Line
public double getEndY()
Line
getEndY
in interface Line
public void setConnection(Connection connection)
Line
setConnection
in interface Line
connection
- the connectionpublic Connection getConnection()
Line
getConnection
in interface Line
public void setWorking(boolean working)
WorkingPart
setWorking
in interface WorkingPart
working
- 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 Component
select
in class Container
Component.select()
public void deselect()
deselect
in interface Component
deselect
in class Container
Component.deselect()
public void setColor(Color color)
Line
setColor
in interface Line
color
- the colorpublic Color getColor()
Line
getColor
in interface Line
public void move(double x, double y)
move
in interface Component
move
in class Container
x
- 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 Line
x
- the x offsety
- the y offsetpublic void moveEndPoint(double x, double y)
Line
moveEndPoint
in interface Line
x
- the x offsety
- the y offsetpublic void pointMoved(Point point)
point
- the pointpublic void setDirected(boolean directed)
Line
setDirected
in interface Line
directed
- whether the line is directedpublic boolean isDirected()
Line
isDirected
in interface Line
public Object clone()
Component
clone
in interface Component
clone
in class Container
public void draw(Graphics2D graphContext)
Container
draw
in class Container
Component.draw(java.awt.Graphics2D)
public void setEndXY(double x, double y)
Line
setEndXY
in interface Line
x
- the x coordinatey
- the y coordinatepublic void setXY(double x, double y)
Component
setXY
in interface Component
setXY
in class Component
x
- the x coordinatey
- the y coordinatepublic boolean isFlatteningAllowed()
isFlatteningAllowed
in interface Container
isFlatteningAllowed
in class Container
Container.isFlatteningAllowed()
public int selectableWith()
selectableWith
in interface Component
selectableWith
in class Container
Component.selectableWith()
public boolean isMovable()
isMovable
in interface Component
isMovable
in class Container
Component.isMovable()
public void calcShape()
Component
calcShape
in class Container
public double getMessageStartX()
public double getMessageEndX()
public double getMessageStartY()
public double getMessageEndY()
public double getMessageDistancePerCycle()
getMessageDistancePerCycle
in interface Line
public void moveMessage(Message message)
message
- the messagepublic 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |