Modelers

org.topcased.modeler.edit
Class GraphNodeEditPart

java.lang.Object
  extended by org.eclipse.gef.editparts.AbstractEditPart
      extended by org.eclipse.gef.editparts.AbstractGraphicalEditPart
          extended by org.topcased.modeler.edit.BaseEditPart
              extended by org.topcased.modeler.edit.GraphNodeEditPart
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.gef.EditPart, org.eclipse.gef.GraphicalEditPart, org.eclipse.gef.NodeEditPart, org.eclipse.gef.RequestConstants
Direct Known Subclasses:
EMFGraphNodeEditPart

public class GraphNodeEditPart
extends BaseEditPart
implements org.eclipse.gef.NodeEditPart

Default edit part for a graph node
creation : 3 dec. 2004


Nested Class Summary
protected  class GraphNodeEditPart.GraphNodeEditPartListener
          Typed listener for a GraphNode
 
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
org.eclipse.gef.editparts.AbstractGraphicalEditPart.AccessibleGraphicalEditPart, org.eclipse.gef.editparts.AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider
 
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.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
GraphNodeEditPart(GraphNode obj)
          Constructor
 
Method Summary
 void activate()
           
protected  void createEditPolicies()
           
protected  org.eclipse.draw2d.IFigure createFigure()
           
 void deactivate()
           
protected  boolean directEditHitTest(org.eclipse.draw2d.geometry.Point requestLoc)
          Check if the direct dedit is allowed for the given position
 java.lang.Object getAdapter(java.lang.Class key)
           
protected  org.eclipse.draw2d.IFigure getAnchorableFigure()
          Return the Figure on which the Connection Anchors should be attached.
 org.eclipse.draw2d.IFigure getContentPane()
           
protected  org.eclipse.swt.graphics.Color getDefaultBackgroundColor()
          Return the default foreground color of this type of element
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  int getDefaultHeight()
          Return the default height for this object
protected  int getDefaultWidth()
          Return the default width for this object
protected  DiagramElementListener getDiagramElementListener()
          Returns the listener used to listen the graphical mode object
protected  org.eclipse.gef.tools.DirectEditManager getDirectEditManager()
          Returns the direct edit manager
 ILabel getEditableLabel()
          Return the editable part of the label of the figure.
protected  GraphNode getGraphNode()
          Get the graphNode model object (DI) associated with the EditPart
 ILabel getHeader()
          Deprecated.  
 org.eclipse.swt.graphics.FontData[] getHeaderFontData()
          Return the FontData[] associated with the header Figure.
 ILabel getLabel()
          Return the ILabel figure contained in the figure of the graph node
protected  int getLineStyle()
          Return the line style of the edge
protected  int getLineWidth()
          Return the line width of the edge
 int getMinimumHeight()
          Return the minimum height for this object
 int getMinimumWidth()
          Return the minimum width for this object
protected  java.util.List getModelChildren()
           
protected  java.util.List getModelSourceConnections()
           
protected  java.util.List getModelTargetConnections()
           
protected  NodeGraphConf getNodeGraphConf()
          Return the NodeGraphConf corresponding to the activeDiagram and the model object associated with the controller
protected  java.lang.String getPresentation()
          Get the presentation field of the GraphElement associated with this EditPart.
 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)
          This method is called when an event occured on the model objects
 void handleNameChange(java.lang.String value)
           
protected  void handlePropertyChanged(Notification msg)
          Deprecated. use handleModelChanged instead
protected  void performDirectEdit()
          Display the manager used to perform the directEdit action
 void performRequest(org.eclipse.gef.Request request)
           
protected  void refreshColors()
          Refresh the background and the foreground Colors of the GraphNode
protected  void refreshConstraints()
          Refresh the constraints of the GraphNode
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()
           
 void revertNameChange()
          Reverts to existing name in model when exiting from a direct edit (possibly before a commit which will result in a change in the label value)
protected  void setDirectEditManager(org.eclipse.gef.tools.DirectEditManager m)
          Changes the direct edit manager
protected  void setNodeGraphConf(NodeGraphConf ngc)
          Set the NodeGraphConf associated with this EditPart
 void setSelected(int value)
          Handle selection
 
Methods inherited from class org.topcased.modeler.edit.BaseEditPart
createSnapToHelper, getModelListener, refresh, updateModelListening
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getDragTracker, getFigure, getLayer, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeChildVisual, removeNodeListener, removeNotify, 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, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, refreshChildren, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setParent, 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, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
 
Methods inherited from interface org.eclipse.gef.EditPart
addEditPartListener, addNotify, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getDragTracker, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, showSourceFeedback, showTargetFeedback, understandsRequest
 

Constructor Detail

GraphNodeEditPart

public GraphNodeEditPart(GraphNode obj)
Constructor

Parameters:
obj - the mdoel object
Method Detail

getDiagramElementListener

protected DiagramElementListener getDiagramElementListener()
Description copied from class: BaseEditPart
Returns the listener used to listen the graphical mode object

