Back to index

moin  1.9.0~rc2
Public Member Functions
CH.ifa.draw.framework.ConnectionFigure Interface Reference

Figures to connect Connectors provided by Figures. More...

Inheritance diagram for CH.ifa.draw.framework.ConnectionFigure:
Inheritance graph
[legend]
Collaboration diagram for CH.ifa.draw.framework.ConnectionFigure:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void connectStart (Connector start)
 Sets the start Connector of the connection.
void connectEnd (Connector end)
 Sets the end Connector of the connection.
void updateConnection ()
 Updates the connection.
void disconnectStart ()
 Disconnects the start figure from the dependent figure.
void disconnectEnd ()
 Disconnects the end figure from the dependent figure.
Connector start ()
 Gets the start Connector.
Connector end ()
 Gets the end Connector.
boolean canConnect (Figure start, Figure end)
 Checks if two figures can be connected.
boolean connectsSame (ConnectionFigure other)
 Checks if the ConnectionFigure connects the same figures.
void startPoint (int x, int y)
 Sets the start point.
void endPoint (int x, int y)
 Sets the end point.
Point startPoint ()
 Gets the start point.
Point endPoint ()
 Gets the end point.
void setPointAt (Point p, int index)
 Sets the position of the point at the given position.
Point pointAt (int index)
 Gets the Point at the given position.
int pointCount ()
 Gets the number of points or nodes of the connection.
int splitSegment (int x, int y)
 Splits the hit segment.
boolean joinSegments (int x, int y)
 Joins the hit segments.
void moveBy (int dx, int dy)
 Moves the Figure to a new location.
void basicDisplayBox (Point origin, Point corner)
 Changes the display box of a figure.
void displayBox (Point origin, Point corner)
 Changes the display box of a figure.
Rectangle displayBox ()
 Gets the display box of a figure.
void displayBox (Rectangle r)
 Changes the display box of a figure.
void draw (Graphics g, boolean showGuides)
 Draws the figure.
Vector handles ()
 Returns the handles used to manipulate the figure.
Dimension size ()
 Gets the size of the figure.
Point center ()
 Gets the figure's center.
boolean isEmpty ()
 Checks if the Figure should be considered as empty.
FigureEnumeration figures ()
 Returns an Enumeration of the figures contained in this figure.
Figure findFigureInside (int x, int y)
 Returns the figure that contains the given point.
boolean containsPoint (int x, int y)
 Checks if a point is inside the figure.
Object clone ()
 Returns a Clone of this figure.
boolean includes (Figure figure)
 Checks whether the given figure is contained in this figure.
FigureEnumeration decompose ()
 Decomposes a figure into its parts.
void addToContainer (FigureChangeListener c)
 Sets the Figure's container and registers the container as a figure change listener.
void removeFromContainer (FigureChangeListener c)
 Removes a figure from the given container and unregisters it as a change listener.
FigureChangeListener listener ()
 Gets the Figure's listeners.
void addFigureChangeListener (FigureChangeListener l)
 Adds a listener for this figure.
void removeFigureChangeListener (FigureChangeListener l)
 Removes a listener for this figure.
void release ()
 Releases a figure's resources.
void invalidate ()
 Invalidates the figure.
void willChange ()
 Informes that a figure is about to change such that its display box is affected.
void changed ()
 Informes that a figure has changed its display box.
boolean canConnect ()
 Checks if this figure can be connected.
Connector connectorAt (int x, int y)
 Gets a connector for this figure at the given location.
void connectorVisibility (boolean isVisible)
 Sets whether the connectors should be visible.
Insets connectionInsets ()
 Returns the connection inset.
Locator connectedTextLocator (Figure text)
 Returns the locator used to located connected text.
Object getAttribute (String name)
 Returns the named attribute or null if a a figure doesn't have an attribute.
void setAttribute (String name, Object value)
 Sets the named attribute to the new value.
void write (StorableOutput dw)
 Writes the object to the StorableOutput.
String getMap ()
 Writes a map image of the object.
void read (StorableInput dr) throws IOException
 Reads the object from the StorableInput.
void figureInvalidated (FigureChangeEvent e)
 Sent when an area is invalid.
void figureChanged (FigureChangeEvent e)
 Sent when a figure changed.
void figureRemoved (FigureChangeEvent e)
 Sent when a figure was removed.
void figureRequestRemove (FigureChangeEvent e)
 Sent when requesting to remove a figure.
void figureRequestUpdate (FigureChangeEvent e)
 Sent when an update should happen.

Detailed Description

Figures to connect Connectors provided by Figures.

A ConnectionFigure knows its start and end Connector. It uses the Connectors to locate its connection points.

A ConnectionFigure can have multiple segments. It provides operations to split and join segments.


Design Patterns

 o

Strategy
Strategy is used encapsulate the algorithm to locate the connection point. ConnectionFigure is the Strategy context and Connector is the Strategy.

 o

Observer
Observer is used to track changes of the connected figures. A connection figure registers itself as listeners or observers of the source and target connector.


See also:
Connector

Definition at line 36 of file ConnectionFigure.java.


Member Function Documentation

Adds a listener for this figure.

Sets the Figure's container and registers the container as a figure change listener.

A figure's container can be any kind of FigureChangeListener. A figure is not restricted to have a single container.

void CH.ifa.draw.framework.Figure.basicDisplayBox ( Point  origin,
Point  corner 
) [inherited]

Changes the display box of a figure.

This method is always implemented in figure subclasses. It only changes the displaybox and does not announce any changes. It is usually not called by the client. Clients typically call displayBox to change the display box.

Parameters:
originthe new origin
cornerthe new corner
See also:
displayBox

Checks if two figures can be connected.

Implement this method to constrain the allowed connections between figures.

