Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Filter graph data in prefuse

Posted on 2009-04-13
1
Medium Priority
?
798 Views
Last Modified: 2012-05-06
I'm trying to filter some data using the prefuse visualization toolkit.
I can create a Graph and show all my data. I need to filter some data.
If I use a ListQueryBinding and add the query to a AndPredicate, thisone to a VisibilityFilter and the filter to an ActionList, nothing happens.
The ComboBox I created using ListQueryBinding.createComboBox(), works fine (it shows all possibility I want to have to filter my data).

I load my data from a GraphML file and my data stucture is a Graph.
Can you help me?

I attach the code that may be useful.
"anno" is a field in my XML source file.

Graph g = new GraphMLReader().readGraph("data/outGraph.xml");
final Visualization vis = new Visualization();
vis.add(graph,g);
 
ListQueryBinding annoQ = new ListQueryBinding(vis.getGroup(edges), "anno");
AndPredicate filter = new AndPredicate(annoQ.getPredicate());
ActionList update = new ActionList(Activity.INFINITY);
update.add(new VisibilityFilter("anno", filter));
update.add(new RepaintAction());
vis.putAction("update", update);

Open in new window

0
Comment
Question by:usilunet
1 Comment
 

Accepted Solution

by:
usilunet earned 0 total points
ID: 24137095
I found the solution!!!!
Create binding, visibility filter and actionlist as follows:

final ListQueryBinding annoQ = new ListQueryBinding((Table)vis.getGroup(edges), "anno",false);
final VisibilityFilter anno_fil = new VisibilityFilter(edges,annoQ.getPredicate());
ActionList anno_filter = new ActionList();
anno_filter.add(anno_fil);
anno_filter.add(new RepaintAction());

then I used a comboBox as follows:

JComboBox timeCombo = annoQ.createComboBox();
timeCombo.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent arg0) {
            vis.removeAction("anno_filter");
            VisibilityFilter anno_fil = new VisibilityFilter(edges, annoQ.getPredicate());
            ActionList anno_filter = new ActionList(1000);
            anno_filter.add(anno_fil);
            anno_filter.add(new RepaintAction());
            vis.putAction("anno_filter", anno_filter);
            vis.putAction("layout", layout);
            vis.run("anno_filter");
      }});
timeCombo.setSelectedIndex(0);

and by selecting a list item the visualization will be updated.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question