RSS

Search Engine

Thursday, August 12, 2010

Tips and Tricks

6.1. Disable that nodes can be moved manually

Per default the user can move the nodes in Zest. To disable this you have to extend the Graph.

    
package sawan.modi.zest.movenodes.graph;

import org.eclipse.draw2d.SWTEventDispatcher;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.zest.core.widgets.Graph;

public class NonMovableGraph extends Graph {

public NonMovableGraph(Composite parent, int style) {
super(parent, style);
this.getLightweightSystem().setEventDispatcher(
new SWTEventDispatcher() {
public void dispatchMouseMoved(
org.eclipse.swt.events.MouseEvent me) {
// Doing nothing
}
});
}

}

The usage is demonstrated in project "sawan.modi.zest.movenodes".

0 comments:

Post a Comment