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

(-)graph/examples/src/org/netbeans/modules/visual/examples/RunDialog.java (+1 lines)
Lines 38-43 Link Here
38
        "test.alignwith.AlignWithMoveGuideLinesTest",
38
        "test.alignwith.AlignWithMoveGuideLinesTest",
39
        "test.alignwith.AlignWithTest",
39
        "test.alignwith.AlignWithTest",
40
        "test.alignwith.AlignWithResizeTest",
40
        "test.alignwith.AlignWithResizeTest",
41
        "test.anchor.ArrowAnchorShapeTest",
41
        "test.anchor.AnchorShapeWidthTest",
42
        "test.anchor.AnchorShapeWidthTest",
42
        "test.anchor.ImageAnchorShapeTest",
43
        "test.anchor.ImageAnchorShapeTest",
43
        "test.anchor.InvalidAnchorNegativeTest",
44
        "test.anchor.InvalidAnchorNegativeTest",
(-)graph/examples/src/test/anchor/ArrowAnchorShapeTest.java (+48 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 test.anchor;
21
22
import org.netbeans.api.visual.anchor.AnchorFactory;
23
import org.netbeans.api.visual.anchor.AnchorShapeFactory;
24
import org.netbeans.api.visual.widget.ConnectionWidget;
25
import org.netbeans.api.visual.widget.Scene;
26
import test.SceneSupport;
27
28
import java.awt.*;
29
30
/**
31
 * @author David Kaspar
32
 */
33
public class ArrowAnchorShapeTest {
34
35
    public static void main (String[] args) {
36
        Scene scene = new Scene ();
37
38
        ConnectionWidget child = new ConnectionWidget (scene);
39
        child.setSourceAnchor (AnchorFactory.createFixedAnchor (new Point (100, 100)));
40
        child.setTargetAnchor (AnchorFactory.createFixedAnchor (new Point (200, 200)));
41
        child.setSourceAnchorShape (AnchorShapeFactory.createArrowAnchorShape (180, 8));
42
        child.setTargetAnchorShape (AnchorShapeFactory.createArrowAnchorShape (30, 16));
43
        scene.addChild (child);
44
45
        SceneSupport.show (scene);
46
    }
47
48
}
(-)graph/lib/apichanges.xml (+14 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>AnchorShapeFactory.createArrowAnchorShape method introduced</summary>
246
            <version major="2" minor="4"/>
247
            <date day="5" month="6" year="2007"/>
248
            <author login="dkaspar"/>
249
            <compatibility addition="yes"/>
250
            <description>
251
                AnchorShapeFactory.createArrowAnchorShape method introduced.
252
            </description>
253
            <class package="org.netbeans.api.visual.anchor" name="AnchorShapeFactory" link="yes"/>
254
            <issue number="105499"/>
255
        </change>
242
    </changes>
256
    </changes>
243
257
244
    <htmlcontents>
258
    <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/anchor/AnchorShapeFactory.java (+12 lines)
Lines 20-25 Link Here
20
20
21
import org.netbeans.modules.visual.anchor.ImageAnchorShape;
21
import org.netbeans.modules.visual.anchor.ImageAnchorShape;
22
import org.netbeans.modules.visual.anchor.TriangleAnchorShape;
22
import org.netbeans.modules.visual.anchor.TriangleAnchorShape;
23
import org.netbeans.modules.visual.anchor.ArrowAnchorShape;
23
24
24
import java.awt.*;
25
import java.awt.*;
25
26
Lines 74-79 Link Here
74
     */
75
     */
75
    public static AnchorShape createTriangleAnchorShape (int size, boolean filled, boolean output, int cutDistance) {
76
    public static AnchorShape createTriangleAnchorShape (int size, boolean filled, boolean output, int cutDistance) {
76
        return new TriangleAnchorShape (size, filled, output, false, cutDistance);
77
        return new TriangleAnchorShape (size, filled, output, false, cutDistance);
78
    }
79
80
    /**
81
     * Creates an arrow anchor shape.
82
     * @param degrees the angle of the arrow in degrees (not radians)
83
     * @param size the size of the arrow
84
     * @return the anchor shape
85
     * @since 2.4
86
     */
87
    public static AnchorShape createArrowAnchorShape (int degrees, int size) {
88
        return new ArrowAnchorShape (degrees, size);
77
    }
89
    }
78
90
79
}
91
}
(-)graph/lib/src/org/netbeans/modules/visual/anchor/ArrowAnchorShape.java (+70 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
package org.netbeans.modules.visual.anchor;
20
21
import org.netbeans.api.visual.anchor.AnchorShape;
22
23
import java.awt.*;
24
import java.awt.geom.GeneralPath;
25
26
/**
27
 * @author Antonio
28
 */
29
public class ArrowAnchorShape implements AnchorShape {
30
31
    private static final Stroke STROKE = new BasicStroke (1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
32
33
    private GeneralPath path;
34
    private int size;
35
36
    public ArrowAnchorShape (int degrees, int size) {
37
        this.size = size;
38
        path = new GeneralPath ();
39
40
        double radians = Math.PI * degrees / 360.0;
41
        double cos = Math.cos (radians);
42
        double sin = -size * Math.sqrt (1 - cos * cos);
43
        cos *= size;
44
45
        path.moveTo (0.0f, 0.0f);
46
        path.lineTo ((float) cos, (float) -sin);
47
        path.moveTo (0.0f, 0.0f);
48
        path.lineTo ((float) cos, (float) sin);
49
    }
50
51
    public boolean isLineOriented () {
52
        return true;
53
    }
54
55
    public int getRadius () {
56
        return size + 1;
57
    }
58
59
    public double getCutDistance () {
60
        return 0;
61
    }
62
63
    public void paint (Graphics2D graphics, boolean source) {
64
        Stroke previousStroke = graphics.getStroke ();
65
        graphics.setStroke (STROKE);
66
        graphics.draw (path);
67
        graphics.setStroke (previousStroke);
68
    }
69
70
}
(-)graph/www/documentation.html (+1 lines)
Lines 109-114 Link Here
109
<li><strong>test.alignwith.AlignWithMoveGuideLinesTest</strong> - test of #97034 - incorrectly painted guide-lines for <code>MoveAlignWithAction</code>
109
<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>
110
<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>
111
<li><strong>test.alignwith.AlignWithResizeTest</strong> - how to use <code>AlignWithMoveAction</code> and <code>AlignWithResizeAction</code>
112
<li><strong>test.anchor.ArrowAnchorShapeTest</strong> - test of <code>ArrowAnchorShape</code>
112
<li><strong>test.anchor.AnchorShapeWidthTest</strong> - test of bugfix #91613 - Incorrectly rendered AnchorShapes
113
<li><strong>test.anchor.AnchorShapeWidthTest</strong> - test of bugfix #91613 - Incorrectly rendered AnchorShapes
113
<li><strong>test.anchor.ImageAnchorShapeTest</strong> - test of <code>ImageAnchorShape</code>
114
<li><strong>test.anchor.ImageAnchorShapeTest</strong> - test of <code>ImageAnchorShape</code>
114
<li><strong>test.anchor.InvalidAnchorNegativeTest</strong> - negative test of invalid anchor (its related widget is not added into scene)
115
<li><strong>test.anchor.InvalidAnchorNegativeTest</strong> - negative test of invalid anchor (its related widget is not added into scene)

Return to bug 105499