Modelers

org.topcased.modeler.commands
Class ReconnectGraphEdgeCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by org.topcased.modeler.commands.ReconnectGraphEdgeCommand
Direct Known Subclasses:
ReconnectEdgeToNodeCommand, ReconnectNodeToEdgeCommand, ReconnectNodeToNodeCommand

public abstract class ReconnectGraphEdgeCommand
extends org.eclipse.gef.commands.Command

Reconnects graphically a GraphEdge


Constructor Summary
ReconnectGraphEdgeCommand(org.eclipse.gef.ConnectionEditPart connection)
          Constructor.
ReconnectGraphEdgeCommand(org.eclipse.gef.ConnectionEditPart connection, boolean needModelUpdate)
          Constructor
 
Method Summary
 boolean canExecute()
           
 void execute()
           
 GraphEdge getEdge()
          Get the GraphEdge
 GraphElement getNewElement()
          Get the target GraphNode
 GraphElement getOldElement()
          Get the source GraphNode
protected abstract  GraphElement getOldGraphElement(org.eclipse.gef.ConnectionEditPart connection)
           
protected  void initializeConnectors(org.eclipse.gef.ConnectionEditPart connection)
          Initializes the connectors before reconnection.
 void redo()
           
protected abstract  void redoModel()
          Update the model after at the end of the redo() method.
 void setNewElement(GraphElement newElement)
          Set the target node
 void undo()
           
protected abstract  void undoModel()
          Update the model at the end of the undo() method.
protected abstract  void updateConnectors(GraphConnector newConnector, GraphConnector oldConnector, GraphConnector attachedConnector)
          Updates anchors and edges within these connectors.
 
Methods inherited from class org.eclipse.gef.commands.Command
canUndo, chain, dispose, getDebugLabel, getLabel, setDebugLabel, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReconnectGraphEdgeCommand

public ReconnectGraphEdgeCommand(org.eclipse.gef.ConnectionEditPart connection)
Constructor. Call the super constructor with : - the container for the edge = the container of the source node - the features list = null. Model will be updated on each graphic reconnection

Parameters:
domain - the EditDomain (used to init the name)
newObj - the edge to create
old - the source node

ReconnectGraphEdgeCommand

public ReconnectGraphEdgeCommand(org.eclipse.gef.ConnectionEditPart connection,
                                 boolean needModelUpdate)
Constructor

Parameters:
domain - the EditDomain (used to init the name)
newObj - the edge to create
oldElement - the source node
featuresList - to be define
needModelUpdate - true if the model must be modified during this command, false if objects already exist in the mode.
Method Detail

canExecute

public boolean canExecute()
Overrides:
canExecute in class org.eclipse.gef.commands.Command
See Also:
Command.canExecute()

execute

public void execute()
Overrides:
execute in class org.eclipse.gef.commands.Command
See Also:
Command.execute()

redo

public void redo()
Overrides:
redo in class org.eclipse.gef.commands.Command
See Also:
Command.redo()

undo

public void undo()
Overrides:
undo in class org.eclipse.gef.commands.Command
See Also:
Command.undo()

getEdge

public GraphEdge getEdge()
Get the GraphEdge

Returns:
GraphEdge

getOldElement

public GraphElement getOldElement()
Get the source GraphNode

Returns:
GraphElement

getNewElement

public GraphElement getNewElement()
Get the target GraphNode

Returns:
GraphElement

setNewElement

public void setNewElement(GraphElement newElement)
Set the target node

Parameters:
newElement - the target node

initializeConnectors

protected void initializeConnectors(org.eclipse.gef.ConnectionEditPart connection)
Initializes the connectors before reconnection.

Parameters:
connection -

redoModel

protected abstract void redoModel()
Update the model after at the end of the redo() method. This method should be overriden by subclasses.


undoModel

protected abstract void undoModel()
Update the model at the end of the undo() method. This method should be overriden by subclasses.


getOldGraphElement

protected abstract GraphElement getOldGraphElement(org.eclipse.gef.ConnectionEditPart connection)
Returns:
Returns the current end element of the given edge

updateConnectors

protected abstract void updateConnectors(GraphConnector newConnector,
                                         GraphConnector oldConnector,
                                         GraphConnector attachedConnector)
Updates anchors and edges within these connectors. Subclasses may remove and add elements depending usage

Parameters:
newConnector - The connectors of the new element
oldConnector - The connectors of the old element

Modelers

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