Hi,
I'm new to the api and I'm trying to write a plugin that would allow me to respond to a double click on a node. Ideally, I'd like the double click to read a node attribute representing a file location and open the file.
Which packages should I look at to best accomplish this?
Thanks,
Thomas
Node Double Click Listener
- eduramiba
- Gephi Code Manager
- Posts:1064
- Joined:22 Mar 2010 15:30
- Location:Madrid, Spain [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Re: Node Double Click Listener
Hi,
At the moment it can only be done in Preview panel.
Check this thread https://forum.gephi.org/viewtopic.php?f ... =20#p10342
At the moment it can only be done in Preview panel.
Check this thread https://forum.gephi.org/viewtopic.php?f ... =20#p10342
Re: Node Double Click Listener
So I've decided to take a different approach with my plugin-- no more double click to open associated files. Instead, I'm reading the file into a panel and editing the contents from within Gephi. The panel jumps to the correct file when the a node is clicked. The files I'm reading are c++ and the nodes represent functions that are defined in a financial modeling platform called Moses. The editor has buttons to connect to tortoiseSVN which can update, revert, etc.. the files. The edges represent references to other functions similar to performing a function trace in excel. This has turned out to be a really great way to visualize our financial models! Some models can get extremely complex! Here's a brand new model that barely has any functions defined in it:
Right now, the programming is terrible and I would like to refactor it. I also want to implement more functionality but will probably need to use an observer pattern. I'm new to Java, so can someone explain to me what this code snippet is doing?
I found it in https://github.com/gephi/gephi/blob/mas ... /Edit.java. I understand what the @Override means, but I don't understand the return statement.
Right now, the programming is terrible and I would like to refactor it. I also want to implement more functionality but will probably need to use an observer pattern. I'm new to Java, so can someone explain to me what this code snippet is doing?
Code: Select all
@Override
public ToolEventListener[] getListeners() {
return new ToolEventListener[]{new NodeClickEventListener() {
@Override
public void clickNodes(Node[] nodes) {
if (nodes.length > 0) {
edc.editNode(nodes[0]);
} else {
edc.disableEdit();
}
}
}};
}
- eduramiba
- Gephi Code Manager
- Posts:1064
- Joined:22 Mar 2010 15:30
- Location:Madrid, Spain [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Re: Node Double Click Listener
Hi,
Right, I forgot you could create a tool and use it to react to clicking on nodes in Overview.
That statement is basically creating an array of event listeners (a single NodeClick listener in this case) for the tool and returning it to the method caller.
This is necessary so the ToolsAPI is able to collect all tools and obtain any event listener that the Tool may need by calling the getListeners method.
So, any ToolPlugin has to implement a common interface: https://github.com/gephi/gephi/blob/mas ... /Tool.java
Eduardo
Right, I forgot you could create a tool and use it to react to clicking on nodes in Overview.
That statement is basically creating an array of event listeners (a single NodeClick listener in this case) for the tool and returning it to the method caller.
This is necessary so the ToolsAPI is able to collect all tools and obtain any event listener that the Tool may need by calling the getListeners method.
So, any ToolPlugin has to implement a common interface: https://github.com/gephi/gephi/blob/mas ... /Tool.java
Eduardo