01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * 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 org.netbeans.modules.bpel.design.decoration.components;
21:
22: import java.awt.BasicStroke;
23: import java.awt.Color;
24: import java.awt.Graphics2D;
25: import java.awt.Paint;
26: import java.awt.Shape;
27: import java.awt.geom.AffineTransform;
28: import java.awt.geom.Area;
29: import java.awt.geom.Rectangle2D;
30: import java.awt.geom.RoundRectangle2D;
31:
32: /**
33: *
34: * @author aa160298
35: */
36: public class BreakpointIcon2D extends Icon2D {
37: private boolean enabled;
38:
39: public BreakpointIcon2D(boolean enabled) {
40: super ();
41: this .enabled = enabled;
42: }
43:
44: protected void paint(Graphics2D g2) {
45: g2.setPaint(enabled ? FILL_COLOR : FILL_COLOR.brighter());
46: g2.fill(SHAPE);
47: g2.setPaint(enabled ? STROKE_COLOR : STROKE_COLOR.brighter());
48: g2.setStroke(STROKE);
49: g2.draw(SHAPE);
50: }
51:
52: protected double getDesignOriginX() {
53: return DESIGN_SIZE / 2;
54: }
55:
56: protected double getDesignOriginY() {
57: return DESIGN_SIZE / 2;
58: }
59:
60: protected double getDesignWidth() {
61: return DESIGN_SIZE;
62: }
63:
64: protected double getDesignHeight() {
65: return DESIGN_SIZE;
66: }
67:
68: private static final double DESIGN_SIZE = 10;
69:
70: private static final Color FILL_COLOR = new Color(0xFFA0A0);
71: private static final Color STROKE_COLOR = new Color(0xFF0000);
72:
73: private static final BasicStroke STROKE = new BasicStroke(1,
74: BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
75:
76: private static final Shape SHAPE;
77:
78: static {
79: float half = (float) (DESIGN_SIZE - STROKE.getLineWidth()) / 2;
80:
81: SHAPE = new Rectangle2D.Float(-half, -half, 2 * half, 2 * half);
82: }
83:
84: }
|