Enable Node selection in Preview Applet

Screenshots, Vectorial Preview and printable exports
babyang
Posts:4
Joined:04 Dec 2013 05:20
[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: Enable Node selection in Preview Applet

Post by babyang » 13 May 2014 11:15

Hi,
I have used the listener and render in the template-updated.zip above,and then I add the class RenderTemplate to the preview model like this:

Code: Select all

ManagedRenderer [] mr = previewModel.getManagedRenderers();
        ManagedRenderer [] mr2 = Arrays.copyOf(mr, mr.length+1);
        mr2[mr.length] = new ManagedRenderer(new RendererTemplate(), true);
        previewModel.setManagedRenderers(mr2);
        previewController.refreshPreview();
but when I click the preview nothing happens.maybe the method to add the render to the preview model above is wrong , can anyone give me some advice?

babyang
Posts:4
Joined:04 Dec 2013 05:20
[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: Enable Node selection in Preview Applet

Post by babyang » 13 May 2014 11:17

eduramiba wrote:Hi,
Sorry for late response.

You are only seeing preProcess called message and not clicked message because Netbeans Platform applications ignore System.out for some reason.
So you should use System.err for debugging, or other kinds of output like a dialog.

I attach an updated, tested, template.zip file that shows a message when a node is clicked. It also marks the clicked node in the graph canvas until other node, or no node is clicked.
While doing these example, I noticed and remembered that Y axis coordinates are inverted in relation to node coordinates. Pay attention to this.

Eduardo

Hi,
I have used the listener and render in the template-updated.zip above,and then I add the class RenderTemplate to the preview model like this:

Code: Select all

ManagedRenderer [] mr = previewModel.getManagedRenderers();
        ManagedRenderer [] mr2 = Arrays.copyOf(mr, mr.length+1);
        mr2[mr.length] = new ManagedRenderer(new RendererTemplate(), true);
        previewModel.setManagedRenderers(mr2);
        previewController.refreshPreview();
but when I click the preview nothing happens.maybe the method to add the render to the preview model above is wrong , can anyone give me some advice?

User avatar
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: Enable Node selection in Preview Applet

Post by eduramiba » 14 May 2014 18:16

Hi,
You don't need to manage renderers at all.

I just uploaded a full working demo here https://github.com/gephi/gephi-toolkit-demos
Just build the project and run the main method in PreviewJFrame

Eduardo

Post Reply
[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