Modelers

org.topcased.modeler.edit
Class GraphEdgeEditPart

java.lang.Object
  extended by org.eclipse.gef.editparts.AbstractEditPart
      extended by org.eclipse.gef.editparts.AbstractGraphicalEditPart
          extended by org.eclipse.gef.editparts.AbstractConnectionEditPart
              extended by org.topcased.modeler.edit.GraphEdgeEditPart
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.gef.ConnectionEditPart, org.eclipse.gef.EditPart, org.eclipse.gef.GraphicalEditPart, org.eclipse.gef.LayerConstants, org.eclipse.gef.NodeEditPart, org.eclipse.gef.RequestConstants
Direct Known Subclasses:
EMFGraphEdgeEditPart

public class GraphEdgeEditPart
extends org.eclipse.gef.editparts.AbstractConnectionEditPart
implements org.eclipse.gef.NodeEditPart

This edit part offers basic methods for edge elements.
Edge elements can optionnaly have some edge objects.
Creation : 30 nov. 2004


Nested Class Summary
protected  class GraphEdgeEditPart.GraphEdgeEditPartListener
          Listener that filters GraphEdge events and handles it : update graphics, connections...
 
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractConnectionEditPart
org.eclipse.gef.editparts.AbstractConnectionEditPart.DefaultAccessibleAnchorProvider
 
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
org.eclipse.gef.editparts.AbstractGraphicalEditPart.AccessibleGraphicalEditPart
 
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractEditPart
org.eclipse.gef.editparts.AbstractEditPart.EditPolicyIterator
 
Field Summary
 
Fields inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
figure, sourceConnections, targetConnections
 
Fields inherited from class org.eclipse.gef.editparts.AbstractEditPart
children, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAG
 
Fields inherited from interface org.eclipse.gef.EditPart
SELECTED, SELECTED_NONE, SELECTED_PRIMARY
 
Fields inherited from interface org.eclipse.gef.LayerConstants
CONNECTION_LAYER, FEEDBACK_LAYER, GRID_LAYER, GUIDE_LAYER, HANDLE_LAYER, PRIMARY_LAYER, PRINTABLE_LAYERS, SCALABLE_LAYERS, SCALED_FEEDBACK_LAYER
 
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
 
Constructor Summary
GraphEdgeEditPart(GraphEdge conn)
          Constructor
 
Method Summary
 void activate()
           
 void addNotify()
           
protected  void createEditPolicies()
           
protected  org.eclipse.draw2d.IFigure createFigure()
           
protected  org.eclipse.gef.SnapToHelper createSnapToHelper()
           
 void deactivate()
           
 java.lang.Object getAdapter(java.lang.Class key)
           
protected  org.eclipse.swt.graphics.Color getDefaultBackgroundColor()
          Deprecated. should not be used anymore
protected  org.eclipse.swt.graphics.Font getDefaultFont()
          Return the default font of this type of element
protected  org.eclipse.swt.graphics.Color getDefaultForegroundColor()
          Return the default foreground color of this type of element
protected  org.eclipse.draw2d.ConnectionRouter getDefaultRouter(org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ConnectionLayerEx cLayer)
          Returns the default router for this edge.
protected  DiagramElementListener getDiagramElementListener()
          Returns the listener used to listen the graphical model object
 org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request req)
           
 IEdgeObjectFigure getEdgeObjectFigure(EdgeObject edgeObject)
          Get the edge object figure for the given edge object.
 EList getEdgeObjects()
          Get the list of edge objects.
protected  GraphEdge getGraphEdge()
          Return the GraphEdge
protected  int getLineStyle()
          Return the line style of the edge
protected  int getLineWidth()
          Return the line width of the edge
protected  Adapter getModelListener()
          Returns the generic model listener
protected  java.util.List getModelSourceConnections()
           
protected  java.util.List getModelTargetConnections()
           
protected  org.eclipse.draw2d.ConnectionRouter getRouter(org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ConnectionLayerEx cLayer)
          Returns the router for this edge.
 org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
           
 org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.Request request)
           
 org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
           
 org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.Request request)
           
protected  void handleModelChanged(Notification msg)
          Refresh datas due to a property that has changed
protected  void handlePropertyChanged(Notification msg)
          Deprecated. use handleModelChanged instead
protected  void listenToConnectors()
          Refresh the listening of connectors
 void refresh()
          Invoke the editpart's refresh mechanism.
