[graphl-cvs] graphl/src/org/mediavirus/graphl/interaction GraphlManipulator.java
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2005-08-24 16:12:49
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6988/src/org/mediavirus/graphl/interaction Modified Files: GraphlManipulator.java Log Message: fixed context menu popup upon creation of new node Index: GraphlManipulator.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/interaction/GraphlManipulator.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GraphlManipulator.java 17 Aug 2005 15:52:55 -0000 1.10 --- GraphlManipulator.java 24 Aug 2005 16:12:41 -0000 1.11 *************** *** 136,139 **** --- 136,156 ---- 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.getGraph().notifyPropertyChanged(); graphPane.repaint(); *************** *** 150,153 **** --- 167,171 ---- TextFieldInPlaceNodeEditor editor = new TextFieldInPlaceNodeEditor(graphPane, clickNode, this); editor.startEditing(); + graphPane.repaint(); } else if (clickEdge != null) { *************** *** 158,161 **** --- 176,180 ---- clickEdge.invert(); graphPane.getGraph().notifyLayoutUpdated(); + graphPane.repaint(); } } *************** *** 173,176 **** --- 192,196 ---- else { graphPane.getSelection().addNode(clickNode); + System.out.println(clickNode.getType()); } graphPane.getGraph().notifyLayoutUpdated(); *************** *** 227,231 **** // we also allow multiple edges between two nodes! RDFEdge edge = new RDFEdge(edgeNode, overNode); ! ((DefaultGraph)graphPane.getGraph()).addElements(null, Collections.singleton(edge)); } else if ( overNode!=edgeNode ) { --- 247,251 ---- // 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 ) { *************** *** 235,238 **** --- 255,259 ---- 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)); *************** *** 320,329 **** public Object editingStarted(Node node) { ! return ((RDFNode)node).getLabel(); } public boolean editingFinished(Node node, Object value) { if (!((String)value).equals("")) { ! ((RDFNode)node).setProperty(NS.graphl + "label",(String)value); } return true; --- 341,350 ---- 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; |