1
14 package demo.view.flowchart.painters;
15
16 import y.view.NodeRealizer;
17 import y.view.GenericNodeRealizer;
18
19 import java.awt.geom.GeneralPath;
20
21
24 public class FlowchartDelayPainter extends AbstractFlowchartPainter {
25
26
27 public FlowchartDelayPainter() {
28 super();
29 outline = new GeneralPath();
30 }
31
32 protected void updateOutline(NodeRealizer context) {
33 GeneralPath shapePath = (GeneralPath) getOutline();
34 shapePath.reset();
35 double height = context.getHeight();
36 double x = context.getX();
37 double y = context.getY();
38 double width = context.getWidth();
39 GenericNodeRealizer cast_gnr = (GenericNodeRealizer) context;
40 double capRadiusHighDependency;
41 if (cast_gnr.getStyleProperty(PROPERTY_RADIUS) != null) {
42 capRadiusHighDependency = ((Double) cast_gnr.getStyleProperty(PROPERTY_RADIUS)).doubleValue();
43 capRadiusHighDependency = Math.min(capRadiusHighDependency, 0.5);
44 } else {
45 capRadiusHighDependency = FLOWCHART_DEFAULT_DELAY_RADIUS;
46 }
47 double borderDistance = capRadiusHighDependency * Math.min(width, height);
48
49 shapePath.moveTo((float) x, (float) y);
50 shapePath.lineTo((float) (x + width - borderDistance), (float) y);
51 shapePath.quadTo((float) (x + width + borderDistance), (float) (y + height / 2),
52 (float) (x + width - borderDistance), (float) (y + height));
53 shapePath.lineTo((float) x, (float) (y + height));
54 shapePath.closePath();
55 }
56 }
57