Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinflahaut committed Mar 12, 2014
1 parent db52f09 commit 39949da
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -271,7 +271,7 @@ graph.addEdge("europe", "germany", "euro", "#FFA500", true);
graph.addEdge("europe", "italy", "euro", "#FFA500", true);
graph.addEdge("europe", "spain", "euro", "#FFA500", true);
graph.addEdge("europe", "etce", 4.0, "euro", "#0000FF", true);
graph.addEdge("europe", "uk", "", "#FFA500", true);
graph.addEdge("europe", "uk", "£", "#FFA500", true);

graph.addEdge("asia", "china");
graph.addEdge("asia", "japan");
@@ -295,6 +295,49 @@ With VivaGraph
<img src=http://i.imgur.com/dLJEyfd.png>


#### Handle an event a change node color
```java
//Handle when the mouse goes over a node:
graph.addNodeMouseHoverHandler(new NodeMouseHoverHandler() {

@Override
public void onMouseHover(String nodeName, GraphGWT o, JSONObject currentNodeData) {
//changing node color:
currentNodeData.put("color", new JSONString("yellow"));
}

});
//handle a click on a node
graph.addNodeClickHandler(new NodeClickHandler() {
//when click is pressed
@Override
public void onClick(String nodeName, GraphGWT o, JSONObject currentNodeData) {
currentNodeData.put("color", new JSONString("red"));
}
//when click is released
@Override
public void onClickRelease(String nodeName, GraphGWT o, JSONObject currentNodeData) {
currentNodeData.put("color", new JSONString("blue"));
}
});
```
Event are currently handled only on a node. Hre is the different event we can handle :
- NodeMouseHoverHandler (when the mouse enter over a node area
* onMouseHover
- NodeMouseOutHandler (when the mouse leave a node area)
* onMouseOut
- NodeClickHandler
* onClick
* onClickRelease
- NodeRightClickHandler
* onRightClick
* onRightClickRelease
- NodeMiddleClickHandler
* onMiddleClickRelease
* onMiddleClickRelease



#### Using graphGWT in a GWT project
Create a folder named "public" next to the gwt.xml file. Add the file [arbor.js](https://raw.github.com/Temis/Graph/master/GraphGwt/src/main/java/com/temis/shared/arbor.js)
in the gwt.xml file, add these lines :

0 comments on commit 39949da

Please sign in to comment.