cytoscape.editor.event
Class PaletteNetworkEditEventHandler
java.lang.Object
cytoscape.editor.event.NetworkEditEventAdapter
cytoscape.editor.event.BasicNetworkEditEventHandler
cytoscape.editor.event.PaletteNetworkEditEventHandler
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.util.EventListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, cytoscape.data.attr.MultiHashMapListener, phoebe.PhoebeCanvasDropListener
- Direct Known Subclasses:
- BioPAXNetworkEditEventHandler
- public class PaletteNetworkEditEventHandler
- extends BasicNetworkEditEventHandler
The PaletteNetworkEditEventHandler extends the basic network edit event handler with the
capability to drag and drop shapes from a palette onto the canvas, resulting in the addition of
nodes and edges to the current Cytoscape network.
- Version:
- 1.0
- Author:
- Allan Kuchinsky, Agilent Technologies
- See Also:
SimpleBioMoleculeEditor
Field Summary |
static java.lang.String |
NODE_TYPE
|
Method Summary |
giny.view.NodeView |
findEdgeDropTarget(java.awt.geom.Point2D location)
determine which node the edge has been dropped on, if any
|
void |
handleDroppedEdge(java.lang.String attributeValue,
phoebe.PhoebeCanvasDropEvent e)
specialized processing for a dropped shape that represents an edge. |
void |
handleDroppedURL(java.awt.datatransfer.Transferable t,
java.awt.datatransfer.DataFlavor d,
java.awt.Point location)
A stub routine that currently just adds a node at the drop position. |
void |
itemDropped(phoebe.PhoebeCanvasDropEvent e)
The itemDropped() method is at the heart of the palette-based editor. |
Methods inherited from class cytoscape.editor.event.BasicNetworkEditEventHandler |
allAttributeValuesRemoved, attributeValueAssigned, attributeValueRemoved, beginEdge, createNode, finishEdge, get_caller, getCanvas, getEdgeAttributeName, getEdgeAttributeValue, getNextPoint, getNode, getNodeAttributeName, getNodeAttributeValue, getStartPoint, getView, isEdgeStarted, isHandlingEdgeDrop, keyTyped, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, set_caller, setEdgeAttributeName, setEdgeAttributeValue, setEdgeStarted, setHandlingEdgeDrop, setNextPoint, setNode, setNodeAttributeName, setNodeAttributeValue, setStartPoint, setView, start, stop, updateEdge |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.awt.event.ActionListener |
actionPerformed |
NODE_TYPE
public static final java.lang.String NODE_TYPE
- See Also:
- Constant Field Values
PaletteNetworkEditEventHandler
public PaletteNetworkEditEventHandler()
PaletteNetworkEditEventHandler
public PaletteNetworkEditEventHandler(CytoscapeEditor caller)
- Parameters:
caller
-
PaletteNetworkEditEventHandler
public PaletteNetworkEditEventHandler(CytoscapeEditor caller,
cytoscape.view.CyNetworkView view)
- Parameters:
caller
- view
-
itemDropped
public void itemDropped(phoebe.PhoebeCanvasDropEvent e)
- The itemDropped() method is at the heart of the palette-based editor. The method can
respond to a variety of DataFlavors that correspond to the shape being dragged and dropped from
the palette. These include Cytoscape nodes and edges, as well as URLs that can be dragged and
dropped from other applications onto the palette.
- Specified by:
itemDropped
in interface phoebe.PhoebeCanvasDropListener
- Overrides:
itemDropped
in class NetworkEditEventAdapter
handleDroppedEdge
public void handleDroppedEdge(java.lang.String attributeValue,
phoebe.PhoebeCanvasDropEvent e)
- specialized processing for a dropped shape that represents an edge.
if the edge shape is dropped on a node, then start an edge from the node that is
dropped on. Subsequent movements of the mouse extend the edge, as in the BasicNetworkEditEventHandler.
A mouse click when over the desired target node completes the edge.
- Parameters:
attributeValue
- the type of the edgee
- the drop event
findEdgeDropTarget
public giny.view.NodeView findEdgeDropTarget(java.awt.geom.Point2D location)
- determine which node the edge has been dropped on, if any
TODO: findEdgeDropTarget currently iterates through all of the Nodes in the current network and
checks whether the drop event position is contained within the bounds of the node. Is
there a more efficient way to do this?
TODO: 06/22/06: update this to use new renderer routines for finding nodes intersecting point
- Parameters:
location
- the location of the drop event
- Returns:
- the NodeView that is located at the drop location.
handleDroppedURL
public void handleDroppedURL(java.awt.datatransfer.Transferable t,
java.awt.datatransfer.DataFlavor d,
java.awt.Point location)
- A stub routine that currently just adds a node at the drop position.
In theory, the URL can be traversed and the retrieved document parsed to
extract information that can be added to the Cytoscape network. For example,
the user could drag a URL an NCBI Unigene Web page and a node could be added
to the network for that gene, with certain pieces of information on that Web
extracted and assigned as attributes for that gene.
- Parameters:
t
- the Transferable that is dropped onto the canvasd
- the DataFlavor that represents the dropped URL.location
- the location of the drop event.