protected  void refreshBendpoints()
          refresh the bendpoints owned by the EditPart's Edge
protected  void refreshColors()
          Refresh the background and the foreground Colors of the GraphNode
protected  void refreshEdgeObjects()
          Refresh the objects associated to this connection
protected  void refreshRouter()
          installes a router on the edit part, depending on the Routing Property
protected  void refreshTextAndFont()
          Refresh the text to display at the top and the current Font of the GraphNode
protected  void refreshVisible()
          Refresh the visbility state of the current object
protected  void refreshVisuals()
          Refresh the visuals
protected  void updateEdgeObject(EdgeObject edgeObject)
          A location property of an edge object has changed.
protected  void updateModelListening(java.lang.Object oldValue, java.lang.Object newValue)
          This method updates the listening on added or removed objects
 
Methods inherited from class org.eclipse.gef.editparts.AbstractConnectionEditPart
activateFigure, deactivateFigure, getConnectionFigure, getSource, getSourceConnectionAnchor, getTarget, getTargetConnectionAnchor, refreshSourceAnchor, refreshTargetAnchor, removeNotify, setParent, setSource, setTarget
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
addChildVisual, addNodeListener, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getContentPane, getFigure, getLayer, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeChildVisual, removeNodeListener, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregisterVisuals
 
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activateEditPolicies, addChild, addEditPartListener, createChild, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getChildren, getCommand, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getModel, getModelChildren, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refreshChildren, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest, unregister, unregisterAccessibility, unregisterModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.gef.GraphicalEditPart
addNodeListener, getContentPane, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
 
Methods inherited from interface org.eclipse.gef.EditPart
addEditPartListener, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 

Constructor Detail

GraphEdgeEditPart

public GraphEdgeEditPart(GraphEdge conn)
Constructor

Parameters:
conn - the model object
Method Detail

getAdapter

public java.lang.Object getAdapter(java.lang.Class key)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Overrides:
getAdapter in class org.eclipse.gef.editparts.AbstractConnectionEditPart
See Also:
AbstractGraphicalEditPart.getAdapter(java.lang.Class)

createSnapToHelper

protected org.eclipse.gef.SnapToHelper createSnapToHelper()

getModelListener

protected Adapter getModelListener()
Returns the generic model listener

Returns:
the model listener

getDiagramElementListener

protected DiagramElementListener getDiagramElementListener()
Returns the listener used to listen the graphical model object

Returns:
the listener

activate

public void activate()
Specified by:
activate in interface org.eclipse.gef.EditPart
Overrides:
activate in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
See Also:
EditPart.activate()

deactivate

public void deactivate()
Specified by:
deactivate in interface org.eclipse.gef.EditPart
Overrides:
deactivate in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
See Also:
EditPart.deactivate()

getDragTracker

public org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request req)
Specified by:
getDragTracker in interface org.eclipse.gef.EditPart
Overrides:
getDragTracker in class org.eclipse.gef.editparts.AbstractConnectionEditPart
See Also:
EditPart.getDragTracker(org.eclipse.gef.Request)

createEditPolicies

protected void createEditPolicies()
Specified by:
createEditPolicies in class org.eclipse.gef.editparts.AbstractEditPart
See Also:
AbstractEditPart.createEditPolicies()

createFigure

protected org.eclipse.draw2d.IFigure createFigure()
Overrides:
createFigure in class org.eclipse.gef.editparts.AbstractConnectionEditPart
See Also:
AbstractGraphicalEditPart.createFigure()

addNotify

public void addNotify()
Specified by:
addNotify in interface org.eclipse.gef.EditPart
Overrides:
addNotify in class org.eclipse.gef.editparts.AbstractConnectionEditPart
See Also:
EditPart.addNotify()

refreshRouter

protected void refreshRouter()
installes a router on the edit part, depending on the Routing Property


getRouter

protected org.eclipse.draw2d.ConnectionRouter getRouter(org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ConnectionLayerEx cLayer)
Returns the router for this edge. The default implementation uses the property "router" in the DI or uses the default router.
This method can be override by subclasses to define a specific router and if the router can be customize.

Parameters:
cLayer - the connection layer
Returns:
the connection router

getDefaultRouter

protected org.eclipse.draw2d.ConnectionRouter getDefaultRouter(org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ConnectionLayerEx cLayer)
Returns the default router for this edge. The default implementation returns the oblique router.
This method can be override by subclasses to define an other default router.