boolean CH.ifa.draw.framework.Figure.canConnect ( ) [inherited]

Checks if this figure can be connected.

Point CH.ifa.draw.framework.Figure.center ( ) [inherited]

Gets the figure's center.

Informes that a figure has changed its display box.

This method also triggers an update call for its registered observers.

See also:
invalidate
willChange
Object CH.ifa.draw.framework.Figure.clone ( ) [inherited]

Returns a Clone of this figure.

Returns the locator used to located connected text.

Sets the end Connector of the connection.

Parameters:
figurethe end figure of the connection

Returns the connection inset.

This is only a hint that connectors can use to determine the connection location. The inset defines the area where the display box of a figure should not be connected.

Connector CH.ifa.draw.framework.Figure.connectorAt ( int  x,
int  y 
) [inherited]

Gets a connector for this figure at the given location.

A figure can have different connectors at different locations.

void CH.ifa.draw.framework.Figure.connectorVisibility ( boolean  isVisible) [inherited]

Sets whether the connectors should be visible.

Connectors can be optionally visible. Implement this method and react on isVisible to turn the connectors on or off.

Checks if the ConnectionFigure connects the same figures.

Sets the start Connector of the connection.

Parameters:
figurethe start figure of the connection
boolean CH.ifa.draw.framework.Figure.containsPoint ( int  x,
int  y 
) [inherited]

Checks if a point is inside the figure.

Decomposes a figure into its parts.

A figure is considered as a part of itself.

Disconnects the end figure from the dependent figure.

Disconnects the start figure from the dependent figure.

void CH.ifa.draw.framework.Figure.displayBox ( Point  origin,
Point  corner 
) [inherited]

Changes the display box of a figure.

Clients usually invoke this method. It changes the display box and announces the corresponding changes.

Parameters:
originthe new origin
cornerthe new corner
See also:
displayBox
Rectangle CH.ifa.draw.framework.Figure.displayBox ( ) [inherited]

Gets the display box of a figure.

See also:
basicDisplayBox
void CH.ifa.draw.framework.Figure.displayBox ( Rectangle  r) [inherited]

Changes the display box of a figure.

This is a convenience method. Implementors should only have to override basicDisplayBox

See also:
displayBox
void CH.ifa.draw.framework.Figure.draw ( Graphics  g,
boolean  showGuides 
) [inherited]

Draws the figure.

Parameters:
gthe Graphics to draw into

Gets the end Connector.

Sets the end point.

Gets the end point.

Sent when a figure changed.

Sent when an area is invalid.

Implemented in CH.ifa.draw.framework.Drawing.

Sent when a figure was removed.

Sent when requesting to remove a figure.

Implemented in CH.ifa.draw.framework.Drawing.

Sent when an update should happen.

Implemented in CH.ifa.draw.framework.Drawing.

Returns an Enumeration of the figures contained in this figure.

Figure CH.ifa.draw.framework.Figure.findFigureInside ( int  x,
int  y 
) [inherited]

Returns the figure that contains the given point.

Object CH.ifa.draw.framework.Figure.getAttribute ( String  name) [inherited]

Returns the named attribute or null if a a figure doesn't have an attribute.

All figures support the attribute names FillColor and FrameColor

String CH.ifa.draw.util.Storable.getMap ( ) [inherited]

Writes a map image of the object.

Implemented in CH.ifa.draw.figures.ArrowTip.

Vector CH.ifa.draw.framework.Figure.handles ( ) [inherited]

Returns the handles used to manipulate the figure.

Handles is a Factory Method for creating handle objects.

Returns:
a Vector of handles
See also:
Handle
boolean CH.ifa.draw.framework.Figure.includes ( Figure  figure) [inherited]

Checks whether the given figure is contained in this figure.

Invalidates the figure.

This method informs its listeners that its current display box is invalid and should be refreshed.

boolean CH.ifa.draw.framework.Figure.isEmpty ( ) [inherited]

Checks if the Figure should be considered as empty.

Joins the hit segments.

Parameters:
x,ythe position where the figure should be joined.
Returns:
whether the segment was joined

Gets the Figure's listeners.

void CH.ifa.draw.framework.Figure.moveBy ( int  dx,
int  dy 
) [inherited]

Moves the Figure to a new location.

Parameters:
xthe x delta
ythe y delta

Gets the Point at the given position.

Gets the number of points or nodes of the connection.

void CH.ifa.draw.util.Storable.read ( StorableInput  dr) throws IOException [inherited]

Reads the object from the StorableInput.

Here is the caller graph for this function:

Releases a figure's resources.

Release is called when a figure is removed from a drawing. Informs the listeners that the figure is removed by calling figureRemoved.

Here is the caller graph for this function:

Removes a listener for this figure.

Removes a figure from the given container and unregisters it as a change listener.

void CH.ifa.draw.framework.Figure.setAttribute ( String  name,
Object  value 
) [inherited]

Sets the named attribute to the new value.

void CH.ifa.draw.framework.ConnectionFigure.setPointAt ( Point  p,
int  index 
)

Sets the position of the point at the given position.

Dimension CH.ifa.draw.framework.Figure.size ( ) [inherited]

Gets the size of the figure.

Splits the hit segment.

Parameters:
x,ythe position where the figure should be split
Returns:
the index of the splitting point

Gets the start Connector.

Sets the start point.

Gets the start point.

Updates the connection.

Informes that a figure is about to change such that its display box is affected.

Here is an example of how it is used together with changed()

 public void move(int x, int y) {
      willChange();
      // change the figure's location
      changed();
  }
 
See also:
invalidate
changed

Writes the object to the StorableOutput.

Here is the caller graph for this function:


The documentation for this interface was generated from the following file: