com.arsdigita.bebop.util
Class Size

java.lang.Object
  extended bycom.arsdigita.bebop.util.Size

public class Size
extends Object

A class for Bebop size parameters.

 private Page buildSomePage() {
     Page page = new Page("Some Page");

     // Put a 10-pixel margin around the contents of this page.
     page.setMargin(new Size(10));

     // Or, instead, put a 10% margin around it.
     page.setMargin(new Size(10, UNIT_PERCENT));

     page.lock();

     return page;
 }
 

Version:
$Id: //core-platform/dev/src/com/arsdigita/bebop/util/Size.java#8 $
Author:
Justin Ross, Jim Parsons, Christian Brechbühler

Field Summary
static int UNIT_PERCENT
          Constant for describing a component in terms of percent size relative to its container.
static int UNIT_PIXEL
          Constant for describing sizes in pixels.
static String versionId
           
 
Constructor Summary
  Size(float scalar, int unitEnum)
          Construct a new Size using the type indicated in unitEnum.
protected Size(float scalar, String unitAbbreviation)
          Construct a new Size.
  Size(int numPixels)
          Construct a new Size in pixels.
 
Method Summary
 String toString()
          Return the size as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

UNIT_PIXEL

public static final int UNIT_PIXEL
Constant for describing sizes in pixels.

See Also:
Constant Field Values

UNIT_PERCENT

public static final int UNIT_PERCENT
Constant for describing a component in terms of percent size relative to its container.

See Also:
Constant Field Values
Constructor Detail

Size

protected Size(float scalar,
               String unitAbbreviation)
Construct a new Size. Classes extending Size should call super with the abbreviation of their unit.

Parameters:
scalar - a simple magnitude. Note that this value may be negative.
unitAbbreviation - an unit abbreviation for use when the size is printed.

Size

public Size(int numPixels)
Construct a new Size in pixels.

Parameters:
numPixels - a simple magnitude. Note that this value may be negative.

Size

public Size(float scalar,
            int unitEnum)
Construct a new Size using the type indicated in unitEnum. unitEnum is any of the UNIT_* constants defined in this class.

Parameters:
scalar - a simple magnitude. Note that this value may be negative.
unitEnum - a unit type.
Method Detail

toString

public String toString()
Return the size as a string. This string will be used in writing the style attributes of Bebop XML.

Returns:
this Size as a string for inclusion in XML.


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC