Connection Class Reference

Inheritance diagram for Connection:
Collaboration diagram for Connection:

List of all members.


Detailed Description

The (GEF-) model base class of an undefined connection. It is rendered as a org.eclipse.draw2d.PolylineConnection. TODO this class needs a listener for the "real" model to react on changes and vice versa.

Author:
sschwieb, fsteeg
See also:
org.eclipse.draw2d.PolylineConnection

Public Methods

 Connection (ChainGraphVertex source, ChainGraphVertex target, boolean solid)
void disconnect ()
int getLineStyle ()
Object getPropertyValue (Object id)
ChainGraphVertex getSource ()
ChainGraphVertex getTarget ()
void reconnect ()
void reconnect (ChainGraphVertex newSource, ChainGraphVertex newTarget)
void setLineStyle (int lineStyle)
void setPropertyValue (Object id, Object value)
Color getColor ()
void connectInModel ()
void setFigure (DefaultConnectionFigure connection)
DefaultConnectionFigure getFigure ()
Object getAdapter (Class adapterClass)
synchronized void addPropertyChangeListener (PropertyChangeListener l)
Object getEditableValue ()
IPropertyDescriptor[] getPropertyDescriptors ()
boolean isPropertySet (Object id)
synchronized void removePropertyChangeListener (PropertyChangeListener l)
void resetPropertyValue (Object id)

Public Static Fields

static final Integer SOLID_CONNECTION = Graphics.LINE_SOLID
static final Integer DASHED_CONNECTION = Graphics.LINE_DASH
static final String LINESTYLE_PROP = "LineStyle"

Protected Methods

void firePropertyChange (String property, Object oldValue, Object newValue)

Constructors

Connection ( ChainGraphVertex  source,
ChainGraphVertex  target,
boolean  solid 
)

Create a solid or dashed connection between two distinct shapes.

Parameters:
sourcea source endpoint for this connection (non null)
targeta target endpoint for this connection (non null)
solidif true, the connection is painted solid, otherwise it is painted dashed
Exceptions:
IllegalArgumentExceptionif any of the parameters are null or source == target
See also:
setLineStyle(int)

Method Details

synchronized void addPropertyChangeListener ( PropertyChangeListener  l) [inherited]

Attach a non-null PropertyChangeListener to this object.

Parameters:
la non-null PropertyChangeListener instance
Exceptions:
IllegalArgumentExceptionif the parameter is null
void connectInModel ( )

Cause the connection to be present in the actual model.

void disconnect ( )

Disconnect this connection from the shapes it is attached to.

void firePropertyChange ( String  property,
Object  oldValue,
Object  newValue 
) [protected, inherited]

Report a property change to registered listeners (for example edit parts).

Parameters:
propertythe programmatic name of the property that changed
oldValuethe old value of this property
newValuethe new value of this property
Object getAdapter ( Class  adapterClass) [inherited]
See also:
org.eclipse.core.runtime.IAdaptable.getAdapter(java.lang.Class)

Reimplemented in ChainGraphDiagram, ChainGraphVertex, and ComponentVertex.

Color getColor ( )
Returns:
The color for the connection
Object getEditableValue ( ) [inherited]

Returns a value for this property source that can be edited in a property sheet.

My (Elias Volanakis (original)) personal rule of thumb:

  • model elements should return themselves and
  • custom IPropertySource implementations (like DimensionPropertySource in the GEF-logic example) should return an editable value.

Override only if necessary.

Returns:
this instance
DefaultConnectionFigure getFigure ( )
int getLineStyle ( )

Returns the line drawing style of this connection.

Returns:
an int value (Graphics.LINE_DASH or Graphics.LINE_SOLID)
IPropertyDescriptor [] getPropertyDescriptors ( ) [inherited]

Children should override this. The default implementation returns an empty array.

Reimplemented in ChainGraphVertex.

Object getPropertyValue ( Object  id)

Returns the lineStyle as String for the Property Sheet

See also:
org.eclipse.ui.views.properties.IPropertySource.getPropertyValue(java.lang.Object)

Reimplemented from ChainGraphItem.

ChainGraphVertex getSource ( )

Returns the source endpoint of this connection.

Returns:
a non-null ChainGraphVertex instance
ChainGraphVertex getTarget ( )

Returns the target endpoint of this connection.

Returns:
a non-null Shape instance
boolean isPropertySet ( Object  id) [inherited]

Children should override this. The default implementation returns false.

void reconnect ( )

Reconnect this connection. The connection will reconnect with the ChainGraphVertex it was previously attached to.

void reconnect ( ChainGraphVertex  newSource,
ChainGraphVertex  newTarget 
)

Reconnect to a different source and/or target ChainGraphVertex. The connection will disconnect from its current attachments and reconnect to the new source and target.

Parameters:
newSourcea new source endpoint for this connection (non null)
newTargeta new target endpoint for this connection (non null)
Exceptions:
IllegalArgumentExceptionif any of the paramers are null or newSource == newTarget
synchronized void removePropertyChangeListener ( PropertyChangeListener  l) [inherited]

Remove a PropertyChangeListener from this component.

Parameters:
la PropertyChangeListener instance
void resetPropertyValue ( Object  id) [inherited]

Children should override this. The default implementation does nothing.

void setFigure ( DefaultConnectionFigure  connection)
void setLineStyle ( int  lineStyle)

Set the line drawing style of this connection.

Parameters:
lineStyleone of following values: Graphics.LINE_DASH or Graphics.LINE_SOLID
See also:
Graphics.LINE_DASH
Graphics.LINE_SOLID
Exceptions:
IllegalArgumentExceptionif lineStyle does not have one of the above values
void setPropertyValue ( Object  id,
Object  value 
)

Sets the lineStyle based on the String provided by the PropertySheet

See also:
org.eclipse.ui.views.properties.IPropertySource.setPropertyValue(java.lang.Object, java.lang.Object)

Reimplemented from ChainGraphItem.


Field Details

final Integer DASHED_CONNECTION = Graphics.LINE_DASH [static]

Used for indicating that a Connection with dashed line style should be created.

See also:
org.eclipse.gef.examples.shapes.parts.ChainGraphVertexEditPart.createEditPolicies()
final String LINESTYLE_PROP = "LineStyle" [static]

Property ID to use when the line style of this connection is modified.

final Integer SOLID_CONNECTION = Graphics.LINE_SOLID [static]

Used for indicating that a Connection with solid line style should be created.

See also:
org.eclipse.gef.examples.shapes.parts.ChainGraphVertexEditPart.createEditPolicies()