Parameters:
cLayer - the connection layer
Returns:
the connection router

getGraphEdge

protected GraphEdge getGraphEdge()
Return the GraphEdge

Returns:
GraphEdge

handleModelChanged

protected void handleModelChanged(Notification msg)
Refresh datas due to a property that has changed

Parameters:
msg - the Notification message

handlePropertyChanged

protected void handlePropertyChanged(Notification msg)
Deprecated. use handleModelChanged instead


refresh

public void refresh()
Invoke the editpart's refresh mechanism.

Specified by:
refresh in interface org.eclipse.gef.EditPart
Overrides:
refresh in class org.eclipse.gef.editparts.AbstractConnectionEditPart

refreshVisuals

protected void refreshVisuals()
Refresh the visuals

Overrides:
refreshVisuals in class org.eclipse.gef.editparts.AbstractEditPart
See Also:
AbstractEditPart.refreshVisuals()

refreshVisible

protected void refreshVisible()
Refresh the visbility state of the current object


refreshEdgeObjects

protected void refreshEdgeObjects()
Refresh the objects associated to this connection


refreshColors

protected void refreshColors()
Refresh the background and the foreground Colors of the GraphNode


refreshTextAndFont

protected void refreshTextAndFont()
Refresh the text to display at the top and the current Font of the GraphNode


refreshBendpoints

protected void refreshBendpoints()
refresh the bendpoints owned by the EditPart's Edge


getDefaultForegroundColor

protected org.eclipse.swt.graphics.Color getDefaultForegroundColor()
Return the default foreground color of this type of element

Returns:
Color

getDefaultBackgroundColor

protected org.eclipse.swt.graphics.Color getDefaultBackgroundColor()
Deprecated. should not be used anymore

Return the default foreground color of this type of element

Returns:
Color

getDefaultFont

protected org.eclipse.swt.graphics.Font getDefaultFont()
Return the default font of this type of element

Returns:
Font

getLineWidth

protected int getLineWidth()
Return the line width of the edge

Returns:
int

getLineStyle

protected int getLineStyle()
Return the line style of the edge

Returns:
style

getEdgeObjects

public EList getEdgeObjects()
Get the list of edge objects.

Returns:
a list of edge objects

getEdgeObjectFigure

public IEdgeObjectFigure getEdgeObjectFigure(EdgeObject edgeObject)
Get the edge object figure for the given edge object.
Subclass must implements this method to return the appropriate edge object figure. Default implementation returns null.

Parameters:
edgeObject - an edge object
Returns:
an edge object figure

updateEdgeObject

protected void updateEdgeObject(EdgeObject edgeObject)
A location property of an edge object has changed. Subclass must implements the update behavior.
Default implementation updates the IEdgeObjectFigure location.

Parameters:
edgeObject - an updated edge object

listenToConnectors

protected void listenToConnectors()
Refresh the listening of connectors


getModelSourceConnections

protected java.util.List getModelSourceConnections()
Overrides:
getModelSourceConnections in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
See Also:
AbstractGraphicalEditPart.getModelSourceConnections()

getModelTargetConnections

protected java.util.List getModelTargetConnections()
Overrides:
getModelTargetConnections in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
See Also:
AbstractGraphicalEditPart.getModelTargetConnections()

getSourceConnectionAnchor

public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
Specified by:
getSourceConnectionAnchor in interface org.eclipse.gef.NodeEditPart
See Also:
NodeEditPart.getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart)

getSourceConnectionAnchor

public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.Request request)
Specified by:
getSourceConnectionAnchor in interface org.eclipse.gef.NodeEditPart
See Also:
NodeEditPart.getSourceConnectionAnchor(org.eclipse.gef.Request)

getTargetConnectionAnchor

public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
Specified by:
getTargetConnectionAnchor in interface org.eclipse.gef.NodeEditPart
See Also:
NodeEditPart.getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart)

getTargetConnectionAnchor

public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.Request request)
Specified by:
getTargetConnectionAnchor in interface org.eclipse.gef.NodeEditPart
See Also:
NodeEditPart.getTargetConnectionAnchor(org.eclipse.gef.Request)

updateModelListening

protected void updateModelListening(java.lang.Object oldValue,
                                    java.lang.Object newValue)
This method updates the listening on added or removed objects

Parameters:
oldValue - the old Object
newValue - the new Object

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.