cytoscape.editor
Class CytoscapeEditorManager

java.lang.Object
  extended bycytoscape.editor.CytoscapeEditorManager

public abstract class CytoscapeEditorManager
extends java.lang.Object

The CytoscapeEditorManager is the central class in the editor framework API. It maintains the state of the editing environment, maintains global state information, and implements static methods for editor registration, editor invocation (via CytoscapeEditorFactory), node/edge addition, undo/redo.

Version:
1.0
Author:
Allan Kuchinsky, Agilent Technologies
See Also:
CytoscapeEditorFactory, CytoscapeEditorManagerSupport

Field Summary
static java.lang.String ANY_VISUAL_STYLE
           
static java.lang.String BIOPAX_NODE_TYPE
          attribute used for BioPAX-like editor
static java.lang.String CYTOSCAPE_EDITOR
          AJK: 06/19/06 CytoscapeEditor class descriptor -- for checking against NETWORK_MODIFIED events
static java.lang.String DEFAULT_EDITOR_TYPE
           
static java.lang.String EDGE_TYPE
          CytoscapeAttribute: EDGE_TYPE
static cytoscape.data.CyAttributes edgeAttribs
          main data structure for all edge attributes
static CytoscapeEditorManagerSupport manager
          subsidiary class which implements methods that require non-static references, e.g.
static java.lang.String NODE_TYPE
          CytoscapeAttribute: NODE_TYPE
static cytoscape.data.CyAttributes nodeAttribs
          main data structure for all node attributes
 
Constructor Summary
CytoscapeEditorManager()
           
 
Method Summary
static void addEdgeTypeForVisualStyle(cytoscape.visual.VisualStyle vizStyle, java.lang.String edgeType)
          adds an edge type to the mappings kept between visual style and its EDGE_TYPE attribute values
static void addEdit(javax.swing.undo.UndoableEdit edit)
          adds an undoable edit to the UndoManager.
static void addHiddenEdgeForNetwork(cytoscape.CyNetwork net, int edgeIdx)
          adds an edge to the list of edges hidden from network
static void addHiddenNodeForNetwork(cytoscape.CyNetwork net, int nodeIdx)
          adds a node to the list of nodes hidden from network
static java.lang.String createUniqueNetworkName()
          generate a unique name for the network under construction, utilizing time stamp
static CytoscapeEditor getCurrentEditor()
          Returns the editor being currently used in Cytoscape.
static ShapePalette getCurrentShapePalette()
           
static float getDefaultBorderWidth()
          returns the default node border width.
static cern.colt.list.IntArrayList getEdgeClipBoard()
          clipboard for storing deleted edges.
static java.util.List getEdgeTypesForVisualStyle(cytoscape.visual.VisualStyle vizStyle)
           
static CytoscapeEditor getEditorForView(cytoscape.view.CyNetworkView view)
          get the editor that is assigned to this CyNetworkView
static int[] getHiddenEdgesForNetwork(cytoscape.CyNetwork net)
          returns edges hidden from network
static int[] getHiddenNodesForNetwork(cytoscape.CyNetwork net)
          returns nodes hidden from network
static NetworkEditEventAdapter getNetworkEditEventAdapter(CytoscapeEditor editor)
          returns the network edit event adapter associated with the editor
static cern.colt.list.IntArrayList getNodeClipBoard()
          clipboard for storing deleted nodes.
static ShapePalette getShapePaletteForView(cytoscape.view.CyNetworkView view)
          get the ShapePalette that is associated with a CyNetworkView.
static NetworkEditEventAdapter getViewNetworkEditEventAdapter(cytoscape.view.CyNetworkView view)
          retrieves the adapter that handles drags/drops, other mouse events on the canvas
static void initialize()
          initial setup of controls, menu items, undo/redo actions, and keyboard accelerators
static NetworkEditEventAdapter initializeEditEventAdapter(CytoscapeEditor editor, java.lang.String adapterName)
          builds the named event handler and associates it with the input editor
static CytoscapeEditor initializeEditor(java.lang.String editorName, java.lang.String networkEditAdapterName)
          initialize the editor as a side-effect of registering it.
static boolean isEditingEnabled()
           
static boolean isRunningEditorFramework()
          flag that indicates whether or not the editor framework is running
static boolean isSettingUpEditor()
           
static void register(java.lang.String editorName)
          sets up menus for invoking the editor
static void register(java.lang.String editorName, java.lang.String networkEditAdapterName)
          makes the system aware of the editor.
static void register(java.lang.String editorName, java.lang.String networkEditAdapterName, java.lang.String visualStyleName)
          makes the system aware of the editor.
