RFC Name : ... |
Editor(s): ... |
About this document
This is an official Request for Comment (RFC) for adding tooltip and context menu functionality to the Cytoscape 2.3 renderer.
For details on RFCs in general, check out the [http://www.answers.com/main/ntquery?method=4&dsid=2222&dekey=Request+for+Comments&gwp=8&curtab=2222_1&linktext=Request%20for%20Comments Wikipedia Entry: Request for Comments (RFCs)]
Status
Not yet completely written
I've got a redesigned scheme for context menus somewhat working for the renderer. I have a test case working where I've been able to bring up the node context menus in a modified version of the Agilent literature search tool. This works for node context menus but not yet for edge context menus -- for edges, I am waiting until we find out or determine how to query for edge intersection.
The scheme is based upon a new interface called NodeContextMenuListener, which has one method:
void addNodeContextMenuItems (Point pt, Object nodeView, JPopupMenu menu);
When you have a class that implements this interface, you add it to the current network view, e.g. in the literature search tool I make a call:
((DGraphView) Cytoscape.getCurrentNetworkView()).addNodeContextMenuListener(this);
I am thinking about whether this should be pushed up to the CyNetwork level to eliminate the need for typecasting, but initially I couldn't get this to work without moving the associated mouse handling code up to the Cytoscape level, where I don't think it should be. In any event, I think we can worry about this detail later.
The routine for building the context menu is in the InnerCanvas class. Basic idea is that the InnerCanvas instantiates the popup menu, calls the addNodeContextMenuItems() method on each NodeContextMenuListener, then shows the menu.
Each NodeContextMenuListener can add JMenuItems, separators, basically do whatever it wants with the JPopupMenu that is passed in to it, all of this using the conventional swing methods for building up menu items. Under the current scheme, each NodeContextMenuListener is responsible for checking whether the JMenuItem already exists on the menu and doing other sanity checks. I am considering whether some global management of the JPopupMenu should be done in the InnerCanvas routine that instantiates and shows the menu, but I'm not sure if that makes sense.
I think this is a more direct and simpler scheme than what has been done for context menus under Cytoscape 2.2.
How to Comment
To view/add comments, click on any of 'Comment' links below. By adding your ideas to the Wiki directly, we can more easily organize everyone's ideas, and keep clear records. Be sure to include today's date and your name for each comment. Here is an example to get things started: ["/Comment"].
Try to keep your comments as concrete and constructive as possible. For example, if you find a part of the RFC makes no sense, please say so, but don't stop there. Take the extra step and propose alternatives.
Proposal
Biological Questions / Use Cases
General Notes
Requirements
Deferred Items
Open Issues
Backward Compatibility
Expected growth and plan for growth
References
Implementation Plan
- ["/Implementation Plan"]