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 104976
Collapse All | Expand All

(-)graph/lib/apichanges.xml (+16 lines)
Lines 239-244 Link Here
239
            <class package="org.netbeans.api.visual.action" name="ActionFactory" link="yes"/>
239
            <class package="org.netbeans.api.visual.action" name="ActionFactory" link="yes"/>
240
            <issue number="104718"/>
240
            <issue number="104718"/>
241
        </change>
241
        </change>
242
243
        <change>
244
            <api name="general"/>
245
            <summary>Zoom actions are using Ctrl key modifier of invocation</summary>
246
            <version major="2" minor="4"/>
247
            <date day="5" month="6" year="2007"/>
248
            <author login="dkaspar"/>
249
            <compatibility addition="no"/>
250
            <description>
251
                All built-in zoom actions are using modifiers from Scene.getInputBindings().getZoomActionModifiers() method.
252
		Default value has been changed from nothing to Ctrl key which backward-incompatible change affecting all users.
253
		A part of the change InputBindings class has been introduces and assigned to a Scene.
254
            </description>
255
            <class package="org.netbeans.api.visual.action" name="ActionFactory" link="yes"/>
256
            <issue number="104976"/>
257
        </change>
242
    </changes>
258
    </changes>
243
259
244
    <htmlcontents>
260
    <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.3
