[graphl-cvs] graphl/src/org/mediavirus/graphl/interaction GraphlManipulator.java
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2005-09-07 12:30:16
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25832/src/org/mediavirus/graphl/interaction Modified Files: GraphlManipulator.java Log Message: - FEATURE: type menu pops up upon edge creation - BUG: fixed assignment of unique ids to new nodes - BUG: fixed in-place editor for nodes - CODE: loading graphs is now synchronized to avoid loading conflicts - CODE: restoring Graphics transform in GraphlPane after rendering Index: GraphlManipulator.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction/GraphlManipulator.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GraphlManipulator.java 5 Sep 2005 15:46:38 -0000 1.12 --- GraphlManipulator.java 7 Sep 2005 12:29:56 -0000 1.13 *************** *** 136,158 **** public void resourceChanged(String resource) { newNode.setType(resource); ! TextFieldInPlaceNodeEditor editor = new TextFieldInPlaceNodeEditor(graphPane, newNode, new NodeEditingController() { ! ! public Object editingStarted(Node node) { ! return node.getProperty(NS.foaf + "name"); ! } ! ! public boolean editingFinished(Node node, Object value) { ! if (!((String)value).equals("")) { ! ((RDFNode)node).setProperty(NS.foaf + "name",(String)value); ! } ! return true; ! } ! ! public void editingAborted(Node node) { ! } ! } ); editor.startEditing(); - graphPane.getFilteredGraph().notifyPropertyChanged(); - graphPane.repaint(); } }); --- 136,141 ---- public void resourceChanged(String resource) { newNode.setType(resource); ! TextFieldInPlaceNodeEditor editor = new TextFieldInPlaceNodeEditor(graphPane, newNode, GraphlManipulator.this); editor.startEditing(); } }); *************** *** 161,166 **** menu.add(nodeTypeMenu); menu.show(graphPane, e.getX(), e.getY()); - - //graphPane.getGraph().notifyLayoutUpdated(); } else if (clickNode != null) { --- 144,147 ---- *************** *** 171,175 **** else if (clickEdge != null) { if ( clickEdge.getCurrentPainter().isPointInLabel(graphPane, clickEdge, p)){ ! //TODO (2): show in-place editor for edge } else { --- 152,156 ---- else if (clickEdge != null) { if ( clickEdge.getCurrentPainter().isPointInLabel(graphPane, clickEdge, p)){ ! // in-place editor for edge ? } else { *************** *** 246,255 **** if (overNode!=null && overNode!=edgeNode) { // 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); --- 227,249 ---- 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()); ! edgeTypeMenu.updateMenu(TypeMenu.PROPERTIES); ! edgeTypeMenu.addResourceListener(new ResourceListener() { ! public void resourceChanged(String resource) { ! edge.setType(resource); ! graphPane.getFilteredGraph().addElements(null, Collections.singleton(edge)); ! } ! }); ! ! JPopupMenu menu = new JPopupMenu(); ! menu.add(edgeTypeMenu); ! menu.show(graphPane, e.getX(), e.getY()); } else if ( overNode!=edgeNode ) { ! final Node newNode = graphPane.getFilteredGraph().createNode(); newNode.setCenter(p.getX(), p.getY()); Edge edge = graphPane.getFilteredGraph().createEdge(edgeNode, newNode); *************** *** 258,265 **** 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(); } --- 252,271 ---- 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)); ! ! TypeMenu nodeTypeMenu = new TypeMenu("New Node", graphPane.getVocabularies()); ! nodeTypeMenu.updateMenu(TypeMenu.CLASSES); ! nodeTypeMenu.addResourceListener(new ResourceListener() { ! public void resourceChanged(String resource) { ! newNode.setType(resource); ! TextFieldInPlaceNodeEditor editor = new TextFieldInPlaceNodeEditor(graphPane, newNode, GraphlManipulator.this); ! editor.startEditing(); ! } ! }); ! ! JPopupMenu menu = new JPopupMenu(); ! menu.add(nodeTypeMenu); ! menu.show(graphPane, e.getX(), e.getY()); } *************** *** 284,287 **** --- 290,294 ---- moved = true; graphPane.getFilteredGraph().notifyLayoutUpdated(); + //graphPane.repaint(); } // else if (dragEdge != null) { |