1.1 --- a/compapp.casaeditor/src/org/netbeans/modules/compapp/casaeditor/design/CasaModelGraphUtilities.java Wed Apr 11 00:39:20 2007 +0000
1.2 +++ b/compapp.casaeditor/src/org/netbeans/modules/compapp/casaeditor/design/CasaModelGraphUtilities.java Wed Apr 11 01:26:08 2007 +0000
1.3 @@ -21,7 +21,15 @@
1.4
1.5 import java.awt.Point;
1.6 import java.awt.Rectangle;
1.7 +import java.lang.Thread.State;
1.8 import java.util.ArrayList;
1.9 +import javax.swing.SwingUtilities;
1.10 +import org.netbeans.api.visual.action.WidgetAction;
1.11 +import org.netbeans.api.visual.action.WidgetAction.WidgetDropTargetDragEvent;
1.12 +import org.netbeans.api.visual.action.WidgetAction.WidgetDropTargetDropEvent;
1.13 +import org.netbeans.api.visual.action.WidgetAction.WidgetDropTargetEvent;
1.14 +import org.netbeans.api.visual.action.WidgetAction.WidgetKeyEvent;
1.15 +import org.netbeans.api.visual.action.WidgetAction.WidgetMouseEvent;
1.16 import org.netbeans.api.visual.widget.ConnectionWidget;
1.17 import org.netbeans.api.visual.widget.Widget;
1.18 import org.netbeans.modules.compapp.casaeditor.Constants;
1.19 @@ -50,14 +58,19 @@
1.20 */
1.21 public class CasaModelGraphUtilities {
1.22
1.23 + private static final DisablingAction DISABLER = new DisablingAction();
1.24 +
1.25
1.26 public static void renderModel(final CasaWrapperModel model, final CasaModelGraphScene scene)
1.27 {
1.28 try {
1.29 + scene.getPriorActions().addAction(0, DISABLER);
1.30 safeRenderModel(model, scene);
1.31 } catch (final Throwable t) {
1.32 scene.autoLayout(false);
1.33 ErrorManager.getDefault().notify(t);
1.34 + } finally {
1.35 + scene.getPriorActions().removeAction(DISABLER);
1.36 }
1.37 }
1.38
1.39 @@ -387,4 +400,84 @@
1.40 public static void ensureVisibity(Widget w) {
1.41 w.getScene().getView().scrollRectToVisible(w.convertLocalToScene(w.getBounds()));
1.42 }
1.43 +
1.44 +
1.45 + private static class DisablingAction extends WidgetAction.Adapter {
1.46 +
1.47 + @Override
1.48 + public State mouseClicked(Widget arg0, WidgetMouseEvent arg1) {
1.49 + return State.CONSUMED;
1.50 + }
1.51 +
1.52 + @Override
1.53 + public State mousePressed(Widget arg0, WidgetMouseEvent arg1) {
1.54 + return State.CONSUMED;
1.55 + }
1.56 +
1.57 + @Override
1.58 + public State mouseReleased(Widget arg0, WidgetMouseEvent arg1) {
1.59 + return State.CONSUMED;
1.60 + }
1.61 +
1.62 + @Override
1.63 + public State mouseEntered(Widget arg0, WidgetMouseEvent arg1) {
1.64 + return State.CONSUMED;
1.65 + }
1.66 +
1.67 + @Override
1.68 + public State mouseExited(Widget arg0, WidgetMouseEvent arg1) {
1.69 + return State.CONSUMED;
1.70 + }
1.71 +
1.72 + @Override
1.73 + public State mouseDragged(Widget arg0, WidgetMouseEvent arg1) {
1.74 + return State.CONSUMED;
1.75 + }
1.76 +
1.77 + @Override
1.78 + public State mouseMoved(Widget arg0, WidgetMouseEvent arg1) {
1.79 + return State.CONSUMED;
1.80 + }
1.81 +
1.82 + @Override
1.83 + public State keyTyped(Widget arg0, WidgetKeyEvent arg1) {
1.84 + return State.CONSUMED;
1.85 + }
1.86 +
1.87 + @Override
1.88 + public State keyPressed(Widget arg0, WidgetKeyEvent arg1) {
1.89 + return State.CONSUMED;
1.90 + }
1.91 +
1.92 + @Override
1.93 + public State keyReleased(Widget arg0, WidgetKeyEvent arg1) {
1.94 + return State.CONSUMED;
1.95 + }
1.96 +
1.97 + @Override
1.98 + public State dragEnter(Widget arg0, WidgetDropTargetDragEvent arg1) {
1.99 + return State.CONSUMED;
1.100 + }
1.101 +
1.102 + @Override
1.103 + public State dragOver(Widget arg0, WidgetDropTargetDragEvent arg1) {
1.104 + return State.CONSUMED;
1.105 + }
1.106 +
1.107 + @Override
1.108 + public State dropActionChanged(Widget arg0,
1.109 + WidgetDropTargetDragEvent arg1) {
1.110 + return State.CONSUMED;
1.111 + }
1.112 +
1.113 + @Override
1.114 + public State dragExit(Widget arg0, WidgetDropTargetEvent arg1) {
1.115 + return State.CONSUMED;
1.116 + }
1.117 +
1.118 + @Override
1.119 + public State drop(Widget arg0, WidgetDropTargetDropEvent arg1) {
1.120 + return State.CONSUMED;
1.121 + }
1.122 + }
1.123 }