[graphl-cvs] graphl/src/org/mediavirus/graphl GraphlApplication.java GraphlPane.java
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2006-07-03 15:26:47
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15693/src/org/mediavirus/graphl Modified Files: GraphlApplication.java GraphlPane.java Log Message: implementing XPath-based filters Index: GraphlApplication.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlApplication.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** GraphlApplication.java 30 Jun 2006 14:31:37 -0000 1.25 --- GraphlApplication.java 3 Jul 2006 15:26:33 -0000 1.26 *************** *** 32,42 **** --- 32,47 ---- import javax.swing.KeyStroke; + import org.jaxen.JaxenException; + import org.jaxen.XPath; import org.mediavirus.graphl.graph.Graph; import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.graph.filter.FilteredGraph; + import org.mediavirus.graphl.graph.filter.NodeCompressionFilter; import org.mediavirus.graphl.graph.filter.SourceFilter; + import org.mediavirus.graphl.graph.filter.XPathFilter; import org.mediavirus.graphl.graph.rdf.RDFGraph; import org.mediavirus.graphl.gui.GenericDialog; import org.mediavirus.graphl.gui.OpenURLPanel; + import org.mediavirus.graphl.jaxen.GraphlXPath; import org.mediavirus.graphl.painter.NodePainter; import org.mediavirus.graphl.vocabulary.NS; *************** *** 428,432 **** Iterator<URL> urls = settingsGraph.readFromFile(new File(filename)).iterator(); ! if (urls.hasNext()) { SourceFilter filter = new SourceFilter(); while (urls.hasNext()) { --- 433,437 ---- Iterator<URL> urls = settingsGraph.readFromFile(new File(filename)).iterator(); ! if (false && urls.hasNext()) { SourceFilter filter = new SourceFilter(); while (urls.hasNext()) { *************** *** 438,441 **** --- 443,458 ---- } + try { + //XPathFilter testFilter = new XPathFilter(new GraphlXPath("foaf:Person")); + //mainPanel.graphPane.getFilteredGraph().addOmissionFilter(testFilter); + + NodeCompressionFilter testCompression = new NodeCompressionFilter(new GraphlXPath("foaf:Connection"),new GraphlXPath("both::foaf:connects/both::foaf:Person"),"foaf:Connection"); + mainPanel.graphPane.getFilteredGraph().addNodeCompressionFilter(testCompression); + } + catch (JaxenException ijexaned) { + System.err.println("Error parsing XPath expression: " + ijexaned); + } + + JRadioButtonMenuItem defaultItem = null; Node defaultSettings = null; Index: GraphlPane.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlPane.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** GraphlPane.java 30 Jun 2006 14:31:37 -0000 1.25 --- GraphlPane.java 3 Jul 2006 15:26:33 -0000 1.26 *************** *** 40,43 **** --- 40,44 ---- import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.graph.filter.FilteredGraph; + import org.mediavirus.graphl.graph.filter.XPathFilteredGraph; import org.mediavirus.graphl.graph.rdf.RDFGraph; import org.mediavirus.graphl.interaction.Manipulator; *************** *** 54,57 **** --- 55,60 ---- import org.mediavirus.graphl.vocabulary.NS; + import com.sun.java.swing.SwingUtilities2; + /** * *************** *** 78,82 **** /** The graph being visualized. */ ! protected FilteredGraph filteredGraph; /** The listener for the graph. */ protected GraphListener graphListener; --- 81,85 ---- /** The graph being visualized. */ ! protected XPathFilteredGraph filteredGraph; /** The listener for the graph. */ protected GraphListener graphListener; *************** *** 127,131 **** this.facetRegistry = registry; registry.updateFacets(filteredGraph); ! repaint(); } --- 130,134 ---- this.facetRegistry = registry; registry.updateFacets(filteredGraph); ! repaintLater(); } *************** *** 296,300 **** public void graphLayoutUpdated(Graph graph) { ! repaint(); } --- 299,307 ---- public void graphLayoutUpdated(Graph graph) { ! SwingUtilities.invokeLater(new Runnable(){ ! public void run() { ! repaint(); ! } ! }); } *************** *** 384,388 **** * @return the current graph */ ! public FilteredGraph getFilteredGraph() { return filteredGraph; } --- 391,395 ---- * @return the current graph */ ! public XPathFilteredGraph getFilteredGraph() { return filteredGraph; } *************** *** 398,402 **** public void setSourceGraph(Graph graph) { if (filteredGraph == null) { ! filteredGraph = new FilteredGraph(graph); filteredGraph.addGraphListener(graphListener); filteredGraph.addGraphListener(this); --- 405,409 ---- public void setSourceGraph(Graph graph) { if (filteredGraph == null) { ! filteredGraph = new XPathFilteredGraph(graph); filteredGraph.addGraphListener(graphListener); filteredGraph.addGraphListener(this); *************** *** 418,422 **** graph.addGraphListener(this); }*/ ! repaint(); //selection = new DefaultSelectionModel(graph); //firePropertyChange("graph",oldGraph,graph); --- 425,433 ---- graph.addGraphListener(this); }*/ ! SwingUtilities.invokeLater(new Runnable(){ ! public void run() { ! repaint(); ! } ! }); //selection = new DefaultSelectionModel(graph); //firePropertyChange("graph",oldGraph,graph); *************** *** 697,700 **** --- 708,719 ---- ((Manipulator)manipulators.get(i)).notifyGraphPaneScrolled(); } + + public void repaintLater() { + SwingUtilities.invokeLater(new Runnable(){ + public void run() { + repaint(); + } + }); + } /** *************** *** 704,718 **** public void graphLayoutUpdated(Graph graph) { ! repaint(); } public void graphUpdated(Graph graph) { if (SwingUtilities.isEventDispatchThread()) { ! repaint(); } else { SwingUtilities.invokeLater(new Runnable() { public void run() { ! repaint(); } }); --- 723,737 ---- public void graphLayoutUpdated(Graph graph) { ! repaintLater(); } public void graphUpdated(Graph graph) { if (SwingUtilities.isEventDispatchThread()) { ! repaintLater(); } else { SwingUtilities.invokeLater(new Runnable() { public void run() { ! repaintLater(); } }); *************** *** 720,730 **** } public void graphContentsChanged(Graph graph) { ! repaint(); } public void elementsAdded(Graph graph,Collection nodes,Collection edges) { ! repaint(); } public void elementsRemoved(Graph graph,Collection nodes,Collection edges) { ! repaint(); } } --- 739,749 ---- } public void graphContentsChanged(Graph graph) { ! repaintLater(); } public void elementsAdded(Graph graph,Collection nodes,Collection edges) { ! repaintLater(); } public void elementsRemoved(Graph graph,Collection nodes,Collection edges) { ! repaintLater(); } } *************** *** 895,899 **** if (e.getKeyCode() == KeyEvent.VK_DELETE) { pauseLayouter(); ! getSourceGraph().deleteElements(getSelection().getSelectedNodes(),getSelection().getSelectedEdges()); getSelection().clear(); resumeLayouter(); --- 914,918 ---- if (e.getKeyCode() == KeyEvent.VK_DELETE) { pauseLayouter(); ! getSourceGraph().removeElements(getSelection().getSelectedElements()); getSelection().clear(); resumeLayouter(); *************** *** 962,974 **** public void nodesAddedToSelection(SelectionModel nodeSelectionModel, Collection<Node> nodes) { ! repaint(); } public void nodesRemovedFromSelection(SelectionModel nodeSelectionModel, Collection<Node> nodes) { ! repaint(); } public void selectionCleared(SelectionModel nodeSelectionModel) { ! repaint(); } --- 981,993 ---- public void nodesAddedToSelection(SelectionModel nodeSelectionModel, Collection<Node> nodes) { ! repaintLater(); } public void nodesRemovedFromSelection(SelectionModel nodeSelectionModel, Collection<Node> nodes) { ! repaintLater(); } public void selectionCleared(SelectionModel nodeSelectionModel) { ! repaintLater(); } *************** *** 977,981 **** */ public void edgesAddedToSelection(SelectionModel nodeSelectionModel, Collection<Edge> edges) { ! repaint(); } --- 996,1000 ---- */ public void edgesAddedToSelection(SelectionModel nodeSelectionModel, Collection<Edge> edges) { ! repaintLater(); } *************** *** 984,988 **** */ public void edgesRemovedFromSelection(SelectionModel nodeSelectionModel, Collection<Edge> edges) { ! repaint(); } --- 1003,1007 ---- */ public void edgesRemovedFromSelection(SelectionModel nodeSelectionModel, Collection<Edge> edges) { ! repaintLater(); } |