1
14 package demo.view.flowchart.painters;
15
16 import y.view.NodeRealizer;
17
18 import java.awt.geom.GeneralPath;
19
20
23 public class FlowchartOffPageReferencePainter extends AbstractFlowchartPainter {
24 public FlowchartOffPageReferencePainter() {
25 super();
26 outline = new GeneralPath();
27 }
28
29 protected void updateOutline(NodeRealizer context) {
30 GeneralPath shape = (GeneralPath) getOutline();
31 shape.reset();
32 double height = context.getHeight();
33 double width = context.getWidth();
34 double x = context.getX();
35 double y = context.getY();
36 double minLength = Math.min(height, width);
37
38 double borderDistanceX = Math.max((width - minLength)/2, 0);
39 double borderDistanceY = Math.max((height - minLength)/2, 0);
40 shape.moveTo((float)(x + borderDistanceX), (float)(y + borderDistanceY));
41 shape.lineTo((float)(x + minLength + borderDistanceX), (float)(y + borderDistanceY));
42 shape.lineTo((float)(x + minLength + borderDistanceX), (float)(y + minLength/2 + borderDistanceY));
43 shape.lineTo((float)(x + minLength/2 + borderDistanceX), (float)(y + minLength + borderDistanceY));
44 shape.lineTo((float)(x + borderDistanceX), (float)(y + minLength/2 + borderDistanceY));
45 shape.closePath();
46 }
47 }
48