Top Description Fields Constructors Methods
com.openhtmltopdf.css.sheet

public Class PropertyDeclaration

extends Object
Class Inheritance
Known Direct Subclasses
com.openhtmltopdf.css.sheet.InvalidPropertyDeclaration
Imports
com.openhtmltopdf.css.constants.CSSName, .IdentValue, com.openhtmltopdf.css.parser.CSSPrimitiveValue, .CSSValue, .PropertyValue

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 com.openhtmltopdf.css.newmatch.CascadedStyle.
Authors
Torbjoern Gannholm, Patrick Wright

Field Summary

Modifier and TypeField and Description
private String
private IdentValue
_identVal

Description of the Field

private static final int
AUTHOR_IMPORTANT

ImportanceAndOrigin of stylesheet - author important

private static final int
AUTHOR_NORMAL

ImportanceAndOrigin of stylesheet - author normal

private CSSName
cssName

Description of the Field

private CSSPrimitiveValue
cssPrimitiveValue

Description of the Field

private boolean
identIsSet

Description of the Field

public static final int
IMPORTANCE_AND_ORIGIN_COUNT

ImportanceAndOrigin of stylesheet - how many different

private boolean
important

Whether the property was declared as important!

private int
origin

Origin constant from the list defined in Stylesheet.

private static final int
USER_AGENT

ImportanceAndOrigin of stylesheet - user agent

private static final int
USER_IMPORTANT

ImportanceAndOrigin of stylesheet - user important

private static final int
USER_NORMAL

ImportanceAndOrigin of stylesheet - user normal

Constructor Summary

AccessConstructor and Description
public
PropertyDeclaration(CSSName cssName, CSSPrimitiveValue
The CSSValue to wrap
value
,
boolean
True if property was declared important! and false if not.
imp
,
int
int constant from Stylesheet for the origin of the property declaration, that is, the origin of the style sheet where it was declared. See StylesheetInfo#USER_AGENT, StylesheetInfo#USER, and StylesheetInfo#AUTHOR.
orig
)

Creates a new instance of PropertyDeclaration from an CSSPrimitiveValue instance.

Method Summary

Modifier and TypeMethod and Description
public IdentValue

Returns:

Returns
asIdentValue
()

Description of the Method

public CSSName

Returns:

The cSSName value
getCSSName
()

Gets the cSSName attribute of the PropertyDeclaration object

public String
public String
public int

Returns:

See method javadoc.
getImportanceAndOrigin
()

Returns an int representing the combined origin and importance of the property as declared.

public int
public String

Returns:

See desc.
getPropertyName
()

Returns the CSS name of this property, e.g. "font-family".

public CSSPrimitiveValue

Returns:

See desc.
getValue
()

Returns the specified CSSValue for this property.

public boolean
public void
public String

Returns:

A string representation of the object.
toString
()

Overrides java.lang.Object.toString.

Converts to a String representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_fingerprintback to summary
private String _fingerprint
_identValback to summary
private IdentValue _identVal

Description of the Field

AUTHOR_IMPORTANTback to summary
private static final int AUTHOR_IMPORTANT

ImportanceAndOrigin of stylesheet - author important

AUTHOR_NORMALback to summary
private static final int AUTHOR_NORMAL

ImportanceAndOrigin of stylesheet - author normal

cssNameback to summary
private CSSName cssName

Description of the Field

cssPrimitiveValueback to summary
private CSSPrimitiveValue cssPrimitiveValue

Description of the Field

identIsSetback to summary
private boolean identIsSet

Description of the Field

IMPORTANCE_AND_ORIGIN_COUNTback to summary
public static final int IMPORTANCE_AND_ORIGIN_COUNT

ImportanceAndOrigin of stylesheet - how many different

importantback to summary
private boolean important

Whether the property was declared as important! by the user.

originback to summary
private int origin

Origin constant from the list defined in Stylesheet. See Stylesheet#USER_AGENT, StylesheetInfo#USER, and Stylesheet#AUTHOR.

USER_AGENTback to summary
private static final int USER_AGENT

ImportanceAndOrigin of stylesheet - user agent

USER_IMPORTANTback to summary
private static final int USER_IMPORTANT

ImportanceAndOrigin of stylesheet - user important

USER_NORMALback to summary
private static final int USER_NORMAL

ImportanceAndOrigin of stylesheet - user normal

Constructor Detail

PropertyDeclarationback to summary
public PropertyDeclaration(CSSName cssName, CSSPrimitiveValue value, boolean imp, int orig)

Creates a new instance of PropertyDeclaration from an CSSPrimitiveValue instance.

Parameters
value:CSSPrimitiveValue

The CSSValue to wrap

imp:boolean

True if property was declared important! and false if not.

orig:int

int constant from Stylesheet for the origin of the property declaration, that is, the origin of the style sheet where it was declared. See StylesheetInfo#USER_AGENT, StylesheetInfo#USER, and StylesheetInfo#AUTHOR.

Method Detail

asIdentValueback to summary
public IdentValue asIdentValue()

Description of the Method

Returns:IdentValue

Returns

getCSSNameback to summary
public CSSName getCSSName()

Gets the cSSName attribute of the PropertyDeclaration object

Returns:CSSName

The cSSName value

getDeclarationStandardTextback to summary
public String getDeclarationStandardText()
getFingerprintback to summary
public String getFingerprint()
getImportanceAndOriginback to summary
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:int

See method javadoc.

getOriginback to summary
public int getOrigin()
getPropertyNameback to summary
public String getPropertyName()

Returns the CSS name of this property, e.g. "font-family".

Returns:String

See desc.

getValueback to summary
public CSSPrimitiveValue getValue()

Returns the specified CSSValue 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:CSSPrimitiveValue

See desc.

isImportantback to summary
public boolean isImportant()
toCSSback to summary
public void toCSS(StringBuilder sb)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Converts to a String representation of the object.

Returns:String

A string representation of the object.

Annotations
@Override