|
NextApp Echo2 v2.1.0.rc2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnextapp.echo2.app.Extent
A representation of a linear distance with units. Extent
objects are immutable once constructed.
WARNING: Many Components will have
Extent-based properties that allow only certain types of
units. Make certain to verify the API specification of any
Component to ensure that you are using Extents
correctly with it. The Extent-based getXXX()
and setXXX() property methods of a Component
will explain what types of Extents are allowed.
| Field Summary | |
static int |
CM
Centimeter units. |
static int |
EM
Em units (height of font). |
static int |
EX
Ex units (height of character 'x' in font). |
static int |
IN
Inch units. |
static int |
MM
Millimeter units. |
static int |
PC
Picas (1pc = 12pt) |
static int |
PERCENT
Percentage units. |
static int |
PT
Points (1pt = 1/72in). |
static int |
PX
Pixel units. |
| Constructor Summary | |
Extent(int value)
Creates a new Extent with pixel units. |
|
Extent(int value,
int units)
Creates a new Extent. |
|
| Method Summary | |
static Extent |
add(Extent a,
Extent b)
Adds one Extent to another, returning the sum as a new
Extent. |
int |
compareTo(java.lang.Object o)
|
boolean |
equals(java.lang.Object o)
|
int |
getUnits()
Returns the units of the Extent. |
int |
getValue()
Returns the value of the Extent. |
boolean |
isComparableTo(Extent that)
Determines whether this Extent can be compared to another
Extent to determine which is a greater length. |
boolean |
isEnglish()
Determines if the Extent has English units, i.e., the
units are of type IN (inches), PC (picas), or
PT (points). |
boolean |
isPercentage()
Determines if the Extent has percentage-based units. |
boolean |
isPrint()
Determines if this Extent has 'print' based units, i.e.,
the units are in real dimensions, such as SI or English values, rather
than screen-based units such as pixels or percentages. |
boolean |
isSI()
Determines if the Extent has SI (Metric) units, i.e., the
units are of type MM (millimeters) or CM
(centimeters). |
int |
toMm()
Returns the value of the extent in millimeters. |
int |
toPoint()
Returns the value of the extent in points. |
java.lang.String |
toString()
Returns a string describing the state of the Extent. |
static void |
validate(Extent value,
int validUnits)
Validates that the specified Extent is acceptable for use
in a particular environment, by ensuring that its units are of a
supported type. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int PX
public static final int PERCENT
public static final int PT
public static final int CM
public static final int MM
public static final int IN
public static final int EM
public static final int EX
public static final int PC
| Constructor Detail |
public Extent(int value)
Extent with pixel units.
value - the value of the extent in pixels
public Extent(int value,
int units)
Extent.
value - the value of the extentunits - the units of the value, one of the following constants:
PC: PixelsPERCENT: Percent (of size of containing
component)PT: PointsCM: CentimetersMM: MillimetersIN: InchesEM: Ems (height of 'M' character)EX: Exs (height of 'x' character)PC: Picas| Method Detail |
public static Extent add(Extent a,
Extent b)
Extent to another, returning the sum as a new
Extent. Null is returned if the Extents have
incompatible units. If either provided Extent is null, the
other is returned.
a - the first Extentb - the second Extent
Extents, if calculable
public static void validate(Extent value,
int validUnits)
Extent is acceptable for use
in a particular environment, by ensuring that its units are of a
supported type.
value - the Extent to validatevalidUnits - a bitmask containing one or more of the unit constants
(multiple unit constants may be ORed together)
java.lang.IllegalArgumentException - if the Extent is invalidpublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.ComparableComparable.compareTo(java.lang.Object)public boolean equals(java.lang.Object o)
Object.equals(java.lang.Object)public int getValue()
Extent.
Extentpublic int getUnits()
Extent.
Extent, one of the following
constants:
PC: PixelsPERCENT: Percent (of size of containing
component)PT: PointsCM: CentimetersMM: MillimetersIN: InchesEM: Ems (height of 'M' character)EX: Exs (height of 'x' character)PC: Picaspublic boolean isComparableTo(Extent that)
Extent can be compared to another
Extent to determine which is a greater length.
that - the Extent to test comparability to
Extents can be comparedpublic boolean isEnglish()
Extent has English units, i.e., the
units are of type IN (inches), PC (picas), or
PT (points).
Extent has English unitspublic boolean isSI()
Extent has SI (Metric) units, i.e., the
units are of type MM (millimeters) or CM
(centimeters).
Extent has SI unitspublic boolean isPercentage()
Extent has percentage-based units.
Extent has percentage-based unitspublic boolean isPrint()
Extent has 'print' based units, i.e.,
the units are in real dimensions, such as SI or English values, rather
than screen-based units such as pixels or percentages.
Extent has 'print' based unitspublic int toMm()
java.lang.IllegalStateException - if the value cannot be returned in
millimeters.
Verify that isPrint() returns true to avoid
potentially receiving this exception.public int toPoint()
java.lang.IllegalStateException - if the value cannot be returned in points
(verify that isPrint() returns true to avoid
potentially receiving this exception).public java.lang.String toString()
Object.toString()
|
NextApp Echo2 v2.1.0.rc2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||