Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/arranger/jarl/widget/base/Rectangle.java


1   package com.arranger.jarl.widget.base;
2   
3   import com.arranger.jarl.base.IContext;
4   import com.arranger.jarl.widget.BaseSegmentWidget;
5   
6   import java.awt.*;
7   import java.awt.geom.Rectangle2D;
8   
9   /**
10   * Rectangle draws a rectangle.
11   *
12   * Required attributes: (should be percentages: eg. 10%)
13   *  width
14   *  height
15   *
16   * @see Rectangle2D
17   *
18   * @widgetAttribute width ## xs:string ## the width relative to the screen of the rectangle
19   * @widgetAttribute height ## xs:string ## the height relative to the screen of the rectangle
20   *
21   * @widgetAttribute startWidth ## xs:string ## the starting width relative to the screen of the rectangle
22   * @widgetAttribute startHeight ## xs:string ## the starting height relative to the screen of the rectangle
23   * @widgetAttribute endWidth ## xs:string ## the ending width relative to the screen of the rectangle
24   * @widgetAttribute endHeight ## xs:string ## the ending height relative to the screen of the rectangle
25   */
26  public class Rectangle extends BaseSegmentWidget {
27  
28      /**
29       * Called from within {@link #paint}
30       *
31       * @param context
32       * @param graphics2D
33       */
34      protected void _paint(IContext context, Graphics2D graphics2D) {
35          double width = getWidth(context);
36          double height = getHeight(context);
37  
38          Rectangle2D rectangle = new Rectangle2D.Double(0,
39              0,
40              width,
41              height);
42  
43          paintShape(context, graphics2D, centerShape(rectangle, context));
44      }
45  }