Index: graph/lib/manifest.mf
===================================================================
RCS file: /cvs/graph/lib/manifest.mf,v
retrieving revision 1.13
diff -u -r1.13 manifest.mf
--- graph/lib/manifest.mf 25 Jun 2007 14:10:16 -0000 1.13
+++ graph/lib/manifest.mf 26 Jul 2007 13:21:11 -0000
@@ -1,4 +1,4 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.api.visual
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/visual/resources/Bundle.properties
-OpenIDE-Module-Specification-Version: 2.5
+OpenIDE-Module-Specification-Version: 2.7
Index: graph/lib/src/org/netbeans/api/visual/action/ActionFactory.java
===================================================================
RCS file: /cvs/graph/lib/src/org/netbeans/api/visual/action/ActionFactory.java,v
retrieving revision 1.24
diff -u -r1.24 ActionFactory.java
--- graph/lib/src/org/netbeans/api/visual/action/ActionFactory.java 5 Jun 2007 08:43:25 -0000 1.24
+++ graph/lib/src/org/netbeans/api/visual/action/ActionFactory.java 26 Jul 2007 13:21:11 -0000
@@ -130,6 +130,10 @@
private static final WidgetAction CYCLE_FOCUS_OBJECT_SCENE = createCycleFocusAction (new CycleObjectSceneFocusProvider ());
+ private static final PanAction PAN_ACTION = new PanAction ();
+
+ private static final WheelPanAction WHEEL_PAN_ACTION = new WheelPanAction ();
+
private ActionFactory () {
}
@@ -401,7 +405,16 @@
* @return the pan action
*/
public static WidgetAction createPanAction () {
- return new PanAction ();
+ return PAN_ACTION;
+ }
+
+ /**
+ * Creates a scene view panning action using mouse-wheel.
+ * @return the wheel pan action
+ * @since 2.7
+ */
+ public static WidgetAction createWheelPanAction () {
+ return WHEEL_PAN_ACTION;
}
/**
Index: graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html
===================================================================
RCS file: /cvs/graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html,v
retrieving revision 1.20
diff -u -r1.20 documentation.html
--- graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html 25 Jun 2007 14:10:19 -0000 1.20
+++ graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html 26 Jul 2007 13:21:12 -0000
@@ -967,10 +967,13 @@
-Created by: ActionFactory.createPanAction ()
+Created by: ActionFactory.createPanAction ()
, ActionFactory.createWheelPanAction ()
The action allows to scroll the view using mouse movement while mouse-middle-button is pressed. It requires to have JComponent view placed into a JScrollPane. This action is usually assigned to a Scene only.
+
+
+The WheelPanAction
allows to scroll ascene view using mouse-wheel. Then no key modifier is pressed, then the view is scrolled vertically. If shift key is held, then the view is scrolled horizontally.
Index: graph/lib/src/org/netbeans/modules/visual/action/WheelPanAction.java
===================================================================
RCS file: graph/lib/src/org/netbeans/modules/visual/action/WheelPanAction.java
diff -N graph/lib/src/org/netbeans/modules/visual/action/WheelPanAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ graph/lib/src/org/netbeans/modules/visual/action/WheelPanAction.java 26 Jul 2007 13:21:12 -0000
@@ -0,0 +1,54 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ */
+
+package org.netbeans.modules.visual.action;
+
+import org.netbeans.api.visual.action.WidgetAction;
+import org.netbeans.api.visual.widget.Widget;
+
+import javax.swing.*;
+import java.awt.event.InputEvent;
+import java.awt.*;
+
+/**
+ * @author David Kaspar
+ */
+public class WheelPanAction extends WidgetAction.Adapter {
+
+ public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) {
+ JComponent view = widget.getScene ().getView ();
+ Rectangle visibleRect = view.getVisibleRect ();
+ int amount = event.getWheelRotation () * 64;
+
+ switch (event.getModifiers () & (InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK | InputEvent.ALT_MASK)) {
+ case InputEvent.SHIFT_MASK:
+ visibleRect.x += amount;
+ break;
+ case 0:
+ visibleRect.y += amount;
+ break;
+ default:
+ return State.REJECTED;
+ }
+
+ view.scrollRectToVisible (visibleRect);
+ return State.CONSUMED;
+ }
+
+}
Index: graph/www/documentation.html
===================================================================
RCS file: /cvs/graph/www/documentation.html,v
retrieving revision 1.97
diff -u -r1.97 documentation.html
--- graph/www/documentation.html 19 Jul 2007 07:15:43 -0000 1.97
+++ graph/www/documentation.html 26 Jul 2007 13:21:12 -0000
@@ -106,6 +106,7 @@
javaone.demo6.LODDemo - how to use LevelOfDetailsWidget
. Zoom-in to see more.
test.action.ActionMapActionTest - how to use ActionMapAction
test.action.SelectLockedActionTest - example of proper cooperation of select (which opens another Swing windows) and locking action
+test.action.WheelPanActionTest - how to use wheel pan action
test.alignwith.AlignWithMoveGuideLinesTest - test of #97034 - incorrectly painted guide-lines for MoveAlignWithAction
test.alignwith.AlignWithTest - how to use MoveAlignWithAction
test.alignwith.AlignWithResizeTest - how to use AlignWithMoveAction
and AlignWithResizeAction