Click on nodes (Tool API)

Asked by sbc

Hi,

I am trying to set up an interaction when users click on a graph node.
I am wondering if I have to write a class which implements Tool API (in this case, what should I put in the getUI() method?) or If I only need to associate a NodeClickEventListener on every nodes at their creation?

Thanks for your help!

Séréna

Question information

Language:
English Edit question
Status:
Solved
For:
Gephi Edit question
Assignee:
No assignee Edit question
Solved by:
Mathieu Bastian
Solved:
Last query:
Last reply:
Revision history for this message
Best Mathieu Bastian (mathieu.bastian) said :
#1

Yes you should implement the Tool interface, as described here (http://gephi.org/docs/api/org/gephi/tools/spi/Tool.html).

Your tool should provide the NodeClickEventListener and the implementation of ToolUI to provide the text and icon for your tool.

It's easy to see this with an example, for instance the NodePencil Tool which creates a new Node.
http://bazaar.launchpad.net/~gephi.team/gephi/0.7/annotate/head:/ToolsPlugin/src/org/gephi/tools/plugin/NodePencil.java

The Node Pencil uses a MouseClickListener (to get the mouse position), The Painter uses the listener you need (http://bazaar.launchpad.net/~gephi.team/gephi/0.7/annotate/head:/ToolsPlugin/src/org/gephi/tools/plugin/Painter.java)

Revision history for this message
sbc (sbc-utc) said :
#2

Thanks Mathieu Bastian, that solved my question.