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 FlowchartManualOperationPainter extends AbstractFlowchartPainter {
25
26
27 public FlowchartManualOperationPainter() {
28 super();
29 outline = new GeneralPath();
30
31 }
32
33 protected void updateOutline(NodeRealizer context) {
34 GeneralPath shapePath = (GeneralPath) getOutline();
35 shapePath.reset();
36
37 double x = context.getX();
38 double y = context.getY();
39 double height = context.getHeight();
40 double width = context.getWidth();
41 double borderDistance;
42 GenericNodeRealizer cast_gnr = (GenericNodeRealizer) context;
43 if (cast_gnr.getStyleProperty(PROPERTY_BORDER_DISTANCE) != null) {
44 borderDistance = ((Double) cast_gnr.getStyleProperty(PROPERTY_BORDER_DISTANCE)).doubleValue();
45 } else {
46 borderDistance = FLOWCHART_DEFAULT_MANUAL_OPERATION_BORDER_DISTANCE;
47 }
48 borderDistance = Math.min(borderDistance, width/2);
49 shapePath.moveTo((float)x,(float)y);
50 shapePath.lineTo((float)(x + width), (float)y);
51 shapePath.lineTo((float)(x + width - borderDistance), (float)(y + height));
52 shapePath.lineTo((float)(x + borderDistance), (float)(y + height));
53 shapePath.closePath();
54
55 }
56 }
57