Home Wiki Blog Forum GEXF.net

Gephi forums

Community support

recuperate node's id

Screenshots, Vectorial Preview and printable exports

recuperate node's id

Postby bassoumar » 24 Apr 2013 09: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 21:18

Re: recuperate node's id

Postby bassoumar » 24 Apr 2013 16:58

Any help please ..
bassoumar
 
Posts: 9
Joined: 10 Apr 2013 21:18

Re: recuperate node's id

Postby seinecle » 25 Apr 2013 14: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
http://www.clementlevallois.net
Gephi tutorials and personalized trainings: http://www.clementlevallois.net/training.html
Join the Gephi Facebook group for help and support: https://www.facebook.com/groups/gephi/
User avatar
seinecle
Gephi Community Support
 
Posts: 530
Joined: 08 Feb 2010 17:55
Location: Lyon, France

Re: recuperate node's id

Postby bassoumar » 25 Apr 2013 15: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 21:18

Re: recuperate node's id

Postby bassoumar » 25 Apr 2013 19:13

please any idea, i need a code java which helps me to recuperate the node's id in my class TopComponent.. please help
bassoumar
 
Posts: 9
Joined: 10 Apr 2013 21:18

Re: recuperate node's id

Postby eduramiba » 28 Apr 2013 22: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
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: recuperate node's id

Postby bassoumar » 29 Apr 2013 10: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
bassoumar
 
Posts: 9
Joined: 10 Apr 2013 21:18

Re: recuperate node's id

Postby eduramiba » 01 May 2013 21:00

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

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

Postby bassoumar » 02 May 2013 14: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
bassoumar
 
Posts: 9
Joined: 10 Apr 2013 21:18

Re: recuperate node's id

Postby eduramiba » 02 May 2013 23: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
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

Next

Return to Visual Results

Who is online

Users browsing this forum: No registered users and 1 guest

cron