static void register(java.lang.String editorName, java.lang.String networkEditAdapterName, java.lang.String controllingNodeAttribute, java.lang.String controllingEdgeAttribute)
          makes the system aware of the editor.
static void register(java.lang.String editorName, java.lang.String networkEditAdapterName, java.lang.String controllingNodeAttribute, java.lang.String controllingEdgeAttribute, java.lang.String visualStyleName)
          makes the system aware of the editor.
static void resetAttributes(java.lang.String oldId, java.lang.String newId, cytoscape.data.CyAttributes attrs)
          reset attributes for a CyNode whose identifier has been reset, basically by copying over attributes from old identifier to new identifier
static void setCurrentEditor(CytoscapeEditor currentEditor)
           
static void setCurrentShapePalette(ShapePalette currentShapePalette)
           
static void setDefaultBorderWidth(float defaultBorderWidth)
          sets the default node border width.
static void setDefaultEditor(CytoscapeEditor defaultEditor)
           
static void setEditingEnabled(boolean editingEnabled)
           
static void setEditorForView(cytoscape.view.CyNetworkView view, CytoscapeEditor editor)
          set the editor for a CyNetworkView
static void setEventHandlerForView(cytoscape.view.CyNetworkView view)
          sets mapping of event handler to CyNetworkView.
static void setRunningEditorFramework(boolean runningEditorFramework)
          set the flag that indicates whether or not the editor framework is running.
static void setSettingUpEditor(boolean settingUpEditor)
           
static void setShapePaletteForView(cytoscape.view.CyNetworkView view, ShapePalette shape)
          sets the ShapePalette that is associated with a CyNetworkView.
static void setupNewNetworkView(cytoscape.view.CyNetworkView newView)
          Handles the logistics of setting up a New Network view.
static void setViewNetworkEditEventAdapter(cytoscape.view.CyNetworkView view, NetworkEditEventAdapter event)
          set the adapter that handles drags/drops, other mouse events on the canvas.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manager

public static CytoscapeEditorManagerSupport manager
subsidiary class which implements methods that require non-static references, e.g. a Swing PropertyChangeListener


NODE_TYPE

public static final java.lang.String NODE_TYPE
CytoscapeAttribute: NODE_TYPE

See Also:
Constant Field Values

BIOPAX_NODE_TYPE

public static final java.lang.String BIOPAX_NODE_TYPE
attribute used for BioPAX-like editor

See Also:
Constant Field Values

EDGE_TYPE

public static final java.lang.String EDGE_TYPE
CytoscapeAttribute: EDGE_TYPE

See Also:
Constant Field Values

ANY_VISUAL_STYLE

public static final java.lang.String ANY_VISUAL_STYLE
See Also:
Constant Field Values

DEFAULT_EDITOR_TYPE

public static final java.lang.String DEFAULT_EDITOR_TYPE
See Also:
Constant Field Values

CYTOSCAPE_EDITOR

public static final java.lang.String CYTOSCAPE_EDITOR
AJK: 06/19/06 CytoscapeEditor class descriptor -- for checking against NETWORK_MODIFIED events

See Also:
Constant Field Values

nodeAttribs

public static cytoscape.data.CyAttributes nodeAttribs
main data structure for all node attributes


edgeAttribs

public static cytoscape.data.CyAttributes edgeAttribs
main data structure for all edge attributes

Constructor Detail

CytoscapeEditorManager

public CytoscapeEditorManager()
Method Detail

initialize

public static void initialize()
initial setup of controls, menu items, undo/redo actions, and keyboard accelerators


initializeEditor

public static CytoscapeEditor initializeEditor(java.lang.String editorName,
                                               java.lang.String networkEditAdapterName)
initialize the editor as a side-effect of registering it. builds editor and its associated event handler builds visual style associated with editor

Parameters:
editorName -
networkEditAdapterName -
Returns:
the editor that is built

initializeEditEventAdapter

public static NetworkEditEventAdapter initializeEditEventAdapter(CytoscapeEditor editor,
                                                                 java.lang.String adapterName)
builds the named event handler and associates it with the input editor

Parameters:
editor -
adapterName -
Returns:

getNetworkEditEventAdapter

public static NetworkEditEventAdapter getNetworkEditEventAdapter(CytoscapeEditor editor)
returns the network edit event adapter associated with the editor

Parameters:
editor - the CytoscapeEditor

register

public static void register(java.lang.String editorName)
sets up menus for invoking the editor

Parameters:
editorName - text for editor name, to appear in menus

register

public static void register(java.lang.String editorName,
                            java.lang.String networkEditAdapterName)
