Thread: [graphl-cvs] graphl/src/org/mediavirus/graphl/interaction DefaultNodeManipulator.java GraphlManipula
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2005-09-05 15:46:48
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14883/src/org/mediavirus/graphl/interaction Modified Files: DefaultNodeManipulator.java GraphlManipulator.java Log Message: added methods to access filtered and unfiltered versions of the graph in GraphlPane Index: GraphlManipulator.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction/GraphlManipulator.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GraphlManipulator.java 24 Aug 2005 16:12:41 -0000 1.11 --- GraphlManipulator.java 5 Sep 2005 15:46:38 -0000 1.12 *************** *** 84,88 **** else { graphPane.pauseLayouter(); ! graphMenu.show(e.getX(), e.getY(), graphPane.getGraph()); } } --- 84,88 ---- else { graphPane.pauseLayouter(); ! graphMenu.show(e.getX(), e.getY(), graphPane.getFilteredGraph()); } } *************** *** 128,132 **** if (e.getClickCount() == 2) { //(e.getWhen() - lastClick) < 300) { if ((clickNode == null) && (clickEdge == null)) { ! final Node newNode = graphPane.getGraph().createNode(); clickNode = newNode; clickNode.setCenter(p.getX(), p.getY()); --- 128,132 ---- if (e.getClickCount() == 2) { //(e.getWhen() - lastClick) < 300) { if ((clickNode == null) && (clickEdge == null)) { ! final Node newNode = graphPane.getFilteredGraph().createNode(); clickNode = newNode; clickNode.setCenter(p.getX(), p.getY()); *************** *** 153,157 **** } ); editor.startEditing(); ! graphPane.getGraph().notifyPropertyChanged(); graphPane.repaint(); } --- 153,157 ---- } ); editor.startEditing(); ! graphPane.getFilteredGraph().notifyPropertyChanged(); graphPane.repaint(); } *************** *** 175,179 **** else { clickEdge.invert(); ! graphPane.getGraph().notifyLayoutUpdated(); graphPane.repaint(); } --- 175,179 ---- else { clickEdge.invert(); ! graphPane.getFilteredGraph().notifyLayoutUpdated(); graphPane.repaint(); } *************** *** 184,188 **** if ((e.getModifiers() & MouseEvent.CTRL_MASK) == 0) { graphPane.getSelection().clear(); ! graphPane.getGraph().notifyLayoutUpdated(); } if (clickNode != null) { --- 184,188 ---- if ((e.getModifiers() & MouseEvent.CTRL_MASK) == 0) { graphPane.getSelection().clear(); ! graphPane.getFilteredGraph().notifyLayoutUpdated(); } if (clickNode != null) { *************** *** 194,198 **** System.out.println(clickNode.getType()); } ! graphPane.getGraph().notifyLayoutUpdated(); } else if (clickEdge != null) { --- 194,198 ---- System.out.println(clickNode.getType()); } ! graphPane.getFilteredGraph().notifyLayoutUpdated(); } else if (clickEdge != null) { *************** *** 203,207 **** graphPane.getSelection().addEdge(clickEdge); } ! graphPane.getGraph().notifyLayoutUpdated(); } } --- 203,207 ---- graphPane.getSelection().addEdge(clickEdge); } ! graphPane.getFilteredGraph().notifyLayoutUpdated(); } } *************** *** 227,231 **** else { graphPane.pauseLayouter(); ! graphMenu.show(e.getX(), e.getY(), graphPane.getGraph()); } } --- 227,231 ---- else { graphPane.pauseLayouter(); ! graphMenu.show(e.getX(), e.getY(), graphPane.getFilteredGraph()); } } *************** *** 247,261 **** // we also allow multiple edges between two nodes! RDFEdge edge = new RDFEdge(edgeNode, overNode); ! graphPane.getGraph().addElements(null, Collections.singleton(edge)); } else if ( overNode!=edgeNode ) { ! Node newNode = graphPane.getGraph().createNode(); newNode.setCenter(p.getX(), p.getY()); ! Edge edge = graphPane.getGraph().createEdge(edgeNode, newNode); Point d = new Point(); graphPane.screenToGraphPoint(dragStart,d); // TODO (3) length should be mapped to arbitrary property! ((DefaultEdge)edge).setLength(dragStart.distance(d)); ! ((DefaultGraph)graphPane.getGraph()).addElements(Collections.singleton(newNode), Collections.singleton(edge)); TextFieldInPlaceNodeEditor editor = new TextFieldInPlaceNodeEditor(graphPane, newNode, this); editor.startEditing(); --- 247,263 ---- // we also allow multiple edges between two nodes! RDFEdge edge = new RDFEdge(edgeNode, overNode); ! edge.setSource(NS.graphl + "USER"); ! graphPane.getFilteredGraph().addElements(null, Collections.singleton(edge)); } else if ( overNode!=edgeNode ) { ! Node newNode = graphPane.getFilteredGraph().createNode(); newNode.setCenter(p.getX(), p.getY()); ! Edge edge = graphPane.getFilteredGraph().createEdge(edgeNode, newNode); ! edge.setSource(NS.graphl + "USER"); Point d = new Point(); graphPane.screenToGraphPoint(dragStart,d); // TODO (3) length should be mapped to arbitrary property! ((DefaultEdge)edge).setLength(dragStart.distance(d)); ! ((DefaultGraph)graphPane.getSourceGraph()).addElements(Collections.singleton(newNode), Collections.singleton(edge)); TextFieldInPlaceNodeEditor editor = new TextFieldInPlaceNodeEditor(graphPane, newNode, this); editor.startEditing(); *************** *** 281,285 **** e.consume(); moved = true; ! graphPane.getGraph().notifyLayoutUpdated(); } // else if (dragEdge != null) { --- 283,287 ---- e.consume(); moved = true; ! graphPane.getFilteredGraph().notifyLayoutUpdated(); } // else if (dragEdge != null) { *************** *** 317,321 **** graphPane.screenToGraphPoint(point,graphPoint); dragNode.setCenter(graphPoint.getX(),graphPoint.getY()); ! graphPane.getGraph().notifyLayoutUpdated(); } } --- 319,323 ---- graphPane.screenToGraphPoint(point,graphPoint); dragNode.setCenter(graphPoint.getX(),graphPoint.getY()); ! graphPane.getFilteredGraph().notifyLayoutUpdated(); } } Index: DefaultNodeManipulator.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction/DefaultNodeManipulator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DefaultNodeManipulator.java 29 Dec 2004 14:31:30 -0000 1.1 --- DefaultNodeManipulator.java 5 Sep 2005 15:46:38 -0000 1.2 *************** *** 62,66 **** if (node != overNode) { overNode = node; ! graphPane.getGraph().notifyUpdated(); } } --- 62,66 ---- if (node != overNode) { overNode = node; ! graphPane.getFilteredGraph().notifyUpdated(); } } *************** *** 74,78 **** (p.getY() < (overNode.getCenterY()+overNode.getHeight()/2)-10)) { overNode = null; ! graphPane.getGraph().notifyUpdated(); } } --- 74,78 ---- (p.getY() < (overNode.getCenterY()+overNode.getHeight()/2)-10)) { overNode = null; ! graphPane.getFilteredGraph().notifyUpdated(); } } |
From: Flo L. <fl...@us...> - 2005-12-18 11:11:53
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2618/src/org/mediavirus/graphl/interaction Modified Files: DefaultNodeManipulator.java GraphlManipulator.java Log Message: - FEATURE: RXPath landed! you can assign properties of facets through XPath-like expressions based on the currently rendered node - CODE: Remove LabelGenerator classes - this can now done with RXPath - CODE: migrated to JDK 1.5, added class specifiers for all collections (generics) - CODE: added a singleton GraphlRegistry, currently only holding the vocabularyRegistry instance Index: GraphlManipulator.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction/GraphlManipulator.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GraphlManipulator.java 7 Sep 2005 12:29:56 -0000 1.13 --- GraphlManipulator.java 18 Dec 2005 11:11:41 -0000 1.14 *************** *** 16,20 **** import org.mediavirus.graphl.GraphlPane; import org.mediavirus.graphl.graph.*; - import org.mediavirus.graphl.graph.rdf.RDFEdge; import org.mediavirus.graphl.graph.rdf.RDFNode; import org.mediavirus.graphl.gui.EdgeContextMenu; --- 16,19 ---- *************** *** 43,54 **** protected Cursor graphCursor; - private long lastClick; private Point mousePos; private Node edgeNode = null; ! private Edge dragEdge = null; private Node dragNode = null; - private double oldLength = 2; Point dragStart = null; --- 42,51 ---- protected Cursor graphCursor; private Point mousePos; private Node edgeNode = null; ! //private Edge dragEdge = null; private Node dragNode = null; Point dragStart = null; *************** *** 187,192 **** } } - - lastClick = e.getWhen(); } --- 184,187 ---- *************** *** 227,233 **** if (overNode!=null && overNode!=edgeNode) { // we also allow multiple edges between two nodes! ! // TODO (2) Edge, Node constructors should be package protected and accessed only via facotry methods in Graph ! final RDFEdge edge = new RDFEdge(edgeNode, overNode); ! edge.setSource(NS.graphl + "USER"); TypeMenu edgeTypeMenu = new TypeMenu("New Edge", graphPane.getVocabularies()); --- 222,226 ---- if (overNode!=null && overNode!=edgeNode) { // we also allow multiple edges between two nodes! ! final Edge edge = graphPane.getFilteredGraph().createEdge(edgeNode, overNode); TypeMenu edgeTypeMenu = new TypeMenu("New Edge", graphPane.getVocabularies()); *************** *** 251,256 **** Point d = new Point(); graphPane.screenToGraphPoint(dragStart,d); - // TODO (3) length should be mapped to arbitrary property! - //((DefaultEdge)edge).setLength(dragStart.distance(d)); ((DefaultGraph)graphPane.getSourceGraph()).addElements(Collections.singleton(newNode), Collections.singleton(edge)); --- 244,247 ---- *************** *** 272,276 **** } ! dragEdge = null; dragNode = null; edgeNode = null; --- 263,267 ---- } ! //dragEdge = null; dragNode = null; edgeNode = null; *************** *** 292,306 **** //graphPane.repaint(); } - // else if (dragEdge != null) { - // int delta = (int)(mousePos.getY() - dragStart.getY()); - // // TODO (2) setLength is not in Edge interface! -> Edge Manipulators - // if (oldLength-delta > 2) - // ((DefaultEdge)dragEdge).setLength(oldLength-delta); - // else - // ((DefaultEdge)dragEdge).setLength(2); - // graphPane.repaint(); - // e.consume(); - // graphPane.getGraph().notifyLayoutUpdated(); - // } else if (edgeNode != null) { graphPane.repaint(); --- 283,286 ---- Index: DefaultNodeManipulator.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction/DefaultNodeManipulator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DefaultNodeManipulator.java 5 Sep 2005 15:46:38 -0000 1.2 --- DefaultNodeManipulator.java 18 Dec 2005 11:11:41 -0000 1.3 *************** *** 23,27 **** public class DefaultNodeManipulator extends AbstractManipulator implements NodeManipulator { ! private List assignedElements = new ArrayList(); private Node overNode = null; --- 23,27 ---- public class DefaultNodeManipulator extends AbstractManipulator implements NodeManipulator { ! private List<GraphElement> assignedElements = new ArrayList<GraphElement>(); private Node overNode = null; *************** *** 113,117 **** // need to return copy, becuase elements might be unassigned by caller // this triggers a ConcurrentModificationException if original set is returned ! return new ArrayList(assignedElements); } --- 113,117 ---- // need to return copy, becuase elements might be unassigned by caller // this triggers a ConcurrentModificationException if original set is returned ! return new ArrayList<GraphElement>(assignedElements); } |