I'm trying to write a statistics plugin that calculates a metric based on a user-selected node attribute. It would be ideal for me to, in the metric's UI, include a JComboBox that had an option for each node attribute. To do this, I would need access to the graph's AttributeModel in the MetricPanel class (and actually, having access to the GraphModel would be nice too). Is this possible? Am I missing something obvious?
Thanks!
[SOLVED] Accessing AttributeModel in StatisticsUI panel
-
- Gephi Community Manager
- Posts:964
- Joined:09 Dec 2009 14:41 [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: Accessing AttributeModel in StatisticsUI panel
That's right!
Here is the snippet to list node attribute columns:
Here is the snippet to list node attribute columns:
Code: Select all
AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
AttributeModel model = ac.getModel();
for (AttributeColumn col : model.getNodeTable().getColumns()) {
//do what you want here
}
- mbastian
- Gephi Architect
- Posts:728
- Joined:10 Dec 2009 10:11
- Location:San Francisco, CA [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: Accessing AttributeModel in StatisticsUI panel
And here for the GraphModel:
Add GraphAPI as a dependency of you module also
Code: Select all
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel model = gc.getModel();