graphl-cvs Mailing List for Graphl - Hybrid graph visualization tool
Status: Pre-Alpha
Brought to you by:
flo1
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(48) |
Sep
(6) |
Oct
(64) |
Nov
(12) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(10) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(34) |
Sep
(31) |
Oct
|
Nov
|
Dec
(25) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(43) |
Jul
(16) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Flo L. <fl...@us...> - 2006-07-11 18:34:52
|
Update of /cvsroot/graphl/graphl/config In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16361/config Added Files: testconfig.rdf Log Message: backup commit - first implementation of xpath-based structural filters --- NEW FILE: testconfig.rdf --- <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE rdf:RDF [ <!ENTITY foo 'http://www.mediavirus.org/foo#'> <!ENTITY graphl 'http://www.mediavirus.org/graphl#'> <!ENTITY foaf 'http://xmlns.com/foaf/0.1/'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY owl 'http://www.w3.org/2002/07/owl#'> <!ENTITY map 'http://fabl.net/vocabularies/geography/map/1.1/'> <!ENTITY geo 'http://www.w3.org/2003/01/geo/wgs84_pos#'> ]> <rdf:RDF xml:base="" xmlns:foo="&foo;" xmlns:graphl="&graphl;" xmlns:foaf="&foaf;" xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:owl="&owl;" xmlns:map="↦" xmlns:geo="&geo;" > <graphl:Configuration graphl:name="Default" graphl:public="true" graphl:default="true" rdf:nodeID="defaultConfig"> <graphl:defaultNodePainter> <graphl:NodePainter graphl:javaClass="'org.mediavirus.graphl.painter.BoxNodePainter'" graphl:baseColor="'#f0f0f0'" graphl:textColor="concat(250 - count(out::*) * 50,',',250 - count(out::*) * 50,',',250 - count(out::*) * 50)" graphl:stroke="1.0" graphl:cornerRadius="8" graphl:label="concat('[ ',graphl:guessName(out::rdf:type/out::*/@rdf:id),' ] ',graphl:guessName(@rdf:id))"> </graphl:NodePainter> </graphl:defaultNodePainter> <graphl:defaultEdgePainter> <graphl:EdgePainter graphl:javaClass="'org.mediavirus.graphl.painter.StraightLineEdgePainter'" graphl:arrowPosition="1" graphl:font="'Dialog-9'" graphl:color="'#000000'" graphl:labelColor="'#000000'" graphl:label="graphl:guessName(@graphl:type)"/> </graphl:defaultEdgePainter> <graphl:defaultNodeLayouter> <graphl:NodeLayouter graphl:javaClass="'org.mediavirus.graphl.layout.RepulsionNodeLayouter'" graphl:strength="1.0"/> </graphl:defaultNodeLayouter> <graphl:defaultEdgeLayouter> <graphl:EdgeLayouter graphl:javaClass="'org.mediavirus.graphl.layout.SpringEdgeLayouter'" graphl:length="300.0" graphl:rigidity="1.0"/> </graphl:defaultEdgeLayouter> <graphl:assignedNodePainters> <rdf:Bag> <rdf:li> <graphl:NodePainter graphl:javaClass="'org.mediavirus.graphl.painter.BoxNodePainter'" graphl:textColor="'30,30,30'" graphl:baseColor="'#d0d0d0'" graphl:borderColor="'#000000'" graphl:font="'Dialog-14'" graphl:borderStroke="'1.5'" graphl:cornerRadius="0" graphl:image="concat(@foaf:name,'.jpg')" graphl:label="@foaf:name"> <graphl:assignedToType> <rdfs:Class rdf:about="&foaf;Person"/> </graphl:assignedToType> </graphl:NodePainter> </rdf:li> </rdf:Bag> </graphl:assignedNodePainters> <graphl:assignedNodeLayouters> <rdf:Bag> <rdf:li> <graphl:NodeLayouter graphl:javaClass="'org.mediavirus.graphl.layout.UnconstrainedNodeLayouter'"> <graphl:assignedToType> <rdfs:Class rdf:about="&rdf;Class"/> </graphl:assignedToType> </graphl:NodeLayouter> </rdf:li> </rdf:Bag> </graphl:assignedNodeLayouters> <graphl:assignedEdgePainters> <rdf:Bag> <rdf:li> <graphl:EdgePainter graphl:javaClass="org.mediavirus.graphl.painter.StraightLineEdgePainter" graphl:paintArrow="false" graphl:paintLabel="false" graphl:stroke="'1.0 1 5'"> <graphl:assignedToType> <rdf:Property rdf:about="&rdf;type"/> </graphl:assignedToType> <graphl:assignedToType> <rdf:Property rdf:about="&rdfs;isDefinedBy"/> </graphl:assignedToType> </graphl:EdgePainter> </rdf:li> </rdf:Bag> </graphl:assignedEdgePainters> <graphl:assignedEdgeLayouters> <rdf:Bag> <rdf:li> <graphl:EdgeLayouter graphl:javaClass="'org.mediavirus.graphl.layout.NeutralEdgeLayouter'"> <graphl:assignedToType> <rdf:Property rdf:about="&rdf;type"/> </graphl:assignedToType> </graphl:EdgeLayouter> </rdf:li> </rdf:Bag> </graphl:assignedEdgeLayouters> </graphl:Configuration> </rdf:RDF> |
From: Flo L. <fl...@us...> - 2006-07-11 18:34:48
|
Update of /cvsroot/graphl/graphl In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16361 Modified Files: .cvsignore Log Message: backup commit - first implementation of xpath-based structural filters Index: .cvsignore =================================================================== RCS file: /cvsroot/graphl/graphl/.cvsignore,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** .cvsignore 8 Jun 2006 13:14:58 -0000 1.5 --- .cvsignore 11 Jul 2006 18:34:31 -0000 1.6 *************** *** 4,5 **** --- 4,6 ---- .cdtproject work + .settings |
From: Flo L. <fl...@us...> - 2006-07-11 18:34:48
|
Update of /cvsroot/graphl/graphl/lib In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16361/lib Added Files: .cvsignore Log Message: backup commit - first implementation of xpath-based structural filters --- NEW FILE: .cvsignore --- jaxen-1.1-beta-9 |
From: Flo L. <fl...@us...> - 2006-07-11 18:34:46
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/filter In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16361/src/org/mediavirus/graphl/graph/filter Modified Files: FilteredGraph.java XPathFilteredGraph.java Added Files: TransitiveCompressionFilter.java EdgeCompressionFilter.java Log Message: backup commit - first implementation of xpath-based structural filters --- NEW FILE: TransitiveCompressionFilter.java --- /* * Created on 10.07.2006 */ package org.mediavirus.graphl.graph.filter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.jaxen.JaxenException; import org.jaxen.XPath; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.jaxen.GraphlXPath; public class TransitiveCompressionFilter { GraphlXPath selector; String edgeType; public TransitiveCompressionFilter(GraphlXPath selector, String newType) { this.selector = selector; this.edgeType = newType; } public String getEdgeType() { return edgeType; } public XPath getSelector() { return selector; } public void filterGraph(XPathFilteredGraph graph) { try { Object paths = selector.selectPaths(graph); if (paths instanceof List) { for (List path : (List<List>)paths) { if (path.get(0) instanceof Node && path.get(path.size()-1) instanceof Node) { Node startNode = (Node)path.get(0); Node endNode = (Node)path.get(path.size()-1); Edge newEdge = graph.createEdge(startNode, endNode); newEdge.setType(edgeType); path.remove(path.size()-1); path.remove(0); graph.removeElements(path); graph.addElements(null, Collections.singleton(newEdge)); } } } } catch (JaxenException jexdasdu) { System.err.println("Error evaluation XPath " + selector.toString() + " on graph: " + jexdasdu); } } } --- NEW FILE: EdgeCompressionFilter.java --- /* * Created on 10.07.2006 */ package org.mediavirus.graphl.graph.filter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.jaxen.JaxenException; import org.jaxen.XPath; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.Node; public class EdgeCompressionFilter { XPath selector; XPath groupBy; String newType; public EdgeCompressionFilter(XPath selector, XPath groupBy, String newType) { this.selector = selector; this.groupBy = groupBy; this.newType = newType; } public XPath getGroupBy() { return groupBy; } public String getNewType() { return newType; } public XPath getSelector() { return selector; } public void filterGraph(XPathFilteredGraph graph) { try { Object elements = selector.evaluate(graph); if (elements instanceof List && ((List)elements).size() > 1) { // this maps edges by to and from nodes Map<Set<Node>, List<Edge>> groups = new HashMap<Set<Node>, List<Edge>>(); for (Edge edge : (List<Edge>)elements) { Object groupElements = groupBy.evaluate(edge); Set nodeSet; if (groupElements instanceof List) { nodeSet = new HashSet((List)groupElements); } else { nodeSet = Collections.singleton(groupElements); } if (groups.get(nodeSet) == null) { groups.put(nodeSet, new ArrayList<Edge>()); } groups.get(nodeSet).add(edge); } List<Edge> newEdges = new ArrayList<Edge>(); List<Edge> edgesToRemove = new ArrayList<Edge>(); for (Set<Node> group : groups.keySet()) { // only compress if more than 1 edge and exactly 2 endnodes if (group.size() == 2 && groups.get(group).size() > 1) { Node[] endnodes = new Node[2]; int i = 0; for (Iterator<Node> groupIter = group.iterator(); groupIter.hasNext();) { Node node = groupIter.next(); endnodes[i++] = node; if (i==2) break; } Edge newEdge = graph.getSource().createEdge(endnodes[0], endnodes[1]); newEdge.setType(newType); newEdges.add(newEdge); edgesToRemove.addAll(groups.get(group)); } else if (group.size() != 2) { System.err.println("Warning: Edge compression grouping expression (" + groupBy.toString() + ") does not result in 2 elements - ignoring compression."); } } graph.removeElements(edgesToRemove); graph.addElements(null, newEdges); } } catch (JaxenException jexdasdu) { System.err.println("Error evaluation XPath " + selector.toString() + " on graph: " + jexdasdu); } } } Index: XPathFilteredGraph.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/filter/XPathFilteredGraph.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XPathFilteredGraph.java 3 Jul 2006 15:26:33 -0000 1.1 --- XPathFilteredGraph.java 11 Jul 2006 18:34:31 -0000 1.2 *************** *** 22,25 **** --- 22,27 ---- List<XPathFilter> omissionFilters = new ArrayList<XPathFilter>(); List<NodeCompressionFilter> nodeCompressionFilters = new ArrayList<NodeCompressionFilter>(); + List<EdgeCompressionFilter> edgeCompressionFilters = new ArrayList<EdgeCompressionFilter>(); + List<TransitiveCompressionFilter> transitiveCompressionFilters = new ArrayList<TransitiveCompressionFilter>(); List<Node> overlayNodes = new ArrayList<Node>(); *************** *** 39,48 **** } ! public void addEdgeCompressionFilter(XPath selector, String newType) { ! } ! public void addTransitiveCompressionFilter(XPath selector, String newType) { ! } --- 41,50 ---- } ! public void addEdgeCompressionFilter(EdgeCompressionFilter filter) { ! edgeCompressionFilters.add(filter); } ! public void addTransitiveCompressionFilter(TransitiveCompressionFilter filter) { ! transitiveCompressionFilters.add(filter); } *************** *** 70,73 **** --- 72,81 ---- filter.filterGraph(this); } + for (EdgeCompressionFilter filter : edgeCompressionFilters) { + filter.filterGraph(this); + } + for (TransitiveCompressionFilter filter : transitiveCompressionFilters) { + filter.filterGraph(this); + } fireGraphContentsChanged(); Index: FilteredGraph.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/filter/FilteredGraph.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FilteredGraph.java 3 Jul 2006 15:26:33 -0000 1.7 --- FilteredGraph.java 11 Jul 2006 18:34:31 -0000 1.8 *************** *** 247,252 **** public void addElements(Collection<Node> nodes, Collection<Edge> edges) { ! cachedNodes.addAll(nodes); ! cachedEdges.addAll(edges); sourceGraph.addElements(nodes, edges); } --- 247,252 ---- public void addElements(Collection<Node> nodes, Collection<Edge> edges) { ! if (nodes != null) cachedNodes.addAll(nodes); ! if (edges != null) cachedEdges.addAll(edges); sourceGraph.addElements(nodes, edges); } |
From: Flo L. <fl...@us...> - 2006-07-11 18:34:46
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16361/src/org/mediavirus/graphl Modified Files: GraphlApplication.java Log Message: backup commit - first implementation of xpath-based structural filters Index: GraphlApplication.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlApplication.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** GraphlApplication.java 3 Jul 2006 15:26:33 -0000 1.26 --- GraphlApplication.java 11 Jul 2006 18:34:31 -0000 1.27 *************** *** 36,42 **** --- 36,44 ---- import org.mediavirus.graphl.graph.Graph; import org.mediavirus.graphl.graph.Node; + import org.mediavirus.graphl.graph.filter.EdgeCompressionFilter; 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.TransitiveCompressionFilter; import org.mediavirus.graphl.graph.filter.XPathFilter; import org.mediavirus.graphl.graph.rdf.RDFGraph; *************** *** 447,452 **** //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) { --- 449,460 ---- //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); ! ! //EdgeCompressionFilter testCompression = new EdgeCompressionFilter(new GraphlXPath("*/foaf:connects|*/foaf:connectx"),new GraphlXPath("both::*"),"foaf:doubleconnected"); ! //mainPanel.graphPane.getFilteredGraph().addEdgeCompressionFilter(testCompression); ! ! TransitiveCompressionFilter testCompression = new TransitiveCompressionFilter(new GraphlXPath("*/foaf:connects/foaf:Connection/foaf:connects/*"),"foaf:connectsNew"); ! mainPanel.graphPane.getFilteredGraph().addTransitiveCompressionFilter(testCompression); } catch (JaxenException ijexaned) { |
From: Flo L. <fl...@us...> - 2006-07-11 18:34:46
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/jaxen In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16361/src/org/mediavirus/graphl/jaxen Modified Files: GraphlXPath.java DocumentNavigator.java Added Files: GraphlContext.java Log Message: backup commit - first implementation of xpath-based structural filters Index: GraphlXPath.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/jaxen/GraphlXPath.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GraphlXPath.java 30 Jun 2006 14:31:33 -0000 1.1 --- GraphlXPath.java 11 Jul 2006 18:34:31 -0000 1.2 *************** *** 5,13 **** --- 5,17 ---- package org.mediavirus.graphl.jaxen; + import java.util.List; + import org.jaxen.BaseXPath; + import org.jaxen.Context; import org.jaxen.JaxenException; import org.jaxen.SimpleFunctionContext; import org.jaxen.SimpleNamespaceContext; import org.jaxen.XPathFunctionContext; + import org.jaxen.util.SingletonList; import org.mediavirus.graphl.GraphlRegistry; *************** *** 26,29 **** --- 30,56 ---- this.setNamespaceContext(GraphlRegistry.instance().getVocabularyRegistry()); } + + public List selectPaths(Object contextNode) throws JaxenException{ + Context context; + + if (contextNode instanceof Context) { + context = (Context) contextNode; + } + else { + context = new GraphlContext(getContextSupport(), true); + + if (contextNode instanceof List) { + context.setNodeSet((List) contextNode); + } + else { + List list = new SingletonList(contextNode); + context.setNodeSet(list); + } + } + + return selectNodesForContext( context ); + + } + } Index: DocumentNavigator.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/jaxen/DocumentNavigator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DocumentNavigator.java 3 Jul 2006 15:26:32 -0000 1.2 --- DocumentNavigator.java 11 Jul 2006 18:34:31 -0000 1.3 *************** *** 15,18 **** --- 15,19 ---- import org.jaxen.UnsupportedAxisException; import org.jaxen.XPath; + import org.jaxen.expr.Step; import org.jaxen.saxpath.Axis; import org.jaxen.saxpath.SAXPathException; *************** *** 213,215 **** --- 214,226 ---- return matchingElements.iterator(); } + + public void visit(Step step, Object context, List resultNodeSet) { + System.out.println("####"); + System.out.println(" Visiting step: " + step.toString()); + System.out.println(" Context: " + context.toString()); + for (Object o : resultNodeSet) { + System.out.println(" Result: " + o.toString()); + } + + } } --- NEW FILE: GraphlContext.java --- /* * Created on 11.07.2006 */ package org.mediavirus.graphl.jaxen; import org.jaxen.Context; import org.jaxen.ContextSupport; public class GraphlContext extends Context { protected boolean getPath = false; public GraphlContext(ContextSupport contextSupport, boolean getPath) { super(contextSupport); this.getPath = getPath; } public boolean isGetPath() { return getPath; } } |
From: Flo L. <fl...@us...> - 2006-07-11 18:34:46
|
Update of /cvsroot/graphl/graphl/graphs In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16361/graphs Modified Files: test.rdf Log Message: backup commit - first implementation of xpath-based structural filters Index: test.rdf =================================================================== RCS file: /cvsroot/graphl/graphl/graphs/test.rdf,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test.rdf 8 Jun 2006 13:15:01 -0000 1.9 --- test.rdf 11 Jul 2006 18:34:31 -0000 1.10 *************** *** 18,28 **** xmlns:vs="&vs;" xmlns:dc="&dc;"> ! <rdf:Description rdf:ID="genid40" ! rdf:id="#genid40"> ! <foaf:phone rdf:resource="#genid82"/> ! </rdf:Description> ! <rdf:Description rdf:ID="genid82" ! rdf:id="#genid82"/> </rdf:RDF> --- 18,71 ---- xmlns:vs="&vs;" xmlns:dc="&dc;"> + <!-- + <foaf:Person foaf:name="Flo" rdf:ID="testNode"> + <foaf:connects> + <foaf:Connection> + <foaf:connects> + <foaf:Person foaf:name="Hansi" rdf:ID="testNode2"> + <foaf:connects> + <foaf:Connection> + <foaf:connects> + <foaf:Person rdf:ID="testNode"/> + </foaf:connects> + </foaf:Connection> + </foaf:connects> + </foaf:Person> + </foaf:connects> + </foaf:Connection> + </foaf:connects> + </foaf:Person> + --> + <foaf:Person foaf:name="Anna" rdf:ID="testNode3"> + <foaf:connects> + <foaf:Connection> + <foaf:connects> + <foaf:Person foaf:name="Benni" rdf:ID="testNode4"> + <!--<foaf:connects> + <foaf:Connection> + <foaf:connects> + <foaf:Person rdf:ID="testNode3"/> + </foaf:connects> + </foaf:Connection> + </foaf:connects>--> + </foaf:Person> + </foaf:connects> + </foaf:Connection> + </foaf:connects> + </foaf:Person> ! ! <!--<foaf:Person foaf:name="Anna" rdf:ID="testNode3"> ! <foaf:connects> ! <foaf:Person foaf:name="Benni" rdf:ID="testNode4"> ! </foaf:Person> ! </foaf:connects> ! </foaf:Person>--> ! <!--<foaf:Person rdf:ID="testNode4"> ! <foaf:connects> ! <foaf:Person rdf:ID="testNode3"> ! </foaf:Person> ! </foaf:connects> ! </foaf:Person>--> </rdf:RDF> |
From: Flo L. <fl...@us...> - 2006-07-11 18:34:46
|
Update of /cvsroot/graphl/graphl/src/org/jaxen/expr In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16361/src/org/jaxen/expr Added Files: DefaultRelativeLocationPath.java Log Message: backup commit - first implementation of xpath-based structural filters --- NEW FILE: DefaultRelativeLocationPath.java --- /* * Created on 10.07.2006 */ package org.jaxen.expr; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import org.jaxen.Context; import org.jaxen.ContextSupport; import org.jaxen.JaxenException; import org.jaxen.util.SingletonList; import org.mediavirus.graphl.jaxen.DocumentNavigator; import org.mediavirus.graphl.jaxen.GraphlContext; public class DefaultRelativeLocationPath extends DefaultLocationPath { public String toString() { return "[(DefaultRelativeLocationPath): " + super.toString() + "]"; } public void accept(Visitor visitor) { visitor.visit(this); } public Object evaluate(Context context) throws JaxenException { List nodeSet = context.getNodeSet(); List contextNodeSet = new ArrayList(nodeSet); ContextSupport support = context.getContextSupport(); Context stepContext = new Context(support); if (!(context instanceof GraphlContext)) { Iterator stepIter = getSteps().iterator(); while ( stepIter.hasNext() ) { Step eachStep = (Step) stepIter.next(); List results = new ArrayList(); for (Object o : contextNodeSet) { stepContext.setNodeSet(new SingletonList(o)); List result = eachStep.evaluate(stepContext); results.addAll(result); if (support.getNavigator() instanceof org.mediavirus.graphl.jaxen.DocumentNavigator) { ((DocumentNavigator)support.getNavigator()).visit(eachStep, o, result); } } contextNodeSet = results; // now we need to reverse the list if this is a reverse axis if (isReverseAxis(eachStep)) { Collections.reverse(contextNodeSet); } } if (getSteps().size() > 1) { Collections.sort(contextNodeSet, new NodeComparator(support.getNavigator())); } return contextNodeSet; } else { stepContext.setNodeSet(contextNodeSet); return doStep(getSteps(), 0, stepContext); } } /** * Recursively performs stepping through the path, returning all paths that were leading to an end node. * @param pathSoFar * @param stepIter * @param stepContext * @return A List of Lists, containing the successful paths (the result node is at the end) */ protected List doStep(List steps, int stepnum, Context stepContext) throws JaxenException{ if (stepnum < steps.size()) { Step currentStep = (Step) steps.get(stepnum++); List results = new ArrayList(); List nextContext = currentStep.evaluate(stepContext); for (Object o : nextContext) { // this selects the nodes for the next step stepContext.setNodeSet(new SingletonList(o)); // this returns a list of lists, the paths to end nodes List result = doStep(steps, stepnum, stepContext); for (Object o2 : result) { List path = (List)o2; path.add(0,o); } results.addAll(result); } return results; } else { // we are at the end of the path - just create the list for filling in the results from the callers List results = new ArrayList(); results.add(new ArrayList()); return results; } } private boolean isReverseAxis(Step step) { int axis = step.getAxis(); return axis == org.jaxen.saxpath.Axis.PRECEDING || axis == org.jaxen.saxpath.Axis.PRECEDING_SIBLING || axis == org.jaxen.saxpath.Axis.ANCESTOR || axis == org.jaxen.saxpath.Axis.ANCESTOR_OR_SELF; } } |
From: Flo L. <fl...@us...> - 2006-07-03 15:26:48
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/filter In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15693/src/org/mediavirus/graphl/graph/filter Modified Files: FilteredGraph.java Added Files: XPathFilteredGraph.java NodeCompressionFilter.java XPathFilter.java Log Message: implementing XPath-based filters Index: FilteredGraph.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/filter/FilteredGraph.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FilteredGraph.java 8 Jun 2006 13:14:59 -0000 1.6 --- FilteredGraph.java 3 Jul 2006 15:26:33 -0000 1.7 *************** *** 14,17 **** --- 14,18 ---- import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Graph; + import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.GraphListener; import org.mediavirus.graphl.graph.Node; *************** *** 33,37 **** public FilteredGraph(Graph graph) { ! setSource(graph); } --- 34,39 ---- public FilteredGraph(Graph graph) { ! sourceGraph = graph; ! graph.addGraphListener(this); } *************** *** 79,83 **** } ! public void update() { cachedEdges.clear(); cachedNodes.clear(); --- 81,85 ---- } ! public synchronized void update() { cachedEdges.clear(); cachedNodes.clear(); *************** *** 119,123 **** * @param edges */ ! private Collection<Edge> filterEdges(Collection<Edge> edges) { if (edges != null) { List<Edge> filteredEdges = new ArrayList<Edge>(); --- 121,125 ---- * @param edges */ ! protected Collection<Edge> filterEdges(Collection<Edge> edges) { if (edges != null) { List<Edge> filteredEdges = new ArrayList<Edge>(); *************** *** 136,140 **** * @param nodes */ ! private Collection<Node> filterNodes(Collection<Node> nodes) { if (nodes != null) { List<Node> filteredNodes = new ArrayList<Node>(); --- 138,142 ---- * @param nodes */ ! protected Collection<Node> filterNodes(Collection<Node> nodes) { if (nodes != null) { List<Node> filteredNodes = new ArrayList<Node>(); *************** *** 245,253 **** public void addElements(Collection<Node> nodes, Collection<Edge> edges) { sourceGraph.addElements(nodes, edges); } ! public void deleteElements(Collection<Node> nodes, Collection<Edge> edges) { ! sourceGraph.deleteElements(nodes, edges); } --- 247,257 ---- public void addElements(Collection<Node> nodes, Collection<Edge> edges) { + cachedNodes.addAll(nodes); + cachedEdges.addAll(edges); sourceGraph.addElements(nodes, edges); } ! public void removeElements(Collection<? extends GraphElement> elements) { ! sourceGraph.removeElements(elements); } --- NEW FILE: NodeCompressionFilter.java --- /* * Created on 03.07.2006 */ package org.mediavirus.graphl.graph.filter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.jaxen.JaxenException; import org.jaxen.XPath; import org.mediavirus.graphl.graph.DefaultEdge; import org.mediavirus.graphl.graph.DefaultNode; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.Node; public class NodeCompressionFilter { XPath selector; XPath groupBy; String newType; public NodeCompressionFilter(XPath selector, XPath groupBy, String newType) { this.selector = selector; this.groupBy = groupBy; this.newType = newType; } public XPath getGroupBy() { return groupBy; } public String getNewType() { return newType; } public XPath getSelector() { return selector; } public void filterGraph(XPathFilteredGraph graph) { try { Object elements = selector.evaluate(graph); if (elements instanceof List && ((List)elements).size() > 1) { // this maps groupBy results and a list of nodes who share them Map<Set, List<Node>> groups = new HashMap<Set, List<Node>>(); for (Node node : (List<Node>)elements) { Object groupElements = groupBy.evaluate(node); Set nodeSet; if (groupElements instanceof List) { nodeSet = new HashSet((List)groupElements); } else { nodeSet = Collections.singleton(groupElements); } if (groups.get(nodeSet) == null) { groups.put(nodeSet, new ArrayList<Node>()); } groups.get(nodeSet).add(node); } List<Node> newNodes = new ArrayList<Node>(); List<Edge> newEdges = new ArrayList<Edge>(); for (List<Node> group : groups.values()) { Node groupNode = graph.getSource().createNode(); newNodes.add(groupNode); groupNode.setType(newType); for (Node oldNode: group) { for (Edge oldEdge : oldNode.getEdgesFrom()) { Edge newEdge = graph.getSource().createEdge(groupNode, oldEdge.getTo()); newEdge.setType(oldEdge.getType()); newEdges.add(newEdge); } for (Edge oldEdge : oldNode.getEdgesTo()) { Edge newEdge = graph.getSource().createEdge(oldEdge.getFrom(), groupNode); newEdge.setType(oldEdge.getType()); newEdges.add(newEdge); } } } graph.removeElements((Collection<? extends GraphElement>) elements); graph.addElements(newNodes, newEdges); } } catch (JaxenException jexdasdu) { System.err.println("Error evaluation XPath " + selector.toString() + " on graph: " + jexdasdu); } } } --- NEW FILE: XPathFilteredGraph.java --- /* * Created on 03.07.2006 */ package org.mediavirus.graphl.graph.filter; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.swing.SwingUtilities; import org.jaxen.XPath; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Graph; import org.mediavirus.graphl.graph.GraphListener; import org.mediavirus.graphl.graph.Node; public class XPathFilteredGraph extends FilteredGraph implements GraphListener { List<XPathFilter> omissionFilters = new ArrayList<XPathFilter>(); List<NodeCompressionFilter> nodeCompressionFilters = new ArrayList<NodeCompressionFilter>(); List<Node> overlayNodes = new ArrayList<Node>(); List<Edge> overlayEdges = new ArrayList<Edge>(); public XPathFilteredGraph(Graph graph) { super(graph); omissionFilters = new ArrayList<XPathFilter>(); } public void addOmissionFilter(XPathFilter filter) { omissionFilters.add(filter); } public void addNodeCompressionFilter(NodeCompressionFilter filter) { nodeCompressionFilters.add(filter); } public void addEdgeCompressionFilter(XPath selector, String newType) { } public void addTransitiveCompressionFilter(XPath selector, String newType) { } public synchronized void update() { // this is super.update() without notify cachedEdges.clear(); cachedNodes.clear(); overlayNodes.clear(); overlayEdges.clear(); Collection<Edge> filteredEdges = filterEdges(sourceGraph.getEdges()); if (filteredEdges != null) cachedEdges.addAll(filteredEdges); Collection<Node> filteredNodes = filterNodes(sourceGraph.getNodes()); if (filteredNodes != null) cachedNodes.addAll(filteredNodes); // //cachedEdges = new ArrayList<Edge>(sourceGraph.getEdges()); //cachedNodes = new ArrayList<Node>(sourceGraph.getNodes()); for (XPathFilter filter : omissionFilters) { filter.filterGraph(this); } for (NodeCompressionFilter filter : nodeCompressionFilters) { filter.filterGraph(this); } fireGraphContentsChanged(); } public void overlayElements(Collection<Node> nodes, Collection<Edge> edges) { overlayNodes.addAll(nodes); overlayEdges.addAll(edges); fireElementsAdded(nodes, edges); } @Override public List<Edge> getEdges() { if (overlayEdges.size()>0) { List<Edge> all = new ArrayList(super.getEdges()); all.addAll(overlayEdges); return all; } else { return super.getEdges(); } } @Override public List<Edge> getEdgesWithPropertyValue(String name, String value) { //todo return super.getEdgesWithPropertyValue(name, value); } @Override public Node getNodeOrAdd(String id) { //todo return super.getNodeOrAdd(id); } @Override public List<Node> getNodes() { if (overlayNodes.size()>0) { List<Node> all = new ArrayList(super.getNodes()); all.addAll(overlayNodes); return all; } else { return super.getNodes(); } } } --- NEW FILE: XPathFilter.java --- /* * Created on 03.07.2006 */ package org.mediavirus.graphl.graph.filter; import java.util.Collection; import java.util.Collections; import java.util.List; import org.jaxen.JaxenException; import org.jaxen.XPath; import org.mediavirus.graphl.graph.GraphElement; public class XPathFilter { XPath filterExpression; public XPathFilter(XPath filterExpression) { this.filterExpression = filterExpression; } public XPath getFilterExpression() { return filterExpression; } public void filterGraph(XPathFilteredGraph graph) { try { Object elements = filterExpression.evaluate(graph); if (elements != null) { if (elements instanceof List) { graph.removeElements((Collection<? extends GraphElement>) elements); } else if (elements instanceof GraphElement) { graph.removeElements(Collections.singleton((GraphElement)elements)); } } } catch (JaxenException jexdasdu) { System.err.println("Error evaluation XPath " + filterExpression.toString() + " on graph: " + jexdasdu); } } } |
From: Flo L. <fl...@us...> - 2006-07-03 15:26:48
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15693/src/org/mediavirus/graphl/graph Modified Files: DefaultGraph.java Graph.java Log Message: implementing XPath-based filters Index: Graph.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/Graph.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Graph.java 8 Jun 2006 13:15:00 -0000 1.8 --- Graph.java 3 Jul 2006 15:26:33 -0000 1.9 *************** *** 51,55 **** public void addElements(Collection<Node> nodes, Collection<Edge> edges); ! public void deleteElements(Collection<Node> nodes, Collection<Edge> edges); } --- 51,55 ---- public void addElements(Collection<Node> nodes, Collection<Edge> edges); ! public void removeElements(Collection<? extends GraphElement> elements); } Index: DefaultGraph.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/DefaultGraph.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DefaultGraph.java 8 Jun 2006 13:15:00 -0000 1.6 --- DefaultGraph.java 3 Jul 2006 15:26:33 -0000 1.7 *************** *** 74,115 **** * Deletes elements from the graph. * ! * @param nodes the nodes to delete (may be <code>null</code>) ! * @param edges the edges to delete (may be <code>null</code>) */ ! public synchronized void deleteElements(Collection<Node> nodes, Collection<Edge> edges) { ! List<Edge> nodeEdges = new ArrayList<Edge>(); ! if (nodes!=null) { ! Iterator<Node> nodesI=nodes.iterator(); ! while (nodesI.hasNext()) { ! Node node = nodesI.next(); ! for (Iterator<Edge> edgesI = node.getEdgesFrom().iterator(); edgesI.hasNext();) { ! Edge edge = edgesI.next(); if (allEdges.remove(edge)) { edge.getTo().notifyEdgeRemoved(edge); ! nodeEdges.add(edge); } } ! for (Iterator<Edge> edgesI = node.getEdgesTo().iterator(); edgesI.hasNext();) { ! Edge edge = edgesI.next(); if (allEdges.remove(edge)) { edge.getFrom().notifyEdgeRemoved(edge); ! nodeEdges.add(edge); } } ! allNodes.remove(node); } ! } ! if (edges!=null) { ! Iterator<Edge> iterator = edges.iterator(); ! while (iterator.hasNext()) { ! Edge edge = iterator.next(); if (allEdges.remove(edge)) { edge.getFrom().notifyEdgeRemoved(edge); edge.getTo().notifyEdgeRemoved(edge); ! } } } ! nodeEdges.addAll(edges); ! fireElementsRemoved(nodes,nodeEdges); } /** --- 74,114 ---- * Deletes elements from the graph. * ! * @param elements the elements to delete (may be <code>null</code>) */ ! public synchronized void removeElements(Collection<? extends GraphElement> elements) { ! ! List<Edge> removedEdges = new ArrayList<Edge>(); ! List<Node> removedNodes = new ArrayList<Node>(); ! ! for (GraphElement element : elements) { ! if (element instanceof Node) { ! Node node = (Node)element; ! for (Edge edge: node.getEdgesFrom()) { if (allEdges.remove(edge)) { edge.getTo().notifyEdgeRemoved(edge); ! removedEdges.add(edge); } } ! for (Edge edge: node.getEdgesTo()) { if (allEdges.remove(edge)) { edge.getFrom().notifyEdgeRemoved(edge); ! removedEdges.add(edge); } } ! if (allNodes.remove(node)) { ! removedNodes.add(node); ! } } ! else if (element instanceof Edge) { ! Edge edge = (Edge) element; if (allEdges.remove(edge)) { edge.getFrom().notifyEdgeRemoved(edge); edge.getTo().notifyEdgeRemoved(edge); ! removedEdges.add(edge); ! } } } ! ! fireElementsRemoved(removedNodes,removedEdges); } /** |
From: Flo L. <fl...@us...> - 2006-07-03 15:26:47
|
Update of /cvsroot/graphl/graphl In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15693 Modified Files: .classpath Log Message: implementing XPath-based filters Index: .classpath =================================================================== RCS file: /cvsroot/graphl/graphl/.classpath,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** .classpath 30 Jun 2006 14:32:50 -0000 1.9 --- .classpath 3 Jul 2006 15:26:33 -0000 1.10 *************** *** 7,11 **** <classpathentry sourcepath="C:/Programme/java/l2fprod-common-0.1-dev/src" kind="lib" path="lib/l2fprod-common-fontchooser.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> ! <classpathentry kind="lib" path="lib/jaxen-1.1-beta-9.jar"/> <classpathentry kind="output" path="bin"/> </classpath> --- 7,11 ---- <classpathentry sourcepath="C:/Programme/java/l2fprod-common-0.1-dev/src" kind="lib" path="lib/l2fprod-common-fontchooser.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> ! <classpathentry sourcepath="lib/jaxen-1.1-beta-9/src/java/main" kind="lib" path="lib/jaxen-1.1-beta-9.jar"/> <classpathentry kind="output" path="bin"/> </classpath> |
From: Flo L. <fl...@us...> - 2006-07-03 15:26:47
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/selection In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15693/src/org/mediavirus/graphl/selection Modified Files: DefaultSelectionModel.java SelectionModel.java Log Message: implementing XPath-based filters Index: DefaultSelectionModel.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/selection/DefaultSelectionModel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DefaultSelectionModel.java 8 Jun 2006 13:14:59 -0000 1.3 --- DefaultSelectionModel.java 3 Jul 2006 15:26:33 -0000 1.4 *************** *** 12,15 **** --- 12,16 ---- import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Graph; + import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.GraphListener; import org.mediavirus.graphl.graph.Node; *************** *** 148,151 **** --- 149,159 ---- return Collections.unmodifiableCollection(selectedEdges); } + + public Collection<GraphElement> getSelectedElements() { + // todo change code to store selectedElements only and remove getSelectedNodes/Edges above + Set<GraphElement> elements = new HashSet<GraphElement>(selectedNodes); + elements.addAll(selectedEdges); + return Collections.unmodifiableCollection(elements); + } /* * Overrides @see org.mediavirus.graphl.selection.SelectionModel#isEdgeSelected(org.mediavirus.graphl.graph.Edge) Index: SelectionModel.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/selection/SelectionModel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SelectionModel.java 18 Dec 2005 11:11:41 -0000 1.3 --- SelectionModel.java 3 Jul 2006 15:26:33 -0000 1.4 *************** *** 4,7 **** --- 4,8 ---- import org.mediavirus.graphl.graph.Edge; + import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.Node; *************** *** 76,79 **** --- 77,82 ---- */ Collection<Edge> getSelectedEdges(); + + Collection<GraphElement> getSelectedElements(); /** * Checks whteher the node has been selected. |
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(); } |
From: Flo L. <fl...@us...> - 2006-07-03 15:26:47
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15693/src/org/mediavirus/graphl/graph/rdf Modified Files: RDFNode.java RDFGraph.java RDFGraphReader.java Log Message: implementing XPath-based filters Index: RDFGraphReader.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf/RDFGraphReader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RDFGraphReader.java 8 Jun 2006 13:14:59 -0000 1.1 --- RDFGraphReader.java 3 Jul 2006 15:26:33 -0000 1.2 *************** *** 15,18 **** --- 15,19 ---- import org.mediavirus.graphl.GraphlRegistry; import org.mediavirus.graphl.graph.Edge; + import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.vocabulary.NS; *************** *** 35,40 **** boolean loading = false; ! List<Node> nodesToRemove; ! List<Edge> edgesToRemove; List<URL> loadedURLs; --- 36,40 ---- boolean loading = false; ! List<GraphElement> elementsToRemove; List<URL> loadedURLs; *************** *** 61,67 **** // store old nodes+edges for checking deletions // while loading, nodes and edges are removed from these lists ! nodesToRemove = sourceNode.getNeighbours(NS.graphl + "definedIn", Node.REVERSE); ! nodesToRemove.remove(sourceNode); ! edgesToRemove = graph.getEdgesWithPropertyValue(NS.graphl + "definedIn",url.toString()); reload = true; } --- 61,67 ---- // store old nodes+edges for checking deletions // while loading, nodes and edges are removed from these lists ! elementsToRemove = new ArrayList<GraphElement>(sourceNode.getNeighbours(NS.graphl + "definedIn", Node.REVERSE)); ! elementsToRemove.remove(sourceNode); ! elementsToRemove.addAll(graph.getEdgesWithPropertyValue(NS.graphl + "definedIn",url.toString())); reload = true; } *************** *** 90,102 **** if (reload) { ! for (Iterator<Node> nodesI = nodesToRemove.iterator(); nodesI.hasNext();) { ! Node node = nodesI.next(); ! List<Node> nodeSources = node.getNeighbours(NS.graphl + "definedIn", Node.FORWARD); ! if (nodeSources.size() > 1) { ! // keep nodes with multiple sources ! nodesToRemove.remove(node); } } ! graph.deleteElements(nodesToRemove, edgesToRemove); } return loadedURLs; --- 90,104 ---- if (reload) { ! for (GraphElement element : elementsToRemove) { ! if (element instanceof Node) { ! Node node = (Node)element; ! List<Node> nodeSources = node.getNeighbours(NS.graphl + "definedIn", Node.FORWARD); ! if (nodeSources.size() > 1) { ! // keep nodes with multiple sources ! elementsToRemove.remove(node); ! } } } ! graph.removeElements(elementsToRemove); } return loadedURLs; *************** *** 168,172 **** if ((edge.getTo() == onode) && (edge.getType().equals(predicate))) { exists = true; ! if (reload) edgesToRemove.remove(edge); break; } --- 170,174 ---- if ((edge.getTo() == onode) && (edge.getType().equals(predicate))) { exists = true; ! if (reload) elementsToRemove.remove(edge); break; } *************** *** 239,243 **** if (!ParseUtils.guessName(uri).startsWith("genid")) { // if the node has a proper id and it's already in the graph, it has existed before ! nodesToRemove.remove(node); } else { --- 241,245 ---- if (!ParseUtils.guessName(uri).startsWith("genid")) { // if the node has a proper id and it's already in the graph, it has existed before ! elementsToRemove.remove(node); } else { Index: RDFNode.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf/RDFNode.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RDFNode.java 8 Jun 2006 13:14:59 -0000 1.13 --- RDFNode.java 3 Jul 2006 15:26:32 -0000 1.14 *************** *** 100,104 **** RDFEdge edge = (RDFEdge)edges.next(); if (edge.getType() == "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") ! graph.deleteElements(null,Collections.singleton((Edge)edge)); } } --- 100,104 ---- RDFEdge edge = (RDFEdge)edges.next(); if (edge.getType() == "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") ! graph.removeElements(Collections.singleton((Edge)edge)); } } Index: RDFGraph.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf/RDFGraph.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** RDFGraph.java 30 Jun 2006 14:31:46 -0000 1.16 --- RDFGraph.java 3 Jul 2006 15:26:33 -0000 1.17 *************** *** 22,25 **** --- 22,26 ---- import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Graph; + import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.Node; *************** *** 146,161 **** * Overrides @see de.fzi.wim.guibase.graphview.graph.DefaultGraph#deleteElements(java.util.Collection, java.util.Collection) */ ! public synchronized void deleteElements(Collection<Node> nodes, Collection<Edge> edges) { setDirty(true); ! if (nodes != null) { ! for (Iterator iter = nodes.iterator(); iter.hasNext();) { ! RDFNode node = (RDFNode) iter.next(); ! allNodes.remove(node.getId()); } } // TODO after this call, nodes is empty??? why??? ! super.deleteElements(nodes, edges); } --- 147,163 ---- * Overrides @see de.fzi.wim.guibase.graphview.graph.DefaultGraph#deleteElements(java.util.Collection, java.util.Collection) */ ! public synchronized void removeElements(Collection<? extends GraphElement> elements) { setDirty(true); ! if (elements != null) { ! for (GraphElement element : elements) { ! if (element instanceof RDFNode) { ! allNodes.remove(((RDFNode)element).getId()); ! } } } // TODO after this call, nodes is empty??? why??? ! super.removeElements(elements); } |
From: Flo L. <fl...@us...> - 2006-07-03 15:26:47
|
Update of /cvsroot/graphl/graphl/src/org/jaxen/expr In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15693/src/org/jaxen/expr Modified Files: DefaultXPathFactory.java Log Message: implementing XPath-based filters Index: DefaultXPathFactory.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/jaxen/expr/DefaultXPathFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DefaultXPathFactory.java 30 Jun 2006 14:30:15 -0000 1.1 --- DefaultXPathFactory.java 3 Jul 2006 15:26:33 -0000 1.2 *************** *** 304,308 **** case Axis.CHILD: { ! iter = new IterableChildAxis( axis ); break; } --- 304,308 ---- case Axis.CHILD: { ! iter = new IterableGraphlAxis( axis ); break; } |
From: Flo L. <fl...@us...> - 2006-07-03 15:26:47
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/jaxen In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15693/src/org/mediavirus/graphl/jaxen Modified Files: IterableGraphlAxis.java DocumentNavigator.java Log Message: implementing XPath-based filters Index: DocumentNavigator.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/jaxen/DocumentNavigator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DocumentNavigator.java 30 Jun 2006 14:31:33 -0000 1.1 --- DocumentNavigator.java 3 Jul 2006 15:26:32 -0000 1.2 *************** *** 18,21 **** --- 18,22 ---- import org.jaxen.saxpath.SAXPathException; import org.mediavirus.graphl.graph.Edge; + import org.mediavirus.graphl.graph.Graph; import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.Node; *************** *** 196,199 **** --- 197,214 ---- } } + else if (contextNode instanceof Graph) { + Graph graph = (Graph)contextNode; + if (localName != null) { + for (Node node : graph.getNodes()) { + if (node.getType() != null && node.getType().equals(namespaceURI + localName)) { + matchingElements.add(node); + } + } + } + else { + matchingElements.addAll(graph.getNodes()); + } + + } return matchingElements.iterator(); } Index: IterableGraphlAxis.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/jaxen/IterableGraphlAxis.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IterableGraphlAxis.java 30 Jun 2006 14:31:33 -0000 1.1 --- IterableGraphlAxis.java 3 Jul 2006 15:26:32 -0000 1.2 *************** *** 11,14 **** --- 11,15 ---- import org.jaxen.UnsupportedAxisException; import org.jaxen.expr.iter.IterableAxis; + import org.jaxen.saxpath.Axis; *************** *** 19,23 **** public IterableGraphlAxis(int axisValue) { super(axisValue); ! this.value = axisValue; } --- 20,25 ---- public IterableGraphlAxis(int axisValue) { super(axisValue); ! value = axisValue; ! if (value == Axis.CHILD) value = Axis.OUT; } |
From: Flo L. <fl...@us...> - 2006-06-30 14:32:53
|
Update of /cvsroot/graphl/graphl In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11977 Modified Files: .classpath Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: .classpath =================================================================== RCS file: /cvsroot/graphl/graphl/.classpath,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** .classpath 18 Dec 2005 13:25:36 -0000 1.8 --- .classpath 30 Jun 2006 14:32:50 -0000 1.9 *************** *** 7,11 **** <classpathentry sourcepath="C:/Programme/java/l2fprod-common-0.1-dev/src" kind="lib" path="lib/l2fprod-common-fontchooser.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> ! <classpathentry sourcepath="C:/lib/commons-jxpath-1.2/src/java" kind="lib" path="lib/commons-jxpath-1.2.jar"/> <classpathentry kind="output" path="bin"/> </classpath> --- 7,11 ---- <classpathentry sourcepath="C:/Programme/java/l2fprod-common-0.1-dev/src" kind="lib" path="lib/l2fprod-common-fontchooser.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> ! <classpathentry kind="lib" path="lib/jaxen-1.1-beta-9.jar"/> <classpathentry kind="output" path="bin"/> </classpath> |
From: Flo L. <fl...@us...> - 2006-06-30 14:32:22
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/graphl/interaction Modified Files: DefaultNodeManipulator.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: DefaultNodeManipulator.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction/DefaultNodeManipulator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DefaultNodeManipulator.java 8 Jun 2006 13:15:01 -0000 1.4 --- DefaultNodeManipulator.java 30 Jun 2006 14:31:45 -0000 1.5 *************** *** 139,141 **** --- 139,146 ---- } + //hack: this is in the factes interface - do we need it here? + public String getStringProperty(String name, GraphElement element) { + return null; + } + } |
From: Flo L. <fl...@us...> - 2006-06-30 14:32:21
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/vocabulary In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/graphl/vocabulary Modified Files: VocabularyRegistry.java SimpleVocabularyRegistry.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: VocabularyRegistry.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/vocabulary/VocabularyRegistry.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VocabularyRegistry.java 18 Dec 2005 11:11:40 -0000 1.4 --- VocabularyRegistry.java 30 Jun 2006 14:31:39 -0000 1.5 *************** *** 9,12 **** --- 9,14 ---- import java.util.Map; + import org.jaxen.NamespaceContext; + *************** *** 15,19 **** * created: 30.05.2004 21:03:28 */ ! public interface VocabularyRegistry { /** --- 17,21 ---- * created: 30.05.2004 21:03:28 */ ! public interface VocabularyRegistry extends NamespaceContext{ /** *************** *** 35,37 **** --- 37,42 ---- public Map<String, String> getNamespaces(); + + public String translateNamespacePrefixToUri(String prefix); + } \ No newline at end of file Index: SimpleVocabularyRegistry.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/vocabulary/SimpleVocabularyRegistry.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SimpleVocabularyRegistry.java 8 Jun 2006 13:15:01 -0000 1.7 --- SimpleVocabularyRegistry.java 30 Jun 2006 14:31:45 -0000 1.8 *************** *** 87,90 **** --- 87,93 ---- return prefixToNamespaceMap; } + public String translateNamespacePrefixToUri(String prefix) { + return resolveNamespace(prefix); + } } |
From: Flo L. <fl...@us...> - 2006-06-30 14:32:21
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/graphl/graph/rdf Modified Files: RDFGraph.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: RDFGraph.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf/RDFGraph.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** RDFGraph.java 8 Jun 2006 13:14:59 -0000 1.15 --- RDFGraph.java 30 Jun 2006 14:31:46 -0000 1.16 *************** *** 59,63 **** */ protected synchronized List<URL> importFromURL(URL url) throws IOException { - // we have to set the loading flag to prevent elementsAdded notifications during loading loading = true; --- 59,62 ---- |
From: Flo L. <fl...@us...> - 2006-06-30 14:32:15
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/view In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/graphl/view Modified Files: AbstractFacet.java Facet.java GraphFacetRegistry.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: Facet.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/view/Facet.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Facet.java 8 Jun 2006 13:14:59 -0000 1.6 --- Facet.java 30 Jun 2006 14:31:38 -0000 1.7 *************** *** 90,92 **** --- 90,95 ---- */ public void refresh(); + + public String getStringProperty(String name, GraphElement element); + } \ No newline at end of file Index: GraphFacetRegistry.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/view/GraphFacetRegistry.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GraphFacetRegistry.java 8 Jun 2006 13:14:59 -0000 1.9 --- GraphFacetRegistry.java 30 Jun 2006 14:31:38 -0000 1.10 *************** *** 223,227 **** try { if (type != null) { ! Class facetClass = Class.forName(type); if (facetClass != null) { Object o = facetClass.newInstance(); --- 223,228 ---- try { if (type != null) { ! // du to xpath, the class name is wrapped in '' ! Class facetClass = Class.forName(type.replace("'","")); if (facetClass != null) { Object o = facetClass.newInstance(); *************** *** 238,242 **** } catch (Exception e) { ! System.err.println("Problem instantiating facet: " + e.getMessage()); } return null; --- 239,243 ---- } catch (Exception e) { ! System.err.println("Problem instantiating facet: " + e.toString()); } return null; Index: AbstractFacet.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/view/AbstractFacet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AbstractFacet.java 8 Jun 2006 13:14:59 -0000 1.9 --- AbstractFacet.java 30 Jun 2006 14:31:38 -0000 1.10 *************** *** 5,9 **** --- 5,12 ---- package org.mediavirus.graphl.view; + import java.awt.Color; import java.awt.Dimension; + import java.awt.Font; + import java.awt.Image; import java.awt.Stroke; import java.beans.BeanInfo; *************** *** 13,24 **** --- 16,39 ---- import java.beans.PropertyChangeListener; import java.beans.SimpleBeanInfo; + import java.io.IOException; + import java.net.MalformedURLException; + import java.net.URL; import java.util.ArrayList; import java.util.Collection; + import java.util.HashMap; + import java.util.Iterator; import java.util.List; + import java.util.Map; import javax.swing.JComponent; + + import org.jaxen.JaxenException; + import org.jaxen.XPath; import org.mediavirus.graphl.graph.GraphElement; import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.gui.StrokePropertyEditor; + import org.mediavirus.graphl.jaxen.GraphlXPath; + import org.mediavirus.graphl.vocabulary.NS; + import org.mediavirus.util.ParseUtils; import com.l2fprod.common.propertysheet.Property; *************** *** 33,36 **** --- 48,54 ---- protected List<GraphElement> assignedElements = new ArrayList<GraphElement>(); + + protected Map<String, XPath> propertyExpressions = new HashMap<String, XPath>(); + protected Map<String, Map<GraphElement, Object>> expressionCache = new HashMap<String, Map<GraphElement, Object>>(); /* *************** *** 58,67 **** public void setConfigurationNode(Node node) { ! // do nothing per default. ! ! // TODO (2) either implement a generic property mechanism here, or implement this method in all subclasses ! // (it should then be removed here). } public JComponent getVisualController() { --- 76,195 ---- public void setConfigurationNode(Node node) { ! // copy xpath properties from config node ! for (Iterator propertyIterator = node.getProperties().keySet().iterator(); propertyIterator.hasNext();) { ! String propName = (String) propertyIterator.next(); ! //todo: only properties form a known list of valid property names should be copied ! //hack: just ignore id for now ! if (!propName.equals(NS.rdf + "id")) { ! try { ! XPath expr = new GraphlXPath(node.getProperty(propName)); ! propertyExpressions.put(propName, expr); ! expressionCache.put(propName, new HashMap<GraphElement, Object>()); ! } ! catch (JaxenException ijexned) { ! System.err.println("Error parsing XPath (" + node.getProperty(propName) + ") in property " + propName + " : " + ijexned.toString()); ! } ! } ! } } + public String getStringProperty(String name, GraphElement element) { + Object value = getProperty(name, element); + if (value instanceof String) return (String) value; + else return null; + } + + public Integer getIntProperty(String name, GraphElement element) { + Object value = getProperty(name, element); + if (value instanceof Double) return new Integer(((Double)value).intValue()); + else return null; + } + + public Double getDoubleProperty(String name, GraphElement element) { + Object value = getProperty(name, element); + if (value instanceof Double) return (Double)value; + else return null; + } + + public boolean getBoolProperty(String name, GraphElement element) { + Integer value = getIntProperty(name, element); + if (value != null && value > 0) return true; + else return false; + } + + public Color getColorProperty(String name, GraphElement element) { + Object value = getProperty(name, element); + if (value instanceof String) { + return ParseUtils.parseColor((String)value); + } + else return null; + } + + public Stroke getStrokeProperty(String name, GraphElement element) { + Object value = getProperty(name, element); + if (value instanceof String) { + return ParseUtils.parseStroke((String)value); + } + else return null; + } + + public Font getFontProperty(String name, GraphElement element) { + Object value = getProperty(name, element); + if (value instanceof String) { + return ParseUtils.parseFont((String)value); + } + else return null; + } + + public Image getImageProperty(String name, GraphElement element, URL baseURL) { + Object value = getProperty(name, element); + if (value instanceof Image) { + return (Image)value; + } + if (value instanceof String) { + String href = (String) value; + Image img = null; + try { + URL url = new URL(baseURL, href); + img = (Image)url.getContent(new Class[]{Image.class}); + } + catch (Exception ex) { + //img = null; + System.err.println("Error getting image from: " + href + " : " + ex.toString()); + } + if (img != null) { + expressionCache.get(name).put(element, img); + } + else { + // put something in cache to cancel future executions + expressionCache.get(name).put(element, new Object()); + } + return img; + } + else return null; + } + + + public Object getProperty(String name, GraphElement element) { + Object value = null; + Map<GraphElement, Object> cache = expressionCache.get(name); + // if cache doesn't exist, the property also has not been set + if (cache != null) { + value = cache.get(element); + if (value == null) { + XPath expr = propertyExpressions.get(name); + if (expr != null) { + try { + value = expr.evaluate(element); + } + catch (JaxenException spe) { + System.err.println("Error evaluating XPath (" + expr.toString() + ") on element " + element.getId()); + } + } + cache.put(element, value); + } + } + return value; + } public JComponent getVisualController() { |
From: Flo L. <fl...@us...> - 2006-06-30 14:32:14
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/graphl/painter Modified Files: StraightLineEdgePainter.java LineEdgePainter.java ManhattanEdgePainter.java BoxNodePainter.java NodePainter.java Added Files: XPathGraphWalker.java Removed Files: ImageNodePainter.java ImageNodePainterBeanInfo.java BoxNodePainterBeanInfo.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: LineEdgePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/LineEdgePainter.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** LineEdgePainter.java 8 Jun 2006 13:14:58 -0000 1.11 --- LineEdgePainter.java 30 Jun 2006 14:31:35 -0000 1.12 *************** *** 14,22 **** import java.util.HashMap; - import org.apache.commons.jxpath.JXPathContext; import org.mediavirus.graphl.GraphlPane; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Node; - import org.mediavirus.graphl.jxpath.JXPathFactory; import org.mediavirus.graphl.vocabulary.NS; import org.mediavirus.util.ParseUtils; --- 14,20 ---- *************** *** 28,69 **** public abstract class LineEdgePainter extends AbstractEdgePainter { ! protected boolean paintArrow = true; ! protected boolean paintLabel = true; ! ! /** ! * ! * @uml.property name="invertArrow" ! */ ! protected boolean invertArrow = false; ! ! Stroke stroke; ! Stroke highlightedStroke; ! Stroke selectedStroke; ! ! String widthExpr; ! String labelExpr; ! ! Font font; ! Color color; ! Color labelColor = Color.BLACK; - HashMap<Edge, Stroke> strokeCache = new HashMap<Edge, Stroke>(); - HashMap<Edge, String> labelCache = new HashMap<Edge, String>(); - - /** - * - */ public LineEdgePainter() { - this(new BasicStroke(0.7f), Color.BLACK, new Font(null, Font.PLAIN, 9), true, true); - } - - public LineEdgePainter(Stroke stroke, Color color, Font font, boolean paintingArrow, boolean paintingLabel) { - - this.paintArrow = paintingArrow; - this.paintLabel = paintingLabel; - - setStroke(stroke); - this.color = color; - this.font = font; } --- 26,33 ---- public abstract class LineEdgePainter extends AbstractEdgePainter { ! Stroke defaultStroke = new BasicStroke(0.7f); ! Font defaultFont = new Font(null, Font.PLAIN, 9); public LineEdgePainter() { } *************** *** 72,98 **** //boolean isDragging = draggingManipulator!=null && draggingManipulator.getDraggedEdge()==edge; ! Stroke oldStroke = getStroke(); ! if (widthExpr != null) { ! Stroke dynStroke = strokeCache.get(edge); ! if (dynStroke == null) { ! JXPathContext context = JXPathFactory.createContext(edge); ! Object widthO = context.getValue(widthExpr); ! try { ! double width = ((Double)widthO).doubleValue(); ! BasicStroke bs = (BasicStroke)stroke; ! dynStroke = new BasicStroke((float) width, bs.getEndCap(), bs.getLineJoin(), bs.getMiterLimit(), bs.getDashArray(), bs.getDashPhase()); ! strokeCache.put(edge, dynStroke); ! } ! catch (Exception ex) {} ! } ! if (dynStroke != null) setStroke(dynStroke); ! doPaintEdge(graphPane, g, edge, selected, highlighted); ! setStroke(oldStroke); ! } ! else { ! doPaintEdge(graphPane, g, edge, selected, highlighted); ! } } --- 36,48 ---- //boolean isDragging = draggingManipulator!=null && draggingManipulator.getDraggedEdge()==edge; ! Stroke oldStroke = g.getStroke(); ! Stroke stroke = getStrokeProperty(NS.graphl + "stroke", edge); ! if (stroke == null) stroke = defaultStroke; + g.setStroke(stroke); + doPaintEdge(graphPane, g, edge, selected, highlighted); + + g.setStroke(oldStroke); } *************** *** 117,236 **** } - /** - * @return A boolean value, indicating if an arrow indicating the direction of the Edge - * will be painted. - */ - public boolean isPaintArrow() { - return paintArrow; - } - - /** - * @param b A boolean value, indicating whether an arrow indicating the direction of the - * Edge should be painted. - */ - public void setPaintArrow(boolean b) { - paintArrow = b; - } - - /** - * @return Returns the invertArrow. - * - * @uml.property name="invertArrow" - */ - public boolean isInvertArrow() { - return invertArrow; - } - - /** - * @param invertArrow The invertArrow to set. - * - * @uml.property name="invertArrow" - */ - public void setInvertArrow(boolean invertArrow) { - this.invertArrow = invertArrow; - } - - - /** - * @return The Stroke currently set for rendering the Edge. - */ - public Stroke getStroke(boolean selected, boolean highlighted) { - if (highlighted) { - return highlightedStroke; - } - if (selected) { - return selectedStroke; - } - return stroke; - } - - /** - * @return A boolean value, indicating if a label should be painted next to the Edge. - */ - public boolean isPaintLabel() { - return paintLabel; - } - - /** - * @return Returns the labelColor. - */ - public Color getLabelColor() { - return labelColor; - } - /** - * @param textColor The text color to set. - */ - public void setLabelColor(Color textColor) { - this.labelColor = textColor; - } - /** - * @return Returns the color. - */ - public Color getColor() { - return color; - } - /** - * @param color The color to set. - */ - public void setColor(Color color) { - this.color = color; - } - /** - * @param stroke The stroke to set. - */ - public void setStroke(Stroke stroke) { - this.stroke = stroke; - BasicStroke bs; - if (stroke instanceof BasicStroke){ - bs = (BasicStroke)stroke; - highlightedStroke = new BasicStroke(bs.getLineWidth() * 2, bs.getEndCap(), bs.getLineJoin(), bs.getMiterLimit(), bs.getDashArray(), bs.getDashPhase()); - selectedStroke = new BasicStroke(bs.getLineWidth() * 3, bs.getEndCap(), bs.getLineJoin(), bs.getMiterLimit(), bs.getDashArray(), bs.getDashPhase()); - } - else { - highlightedStroke = new BasicStroke(2.0f); - selectedStroke = new BasicStroke(3.0f); - } - } - /** - * @param b - */ - public void setPaintLabel(boolean b) { - paintLabel = b; - } - - /** - * @return The Font that is currently set for rendering the label. - */ - public Font getFont() { - return font; - } - - /** - * @param font The Font to use for rendering the label. - */ - public void setFont(Font font) { - this.font = font; - } - public abstract Object clone(); --- 67,70 ---- *************** *** 241,270 **** public abstract double screenDistanceFromEdge(GraphlPane graphPane, Edge edge, Point point); - /** - * @return Returns the stroke. - */ - public Stroke getStroke() { - - return stroke; - } - - public String getLabel(Edge edge) { - String label = labelCache.get(edge); - if (label == null) { - if (labelExpr != null) { - JXPathContext context = JXPathFactory.createContext(edge); - Object labelO = context.getValue(labelExpr); - if (labelO != null) { - label = labelO.toString(); - labelCache.put(edge, label); - } - else { - labelCache.put(edge,""); - } - } - } - return label; - } - public abstract boolean isPointInLabel(GraphlPane graphPane, Edge edge, Point point); --- 75,78 ---- *************** *** 273,329 **** public abstract boolean isSameClass(Object o); - public void setConfigurationNode(Node node) { - - String str = node.getProperty(NS.graphl + "paintArrow"); - if (str != null) { - setPaintArrow(str.equalsIgnoreCase("true")); - } - str = node.getProperty(NS.graphl + "paintLabel"); - if (str != null) { - setPaintLabel(str.equalsIgnoreCase("true")); - } - str = node.getProperty(NS.graphl + "invertArrow"); - if (str != null) { - setInvertArrow(str.equalsIgnoreCase("true")); - } - - Color col = ParseUtils.parseColor(node.getProperty(NS.graphl + "color")); - if (col != null) setColor(col); - - col = ParseUtils.parseColor(node.getProperty(NS.graphl + "labelColor")); - if (col != null) setLabelColor(col); - - Stroke stroke = ParseUtils.parseStroke(node.getProperty(NS.graphl + "stroke")); - if (stroke != null) setStroke(stroke); - - widthExpr = node.getProperty(NS.graphl + "width"); - labelExpr = node.getProperty(NS.graphl + "label"); - - } - - - public String getLabelExpr() { - return labelExpr; - } - - - public void setLabelExpr(String labelExpr) { - this.labelExpr = labelExpr; - } - - - public String getWidthExpr() { - return widthExpr; - } - - - public void setWidthExpr(String widthExpr) { - this.widthExpr = widthExpr; - } - - public void refresh() { - strokeCache.clear(); - labelCache.clear(); - } } --- 81,84 ---- Index: StraightLineEdgePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/StraightLineEdgePainter.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** StraightLineEdgePainter.java 18 Dec 2005 11:11:40 -0000 1.9 --- StraightLineEdgePainter.java 30 Jun 2006 14:31:34 -0000 1.10 *************** *** 18,21 **** --- 18,22 ---- import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Node; + import org.mediavirus.graphl.vocabulary.NS; /** *************** *** 28,36 **** //TODO (2, 2h) add settings and controller to choose arrow position (begin, middle, end) - - public StraightLineEdgePainter() { - super(); - } - /** --- 29,32 ---- *************** *** 41,47 **** * @param paintingLabel */ ! public StraightLineEdgePainter(Stroke stroke, Color color, Font font, ! boolean paintingArrow, boolean paintingLabel) { ! super(stroke, color, font, paintingArrow, paintingLabel); } --- 37,42 ---- * @param paintingLabel */ ! public StraightLineEdgePainter() { ! super(); } *************** *** 87,92 **** Rectangle sourceNodeRectangle = new Rectangle(); sourceNodePainter.getNodeScreenBounds(graphPane, sourceNode, sourceNodeRectangle); ! if (isPaintArrow()) { targetNodeRectangle.grow(2,2); //sourceNodeRectangle.grow(-3,-3); --- 82,89 ---- Rectangle sourceNodeRectangle = new Rectangle(); sourceNodePainter.getNodeScreenBounds(graphPane, sourceNode, sourceNodeRectangle); + + Integer arrowPosition = getIntProperty(NS.graphl + "arrowPosition", edge); ! if (arrowPosition != null && arrowPosition > 0) { targetNodeRectangle.grow(2,2); //sourceNodeRectangle.grow(-3,-3); *************** *** 101,116 **** Color oldColor = g.getColor(); ! g.setStroke(getStroke(selected, highlighted)); ! if (selected) { ! g.setColor(getColor().brighter()); } else { ! g.setColor(getColor()); } g.drawLine(from.x,from.y, to.x,to.y); g.setStroke(oldStroke); ! ! if (isPaintArrow() || isPaintLabel()) { int x = (from.x+to.x)/2; --- 98,121 ---- Color oldColor = g.getColor(); ! Stroke stroke = getStrokeProperty(NS.graphl + "stroke", edge); ! if (stroke == null) stroke = defaultStroke; ! g.setStroke(stroke); ! ! Color color = getColorProperty(NS.graphl + "color", edge); ! if (color == null) color = Color.BLACK; ! if (selected || highlighted) { ! g.setColor(color.brighter()); } else { ! g.setColor(color); } g.drawLine(from.x,from.y, to.x,to.y); g.setStroke(oldStroke); ! ! String label = getStringProperty(NS.graphl + "label", edge); ! boolean invertArrow = getBoolProperty(NS.graphl + "invertArrow", edge); ! ! if ((arrowPosition != null && arrowPosition > 0) || label != null) { int x = (from.x+to.x)/2; *************** *** 132,136 **** g.rotate(angle,x,y); ! if (isPaintArrow()) { if (flipped) { paintArrow(g,x+5,y,x-5,y); --- 137,141 ---- g.rotate(angle,x,y); ! if (arrowPosition != null && arrowPosition > 0) { if (flipped) { paintArrow(g,x+5,y,x-5,y); *************** *** 140,153 **** } } ! if (isPaintLabel()){ ! g.setColor(getLabelColor()); ! String label = getLabel(edge); ! if (label != null){ ! Font oldfont = g.getFont(); ! g.setFont(getFont()); ! g.translate(-g.getFontMetrics().stringWidth(label)/2,-2); ! g.drawString(label,x,y); ! g.setFont(oldfont); ! } } g.setTransform(oldxf); --- 145,158 ---- } } ! if (label != null){ ! color = getColorProperty(NS.graphl + "labelColor", edge); ! if (color == null) color = Color.BLACK; ! g.setColor(color); ! Font oldfont = g.getFont(); ! ! g.setFont(getFontProperty(NS.graphl + "font", edge)); ! g.translate(-g.getFontMetrics().stringWidth(label)/2,-2); ! g.drawString(label,x,y); ! g.setFont(oldfont); } g.setTransform(oldxf); *************** *** 297,301 **** public Object clone() { ! StraightLineEdgePainter p = new StraightLineEdgePainter(getStroke(), getColor(), getFont(), isPaintArrow(), isPaintLabel()); return p; } --- 302,307 ---- public Object clone() { ! // todo: implement this ! StraightLineEdgePainter p = new StraightLineEdgePainter(); return p; } --- ImageNodePainterBeanInfo.java DELETED --- --- ImageNodePainter.java DELETED --- Index: NodePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/NodePainter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NodePainter.java 8 Jun 2006 13:14:58 -0000 1.5 --- NodePainter.java 30 Jun 2006 14:31:36 -0000 1.6 *************** *** 52,56 **** */ public Point getEdgePin(Node node, Edge edge); - - public String getLabel(Node node); } --- 52,54 ---- Index: ManhattanEdgePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/ManhattanEdgePainter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ManhattanEdgePainter.java 18 Dec 2005 11:11:40 -0000 1.6 --- ManhattanEdgePainter.java 30 Jun 2006 14:31:35 -0000 1.7 *************** *** 24,28 **** void doPaintEdge(GraphlPane graphPane, Graphics2D g, Edge edge, boolean selected, boolean highlighted) { - g.setStroke(getStroke(selected, highlighted)); Point points[] = getVertices(graphPane, edge); if (points != null) { --- 24,27 ---- Index: BoxNodePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/BoxNodePainter.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** BoxNodePainter.java 8 Jun 2006 13:14:57 -0000 1.12 --- BoxNodePainter.java 30 Jun 2006 14:31:35 -0000 1.13 *************** *** 10,26 **** import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.Stroke; ! import java.util.HashMap; ! import java.util.Map; - import org.apache.commons.jxpath.JXPathContext; import org.mediavirus.graphl.GraphlPane; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Node; - import org.mediavirus.graphl.jxpath.JXPathFactory; import org.mediavirus.graphl.vocabulary.NS; - import org.mediavirus.util.ParseUtils; /** --- 10,24 ---- import java.awt.FontMetrics; import java.awt.Graphics2D; + import java.awt.Image; import java.awt.Point; import java.awt.Rectangle; import java.awt.Stroke; ! import java.awt.image.ImageObserver; ! import java.net.URL; import org.mediavirus.graphl.GraphlPane; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.vocabulary.NS; /** *************** *** 28,214 **** * @author Flo Ledermann <led...@im...> */ ! public class BoxNodePainter extends AbstractNodePainter{ ! ! Stroke borderStroke = null; ! Font font = null; ! private Color baseColor = null; ! Color borderColor = null; ! boolean useBorderColor = false; ! Color textColor = null; ! float transparency = 0.2f; ! ! boolean roundRect = true; ! int cornerRadius = 8; ! ! //LabelGenerator labelGenerator; ! String labelExpr; ! Map<Node, String> labelCache = new HashMap<Node, String>(); ! ! public BoxNodePainter(){ ! super(); ! ! borderStroke = new BasicStroke(1.0f); ! font = new Font(null, Font.PLAIN, 10); ! baseColor = new Color(255,250,168); ! textColor = Color.BLACK; ! //labelGenerator = new LabelGenerator(); ! } ! ! protected Color getBackgroundColor( ! boolean isHighlighted, ! boolean isSelected, ! boolean isDragging) { ! ! if (isSelected) return baseColor.darker(); ! return baseColor; ! } ! ! ! protected Color getBorderColor( ! boolean isHighlighted, ! boolean isSelected, ! boolean isDragging) { ! ! if (borderColor != null) { ! return borderColor; ! } ! return baseColor.darker(); ! } ! ! protected Color getTextColor( ! boolean isHighlighted, ! boolean isSelected, ! boolean isDragging) { ! ! return textColor; ! } ! ! ! public String getLabelExpr() { ! return labelExpr; ! } ! ! public void setLabelExpr(String labelExpr) { ! this.labelExpr = labelExpr; ! } ! /** ! * @return Returns the borderStroke. ! */ ! public Stroke getBorderStroke() { ! return borderStroke; ! } ! /** ! * @param stroke The borderStroke to set. ! */ ! public void setBorderStroke(Stroke stroke) { ! this.borderStroke = stroke; ! } ! /** ! * @return A boolean value indicating whether the border color will be used. If ! * <code>false</code>, the border color will be calculated from the base color. ! */ ! public boolean isUseBorderColor() { ! return useBorderColor; ! } ! /** ! * @param useBorderColor A boolean value indicating whether the border color will be used. If ! * <code>false</code>, the border color will be calculated from the base color. ! */ ! public void setUseBorderColor(boolean useBorderColor) { ! this.useBorderColor = useBorderColor; } - /** - * @return Returns the baseColor. - */ - public Color getBaseColor() { - return baseColor; - } - - /** - * @param baseColor The baseColor to set. - */ - public void setBaseColor(Color baseColor) { - this.baseColor = baseColor; - } - - /** - * @return Returns the borderColor. - */ - public Color getBorderColor() { - return borderColor; - } - - /** - * Sets the border color. A custom border color will only be used if useBorderColor - * is <code>true</code>. Otherwise, the border color will be calculated from the - * current base color. - * @param borderColor The borderColor to set. - */ - public void setBorderColor(Color borderColor) { - this.borderColor = borderColor; - } - /** - * @return Returns the font. - */ - public Font getFont() { - return font; - } - /** - * @param font The font to set. - */ - public void setFont(Font font) { - this.font = font; - } - /** - * @return Returns the textColor. - */ - public Color getTextColor() { - return textColor; - } - /** - * @param textColor The textColor to set. - */ - public void setTextColor(Color textColor) { - this.textColor = textColor; - } - /** - * @return Returns the transparency. - */ - public float getTransparency() { - return transparency; - } - /** - * @param transparency The transparency to set. - */ - public void setTransparency(float transparency) { - this.transparency = transparency; - } - /** - * @return Returns the cornerRadius. - */ - public int getCornerRadius() { - return cornerRadius; - } - /** - * @param cornerRadius The cornerRadius to set. - */ - public void setCornerRadius(int cornerRadius) { - this.cornerRadius = cornerRadius; - } - /** - * @return Returns the roundRect. - */ - public boolean isRoundRect() { - return roundRect; - } - /** - * @param roundRect The roundRect to set. - */ - public void setRoundRect(boolean roundRect) { - this.roundRect = roundRect; - } /** * Paints the supplied node. --- 26,39 ---- * @author Flo Ledermann <led...@im...> */ ! public class BoxNodePainter extends AbstractNodePainter implements ImageObserver { ! Color defaultColor = new Color(255, 250, 168); ! Font defaultFont = new Font(null, Font.PLAIN, 10); ! Stroke defaultStroke = new BasicStroke(1.0f); ! public BoxNodePainter() { ! super(); } /** * Paints the supplied node. *************** *** 218,272 **** * @param node the node to paint */ ! public void paintNode(GraphlPane graphPane,Graphics2D g,Node node, boolean selected, boolean highlighted) { //DraggingManipulator draggingManipulator=(DraggingManipulator)graphPane.getManipulator(DraggingManipulator.NAME); //boolean isDragging=false; //draggingManipulator!=null && draggingManipulator.getDraggedNode()==node; ! Point nodePoint=graphPane.getScreenPointForNode(node); ! int width=1; ! int height=1; ! int textX=0; ! int textY=0; ! String label = getLabel(node); ! g.setStroke(borderStroke); ! if (label!=null) { ! FontMetrics fontMetrics=graphPane.getFontMetrics(font); ! int stringWidth=fontMetrics.stringWidth(label); ! width+=stringWidth+6; ! height+=fontMetrics.getAscent()+fontMetrics.getDescent()+4; ! textX=nodePoint.x-stringWidth/2; ! textY=nodePoint.y+(fontMetrics.getAscent()-fontMetrics.getDescent())/2; } else { ! width+=40; ! height+=20; } node.setWidth(width); node.setHeight(height); ! Color oldColor=g.getColor(); ! g.setColor(getBackgroundColor(highlighted, selected, false)); ! if (roundRect) { ! g.fillRoundRect(nodePoint.x-width/2,nodePoint.y-height/2,width,height,cornerRadius, cornerRadius); } else { ! g.fillRect(nodePoint.x-width/2,nodePoint.y-height/2,width,height); } ! if (label!=null) { ! Font oldFont=g.getFont(); g.setFont(font); ! g.setColor(getTextColor(highlighted, selected, false)); ! g.drawString(label,textX,textY); g.setFont(oldFont); } ! g.setColor(getBorderColor(highlighted, selected, false)); ! if (roundRect) { ! g.drawRoundRect(nodePoint.x-width/2,nodePoint.y-height/2,width,height,cornerRadius,cornerRadius); } else { ! g.drawRect(nodePoint.x-width/2,nodePoint.y-height/2,width,height); } g.setColor(oldColor); } ! /** * Returns the outer rectangle of the node on screen. --- 43,147 ---- * @param node the node to paint */ ! public void paintNode(GraphlPane graphPane, Graphics2D g, Node node, boolean selected, boolean highlighted) { //DraggingManipulator draggingManipulator=(DraggingManipulator)graphPane.getManipulator(DraggingManipulator.NAME); //boolean isDragging=false; //draggingManipulator!=null && draggingManipulator.getDraggedNode()==node; ! Point nodePoint = graphPane.getScreenPointForNode(node); ! int width = 1; ! int height = 1; ! int textX = 0; ! int textY = 0; ! Font font = getFontProperty(NS.graphl + "font", node); ! if (font == null) font = defaultFont; ! Stroke oldStroke = g.getStroke(); ! Stroke stroke = getStrokeProperty(NS.graphl + "borderStroke", node); ! if (stroke == null) stroke = defaultStroke; ! ! String label = getStringProperty(NS.graphl + "label", node); ! ! g.setStroke(stroke); ! if (label != null) { ! FontMetrics fontMetrics = graphPane.getFontMetrics(font); ! int stringWidth = fontMetrics.stringWidth(label); ! width += stringWidth + 6; ! height += fontMetrics.getAscent() + fontMetrics.getDescent() + 4; ! textX = nodePoint.x - stringWidth / 2; ! textY = nodePoint.y + (fontMetrics.getAscent() - fontMetrics.getDescent()) / 2; } else { ! width += 40; ! height += 20; ! } ! ! URL baseURL = null; ! try { ! baseURL = new URL(node.getFirstNeighbour(NS.graphl + "definedIn", Node.FORWARD).getId()); ! } ! catch (Exception ex) { ! // do nothing } + Image img = getImageProperty(NS.graphl + "image", node, baseURL); + if (img != null) { + if (node.getWidth() > 0) { + width = (int)node.getWidth(); + } + else { + width = img.getWidth(this); + } + if (node.getHeight() > 0) { + height = (int) node.getHeight(); + } + else { + height = img.getHeight(this); + } + } + node.setWidth(width); node.setHeight(height); ! ! Color oldColor = g.getColor(); ! Color baseColor = getColorProperty(NS.graphl + "baseColor", node); ! if (baseColor == null) baseColor = defaultColor; ! Color borderColor = baseColor.darker(); ! if (selected) baseColor = borderColor; ! ! g.setColor(baseColor); ! ! Integer cornerRadius = getIntProperty(NS.graphl + "cornerRadius", node); ! if (img != null) { ! g.drawImage(img, (int)node.getCenterX()-width/2, (int)node.getCenterY()-height/2, width, height, this); } else { ! if (cornerRadius != null && cornerRadius > 0) { ! g.fillRoundRect(nodePoint.x - width / 2, nodePoint.y - height / 2, width, height, cornerRadius, cornerRadius); ! } ! else { ! g.fillRect(nodePoint.x - width / 2, nodePoint.y - height / 2, width, height); ! } } ! if (label != null) { ! Font oldFont = g.getFont(); g.setFont(font); ! Color color = getColorProperty(NS.graphl + "labelColor", node); ! if (color == null) color = Color.BLACK; ! g.setColor(color); ! g.drawString(label, textX, textY); g.setFont(oldFont); } ! ! g.setColor(borderColor); ! if (cornerRadius != null && cornerRadius > 0) { ! g.drawRoundRect(nodePoint.x - width / 2, nodePoint.y - height / 2, width, height, cornerRadius, cornerRadius); } else { ! g.drawRect(nodePoint.x - width / 2, nodePoint.y - height / 2, width, height); } + + // restore previous state g.setColor(oldColor); + g.setStroke(oldStroke); } ! /** * Returns the outer rectangle of the node on screen. *************** *** 276,326 **** * @param nodeScreenRectangle the rectangle receiving the node's coordinates */ ! public void getNodeScreenBounds(GraphlPane graphPane,Node node,Rectangle nodeScreenRectangle) { ! Point nodePoint=graphPane.getScreenPointForNode(node); ! String label = getLabel(node); ! int width=1; ! int height=1; ! if (label!=null) { ! FontMetrics fontMetrics=graphPane.getFontMetrics(font); ! width+=fontMetrics.stringWidth(label)+6; ! height+=fontMetrics.getAscent()+fontMetrics.getDescent()+4; } else { ! width+=40; ! height+=20; } ! nodeScreenRectangle.setBounds(nodePoint.x-width/2,nodePoint.y-height/2,width,height); } ! public String getLabel(Node node) { ! String label = labelCache.get(node); ! if (label == null) { ! label = "XXX"; ! if (labelExpr != null) { ! JXPathContext context = JXPathFactory.createContext(node); ! Object labelO = context.getValue(labelExpr); ! if (labelO instanceof String) { ! label = (String) labelO; ! } ! } ! labelCache.put(node, label); } ! return label; } - public boolean isEdgeDragPoint(GraphlPane graphPane,Node node,Point p) { - Rectangle r = new Rectangle(); - getNodeScreenBounds(graphPane, node, r); - if ((p.getX() < r.getMinX()+5) || - (p.getX() > r.getMaxX()-5) || - (p.getY() < r.getMinY()+4) || - (p.getY() > r.getMaxY()-4)) { - return true; - } - return false; - } - public Point getEdgePin(Node node, Edge edge) { ! return new Point((int)node.getCenterX(), (int)node.getCenterY()); } --- 151,210 ---- * @param nodeScreenRectangle the rectangle receiving the node's coordinates */ ! public void getNodeScreenBounds(GraphlPane graphPane, Node node, Rectangle nodeScreenRectangle) { ! Point nodePoint = graphPane.getScreenPointForNode(node); ! int width = 1; ! int height = 1; ! ! URL baseURL = null; ! try { ! baseURL = new URL(node.getFirstNeighbour(NS.graphl + "definedIn", Node.FORWARD).getId()); } + catch (Exception ex) { + // do nothing + } + Image img = getImageProperty(NS.graphl + "image", node, baseURL); + if (img != null) { + if (node.getWidth() > 0) { + width = (int)node.getWidth(); + } + else { + width = img.getWidth(this); + } + if (node.getHeight() > 0) { + height = (int) node.getHeight(); + } + else { + height = img.getHeight(this); + } + } else { ! String label = getStringProperty(NS.graphl + "label", node); ! Font font = getFontProperty(NS.graphl + "font", node); ! if (font == null) font = defaultFont; ! ! if (label != null) { ! FontMetrics fontMetrics = graphPane.getFontMetrics(font); ! width += fontMetrics.stringWidth(label) + 6; ! height += fontMetrics.getAscent() + fontMetrics.getDescent() + 4; ! } ! else { ! width += 40; ! height += 20; ! } } ! nodeScreenRectangle.setBounds(nodePoint.x - width / 2, nodePoint.y - height / 2, width, height); } ! public boolean isEdgeDragPoint(GraphlPane graphPane, Node node, Point p) { ! Rectangle r = new Rectangle(); ! getNodeScreenBounds(graphPane, node, r); ! if ((p.getX() < r.getMinX() + 5) || (p.getX() > r.getMaxX() - 5) || (p.getY() < r.getMinY() + 4) || (p.getY() > r.getMaxY() - 4)) { ! return true; } ! return false; } public Point getEdgePin(Node node, Edge edge) { ! return new Point((int) node.getCenterX(), (int) node.getCenterY()); } *************** *** 330,334 **** public String toString() { ! return getName(); } --- 214,218 ---- public String toString() { ! return getName(); } *************** *** 343,397 **** public Object clone() { BoxNodePainter b2 = new BoxNodePainter(); ! b2.setBaseColor(baseColor); ! b2.setBorderColor(borderColor); ! BasicStroke stroke = (BasicStroke)borderStroke; ! b2.setBorderStroke(new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(), stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase())); ! b2.setCornerRadius(cornerRadius); ! b2.setFont(font); ! b2.setRoundRect(roundRect); ! b2.setTextColor(textColor); ! b2.setTransparency(transparency); ! b2.setUseBorderColor(useBorderColor); return b2; } - - public void setConfigurationNode(Node node) { - Color col = ParseUtils.parseColor(node.getProperty(NS.graphl + "baseColor")); - if (col != null) baseColor = col; - - col = ParseUtils.parseColor(node.getProperty(NS.graphl + "borderColor")); - if (col != null) borderColor = col; - - col = ParseUtils.parseColor(node.getProperty(NS.graphl + "textColor")); - if (col != null) textColor = col; - - Font font = ParseUtils.parseFont(node.getProperty(NS.graphl + "font")); - if (font != null) setFont(font); - - // try { - // Node labelGeneratorNode = (Node)node.getNeighbours(NS.graphl + "labelGenerator", true).get(0); - // labelGenerator.setConfigurationNode(labelGeneratorNode); - // } - // catch (IndexOutOfBoundsException ioobex) { - // // no such neighbour found - // } - - Stroke stroke = ParseUtils.parseStroke(node.getProperty(NS.graphl + "borderStroke")); - if (stroke != null) setBorderStroke(stroke); - - String str = node.getProperty(NS.graphl + "roundRect"); - if (str != null) setRoundRect(str.equalsIgnoreCase("true")); - - str = node.getProperty(NS.graphl + "useBorderColor"); - if (str != null) setUseBorderColor(str.equalsIgnoreCase("true")); - - str = node.getProperty(NS.graphl + "cornerRadius"); - if (str != null) setCornerRadius(Integer.parseInt(str)); - - str = node.getProperty(NS.graphl + "label"); - if (str != null) setLabelExpr(str); - } - - } - --- 227,236 ---- public Object clone() { BoxNodePainter b2 = new BoxNodePainter(); ! //todo: setConfigurationNode return b2; } + public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { + return true; + } + } \ No newline at end of file --- BoxNodePainterBeanInfo.java DELETED --- --- NEW FILE: XPathGraphWalker.java --- /* * Created on 26.06.2006 */ package org.mediavirus.graphl.painter; import java.util.ArrayList; import java.util.List; import org.jaxen.saxpath.Axis; import org.jaxen.saxpath.SAXPathException; import org.jaxen.saxpath.XPathHandler; import org.mediavirus.graphl.graph.Graph; import org.mediavirus.graphl.graph.GraphElement; public class XPathGraphWalker implements XPathHandler { List<? extends Object> context = null; public XPathGraphWalker(GraphElement context) { ArrayList<GraphElement> list = new ArrayList<GraphElement>(); list.add(context); this.context = list; } public XPathGraphWalker(Graph graph) { this.context = graph.getNodes(); } public XPathGraphWalker(List<? extends Object> context) { this.context = context; } public List<? extends Object> getContext() { return context; } public void startXPath() throws SAXPathException { } public void endXPath() throws SAXPathException { } public void startPathExpr() throws SAXPathException { } public void endPathExpr() throws SAXPathException { } public void startAbsoluteLocationPath() throws SAXPathException { } public void endAbsoluteLocationPath() throws SAXPathException { } public void startRelativeLocationPath() throws SAXPathException { } public void endRelativeLocationPath() throws SAXPathException { } public void startNameStep(int axis, String prefix, String localName) throws SAXPathException { System.out.println("Name step : " + Axis.lookup(axis) + "::" + prefix + ":" + localName); } public void endNameStep() throws SAXPathException { } public void startCommentNodeStep(int axis) throws SAXPathException { } public void endCommentNodeStep() throws SAXPathException { } public void startAllNodeStep(int axis) throws SAXPathException { System.out.println("AllNode step: " + Axis.lookup(axis)); } public void endAllNodeStep() throws SAXPathException { } public void startPredicate() throws SAXPathException { } public void endPredicate() throws SAXPathException { } public void startFilterExpr() throws SAXPathException { } public void endFilterExpr() throws SAXPathException { } public void startOrExpr() throws SAXPathException { } public void endOrExpr(boolean create) throws SAXPathException { } public void startAndExpr() throws SAXPathException { } public void endAndExpr(boolean create) throws SAXPathException { } public void startEqualityExpr() throws SAXPathException { } public void endEqualityExpr(int equalityOperator) throws SAXPathException { } public void startRelationalExpr() throws SAXPathException { } public void endRelationalExpr(int relationalOperator) throws SAXPathException { } public void startAdditiveExpr() throws SAXPathException { } public void endAdditiveExpr(int additiveOperator) throws SAXPathException { } public void startMultiplicativeExpr() throws SAXPathException { } public void endMultiplicativeExpr(int multiplicativeOperator) throws SAXPathException { } public void startUnaryExpr() throws SAXPathException { } public void endUnaryExpr(int unaryOperator) throws SAXPathException { } public void startUnionExpr() throws SAXPathException { } public void endUnionExpr(boolean create) throws SAXPathException { } public void number(int number) throws SAXPathException { System.out.println("Number : " + number); } public void number(double number) throws SAXPathException { System.out.println("Number : " + number); } public void literal(String literal) throws SAXPathException { System.out.println("Literal : " + literal); } public void startFunction(String prefix, String functionName) throws SAXPathException { System.out.println("Function : " + prefix + ":" + functionName); } public void endFunction() throws SAXPathException { System.out.println("EndFunc +"); } // unsupported right now public void variableReference(String prefix, String variableName) throws SAXPathException { } public void startProcessingInstructionNodeStep(int axis, String name) throws SAXPathException { System.out.println("PI step: " + axis + "::" + name); } public void endProcessingInstructionNodeStep() throws SAXPathException { } public void startTextNodeStep(int axis) throws SAXPathException { System.out.println("Text step : " + axis); } public void endTextNodeStep() throws SAXPathException { } } |
From: Flo L. <fl...@us...> - 2006-06-30 14:32:14
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/layout In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/graphl/layout Modified Files: AbsoluteNodeLayouter.java Layouter.java SpringEdgeLayouter.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: Layouter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/layout/Layouter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Layouter.java 30 Nov 2004 09:38:32 -0000 1.4 --- Layouter.java 30 Jun 2006 14:31:38 -0000 1.5 *************** *** 48,52 **** t.interrupt(); try { ! t.join(); } catch (InterruptedException ignored) { --- 48,53 ---- t.interrupt(); try { ! //hack: omitting the timeout my result in a deadlock here - have to investigate! ! t.join(500); } catch (InterruptedException ignored) { Index: AbsoluteNodeLayouter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/layout/AbsoluteNodeLayouter.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AbsoluteNodeLayouter.java 8 Jun 2006 13:14:57 -0000 1.10 --- AbsoluteNodeLayouter.java 30 Jun 2006 14:31:38 -0000 1.11 *************** *** 10,16 **** import java.util.Map; - import org.apache.commons.jxpath.JXPathContext; import org.mediavirus.graphl.graph.Node; - import org.mediavirus.graphl.jxpath.JXPathFactory; import org.mediavirus.graphl.layout.GraphlLayoutStrategy.GraphManager; import org.mediavirus.graphl.view.AbstractFacet; --- 10,14 ---- *************** *** 55,82 **** double y = 0; ! if (xExpr != null || yExpr != null) { ! JXPathContext context = JXPathFactory.createContext(node); ! if (xExpr != null) { ! Object xO = context.getValue(xExpr); ! try { ! x = ((Double) xO).doubleValue(); ! x -= 51; ! x *= 100; ! } ! catch (Exception ex) { ! } ! } ! ! if (yExpr != null) { ! Object yO = context.getValue(yExpr); ! try { ! y = ((Double) yO).doubleValue(); ! //y -= 51.51; ! y *= 100; ! } ! catch (Exception ex) { ! } ! } ! } System.out.println("pos: " + x + ":" + y); pos = new Point2D.Double(x, y); --- 53,80 ---- double y = 0; ! // if (xExpr != null || yExpr != null) { ! // JXPathContext context = JXPathFactory.createContext(node); ! // if (xExpr != null) { ! // Object xO = context.getValue(xExpr); ! // try { ! // x = ((Double) xO).doubleValue(); ! // x -= 51; ! // x *= 100; ! // } ! // catch (Exception ex) { ! // } ! // } ! // ! // if (yExpr != null) { ! // Object yO = context.getValue(yExpr); ! // try { ! // y = ((Double) yO).doubleValue(); ! // //y -= 51.51; ! // y *= 100; ! // } ! // catch (Exception ex) { ! // } ! // } ! // } System.out.println("pos: " + x + ":" + y); pos = new Point2D.Double(x, y); *************** *** 95,119 **** double height = 0; ! if (widthExpr != null || heightExpr != null) { ! JXPathContext context = JXPathFactory.createContext(node); ! if (widthExpr != null) { ! Object widthO = context.getValue(widthExpr); ! try { ! width = ((Double) widthO).doubleValue(); ! } ! catch (Exception ex) { ! } ! } ! ! if (heightExpr != null) { ! Object heightO = context.getValue(heightExpr); ! try { ! height = ((Double) heightO).doubleValue(); ! } ! catch (Exception ex) { ! } ! } ! } ! else return null; size = new Point2D.Double(width, height); --- 93,117 ---- double height = 0; ! // if (widthExpr != null || heightExpr != null) { ! // JXPathContext context = JXPathFactory.createContext(node); ! // if (widthExpr != null) { ! // Object widthO = context.getValue(widthExpr); ! // try { ! // width = ((Double) widthO).doubleValue(); ! // } ! // catch (Exception ex) { ! // } ! // } ! // ! // if (heightExpr != null) { ! // Object heightO = context.getValue(heightExpr); ! // try { ! // height = ((Double) heightO).doubleValue(); ! // } ! // catch (Exception ex) { ! // } ! // } ! // } ! // else return null; size = new Point2D.Double(width, height); Index: SpringEdgeLayouter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/layout/SpringEdgeLayouter.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SpringEdgeLayouter.java 8 Jun 2006 13:14:57 -0000 1.11 --- SpringEdgeLayouter.java 30 Jun 2006 14:31:38 -0000 1.12 *************** *** 8,15 **** import java.util.Map; - import org.apache.commons.jxpath.JXPathContext; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Node; - import org.mediavirus.graphl.jxpath.JXPathFactory; import org.mediavirus.graphl.layout.GraphlLayoutStrategy.GraphManager; import org.mediavirus.graphl.view.AbstractFacet; --- 8,13 ---- *************** *** 53,76 **** float rigidity = defaultRigidity; ! if (lengthExpr != null || rigidityExpr != null) { ! JXPathContext context = JXPathFactory.createContext(edge); ! if (lengthExpr != null) { ! Object lengthO = context.getValue(lengthExpr); ! try { ! length = ((Double) lengthO).floatValue(); ! } ! catch (Exception ex) { ! } ! } ! ! if (rigidityExpr != null) { ! Object rigidityO = context.getValue(rigidityExpr); ! try { ! rigidity = ((Double) rigidityO).floatValue(); ! } ! catch (Exception ex) { ! } ! } ! } spring = new Spring(length, rigidity); --- 51,74 ---- float rigidity = defaultRigidity; ! // if (lengthExpr != null || rigidityExpr != null) { ! // JXPathContext context = JXPathFactory.createContext(edge); ! // if (lengthExpr != null) { ! // Object lengthO = context.getValue(lengthExpr); ! // try { ! // length = ((Double) lengthO).floatValue(); ! // } ! // catch (Exception ex) { ! // } ! // } ! // ! // if (rigidityExpr != null) { ! // Object rigidityO = context.getValue(rigidityExpr); ! // try { ! // rigidity = ((Double) rigidityO).floatValue(); ! // } ! // catch (Exception ex) { ! // } ! // } ! // } spring = new Spring(length, rigidity); |
From: Flo L. <fl...@us...> - 2006-06-30 14:32:12
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/util In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/util Modified Files: ParseUtils.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: ParseUtils.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/util/ParseUtils.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ParseUtils.java 27 Oct 2004 10:55:41 -0000 1.4 --- ParseUtils.java 30 Jun 2006 14:31:37 -0000 1.5 *************** *** 20,26 **** Color col = null; if (colstr != null) { ! colstr = colstr.substring(1); ! int colval = Integer.parseInt(colstr, 16); ! col = new Color(colval); } return col; --- 20,44 ---- Color col = null; if (colstr != null) { ! // web notation ! if (colstr.startsWith("#")) { ! colstr = colstr.substring(1); ! int colval = Integer.parseInt(colstr, 16); ! col = new Color(colval); ! } ! // rgb notation ! else { ! StringTokenizer coltok = new StringTokenizer(colstr,","); ! int i=0; ! int[] rgb = {0,0,0}; ! while (coltok.hasMoreTokens()) { ! String val = coltok.nextToken(); ! rgb[i] = Integer.parseInt(val); ! // clamp color values ! if (rgb[i] > 255) rgb[i] = 255; ! if (rgb[i] < 0) rgb[i] = 0; ! if (i++ == 3) break; ! } ! col = new Color(rgb[0],rgb[1],rgb[2]); ! } } return col; |
From: Flo L. <fl...@us...> - 2006-06-30 14:32:12
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/graphl Modified Files: GraphlApplication.java GraphlPane.java GraphlApplet.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: GraphlApplet.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlApplet.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GraphlApplet.java 8 Jun 2006 13:14:58 -0000 1.14 --- GraphlApplet.java 30 Jun 2006 14:31:37 -0000 1.15 *************** *** 25,34 **** import javax.swing.JRadioButtonMenuItem; - import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl; import org.mediavirus.graphl.graph.Graph; import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.graph.filter.SourceFilter; import org.mediavirus.graphl.graph.rdf.RDFGraph; - import org.mediavirus.graphl.jxpath.JXPathFactory; import org.mediavirus.graphl.vocabulary.NS; --- 25,32 ---- *************** *** 49,53 **** public GraphlApplet() { ! JXPathContextReferenceImpl.addNodePointerFactory(new JXPathFactory()); this.getContentPane().setLayout(new BorderLayout()); --- 47,51 ---- public GraphlApplet() { ! //JXPathContextReferenceImpl.addNodePointerFactory(new JXPathFactory()); this.getContentPane().setLayout(new BorderLayout()); Index: GraphlApplication.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlApplication.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** GraphlApplication.java 8 Jun 2006 13:14:58 -0000 1.24 --- GraphlApplication.java 30 Jun 2006 14:31:37 -0000 1.25 *************** *** 32,36 **** import javax.swing.KeyStroke; - import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl; import org.mediavirus.graphl.graph.Graph; import org.mediavirus.graphl.graph.Node; --- 32,35 ---- *************** *** 40,44 **** import org.mediavirus.graphl.gui.GenericDialog; import org.mediavirus.graphl.gui.OpenURLPanel; - import org.mediavirus.graphl.jxpath.JXPathFactory; import org.mediavirus.graphl.painter.NodePainter; import org.mediavirus.graphl.vocabulary.NS; --- 39,42 ---- *************** *** 487,491 **** System.setProperty("swing.metalTheme", "steel"); ! JXPathContextReferenceImpl.addNodePointerFactory(new JXPathFactory()); GraphlApplication app = new GraphlApplication(); --- 485,489 ---- System.setProperty("swing.metalTheme", "steel"); ! //JXPathContextReferenceImpl.addNodePointerFactory(new JXPathFactory()); GraphlApplication app = new GraphlApplication(); Index: GraphlPane.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlPane.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** GraphlPane.java 8 Jun 2006 13:14:58 -0000 1.24 --- GraphlPane.java 30 Jun 2006 14:31:37 -0000 1.25 *************** *** 206,210 **** // } ! if (filteredGraph!=null) synchronized (filteredGraph) { // this is the main rendering loop --- 206,210 ---- // } ! if (filteredGraph!=null) { synchronized (filteredGraph) { // this is the main rendering loop *************** *** 251,254 **** --- 251,255 ---- //if (renderDuration > 0) System.out.println("render time: " + renderDuration + " FPS: " + 1000.0/renderDuration); } + } g2.setTransform(oldTrans); } *************** *** 949,953 **** Node node = nodesI.next(); if (node.getCurrentPainter() != null) { ! String label = node.getCurrentPainter().getLabel(node); if (label != null && label.startsWith(input)) { matchingNodes.add(node); --- 950,954 ---- Node node = nodesI.next(); if (node.getCurrentPainter() != null) { ! String label = node.getCurrentPainter().getStringProperty(NS.graphl + "label", node); if (label != null && label.startsWith(input)) { matchingNodes.add(node); |