makes the system aware of the editor. adds the editor's type to the list of editor types maintained by the CytoscapeEditorFactory.

Parameters:
editorName - specifies the 'type' of the editor
networkEditAdapterName - every editor has a NetworkEditEventHandler that handles user input in in a way that is specialized for that editor. This is the heart of the editors behaviour.

register

public static void register(java.lang.String editorName,
                            java.lang.String networkEditAdapterName,
                            java.lang.String visualStyleName)
makes the system aware of the editor. adds the editor's type to the list of editor types maintained by the CytoscapeEditorFactory.

Parameters:
editorName - specifies the 'type' of the editor
networkEditAdapterName - every editor has a NetworkEditEventHandler that handles user input in in a way that is specialized for that editor. This is the heart of the editors behaviour.
visualStyleName - specifies the visual style that is to be associated with the editor

register

public static void register(java.lang.String editorName,
                            java.lang.String networkEditAdapterName,
                            java.lang.String controllingNodeAttribute,
                            java.lang.String controllingEdgeAttribute)
makes the system aware of the editor. adds the editor's type to the list of editor types maintained by the CytoscapeEditorFactory.

Parameters:
editorName - specifies the 'type' of the editor
networkEditAdapterName - every editor has a NetworkEditEventHandler that handles user input in in a way that is specialized for that editor. This is the heart of the editors behaviour.
controllingNodeAttribute - attribute used by the visual style to map node attribute values into shapes, colors of nodes on palette
controllingEdgeAttribute - attribute used by the visual style to map edge attribute values into target arrows, line types of edges on palette

register

public static void register(java.lang.String editorName,
                            java.lang.String networkEditAdapterName,
                            java.lang.String controllingNodeAttribute,
                            java.lang.String controllingEdgeAttribute,
                            java.lang.String visualStyleName)
makes the system aware of the editor. adds the editor's type to the list of editor types maintained by the CytoscapeEditorFactory.

Parameters:
editorName - specifies the 'type' of the editor
networkEditAdapterName - every editor has a NetworkEditEventHandler that handles user input in in a way that is specialized for that editor. This is the heart of the editors behaviour.
controllingNodeAttribute - attribute used by the visual style to map node attribute values into shapes, colors of nodes on palette
controllingEdgeAttribute - attribute used by the visual style to map edge attribute values into target arrows, line types of edges on palette
visualStyleName - specifies the visual style that is to be associated with the editor

setupNewNetworkView

public static void setupNewNetworkView(cytoscape.view.CyNetworkView newView)
Handles the logistics of setting up a New Network view.

Parameters:
newView - the NetworkView being created

setEventHandlerForView

public static void setEventHandlerForView(cytoscape.view.CyNetworkView view)
sets mapping of event handler to CyNetworkView. Typically done when a NETWORK_VIEW_FOCUSED event is received. removes various listeners on canvas from previous view and sets up the listeners for this view on the canvas.

Parameters:
view -

setViewNetworkEditEventAdapter

public static void setViewNetworkEditEventAdapter(cytoscape.view.CyNetworkView view,
                                                  NetworkEditEventAdapter event)
set the adapter that handles drags/drops, other mouse events on the canvas. Associate it with the input view.

Parameters:
view - the Network View
event - the NetworkEditEventHandler associated with the view.

getViewNetworkEditEventAdapter

public static NetworkEditEventAdapter getViewNetworkEditEventAdapter(cytoscape.view.CyNetworkView view)
retrieves the adapter that handles drags/drops, other mouse events on the canvas

Returns:
the NetworkEventAdapter

getEditorForView

public static CytoscapeEditor getEditorForView(cytoscape.view.CyNetworkView view)
get the editor that is assigned to this CyNetworkView

Parameters:
view - a CyNetworkView
Returns:
the editor assigned to this CyNetworkView

getShapePaletteForView

public static ShapePalette getShapePaletteForView(cytoscape.view.CyNetworkView view)
get the ShapePalette that is associated with a CyNetworkView. needed when a view changes

Parameters:
view -
Returns:

setShapePaletteForView

public static void setShapePaletteForView(cytoscape.view.CyNetworkView view,
                                          ShapePalette shape)
sets the ShapePalette that is associated with a CyNetworkView. needed when a view changes

Parameters:
view -
shape -

getHiddenNodesForNetwork

public static int[] getHiddenNodesForNetwork(cytoscape.CyNetwork net)
returns nodes hidden from network

Parameters:
net -
Returns:

getHiddenEdgesForNetwork

public static int[] getHiddenEdgesForNetwork(cytoscape.CyNetwork net)
returns edges hidden from network

