org.w3c.dom.css
Interface CSS2BackgroundPosition

All Superinterfaces:
CSSValue

public interface CSS2BackgroundPosition
extends CSSValue

The CSS2BackgroundPosition interface represents the background-position CSS Level 2 property.

For this extension of the CSSValue interface, the valueType attribute of the underlying CSSValue interface shall be CSS_CUSTOM .

See also the Document Object Model (DOM) Level 2 Specification.

Since:
DOM Level 2

Fields inherited from interface org.w3c.dom.css.CSSValue
CSS_CUSTOM, CSS_INHERIT, CSS_PRIMITIVE_VALUE, CSS_VALUE_LIST
 
Method Summary
 java.lang.String getHorizontalIdentifier()
          If horizontalType is CSS_IDENT or CSS_INHERIT , this attribute contains the string representation of the ident, otherwise it contains an empty string.
 float getHorizontalPosition(float hType)
          This method is used to get the float value in a specified unit if the horizontalPosition represents a length or a percentage.
 short getHorizontalType()
          A code defining the type of the horizontal value.
 java.lang.String getVerticalIdentifier()
          If verticalType is CSS_IDENT or CSS_INHERIT , this attribute contains the string representation of the ident, otherwise it contains an empty string.
 float getVerticalPosition(float vType)
          This method is used to get the float value in a specified unit if the verticalPosition represents a length or a percentage.
 short getVerticalType()
          A code defining the type of the horizontal value.
 void setHorizontalPosition(short hType, float value)
          This method is used to set the horizontal position with a specified unit.
 void setPositionIdentifier(java.lang.String hIdentifier, java.lang.String vIdentifier)
          Sets the identifiers.
 void setVerticalPosition(short vType, float value)
          This method is used to set the vertical position with a specified unit.
 
Methods inherited from interface org.w3c.dom.css.CSSValue
getCssText, getCssValueType, setCssText
 

Method Detail

getHorizontalType

public short getHorizontalType()
A code defining the type of the horizontal value. It would be one of CSS_PERCENTAGE , CSS_EMS , CSS_EXS , CSS_PX , CSS_CM , CSS_MM , CSS_IN , CSS_PT , CSS_PC or CSS_IDENT . If one of horizontal or vertical is CSS_IDENT , it's guaranteed that the other is the same.

getVerticalType

public short getVerticalType()
A code defining the type of the horizontal value. The code can be one of the following units : CSS_PERCENTAGE , CSS_EMS , CSS_EXS , CSS_PX , CSS_CM , CSS_MM , CSS_IN , CSS_PT , CSS_PC , CSS_IDENT , CSS_INHERIT . If one of horizontal or vertical is CSS_IDENT or CSS_INHERIT , it's guaranteed that the other is the same.

getHorizontalIdentifier

public java.lang.String getHorizontalIdentifier()
If horizontalType is CSS_IDENT or CSS_INHERIT , this attribute contains the string representation of the ident, otherwise it contains an empty string.

getVerticalIdentifier

public java.lang.String getVerticalIdentifier()
If verticalType is CSS_IDENT or CSS_INHERIT , this attribute contains the string representation of the ident, otherwise it contains an empty string. The value is "center" if only the horizontalIdentifier has been set.

getHorizontalPosition

public float getHorizontalPosition(float hType)
                            throws DOMException
This method is used to get the float value in a specified unit if the horizontalPosition represents a length or a percentage. If the float doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised.
Parameters:
hType - The horizontal unit.
Returns:
The float value.
Throws:
DOMException - INVALID_ACCESS_ERR: Raised if the property doesn't contain a float or the value can't be converted.

getVerticalPosition

public float getVerticalPosition(float vType)
                          throws DOMException
This method is used to get the float value in a specified unit if the verticalPosition represents a length or a percentage. If the float doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised. The value is 50% if only the horizontal value has been specified.
Parameters:
vType - The vertical unit.
Returns:
The float value.
Throws:
DOMException - INVALID_ACCESS_ERR: Raised if the property doesn't contain a float or the value can't be converted.

setHorizontalPosition

public void setHorizontalPosition(short hType,
                                  float value)
                           throws DOMException
This method is used to set the horizontal position with a specified unit. If the vertical value is not a percentage or a length, it sets the vertical position to 50% .
Parameters:
hType - The specified unit (a length or a percentage).
value - The new value.
Throws:
DOMException - INVALID_ACCESS_ERR: Raised if the specified unit is not a length or a percentage.
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.

setVerticalPosition

public void setVerticalPosition(short vType,
                                float value)
                         throws DOMException
This method is used to set the vertical position with a specified unit. If the horizontal value is not a percentage or a length, it sets the vertical position to 50% .
Parameters:
vType - The specified unit (a length or a percentage).
value - The new value.
Throws:
DOMException - INVALID_ACCESS_ERR: Raised if the specified unit is not a length or a percentage.
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.

setPositionIdentifier

public void setPositionIdentifier(java.lang.String hIdentifier,
                                  java.lang.String vIdentifier)
                           throws DOMException
Sets the identifiers. If the second identifier is the empty string, the vertical identifier is set to its default value ( "center" ).
Parameters:
hIdentifier - The new horizontal identifier.
vIdentifier - The new vertical identifier.
Throws:
DOMException - SYNTAX_ERR: Raised if the identifiers have a syntax error and are unparsable.
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.

Source code is GPL'd at http://xmlconf.sourceforge.net.