1   /****************************************************************************
2    **
3    ** This file is part of yFiles-2.9. 
4    ** 
5    ** yWorks proprietary/confidential. Use is subject to license terms.
6    **
7    ** Redistribution of this file or of an unauthorized byte-code version
8    ** of this file is strictly forbidden.
9    **
10   ** Copyright (c) 2000-2011 by yWorks GmbH, Vor dem Kreuzberg 28, 
11   ** 72070 Tuebingen, Germany. All rights reserved.
12   **
13   ***************************************************************************/
14  package demo.view.flowchart.painters;
15  
16  import y.view.NodeRealizer;
17  
18  import java.awt.geom.RoundRectangle2D;
19  
20  /**
21  * This class is an implementation of {@link y.view.GenericNodeRealizer.Painter} that draws the termination symbol of flowchart diagrams.
22   **/
23  public class FlowchartTerminatorPainter extends AbstractFlowchartPainter {
24    public FlowchartTerminatorPainter() {
25      super();
26      outline = new RoundRectangle2D.Double();
27    }
28  
29    protected void updateOutline(NodeRealizer context) {
30      RoundRectangle2D shape = (RoundRectangle2D) getOutline();
31      double height = context.getHeight();
32      double width = context.getWidth();
33      double x = context.getX();
34      double y = context.getY();
35  
36      double arc = Math.min(height, width*2);
37      shape.setRoundRect(x, y, width, height, arc, arc);
38    }
39  }
40