public class OMSVGLength
extends com.google.gwt.core.client.JavaScriptObject
OMSVGLength
interface corresponds to
the <length> basic data type.
An OMSVGLength
object
can be designated as read only, which means that attempts to modify
the object will result in an exception being thrown, as described below.
Modifier and Type | Field and Description |
---|---|
static short |
SVG_LENGTHTYPE_CM
A value was specified using the cm units defined in CSS2.
|
static short |
SVG_LENGTHTYPE_EMS
A value was specified using the em units defined in CSS2.
|
static short |
SVG_LENGTHTYPE_EXS
A value was specified using the ex units defined in CSS2.
|
static short |
SVG_LENGTHTYPE_IN
A value was specified using the in units defined in CSS2.
|
static short |
SVG_LENGTHTYPE_MM
A value was specified using the mm units defined in CSS2.
|
static short |
SVG_LENGTHTYPE_NUMBER
No unit type was provided (i.e., a unitless value was specified), which
indicates a value in user units.
|
static short |
SVG_LENGTHTYPE_PC
A value was specified using the pc units defined in CSS2.
|
static short |
SVG_LENGTHTYPE_PERCENTAGE
A percentage value was specified.
|
static short |
SVG_LENGTHTYPE_PT
A value was specified using the pt units defined in CSS2.
|
static short |
SVG_LENGTHTYPE_PX
A value was specified using the px units defined in CSS2.
|
static short |
SVG_LENGTHTYPE_UNKNOWN
The unit type is not one of predefined unit types.
|
Modifier | Constructor and Description |
---|---|
protected |
OMSVGLength() |
Modifier and Type | Method and Description |
---|---|
static com.google.gwt.dom.client.Style.Unit |
codeToUnit(short unit)
Converts an SVG length constant to
a
Style.Unit enum. |
void |
convertToSpecifiedUnits(short unitType)
Preserve the same underlying stored value, but reset the stored unit identifier
to the given unitType.
|
void |
convertToSpecifiedUnits(com.google.gwt.dom.client.Style.Unit unitType)
Preserve the same underlying stored value, but reset the stored unit identifier
to the given unitType.
|
com.google.gwt.dom.client.Style.Unit |
getUnit()
Returns the type of the value as defined by the
Style.Unit enum. |
short |
getUnitType()
The type of the value as specified by one of the SVG_LENGTHTYPE_ constants
defined on this interface.
|
float |
getValue()
The value as a floating point value, in user units.
|
String |
getValueAsString()
The value as a string value, in the units expressed by
getUnitType() . |
float |
getValueInSpecifiedUnits()
The value as a floating point value, in the units expressed by
getUnitType() . |
float |
getValueInSpecifiedUnits(short unitType)
The value as a floating point value, in the units expressed by the given unitType.
|
float |
getValueInSpecifiedUnits(com.google.gwt.dom.client.Style.Unit unitType)
The value as a floating point value, in the units expressed by the given unitType.
|
void |
newValueSpecifiedUnits(short unitType,
float valueInSpecifiedUnits)
Reset the value as a number with an associated
getUnitType() ,
thereby replacing the values for all of the attributes on the object. |
void |
newValueSpecifiedUnits(com.google.gwt.dom.client.Style.Unit unitType,
float valueInSpecifiedUnits)
Reset the value as a number with an associated
getUnitType() ,
thereby replacing the values for all of the attributes on the object. |
void |
setValue(float value)
The value as a floating point value, in user units.
|
void |
setValueAsString(String value)
The value as a string value, in the units expressed by
getUnitType() . |
void |
setValueInSpecifiedUnits(float value)
The value as a floating point value, in the units expressed by
getUnitType() . |
static short |
unitToCode(com.google.gwt.dom.client.Style.Unit unit)
Converts a
Style.Unit enum to an
SVG length constant. |
public static final short SVG_LENGTHTYPE_UNKNOWN
public static final short SVG_LENGTHTYPE_NUMBER
public static final short SVG_LENGTHTYPE_PERCENTAGE
public static final short SVG_LENGTHTYPE_EMS
public static final short SVG_LENGTHTYPE_EXS
public static final short SVG_LENGTHTYPE_PX
public static final short SVG_LENGTHTYPE_CM
public static final short SVG_LENGTHTYPE_MM
public static final short SVG_LENGTHTYPE_IN
public static final short SVG_LENGTHTYPE_PT
public static final short SVG_LENGTHTYPE_PC
public final short getUnitType()
public final float getValue()
getValueInSpecifiedUnits()
and getValueAsString()
to be
updated automatically to reflect this setting.public final void setValue(float value) throws com.google.gwt.core.client.JavaScriptException
getValueInSpecifiedUnits()
and getValueAsString()
to be
updated automatically to reflect this setting.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the length
corresponds to a read only attribute
or when the object itself is read only.com.google.gwt.core.client.JavaScriptException
public final float getValueInSpecifiedUnits()
getUnitType()
.
Setting this attribute will cause getValue()
and getValueAsString()
to be
updated automatically to reflect this setting.public final void setValueInSpecifiedUnits(float value) throws com.google.gwt.core.client.JavaScriptException
getUnitType()
.
Setting this attribute will cause getValue()
and getValueAsString()
to be
updated automatically to reflect this setting.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the length
corresponds to a read only attribute
or when the object itself is read only.com.google.gwt.core.client.JavaScriptException
public final String getValueAsString()
getUnitType()
.
Setting this attribute will cause getValue()
,
getValueInSpecifiedUnits()
and
getUnitType()
to be updated
automatically to reflect this setting.public final void setValueAsString(String value) throws com.google.gwt.core.client.JavaScriptException
getUnitType()
.
Setting this attribute will cause getValue()
,
getValueInSpecifiedUnits()
and
getUnitType()
to be updated
automatically to reflect this setting.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the length
corresponds to a read only attribute
or when the object itself is read only.DOMException(SYNTAX_ERR)
- Raised if the assigned string cannot
be parsed as a valid <length>
.com.google.gwt.core.client.JavaScriptException
public final void newValueSpecifiedUnits(short unitType, float valueInSpecifiedUnits) throws com.google.gwt.core.client.JavaScriptException
getUnitType()
,
thereby replacing the values for all of the attributes on the object.unitType
- The unit type for the value (e.g., SVG_LENGTHTYPE_MM
).valueInSpecifiedUnits
- The new value.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the length
corresponds to a read only attribute
or when the object itself is read only.DOMException(NOT_SUPPORTED_ERR)
- Raised if unitType is SVG_LENGTHTYPE_UNKNOWN
or not a valid unit type constant (one of the other SVG_LENGTHTYPE_ constants
defined on this interface).com.google.gwt.core.client.JavaScriptException
public final void convertToSpecifiedUnits(short unitType) throws com.google.gwt.core.client.JavaScriptException
getUnitType()
,
getValueInSpecifiedUnits()
and
getValueAsString()
might be
modified as a result of this method. For example, if the original value
were "0.5cm" and the method was invoked to convert to millimeters, then
the getUnitType()
would be changed
to SVG_LENGTHTYPE_MM
, getValueInSpecifiedUnits()
would be changed to the numeric value 5 and getValueAsString()
would be changed to "5mm".unitType
- The unit type to switch to (e.g., SVG_LENGTHTYPE_MM
).DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the length
corresponds to a read only attribute
or when the object itself is read only.DOMException(NOT_SUPPORTED_ERR)
- Raised if unitType is SVG_LENGTHTYPE_UNKNOWN
or not a valid unit type constant (one of the other SVG_LENGTHTYPE_ constants
defined on this interface).com.google.gwt.core.client.JavaScriptException
public static final short unitToCode(com.google.gwt.dom.client.Style.Unit unit)
Style.Unit
enum to an
SVG length constant.public static final com.google.gwt.dom.client.Style.Unit codeToUnit(short unit)
Style.Unit
enum.Style.Unit
enum.public final com.google.gwt.dom.client.Style.Unit getUnit()
Style.Unit
enum.public final void newValueSpecifiedUnits(com.google.gwt.dom.client.Style.Unit unitType, float valueInSpecifiedUnits) throws com.google.gwt.core.client.JavaScriptException
getUnitType()
,
thereby replacing the values for all of the attributes on the object.unitType
- The unit type for the value.valueInSpecifiedUnits
- The new value.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the length
corresponds to a read only attribute
or when the object itself is read only.DOMException(NOT_SUPPORTED_ERR)
- Raised if unitType is SVG_LENGTHTYPE_UNKNOWN
or not a valid unit type constant (one of the other SVG_LENGTHTYPE_ constants
defined on this interface).com.google.gwt.core.client.JavaScriptException
public final void convertToSpecifiedUnits(com.google.gwt.dom.client.Style.Unit unitType) throws com.google.gwt.core.client.JavaScriptException
getUnitType()
,
getValueInSpecifiedUnits()
and
getValueAsString()
might be
modified as a result of this method. For example, if the original value
were "0.5cm" and the method was invoked to convert to millimeters, then
the getUnitType()
would be changed
to SVG_LENGTHTYPE_MM
, getValueInSpecifiedUnits()
would be changed to the numeric value 5 and getValueAsString()
would be changed to "5mm".unitType
- The unit type to switch to.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised when the length
corresponds to a read only attribute
or when the object itself is read only.DOMException(NOT_SUPPORTED_ERR)
- Raised if unitType is SVG_LENGTHTYPE_UNKNOWN
or not a valid unit type constant (one of the other SVG_LENGTHTYPE_ constants
defined on this interface).com.google.gwt.core.client.JavaScriptException
public final float getValueInSpecifiedUnits(com.google.gwt.dom.client.Style.Unit unitType)
unitType
- The unit type to use to express the value.public final float getValueInSpecifiedUnits(short unitType)
unitType
- The unit type to use to express the value.Copyright © 2018. All Rights Reserved.