This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 107774
Collapse All | Expand All

(-)graph/examples/src/org/netbeans/modules/visual/examples/RunDialog.java (+1 lines)
Lines 35-40 Link Here
35
        "javaone.demo6.LODDemo",
35
        "javaone.demo6.LODDemo",
36
        "test.action.ActionMapActionTest",
36
        "test.action.ActionMapActionTest",
37
        "test.action.SelectLockedActionTest",
37
        "test.action.SelectLockedActionTest",
38
        "test.action.WheelPanActionTest",
38
        "test.alignwith.AlignWithMoveGuideLinesTest",
39
        "test.alignwith.AlignWithMoveGuideLinesTest",
39
        "test.alignwith.AlignWithTest",
40
        "test.alignwith.AlignWithTest",
40
        "test.alignwith.AlignWithResizeTest",
41
        "test.alignwith.AlignWithResizeTest",
(-)graph/examples/src/test/action/WheelPanActionTest.java (+45 lines)
Added Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 *
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 *
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 *
15
 * The Original Software is NetBeans. The Initial Developer of the Original
16
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17
 * Microsystems, Inc. All Rights Reserved.
18
 */
19
20
package test.action;
21
22
import org.netbeans.api.visual.action.ActionFactory;
23
import test.SceneSupport;
24
import test.general.StringGraphScene;
25
26
import java.awt.*;
27
28
/**
29
 * @author David Kaspar
30
 */
31
public class WheelPanActionTest {
32
33
    public static void main (String[] args) {
34
        StringGraphScene scene = new StringGraphScene ();
35
36
        for (int a = 1; a <= 100; a ++)
37
            scene.addNode (String.valueOf(a)).setPreferredLocation (new Point (a * 10, a * 10));
38
39
        scene.getActions ().addAction (ActionFactory.createWheelPanAction ());
40
        scene.getActions ().addAction (ActionFactory.createMouseCenteredZoomAction (1.5));
41
42
        SceneSupport.show (scene);
43
    }
44
45
}
(-)graph/lib/apichanges.xml (+14 lines)
Lines 330-335 Link Here
330
            <class package="org.netbeans.api.visual.vmd" name="VMDColorScheme" link="yes"/>
330
            <class package="org.netbeans.api.visual.vmd" name="VMDColorScheme" link="yes"/>
331
            <issue number="105929"/>
331
            <issue number="105929"/>
332
        </change>
332
        </change>
333
334
        <change>
335
            <api name="general"/>
336
            <summary>WheelPanAction introduced</summary>
337
            <version major="2" minor="7"/>
338
            <date day="25" month="6" year="2007"/>
339
            <author login="dkaspar"/>
340
            <compatibility addition="yes"/>
341
            <description>
342
                WheelPanAction has been added to allow vertical and horizontal scrolling of a scene view using mouse wheel.
343
            </description>
344
            <class package="org.netbeans.api.visual.action" name="ActionFactory" link="yes"/>
345
            <issue number="107774"/>
346
        </change>
333
    </changes>
347
    </changes>
334
348
335
    <htmlcontents>
349
    <htmlcontents>
(-)graph/lib/manifest.mf (-1 / +1 lines)
Lines 1-4 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.api.visual
2
OpenIDE-Module: org.netbeans.api.visual
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/visual/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/visual/resources/Bundle.properties
4
OpenIDE-Module-Specification-Version: 2.5
4
OpenIDE-Module-Specification-Version: 2.7
(-)graph/lib/src/org/netbeans/api/visual/action/ActionFactory.java (-1 / +14 lines)
Lines 130-135 Link Here
130
130
131
    private static final WidgetAction CYCLE_FOCUS_OBJECT_SCENE = createCycleFocusAction (new CycleObjectSceneFocusProvider ());
131
    private static final WidgetAction CYCLE_FOCUS_OBJECT_SCENE = createCycleFocusAction (new CycleObjectSceneFocusProvider ());
132
132
133
    private static final PanAction PAN_ACTION = new PanAction ();
134
135
    private static final WheelPanAction WHEEL_PAN_ACTION = new WheelPanAction ();
136
133
    private ActionFactory () {
137
    private ActionFactory () {
134
    }
138
    }
135
139
Lines 401-407 Link Here
401
     * @return the pan action
405
     * @return the pan action
402
     */
406
     */