Specified by:
getDiagramElementListener in class BaseEditPart
Returns:
the listener
See Also:
BaseEditPart.getDiagramElementListener()

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()

getAdapter

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

createFigure

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

createEditPolicies

protected void createEditPolicies()
Overrides:
createEditPolicies in class BaseEditPart
See Also:
AbstractEditPart.createEditPolicies()

handleModelChanged

protected void handleModelChanged(Notification msg)
Description copied from class: BaseEditPart
This method is called when an event occured on the model objects

Specified by:
handleModelChanged in class BaseEditPart
Parameters:
msg - the event notification
See Also:
BaseEditPart.handleModelChanged(Notification)

handlePropertyChanged

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


getGraphNode

protected GraphNode getGraphNode()
Get the graphNode model object (DI) associated with the EditPart

Returns:
GraphNode

getModelChildren

protected java.util.List getModelChildren()

Overrides:
getModelChildren in class org.eclipse.gef.editparts.AbstractEditPart
See Also:
AbstractEditPart.getModelChildren()
** Generated **

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)

getAnchorableFigure

protected org.eclipse.draw2d.IFigure getAnchorableFigure()
Return the Figure on which the Connection Anchors should be attached. By default, we return the global figure of the AbstractGraphicalEditPart.

Returns:
IFigure the Figure on which to attach the Anchors

refreshVisuals

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

refreshVisible

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


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


refreshConstraints

protected void refreshConstraints()
Refresh the constraints of the GraphNode


performRequest

public void performRequest(org.eclipse.gef.Request request)
Specified by:
performRequest in interface org.eclipse.gef.EditPart
Overrides:
performRequest in class org.eclipse.gef.editparts.AbstractEditPart
See Also:
EditPart.performRequest(org.eclipse.gef.Request)

getDirectEditManager

protected org.eclipse.gef.tools.DirectEditManager getDirectEditManager()
Returns the direct edit manager

Returns:
Returns the manager.

setDirectEditManager

protected void setDirectEditManager(org.eclipse.gef.tools.DirectEditManager m)
Changes the direct edit manager

Parameters:
m - The manager to set.

directEditHitTest

protected boolean directEditHitTest(org.eclipse.draw2d.geometry.Point requestLoc)
Check if the direct dedit is allowed for the given position

Parameters:
requestLoc - the current position
Returns:
true if the direct edit is allowed

performDirectEdit

protected void performDirectEdit()
Display the manager used to perform the directEdit action


handleNameChange

public void handleNameChange(java.lang.String value)
Parameters:
value - the name change during an edit

revertNameChange

public void revertNameChange()
Reverts to existing name in model when exiting from a direct edit (possibly before a commit which will result in a change in the label value)


getHeader

public ILabel getHeader()
Deprecated. 

Return label header

Returns:
Label

getLabel

public ILabel getLabel()
Return the ILabel figure contained in the figure of the graph node

Returns:
the label

getEditableLabel

public ILabel getEditableLabel()
Return the editable part of the label of the figure. The default behaviour is to return the label. If the label is a composed label, then the mai part of it is returned. This function should be overriden for custum behaviour

Returns:
the editable label

setSelected

public void setSelected(int value)
Handle selection

Specified by:
setSelected in interface org.eclipse.gef.EditPart
Overrides:
setSelected in class org.eclipse.gef.editparts.AbstractEditPart
Parameters:
value - The value of the selection

getHeaderFontData

public org.eclipse.swt.graphics.FontData[] getHeaderFontData()
Return the FontData[] associated with the header Figure.

Returns:
FontData[]

getContentPane

public org.eclipse.draw2d.IFigure getContentPane()
Specified by:
getContentPane in interface org.eclipse.gef.GraphicalEditPart
Overrides:
getContentPane in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
See Also:
AbstractGraphicalEditPart.getContentPane()

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()
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

getDefaultWidth

protected int getDefaultWidth()
Return the default width for this object

Returns:
the default width

getDefaultHeight

protected int getDefaultHeight()
Return the default height for this object

Returns:
the default height

getMinimumWidth

public int getMinimumWidth()
Return the minimum width for this object

Returns:
the default width

getMinimumHeight

public int getMinimumHeight()
Return the minimum height for this object

Returns:
the minimum height

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

getNodeGraphConf

protected NodeGraphConf getNodeGraphConf()
Return the NodeGraphConf corresponding to the activeDiagram and the model object associated with the controller

Returns:
NodeGraphConf

getPresentation

protected java.lang.String getPresentation()
Get the presentation field of the GraphElement associated with this EditPart. Subclasses may override this method to provide a different presentation field depending on the model element properties for example.

Returns:
String the presentation field. Default value is "default".

setNodeGraphConf

protected void setNodeGraphConf(NodeGraphConf ngc)
Set the NodeGraphConf associated with this EditPart

Parameters:
ngc - the new NodeGraphConf

Modelers

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