Package org.xhtmlrenderer.css.sheet
Class PropertyDeclaration
- java.lang.Object
-
- org.xhtmlrenderer.css.sheet.PropertyDeclaration
-
public class PropertyDeclaration extends java.lang.Object
Represents a single property declared in a CSS rule set. A PropertyDeclaration is created from an CSSValue and is immutable. The declaration knows its origin, importance and specificity, and thus is prepared to be sorted out among properties of the same name, within a matched group, for the CSS cascade, into aCascadedStyle
.- Author:
- Torbjörn Gannholm, Patrick Wright
-
-
Field Summary
Fields Modifier and Type Field Description static int
IMPORTANCE_AND_ORIGIN_COUNT
ImportanceAndOrigin of stylesheet - how many different
-
Constructor Summary
Constructors Constructor Description PropertyDeclaration(CSSName cssName, org.w3c.dom.css.CSSPrimitiveValue value, boolean imp, int orig)
Creates a new instance of PropertyDeclaration from anCSSPrimitiveValue
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IdentValue
asIdentValue()
Description of the MethodCSSName
getCSSName()
Gets the cSSName attribute of the PropertyDeclaration objectjava.lang.String
getDeclarationStandardText()
java.lang.String
getFingerprint()
int
getImportanceAndOrigin()
Returns an int representing the combined origin and importance of the property as declared.int
getOrigin()
java.lang.String
getPropertyName()
Returns the CSS name of this property, e.g.org.w3c.dom.css.CSSPrimitiveValue
getValue()
Returns the specifiedCSSValue
for this property.boolean
isImportant()
java.lang.String
toString()
Converts to a String representation of the object.
-
-
-
Field Detail
-
IMPORTANCE_AND_ORIGIN_COUNT
public static final int IMPORTANCE_AND_ORIGIN_COUNT
ImportanceAndOrigin of stylesheet - how many different- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PropertyDeclaration
public PropertyDeclaration(CSSName cssName, org.w3c.dom.css.CSSPrimitiveValue value, boolean imp, int orig)
Creates a new instance of PropertyDeclaration from anCSSPrimitiveValue
instance.- Parameters:
cssName
-value
- The CSSValue to wrapimp
- True if property was declared important! and false if not.orig
- int constant fromStylesheet
for the origin of the property declaration, that is, the origin of the style sheet where it was declared. SeeStylesheetInfo.USER_AGENT
,StylesheetInfo.USER
, andStylesheetInfo.AUTHOR
.
-
-
Method Detail
-
toString
public java.lang.String toString()
Converts to a String representation of the object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the object.
-
asIdentValue
public IdentValue asIdentValue()
Description of the Method- Returns:
- Returns
-
getDeclarationStandardText
public java.lang.String getDeclarationStandardText()
-
getFingerprint
public java.lang.String getFingerprint()
-
getImportanceAndOrigin
public int getImportanceAndOrigin()
Returns an int representing the combined origin and importance of the property as declared. The int is assigned such that default origin and importance is 0, and highest an important! property defined by the user (origin is Stylesheet.USER). The combined value would allow this property to be sequenced in the CSS cascade along with other properties matched to the same element with the same property name. In that sort, the highest sequence number returned from this method would take priority in the cascade, so that a user important! property would override a user non-important! property, and so on. The actual integer value returned by this method is unimportant, but has a lowest value of 0 and increments sequentially by 1 for each increase in origin/importance..- Returns:
- See method javadoc.
-
getPropertyName
public java.lang.String getPropertyName()
Returns the CSS name of this property, e.g. "font-family".- Returns:
- See desc.
-
getCSSName
public CSSName getCSSName()
Gets the cSSName attribute of the PropertyDeclaration object- Returns:
- The cSSName value
-
getValue
public org.w3c.dom.css.CSSPrimitiveValue getValue()
Returns the specifiedCSSValue
for this property. Specified means the value as entered by the user. Modifying the CSSValue returned here will result in indeterminate behavior--consider it immutable.- Returns:
- See desc.
-
isImportant
public boolean isImportant()
-
getOrigin
public int getOrigin()
-
-