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