403
    public static WidgetAction createPanAction () {
407
    public static WidgetAction createPanAction () {
404
        return new PanAction ();
408
        return PAN_ACTION;
409
    }
410
411
    /**
412
     * Creates a scene view panning action using mouse-wheel.
413
     * @return the wheel pan action
414
     * @since 2.7
415
     */
416
    public static WidgetAction createWheelPanAction () {
417
        return WHEEL_PAN_ACTION;
405
    }
418
    }
406
419
407
    /**
420
    /**
(-)graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html (-1 / +4 lines)
Lines 967-976 Link Here
967
<h3><a name="PanAction">PanAction</a></h3>
967
<h3><a name="PanAction">PanAction</a></h3>
968
968
969
<p>
969
<p>
970
Created by: <code>ActionFactory.createPanAction ()</code>
970
Created by: <code>ActionFactory.createPanAction ()</code>, <code>ActionFactory.createWheelPanAction ()</code>
971
971
972
<p>
972
<p>
973
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.
973
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.
974
975
<p>
976
The <code>WheelPanAction</code> 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.
974
977
975
<h3><a name="PopupMenuAction">PopupMenuAction</a></h3>
978
<h3><a name="PopupMenuAction">PopupMenuAction</a></h3>
976
979
(-)graph/lib/src/org/netbeans/modules/visual/action/WheelPanAction.java (+54 lines)
Added Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 *
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 *
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 *
15
 * The Original Software is NetBeans. The Initial Developer of the Original
16
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17
 * Microsystems, Inc. All Rights Reserved.
18
 */
19
20
package org.netbeans.modules.visual.action;
21
22
import org.netbeans.api.visual.action.WidgetAction;
23
import org.netbeans.api.visual.widget.Widget;
24
25
import javax.swing.*;
26
import java.awt.event.InputEvent;
27
import java.awt.*;
28
29
/**
30
 * @author David Kaspar
31
 */
32
public class WheelPanAction extends WidgetAction.Adapter {
33
34
    public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) {
35
        JComponent view = widget.getScene ().getView ();
36
        Rectangle visibleRect = view.getVisibleRect ();
37
        int amount = event.getWheelRotation () * 64;
38
39
        switch (event.getModifiers () & (InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK | InputEvent.ALT_MASK)) {
40
            case InputEvent.SHIFT_MASK:
41
                visibleRect.x += amount;
42
                break;
43
            case 0:
44
                visibleRect.y += amount;
45
                break;
46
            default:
47
                return State.REJECTED;
48
        }
49
50
        view.scrollRectToVisible (visibleRect);
51
        return State.CONSUMED;
52
    }
53
54
}
(-)graph/www/documentation.html (+1 lines)
Lines 106-111 Link Here
106
<li><strong>javaone.demo6.LODDemo</strong> - how to use <code>LevelOfDetailsWidget</code>. Zoom-in to see more.
106
<li><strong>javaone.demo6.LODDemo</strong> - how to use <code>LevelOfDetailsWidget</code>. Zoom-in to see more.
107
<li><strong>test.action.ActionMapActionTest</strong> - how to use <code>ActionMapAction</code>
107
<li><strong>test.action.ActionMapActionTest</strong> - how to use <code>ActionMapAction</code>
108
<li><strong>test.action.SelectLockedActionTest</strong> - example of proper cooperation of select (which opens another Swing windows) and locking action
108
<li><strong>test.action.SelectLockedActionTest</strong> - example of proper cooperation of select (which opens another Swing windows) and locking action
109
<li><strong>test.action.WheelPanActionTest</strong> - how to use wheel pan action
109
<li><strong>test.alignwith.AlignWithMoveGuideLinesTest</strong> - test of #97034 - incorrectly painted guide-lines for <code>MoveAlignWithAction</code>
110
<li><strong>test.alignwith.AlignWithMoveGuideLinesTest</strong> - test of #97034 - incorrectly painted guide-lines for <code>MoveAlignWithAction</code>
110
<li><strong>test.alignwith.AlignWithTest</strong> - how to use <code>MoveAlignWithAction</code>
111
<li><strong>test.alignwith.AlignWithTest</strong> - how to use <code>MoveAlignWithAction</code>
111
<li><strong>test.alignwith.AlignWithResizeTest</strong> - how to use <code>AlignWithMoveAction</code> and <code>AlignWithResizeAction</code>
112
<li><strong>test.alignwith.AlignWithResizeTest</strong> - how to use <code>AlignWithMoveAction</code> and <code>AlignWithResizeAction</code>

Return to bug 107774