Package com.openhtmltopdf.css.sheet
Class PropertyDeclaration
java.lang.Object
com.openhtmltopdf.css.sheet.PropertyDeclaration
- Direct Known Subclasses:
InvalidPropertyDeclaration
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 a
CascadedStyle
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private IdentValue
Description of the Fieldprivate static final int
ImportanceAndOrigin of stylesheet - author importantprivate static final int
ImportanceAndOrigin of stylesheet - author normalprivate CSSName
Description of the Fieldprivate CSSPrimitiveValue
Description of the Fieldprivate boolean
Description of the Fieldstatic final int
ImportanceAndOrigin of stylesheet - how many differentprivate boolean
Whether the property was declared as important! by the user.private int
Origin constant from the list defined inStylesheet
.private static final int
ImportanceAndOrigin of stylesheet - user agentprivate static final int
ImportanceAndOrigin of stylesheet - user importantprivate static final int
ImportanceAndOrigin of stylesheet - user normal -
Constructor Summary
ConstructorsConstructorDescriptionPropertyDeclaration
(CSSName cssName, CSSPrimitiveValue value, boolean imp, int orig) Creates a new instance of PropertyDeclaration from anCSSPrimitiveValue
instance. -
Method Summary
Modifier and TypeMethodDescriptionDescription of the MethodGets the cSSName attribute of the PropertyDeclaration objectint
Returns an int representing the combined origin and importance of the property as declared.int
Returns the CSS name of this property, e.g.getValue()
Returns the specifiedCSSValue
for this property.boolean
void
toCSS
(StringBuilder sb) toString()
Converts to a String representation of the object.
-
Field Details
-
cssName
Description of the Field -
cssPrimitiveValue
Description of the Field -
important
private boolean importantWhether the property was declared as important! by the user. -
origin
private int originOrigin constant from the list defined inStylesheet
. Seeinvalid reference
Stylesheet#USER_AGENT
StylesheetInfo.USER
, andinvalid reference
Stylesheet#AUTHOR
-
_identVal
Description of the Field -
identIsSet
private boolean identIsSetDescription of the Field -
_fingerprint
-
IMPORTANCE_AND_ORIGIN_COUNT
public static final int IMPORTANCE_AND_ORIGIN_COUNTImportanceAndOrigin of stylesheet - how many different- See Also:
-
USER_AGENT
private static final int USER_AGENTImportanceAndOrigin of stylesheet - user agent- See Also:
-
USER_NORMAL
private static final int USER_NORMALImportanceAndOrigin of stylesheet - user normal- See Also:
-
AUTHOR_NORMAL
private static final int AUTHOR_NORMALImportanceAndOrigin of stylesheet - author normal- See Also:
-
AUTHOR_IMPORTANT
private static final int AUTHOR_IMPORTANTImportanceAndOrigin of stylesheet - author important- See Also:
-
USER_IMPORTANT
private static final int USER_IMPORTANTImportanceAndOrigin of stylesheet - user important- See Also:
-
-
Constructor Details
-
PropertyDeclaration
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 Details
-
toString
Converts to a String representation of the object. -
asIdentValue
Description of the Method- Returns:
- Returns
-
getDeclarationStandardText
-
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
Returns the CSS name of this property, e.g. "font-family".- Returns:
- See desc.
-
getCSSName
Gets the cSSName attribute of the PropertyDeclaration object- Returns:
- The cSSName value
-
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() -
toCSS
-