KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > views > StepRenderer


1 package com.opensymphony.workflow.designer.views;
2
3 import java.awt.*;
4
5 import org.jgraph.graph.GraphConstants;
6 import org.jgraph.graph.VertexRenderer;
7
8 public class StepRenderer extends VertexRenderer
9 {
10   public void paint(Graphics g)
11   {
12     int b = borderWidth;
13     Graphics2D g2 = (Graphics2D)g;
14     Dimension d = getSize();
15     boolean tmp = selected;
16     if(super.isOpaque())
17     {
18       g.setColor(super.getBackground());
19       int arcw = d.width / 5;
20       int arch = d.height / 5;
21       g.fillRoundRect(b - 1, b - 1, d.width - b, d.height - b, arcw, arch);
22     }
23     try
24     {
25       selected = false;
26       super.paint(g);
27     }
28     finally
29     {
30       selected = tmp;
31     }
32     if(bordercolor != null)
33     {
34       g.setColor(bordercolor);
35       g2.setStroke(new BasicStroke(b));
36       int arcw = d.width / 5;
37       int arch = d.height / 5;
38       g.drawRoundRect(b - 1, b - 1, d.width - b, d.height - b, arcw, arch);
39
40     }
41     if(selected)
42     {
43       g2.setStroke(GraphConstants.SELECTION_STROKE);
44       g.setColor(graph.getHighlightColor());
45       int arcw = d.width / 5;
46       int arch = d.height / 5;
47       g.drawRoundRect(b - 1, b - 1, d.width - b, d.height - b, arcw, arch);
48     }
49   }
50
51 }
52
Popular Tags