Package net.miginfocom.layout
Class UnitValue
java.lang.Object
net.miginfocom.layout.UnitValue
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
An operation indicating a addition of two sub units.static final int
A unit indicating alignment.static final int
A unit indicating botton size.static final int
A unit indicating centimeters.static final int
An operation indicating a division of two sub units.static final int
A unit indicating inches.static final int
A unit indicating label alignment.static final int
A unit indicating linking to height.static final int
A unit indicating linking to width.static final int
A unit indicating linking to x.static final int
A unit indicating linking to x2.static final int
A unit indicating linking to x position on screen.static final int
A unit indicating linking to y.static final int
A unit indicating linking to y2.static final int
A unit indicating linking to y position on screen.static final int
A unit indicating a lookup.static final int
A unit indicating logical horizontal pixels.static final int
A unit indicating logical vertical pixels.static final int
An operation indicating the maximum of two sub unitsstatic final int
A unit indicating maximum size.static final int
An operation indicating the middle value of two sub unitsstatic final int
An operation indicating the minimum of two sub unitsstatic final int
A unit indicating minimum size.static final int
A unit indicating millimeters.static final int
An operation indicating a multiplication of two sub units.static final int
A unit indicating percent.static final int
A unit indicating pixels.static final int
A unit indicating preferred size.static final int
A unit indicating points.static final int
A unit indicating screen percentage width.static final int
A unit indicating screen percentage height.static final int
An operation indicating a static value.static final int
An operation indicating a subtraction of two sub units -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Adds a global unit converter that can convert from someunit
to pixels.final String
Returns the creation string for this object.static int
Deprecated.static UnitConverter[]
Returns the global converters currently registered.final int
final int
getPixels
(float refValue, ContainerWrapper parent, ComponentWrapper comp) Returns the size in pixels rounded.final float
getPixelsExact
(float refValue, ContainerWrapper parent, ComponentWrapper comp) Returns the size in pixels.final UnitValue[]
final int
getUnit()
final String
final float
getValue()
final int
hashCode()
final boolean
static boolean
Removed the converter.static void
setDefaultUnit
(int unit) Deprecated.final String
toString()
-
Field Details
-
STATIC
public static final int STATICAn operation indicating a static value.- See Also:
-
ADD
public static final int ADDAn operation indicating a addition of two sub units.- See Also:
-
SUB
public static final int SUBAn operation indicating a subtraction of two sub units- See Also:
-
MUL
public static final int MULAn operation indicating a multiplication of two sub units.- See Also:
-
DIV
public static final int DIVAn operation indicating a division of two sub units.- See Also:
-
MIN
public static final int MINAn operation indicating the minimum of two sub units- See Also:
-
MAX
public static final int MAXAn operation indicating the maximum of two sub units- See Also:
-
MID
public static final int MIDAn operation indicating the middle value of two sub units- See Also:
-
PIXEL
public static final int PIXELA unit indicating pixels.- See Also:
-
LPX
public static final int LPXA unit indicating logical horizontal pixels.- See Also:
-
LPY
public static final int LPYA unit indicating logical vertical pixels.- See Also:
-
MM
public static final int MMA unit indicating millimeters.- See Also:
-
CM
public static final int CMA unit indicating centimeters.- See Also:
-
INCH
public static final int INCHA unit indicating inches.- See Also:
-
PERCENT
public static final int PERCENTA unit indicating percent.- See Also:
-
PT
public static final int PTA unit indicating points.- See Also:
-
SPX
public static final int SPXA unit indicating screen percentage width.- See Also:
-
SPY
public static final int SPYA unit indicating screen percentage height.- See Also:
-
ALIGN
public static final int ALIGNA unit indicating alignment.- See Also:
-
MIN_SIZE
public static final int MIN_SIZEA unit indicating minimum size.- See Also:
-
PREF_SIZE
public static final int PREF_SIZEA unit indicating preferred size.- See Also:
-
MAX_SIZE
public static final int MAX_SIZEA unit indicating maximum size.- See Also:
-
BUTTON
public static final int BUTTONA unit indicating botton size.- See Also:
-
LINK_X
public static final int LINK_XA unit indicating linking to x.- See Also:
-
LINK_Y
public static final int LINK_YA unit indicating linking to y.- See Also:
-
LINK_W
public static final int LINK_WA unit indicating linking to width.- See Also:
-
LINK_H
public static final int LINK_HA unit indicating linking to height.- See Also:
-
LINK_X2
public static final int LINK_X2A unit indicating linking to x2.- See Also:
-
LINK_Y2
public static final int LINK_Y2A unit indicating linking to y2.- See Also:
-
LINK_XPOS
public static final int LINK_XPOSA unit indicating linking to x position on screen.- See Also:
-
LINK_YPOS
public static final int LINK_YPOSA unit indicating linking to y position on screen.- See Also:
-
LOOKUP
public static final int LOOKUPA unit indicating a lookup.- See Also:
-
LABEL_ALIGN
public static final int LABEL_ALIGNA unit indicating label alignment.- See Also:
-
-
Constructor Details
-
UnitValue
public UnitValue(float value) -
UnitValue
-
-
Method Details
-
getPixels
Returns the size in pixels rounded.- Parameters:
refValue
- The reference value. Normally the size of the parent. For unitALIGN
the current size of the component should be sent in.parent
- The parent. May benull
for testing the validity of the value, but should normally not and are not required to return any usable value ifnull
.comp
- The component, if any, that the value is for. Might benull
if the value is not connected to any component.- Returns:
- The size in pixels.
-
getPixelsExact
Returns the size in pixels.- Parameters:
refValue
- The reference value. Normally the size of the parent. For unitALIGN
the current size of the component should be sent in.parent
- The parent. May benull
for testing the validity of the value, but should normally not and are not required to return any usable value ifnull
.comp
- The component, if any, that the value is for. Might benull
if the value is not connected to any component.- Returns:
- The size in pixels.
-
getSubUnits
-
getUnit
public final int getUnit() -
getUnitString
-
getOperation
public final int getOperation() -
getValue
public final float getValue() -
isHorizontal
public final boolean isHorizontal() -
toString
-
getConstraintString
Returns the creation string for this object. Note thatLayoutUtil.setDesignTime(ContainerWrapper, boolean)
must be set totrue
for the creation strings to be stored.- Returns:
- The constraint string or
null
if none is registered.
-
hashCode
public final int hashCode() -
addGlobalUnitConverter
Adds a global unit converter that can convert from someunit
to pixels.This converter will be asked before the platform converter so the values for it (e.g. "related" and "unrelated") can be overridden. It is however not possible to override the built in ones (e.g. "mm", "pixel" or "lp").
- Parameters:
conv
- The converter. Notnull
.
-
removeGlobalUnitConverter
Removed the converter.- Parameters:
unit
- The converter.- Returns:
- If there was a converter found and thus removed.
-
getGlobalUnitConverters
Returns the global converters currently registered. The platform converter will not be in this list.- Returns:
- The converters. Never
null
.
-
getDefaultUnit
public static int getDefaultUnit()Deprecated.Returns the current default unit. The default unit is the unit used if no unit is set. E.g. "width 10".- Returns:
- The current default unit.
- See Also:
-
setDefaultUnit
public static void setDefaultUnit(int unit) Deprecated.Sets the default unit. The default unit is the unit used if no unit is set. E.g. "width 10".- Parameters:
unit
- The new default unit.- See Also:
-
PlatformDefaults.getDefaultHorizontalUnit()
andPlatformDefaults.getDefaultVerticalUnit()
instead.