- All Implemented Interfaces:
- Serializable,- Comparable<Style>
- an optional media condition
- an optional crossorigin attribute
- a disabled attribute
Optimizers should be careful to only group styles that have equivalent constraints.
TODO: Support a "group" (or "position" / "category"?): prelude, main, and coda. "prelude" is before all others (except possibly other prelude). "main" (the default) is the middle. "coda" is after all others (except possibly other coda). It would be an error if the topological sort results in prelude that is not first or coda that is not last. Use "prelude" for "html5.css".
TODO: Support inline styles without URI.
- Author:
- AO Industries, Inc.
- See Also:
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Comparator<Style> Styles start with a default ordering that should minimize the number of explicit ordering declarations: TODO: Review that this is the best default ordering.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic Style.Builderbuilder()intAll concrete implementations of Resource must be comparable to themselves.booleanTwo resources may be compared to see if they are exactly equal, including all relevant attributes.Gets the optional crossorigin policy.Gets the direction for the style.getMedia()Gets the optional media condition.inthashCode()The hash key must be consistent withResource.equals(java.lang.Object).booleanStyle may be disabled by default, then enabled via JavaScript.toString()
- 
Field Details- 
COMPARATORStyles start with a default ordering that should minimize the number of explicit ordering declarations: TODO: Review that this is the best default ordering.- Order by media condition, nulls first
- Order by direction, nulls first
- Order by URI
 Note: The crossorigin policy is not used in ordering. Note: The disabled flag is not used in ordering. All string comparisons are performed via SmartComparator.ROOT.As an example of this ordering, consider the following order would be the default, which we expect will often match the way CSS styles override base definitions: - global.css(no media)
- global-print.css(media="print")
 
 
- 
- 
Constructor Details- 
Stylepublic Style(String href, String media, Style.Direction direction, String crossorigin, boolean disabled) Creates a new style.- Parameters:
- href- See- Resource.getUri()
- media- See- getMedia()
- direction- See- getDirection()
- crossorigin- See- getCrossorigin()
- disabled- See- isDisabled()
 
- 
StyleCreates a new style.- Parameters:
- href- See- Resource.getUri()
 
 
- 
- 
Method Details- 
builder
- 
toString
- 
equalsDescription copied from class:ResourceTwo resources may be compared to see if they are exactly equal, including all relevant attributes.
- 
hashCodepublic int hashCode()Description copied from class:ResourceThe hash key must be consistent withResource.equals(java.lang.Object).
- 
compareToAll concrete implementations of Resource must be comparable to themselves.This default implementation compares by URI only via SmartComparator.ROOT.
- 
getMediaGets the optional media condition.
- 
getDirectionGets the direction for the style. This is matched against the current response language/locale, when know, to selectively include the style.
- 
getCrossoriginGets the optional crossorigin policy.
- 
isDisabledpublic boolean isDisabled()Style may be disabled by default, then enabled via JavaScript.
 
- 

