Home Wiki Blog Forum GEXF.net

Gephi forums

Community support

Java Application with multiple Workspaces

Automated tasks on server

Java Application with multiple Workspaces

Postby csloan123 » 08 Jul 2013 15:03

Hello,

I am attempting to create a simple Java application which will have more than one workspace. I want to do this so that I can separately modify the same data set and have them both display side by side in different windows.

Unfortunately, using the ProjectController's newWorkspace and duplicateWorkspace methods are not giving me any joy, it seems that when I import the data set (GML) into both in turn using the import tutorial code, only one of the graph models gets populated. This is only fixed if I comment out the code creating a second workspace.

Could somebody let me know how I would go about:

1) Setting up 2 workspaces
2) Importing the same data file into each one separately

I am working on this project quite a lot and so would appreciate a quick response.

Thanks,
Conor
csloan123
 
Posts: 6
Joined: 03 Jul 2013 11:17

Re: Java Application with multiple Workspaces

Postby csloan123 » 08 Jul 2013 22:37

just to update my problem:

I have successfully created multiple workspaces with data imported, and it now appears my issue is displaying both different graphs side by side in different jframes. it appears that using 2 PApplets does not work as they both display the second workspace's graph.

if anyone knows what the problem could be or needs more information let me know.. thanks
csloan123
 
Posts: 6
Joined: 03 Jul 2013 11:17

Re: Java Application with multiple Workspaces

Postby eduramiba » 24 Jul 2013 20:19

Hi,
Sorry, Preview is not ready for visualizing multiple workspaces at the same time (see similar problem viewtopic.php?f=27&t=2721#p8886).
This is important for the toolkit, so future versions should make this possible.

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: Java Application with multiple Workspaces

Postby csloan123 » 04 Oct 2013 22:58

Hi,

Thanks for the response Eduardo. In fact I did manage to hack together a solution, which looked something like this:
Having one "DemoFrame" each with a different workspace as a member, I used the following code to modify the event listener of the Papplet:

Code: Select all
        final MouseListener mouse = applet.getMouseListeners()[0];
        applet.removeMouseListener(mouse);
        applet.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {
                pc.openWorkspace(workspace);
                mouse.mouseClicked(e);
            }

            @Override
            public void mousePressed(MouseEvent e) {
                pc.openWorkspace(workspace);
                mouse.mousePressed(e);
            }

            @Override
            public void mouseReleased(MouseEvent e) {
                pc.openWorkspace(workspace);
                mouse.mouseReleased(e);
            }

            @Override
            public void mouseEntered(MouseEvent e) {
                pc.openWorkspace(workspace);
                mouse.mouseEntered(e);
            }

            @Override
            public void mouseExited(MouseEvent e) {
                pc.openWorkspace(workspace);
                mouse.mouseExited(e);
            }
        });



This worked for what I wanted, as I just needed 4 graphs to update differently when one node was clicked on any graph..
It was very messy, and often buggy, requiring me to re-click every frame to update it, but it served its purpose!

*EDIT

I also of course used openWorkspace whenever making changes or working with a specific window/workspace, it wasn't just for events..
csloan123
 
Posts: 6
Joined: 03 Jul 2013 11:17

Re: Java Application with multiple Workspaces

Postby guodah » 23 Oct 2013 22:27

Hi, csloan,

May I ask how many applets you created in your application? Do the frames share one applet and "pc.openWorkSpace()" changes the content in the applet? Or each frame has its own applet?

May I see more of your code?

Thanks,
guodah
guodah
 
Posts: 1
Joined: 23 Oct 2013 17:08
Location: United States


Return to Toolkit

Who is online

Users browsing this forum: No registered users and 3 guests