4
OpenIDE-Module-Specification-Version: 2.4
(-)graph/lib/src/org/netbeans/api/visual/laf/InputBindings.java (+64 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.api.visual.laf;
21
22
import java.awt.event.KeyEvent;
23
24
/**
25
 * This represents input bindings e.g. manages modifiers of actions.
26
 *
27
 * @author David Kaspar
28
 * @since 2.4
29
 */
30
public final class InputBindings {
31
32
    private int zoomActionModifiers = KeyEvent.CTRL_MASK;
33
    
34
    private InputBindings () {
35
    }
36
37
    /**
38
     * Returns InputEvent modifiers of all zoom actions.
39
     * @return the modifiers
40
     * @since 2.4
41
     */
42
    public int getZoomActionModifiers () {
43
        return zoomActionModifiers;
44
    }
45
46
    /**
47
     * Sets InputEvent modifiers for all zoom actions.
48
     * @param zoomActionModifiers the modifiers
49
     * @since 2.4
50
     */
51
    public void setZoomActionModifiers (int zoomActionModifiers) {
52
        this.zoomActionModifiers = zoomActionModifiers;
53
    }
54
55
    /**
56
     * Creates a new input bindings. This is usually used by the Scene class only.
57
     * @return the input bindings
58
     * @since 2.4
59
     */
60
    public static InputBindings create () {
61
        return new InputBindings ();
62
    }
63
64
}
(-)graph/lib/src/org/netbeans/api/visual/widget/Scene.java (+11 lines)
Lines 23-28 Link Here
23
import org.netbeans.api.visual.action.WidgetAction;
23
import org.netbeans.api.visual.action.WidgetAction;
24
import org.netbeans.api.visual.animator.SceneAnimator;
24
import org.netbeans.api.visual.animator.SceneAnimator;
25
import org.netbeans.api.visual.laf.LookFeel;
25
import org.netbeans.api.visual.laf.LookFeel;
26
import org.netbeans.api.visual.laf.InputBindings;
26
import org.netbeans.modules.visual.util.GeomUtil;
27
import org.netbeans.modules.visual.util.GeomUtil;
27
import org.netbeans.modules.visual.widget.SatelliteComponent;
28
import org.netbeans.modules.visual.widget.SatelliteComponent;
28
29
Lines 68-73 Link Here
68
69
69
    private Font defaultFont;
70
    private Font defaultFont;
70
    private LookFeel lookFeel = LookFeel.createDefaultLookFeel ();
71
    private LookFeel lookFeel = LookFeel.createDefaultLookFeel ();
72
    private InputBindings inputBindings = InputBindings.create ();
71
    private String activeTool = null;
73
    private String activeTool = null;
72
    private Rectangle maximumBounds = new Rectangle (Integer.MIN_VALUE / 2, Integer.MIN_VALUE / 2, Integer.MAX_VALUE, Integer.MAX_VALUE);
74
    private Rectangle maximumBounds = new Rectangle (Integer.MIN_VALUE / 2, Integer.MIN_VALUE / 2, Integer.MAX_VALUE, Integer.MAX_VALUE);
73
75
Lines 472-477 Link Here
472
    public final void setLookFeel (LookFeel lookFeel) {
474
    public final void setLookFeel (LookFeel lookFeel) {
473
        assert lookFeel != null;
475
        assert lookFeel != null;
474
        this.lookFeel = lookFeel;
476
        this.lookFeel = lookFeel;
477
    }
478
479
    /**
480
     * Returns input bindings of the scene.
481
     * @return the input bindings
482
     * @since 2.4
483
     */
484
    public final InputBindings getInputBindings () {
485
        return inputBindings;
475
    }
486
    }
476
487
477
    /**
488
    /**
(-)graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html (+6 lines)
Lines 532-537 Link Here
532
<td>getLookFeel<br>setLookFeel
532
<td>getLookFeel<br>setLookFeel
533
<td>Controls the scene look and feel. <code>LookFeel.createDefaultLookFeel</code> by default. See <a href="#LookFeel">Look and Feel</a> section.
533
<td>Controls the scene look and feel. <code>LookFeel.createDefaultLookFeel</code> by default. See <a href="#LookFeel">Look and Feel</a> section.
534
<tr>
534
<tr>
535
<td>getInputBindinds
536
<td>Returns input bindings used by the scene. See <a href="#LookFeel">Look and Feel</a> section.
537
<tr>
535
<td>getActiveTool<br>setActiveTool
538
<td>getActiveTool<br>setActiveTool
536
<td>Controls the active action tool of the scene. See <a href="#ActionTools">Action Tools</a> section.
539
<td>Controls the active action tool of the scene. See <a href="#ActionTools">Action Tools</a> section.
537
<tr>
540
<tr>
Lines 1834-1839 Link Here
1834
1837
1835
<p>
1838
<p>
1836
The library contains a preliminary look&amp;feel support defined by <code>LookFeel</code> abstract class. Almost every method is dependent on <code>ObjectState</code> parameter. Usually the interface should be used in <code>Widget.notifyStateChanged</code> method implementation. The <code>Scene.getLookFeel</code> and <code>Scene.setLookFeel</code> methods allows manipulation with a look&amp;feel assigned to a scene. The default <code>LookFeel</code> implementation can be obtained using <code>LookFeel.createDefaultLookFeel</code> method.
1839
The library contains a preliminary look&amp;feel support defined by <code>LookFeel</code> abstract class. Almost every method is dependent on <code>ObjectState</code> parameter. Usually the interface should be used in <code>Widget.notifyStateChanged</code> method implementation. The <code>Scene.getLookFeel</code> and <code>Scene.setLookFeel</code> methods allows manipulation with a look&amp;feel assigned to a scene. The default <code>LookFeel</code> implementation can be obtained using <code>LookFeel.createDefaultLookFeel</code> method.
1840
1841
<p>
1842
There is also an InputBindings class which is assigned to a scene. It allows to manage action-related scene options e.g. <code>InputEvent</code> modifier of zoom actions used in the scene.
1837
1843
1838
<h2><a name="Animator">Animator</a></h2>
1844
<h2><a name="Animator">Animator</a></h2>
1839
1845
(-)graph/lib/src/org/netbeans/modules/visual/action/CenteredZoomAction.java (+5 lines)
Lines 39-44 Link Here
39
39
40
    public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) {
40
    public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) {
41
        Scene scene = widget.getScene ();
41
        Scene scene = widget.getScene ();
42
43
        int modifiers = scene.getInputBindings ().getZoomActionModifiers ();
44
        if ((event.getModifiers () & modifiers) != modifiers)
45
            return State.REJECTED;
46
42
        int amount = event.getWheelRotation ();
47
        int amount = event.getWheelRotation ();
43
48
44
        double scale = 1.0;
49
        double scale = 1.0;
(-)graph/lib/src/org/netbeans/modules/visual/action/MouseCenteredZoomAction.java (+5 lines)
Lines 38-43 Link Here
38
38
39
    public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) {
39
    public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) {
40
        Scene scene = widget.getScene ();
40
        Scene scene = widget.getScene ();
41
42
        int modifiers = scene.getInputBindings ().getZoomActionModifiers ();
43
        if ((event.getModifiers () & modifiers) != modifiers)
44
            return State.REJECTED;
45
41
        int amount = event.getWheelRotation ();
46
        int amount = event.getWheelRotation ();
42
47
43
        double scale = 1.0;
48
        double scale = 1.0;
(-)graph/lib/src/org/netbeans/modules/visual/action/ZoomAction.java (+5 lines)
Lines 38-43 Link Here
38
38
39
    public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) {
39
    public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) {
40
        Scene scene = widget.getScene ();
40
        Scene scene = widget.getScene ();
41
42
        int modifiers = scene.getInputBindings ().getZoomActionModifiers ();
43
        if ((event.getModifiers () & modifiers) != modifiers)
44
            return State.REJECTED;
45
41
        int amount = event.getWheelRotation ();
46
        int amount = event.getWheelRotation ();
42
47
43
        if (useAnimator) {
48
        if (useAnimator) {

Return to bug 104976