Parameters:
net -
Returns:

addHiddenNodeForNetwork

public static void addHiddenNodeForNetwork(cytoscape.CyNetwork net,
                                           int nodeIdx)
adds a node to the list of nodes hidden from network

Parameters:
net -
nodeIdx - index of the node to be added

addHiddenEdgeForNetwork

public static void addHiddenEdgeForNetwork(cytoscape.CyNetwork net,
                                           int edgeIdx)
adds an edge to the list of edges hidden from network

Parameters:
net -
edgeIdx - index of the edge to be added

addEdgeTypeForVisualStyle

public static void addEdgeTypeForVisualStyle(cytoscape.visual.VisualStyle vizStyle,
                                             java.lang.String edgeType)
adds an edge type to the mappings kept between visual style and its EDGE_TYPE attribute values

Parameters:
vizStyle -
edgeType -

getEdgeTypesForVisualStyle

public static java.util.List getEdgeTypesForVisualStyle(cytoscape.visual.VisualStyle vizStyle)
Parameters:
vizStyle -
Returns:
a list of the EDGE_TYPEs associated with the visual style

setEditorForView

public static void setEditorForView(cytoscape.view.CyNetworkView view,
                                    CytoscapeEditor editor)
set the editor for a CyNetworkView

Parameters:
view - the CyNetworkView
editor - the editor to be assigned to the CyNetworkView

addEdit

public static void addEdit(javax.swing.undo.UndoableEdit edit)
adds an undoable edit to the UndoManager. Currently the Cytoscape Editor framework supports undo/redo for deletion operations. This method is typically invoked from within the code for performing deletion.

Parameters:
edit - the edit method to be added to the UndoManager.

getNodeClipBoard

public static cern.colt.list.IntArrayList getNodeClipBoard()
clipboard for storing deleted nodes. Used by undo/redo.

Returns:
clipboard for storing deleted nodes.

getEdgeClipBoard

public static cern.colt.list.IntArrayList getEdgeClipBoard()
clipboard for storing deleted edges. Used by undo/redo.

Returns:
clipboard for storing deleted edges.

getCurrentEditor

public static CytoscapeEditor getCurrentEditor()
Returns the editor being currently used in Cytoscape.

Returns:
the editor

setCurrentEditor

public static void setCurrentEditor(CytoscapeEditor currentEditor)
Parameters:
currentEditor - the editor being currently used

getDefaultBorderWidth

public static float getDefaultBorderWidth()
returns the default node border width. This is used in highlighting a node, by thickening its border, upon mouseEntry.

Returns:
the default border width

setDefaultBorderWidth

public static void setDefaultBorderWidth(float defaultBorderWidth)
sets the default node border width. This is used in highlighting a node, by thickening its border, upon mouseEntry.


isRunningEditorFramework

public static boolean isRunningEditorFramework()
flag that indicates whether or not the editor framework is running

Returns:
true if the editor framework is running, false otherwise

setRunningEditorFramework

public static void setRunningEditorFramework(boolean runningEditorFramework)
set the flag that indicates whether or not the editor framework is running. Currently this is done via command line argument to Cytoscape


isEditingEnabled

public static boolean isEditingEnabled()
Returns:
Returns the editingEnabled.

setEditingEnabled

public static void setEditingEnabled(boolean editingEnabled)
Parameters:
editingEnabled - The editingEnabled to set.

getCurrentShapePalette

public static ShapePalette getCurrentShapePalette()
Returns:
Returns the currentShapePalette.

setCurrentShapePalette

public static void setCurrentShapePalette(ShapePalette currentShapePalette)
Parameters:
currentShapePalette - The currentShapePalette to set.

setDefaultEditor

public static void setDefaultEditor(CytoscapeEditor defaultEditor)
Parameters:
defaultEditor - The defaultEditor to set.

isSettingUpEditor

public static boolean isSettingUpEditor()
Returns:
Returns the settingUpEditor.

setSettingUpEditor

public static void setSettingUpEditor(boolean settingUpEditor)
Parameters:
settingUpEditor - The settingUpEditor to set.

createUniqueNetworkName

public static java.lang.String createUniqueNetworkName()
generate a unique name for the network under construction, utilizing time stamp

Returns:

resetAttributes

public static void resetAttributes(java.lang.String oldId,
                                   java.lang.String newId,
                                   cytoscape.data.CyAttributes attrs)
reset attributes for a CyNode whose identifier has been reset, basically by copying over attributes from old identifier to new identifier

Parameters:
oldId - old node identifier
newId - new node identifier
attrs - attributes