Home Wiki Blog Forum GEXF.net

Gephi forums

Community support

Developing interactive graph applet

Automated tasks on server

Developing interactive graph applet

Postby nakulpathak » 26 Feb 2013 13:42

Hi

Iam trying to develop a UI Screen, using which I can select nodes using a mouse.

Iam using gephiToolkit, Below is the feature I would like to achieve

1. Load a graph
2. display the graph on to the screen
3. Select a particular node, and print properties of that particular node to console.

I would like to know if this sort of feature is possible using gephi Toolkit.
(Currently using pApplet, but it does not allow node selection)

Any help would be appreciated.

Regards
nakulpathak
 
Posts: 9
Joined: 12 Feb 2013 08:53

Re: Developing interactive graph applet

Postby eduramiba » 26 Feb 2013 21:41

Hi,
Preview doesn't handle node click events, at least for now.

But since last toolkit version you can create your own mouse listeners.
Read this topic for more info about doing this.

I think a simple node click listener could be easily coded.

Please note that this new API is likely to be extended in the future. For example, a related renderer is needed for the mouse listener to be enabled. These listeners should be able to be enabled without a renderer in some cases. You can create a dummy renderer for now.

Let me know if you find any problem doing this or you have any suggestion.

Eduardo
Life... is like a grapefruit. It's orange and squishy, and has a few pips in it, and some folks have half a one for breakfast.
User avatar
eduramiba
Gephi Code Manager
 
Posts: 579
Joined: 22 Mar 2010 16:30
Location: Zaragoza, Spain

Re: Developing interactive graph applet

Postby nakulpathak » 28 Feb 2013 08:01

Hi,
Thank you for your templates and using these template I have created one mouse listener class.
I think for making the thing works I need to register this mouse listener. I tried to register it but not able to do it.
I would like to know exactly where and how to register this mouse listener in my code.

Any help would be appreciated.

Regards
nakulpathak
 
Posts: 9
Joined: 12 Feb 2013 08:53

Re: Developing interactive graph applet

Postby eduramiba » 28 Feb 2013 22:14

You need to annotate every class that implements a service with this:

Code: Select all
@ServiceProvider(service = PreviewMouseListener.class)

That's for the listener

Eduardo
Life... is like a grapefruit. It's orange and squishy, and has a few pips in it, and some folks have half a one for breakfast.
User avatar
eduramiba
Gephi Code Manager
 
Posts: 579
Joined: 22 Mar 2010 16:30
Location: Zaragoza, Spain

Re: Developing interactive graph applet

Postby nakulpathak » 05 Mar 2013 08:31

Hi,
Selecting preview applet event has started working for me.
Thanks Eduardo,

Nakul
nakulpathak
 
Posts: 9
Joined: 12 Feb 2013 08:53

Re: Developing interactive graph applet

Postby tangwing » 16 Mar 2013 16:43

Sorry to pull you back to this question... but could you help me?
I'm also trying to implement a simple mouse click listener : just print a msg when being clicked.
Firstly I turn the Reuse_the_Preview_Applet example to a JFrame version, no problem for this;
Secondly, according to my comprehension of what you have said, I create a mouselistener like this:

Code: Select all
@ServiceProvider(service = PreviewMouseListener.class, position=0)
public class MyPreviewMouseListener implements PreviewMouseListener{
        @Override
        public void mouseClicked(PreviewMouseEvent event,
                        PreviewProperties properties, Workspace workspace) {
                System.out.println("I'm clicked!!");
        }
        @Override
        public void mousePressed(PreviewMouseEvent event,
                        PreviewProperties properties, Workspace workspace) {System.out.println("I'm clicked!!");}
        @Override
        public void mouseDragged(PreviewMouseEvent event,
                        PreviewProperties properties, Workspace workspace) {}
        @Override
        public void mouseReleased(PreviewMouseEvent event,
                        PreviewProperties properties, Workspace workspace) {}
}


Then I launch the app, but when I click nodes, nothing is printed.
Please give me some advices! Thanks a lot.

PS : I'am using eclipse to do this.
tangwing
 
Posts: 2
Joined: 14 Mar 2013 22:04

Re: Developing interactive graph applet

Postby eduramiba » 18 Mar 2013 21:20

Hi,
Did you create a mouse responsive Renderer that uses this mouse listener? It's necessary for now.
Anyway, we need to extend this API for more general cases yet.

Eduardo
Life... is like a grapefruit. It's orange and squishy, and has a few pips in it, and some folks have half a one for breakfast.
User avatar
eduramiba
Gephi Code Manager
 
Posts: 579
Joined: 22 Mar 2010 16:30
Location: Zaragoza, Spain

Re: Developing interactive graph applet

Postby tangwing » 19 Mar 2013 00:33

Thanks for your reply.

Yes I did implement a MouserResponseRenderer, even though I don't think I've really understood...

Code: Select all
@ServiceProvider(service = MouseResponsiveRenderer.class)
public class AtosMouseResponsiveRenderer implements MouseResponsiveRenderer {

   @Override
   public boolean needsPreviewMouseListener(
         PreviewMouseListener previewMouseListener) {
      return previewMouseListener instanceof AtosPreviewMouseListener;
   }
}


I always don't have MouseClick response. And I have another doubt now : I'am not sure that I can develop on Eclipse. In Netbeans, with annotations like
Code: Select all
@ServiceProvider(service = MouseResponsiveRenderer.class)
, I can find the file generated under "\build\classes\META-INF\services\org.gephi.preview.spi.MouseResponsiveRenderer", while in Eclipse, there is nothing like that generated.

Anyway, my little app doesn't work on neither Netbeans nor Eclipse, and I think the services are not even registered under Eclipse.
tangwing
 
Posts: 2
Joined: 14 Mar 2013 22:04

Re: Developing interactive graph applet

Postby eduramiba » 20 Mar 2013 21:51

Hi,
Actually, like the doc in MouserResponseRenderer says, you need to create a class that implements both Renderer and MouserResponseRenderer. Also, annotate it with
Code: Select all
@ServiceProvider(service = Renderer.class)


Eduardo
Life... is like a grapefruit. It's orange and squishy, and has a few pips in it, and some folks have half a one for breakfast.
User avatar
eduramiba
Gephi Code Manager
 
Posts: 579
Joined: 22 Mar 2010 16:30
Location: Zaragoza, Spain

Re: Developing interactive graph applet

Postby ajavinash » 08 Jul 2013 07:41

Hi,
I want a similar feature where the following should happen:

When I click on a node, the ego network of that node should be shown. (Ideally the layout should also realign)

Thanks
Avinash.
ajavinash
 
Posts: 1
Joined: 07 Jul 2013 15:56
Location: India

Next

Return to Toolkit

Who is online

Users browsing this forum: No registered users and 0 guests

cron