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