recuperate node's id

Screenshots, Vectorial Preview and printable exports
bassoumar
Posts:9
Joined:10 Apr 2013 20:18
[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
recuperate node's id

Post by bassoumar » 24 Apr 2013 08:19

hi everybody,
I need to know how to recuperate the id of a node selected in the graphe in aim to send this value to a server which send me back a new graph.
Please is there any body can help me :roll:

bassoumar
Posts:9
Joined:10 Apr 2013 20:18
[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: recuperate node's id

Post by bassoumar » 24 Apr 2013 15:58

Any help please ..

User avatar
seinecle
Gephi Community Support
Posts:546
Joined:08 Feb 2010 16:55
Location:Lyon, France
Contact:

Re: recuperate node's id

Post by seinecle » 25 Apr 2013 13:34

Sorry but the question is not very clear. From the UI just select the node by choosing the icon with the arrow ans question mark on it then clicking on the node. You can then read the info for this node in the "Edit" window.

Best,

Clement

bassoumar
Posts:9
Joined:10 Apr 2013 20:18
[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: recuperate node's id

Post by bassoumar » 25 Apr 2013 14:22

hi Clement, thanks for your reply,
my task consists in creating a new panel in wich i added a text area , what i want to do is when selecting a node from a graph i can recuperate its ID in that text area. I need to know which class or method should i use and where should i implement it, i tried to use the Edit.java class but i'm lost :(
Can you please help me

bassoumar
Posts:9
Joined:10 Apr 2013 20:18
[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: recuperate node's id

Post by bassoumar » 25 Apr 2013 18:13

please any idea, i need a code java which helps me to recuperate the node's id in my class TopComponent.. please help

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: recuperate node's id

Post by eduramiba » 28 Apr 2013 21:56

Hi,
If you want to write an on-right-click menu action, check this page http://wiki.gephi.org/index.php/HowTo_e ... y_features (pay special attention to the GraphContextMenuItem comment). Also, you can see real examples in Gephi here
In the implementation you receive the nodes, so you can easily retrieve their ids.

Or, if you want to create your own tool for selection, implement this https://github.com/gephi/gephi/blob/mas ... /Tool.java in a similar way. Real example of the Edit Tool.

If you want to get/listen to node selection in the Graph window in general from any tool, I think there is no way to do this at the moment because the Visualization module is not modular enough.

Eduardo

bassoumar
Posts:9
Joined:10 Apr 2013 20:18
[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: recuperate node's id

Post by bassoumar » 29 Apr 2013 09:03

Hi Eduardo, thanks a lot for your reply,
I tried to make my own tool for selection and i tried to implement it in the same way like the edit tool but instead of using the EditWindowControlle i used my own class" propriety_nodeTopComponent" of my new plugin but nothing worked. Here is the code of my tool Selection:
package org.myname.node;

import javax.swing.Icon;
import javax.swing.JPanel;
import org.gephi.graph.api.Node;
import org.gephi.tools.spi.NodeClickEventListener;
import org.gephi.tools.spi.Tool;
import org.gephi.tools.spi.ToolEventListener;
import org.gephi.tools.spi.ToolSelectionType;
import org.gephi.tools.spi.ToolUI;
import org.openide.util.Lookup;
import org.openide.util.lookup.ServiceProvider;

/**
*
* @author basma
*/
@ServiceProvider(service = Tool.class)
public class Selection implements Tool{
private propriety_nodeTopComponent edc;
@Override
public void select() {
edc=Lookup.getDefault().lookup(propriety_nodeTopComponent.class);
edc.componentOpened();
}

@Override
public void unselect() {

}

@Override
public ToolEventListener[] getListeners() {
return new ToolEventListener[]{new NodeClickEventListener() {

@Override
public void clickNodes(Node[] nodes) {
System.out.println("node clicked");
}


}};
}

@Override
public ToolUI getUI() {
return new ToolUI() {

@Override
public JPanel getPropertiesBar(Tool tool) {
return new JPanel();
}

@Override
public Icon getIcon() {
return null;//new ImageIcon(getClass().getResource("/org/gephi/ui/tools/plugin/edit/edit.png"));
}

@Override
public String getName() {
return null;
}

@Override
public String getDescription() {
return null;//NbBundle.getMessage(Selection.class, "Selection.description");
}

@Override
public int getPosition() {
return 200;
}
};
}

@Override
public ToolSelectionType getSelectionType() {
return ToolSelectionType.SELECTION;
}

}
would you please 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: recuperate node's id

Post by eduramiba » 01 May 2013 20:00

Look at the EditWindowController implementation, TopComponents work a little strange.

Eduardo

bassoumar
Posts:9
Joined:10 Apr 2013 20:18
[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: recuperate node's id

Post by bassoumar » 02 May 2013 13:36

thanks a lot Eduardo , i'll see it, i want to ask if there any possibility of acess to the data table and parsing it with a code java :?:

Basma

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: recuperate node's id

Post by eduramiba » 02 May 2013 22:23

Use Attributes API for accessing graph attributes.
An example: http://wiki.gephi.org/index.php/Toolkit ... attributes

You can also take a look at other kinds of examples http://wiki.gephi.org/index.php/Toolkit_portal

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