final class CssStyleHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
CssStyleHelper.CacheContainer |
Modifier and Type | Field and Description |
---|---|
private CssStyleHelper.CacheContainer |
cacheContainer |
private static CssMetaData |
dummyFontProperty |
private Node |
firstStyleableAncestor |
private static PlatformLogger |
LOGGER |
private static java.util.Set<PseudoClass> |
NULL_PSEUDO_CLASS_STATE |
private PseudoClassState |
triggerStates
A Set of all the pseudo-class states which, if they change, need to
cause the Node to be set to UPDATE its CSS styles on the next pulse.
|
Modifier | Constructor and Description |
---|---|
private |
CssStyleHelper() |
Modifier and Type | Method and Description |
---|---|
private CalculatedValue |
calculateValue(CascadingStyle style,
Styleable styleable,
CssMetaData cssMetaData,
StyleMap styleMap,
java.util.Set<PseudoClass> states,
Styleable originatingStyleable,
CalculatedValue fontFromCacheEntry) |
private static boolean |
canReuseStyleHelper(Node node,
StyleMap styleMap) |
(package private) static CssStyleHelper |
createStyleHelper(Node node)
Creates a new StyleHelper.
|
(package private) Font |
deriveFont(Font font,
java.lang.String fontFamily,
FontWeight fontWeight,
FontPosture fontPosture,
double fontSize) |
private static Node |
findFirstStyleableAncestor(Styleable st) |
private java.lang.String |
formatExceptionMessage(Styleable styleable,
CssMetaData cssMetaData,
Style style,
java.lang.Exception e) |
private java.lang.String |
formatUnresolvedLookupMessage(Styleable styleable,
CssMetaData cssMetaData,
Style style,
ParsedValue resolved,
java.lang.ClassCastException cce) |
private CalculatedValue |
getCachedFont(Styleable styleable) |
(package private) java.lang.String |
getFontFamily(Font font) |
(package private) FontPosture |
getFontPosture(Font font) |
(package private) FontWeight |
getFontWeight(Font font) |
private CascadingStyle |
getInheritedStyle(Styleable styleable,
java.lang.String property)
Called when we must getInheritedStyle a value from a parent node in the scenegraph.
|
private void |
getMatchingLookupStyles(Styleable node,
ParsedValue parsedValue,
java.util.List<CascadingStyle> styleList,
boolean matchState) |
(package private) static java.util.Map<<any>,java.util.List<Style>> |
getMatchingStyles(java.util.Map<<any>,java.util.List<Style>> map,
Node node) |
(package private) static java.util.List<Style> |
getMatchingStyles(Styleable styleable,
CssMetaData styleableProperty)
Called from Node NodeHelper.getMatchingStyles
|
private java.util.List<Style> |
getMatchingStyles(Styleable node,
CssMetaData styleableProperty,
boolean matchState) |
private void |
getMatchingStyles(Styleable node,
CssMetaData styleableProperty,
java.util.List<CascadingStyle> styleList,
boolean matchState) |
private CascadingStyle |
getStyle(Styleable styleable,
java.lang.String property,
StyleMap styleMap,
java.util.Set<PseudoClass> states)
Gets the CSS CascadingStyle for the property of this node in these pseudo-class
states.
|
private static CssStyleHelper |
getStyleHelper(Node n) |
private StyleMap |
getStyleMap(Styleable styleable) |
private java.util.Set<PseudoClass>[] |
getTransitionStates(Node node)
Dynamic pseudo-class state of the node and its parents.
|
private java.lang.String |
getUnresolvedLookup(ParsedValue resolved) |
private CalculatedValue |
handleNoStyleFound(Styleable styleable,
CssMetaData cssMetaData,
StyleMap styleMap,
java.util.Set<PseudoClass> pseudoClassStates,
Styleable originatingStyleable,
CalculatedValue cachedFont)
Called when there is no style found.
|
private static boolean |
isTrue(<any> booleanProperty) |
private boolean |
isUserSetFont(Styleable node) |
private CalculatedValue |
lookup(Styleable styleable,
CssMetaData cssMetaData,
StyleMap styleMap,
java.util.Set<PseudoClass> states,
Styleable originatingStyleable,
CalculatedValue cachedFont)
The main workhorse of this class, the lookup method walks up the CSS
style tree looking for the style information for the Node, the
property associated with the given styleable, in these states for this font.
|
(package private) CalculatedValue |
lookupFont(Styleable styleable,
java.lang.String property,
StyleMap styleMap,
CalculatedValue cachedFont)
Look up a font property.
|
private CascadingStyle |
lookupInheritedFontProperty(Styleable styleable,
java.lang.String property,
StyleMap styleMap,
int distance,
CascadingStyle fontShorthand) |
(package private) boolean |
pseudoClassStateChanged(PseudoClass pseudoClass) |
private void |
resetToInitialValues(Styleable styleable) |
private ParsedValue |
resolveLookups(Styleable styleable,
ParsedValue parsedValue,
StyleMap styleMap,
java.util.Set<PseudoClass> states,
<any> whence,
java.util.Set<ParsedValue> resolves) |
private CascadingStyle |
resolveRef(Styleable styleable,
java.lang.String property,
StyleMap styleMap,
java.util.Set<PseudoClass> states)
Find the property among the styles that pertain to the Node
|
private static void |
setTrue(<any> booleanProperty) |
(package private) void |
transitionToState(Node node)
Called by the Node whenever it has transitioned from one set of
pseudo-class states to another.
|
private static void |
updateParentTriggerStates(Styleable styleable,
int depth,
PseudoClassState[] triggerStates) |
private static final PlatformLogger LOGGER
private Node firstStyleableAncestor
private CssStyleHelper.CacheContainer cacheContainer
private PseudoClassState triggerStates
.button { ... }
.button:hover { ... }
.button *.label { text-fill: black }
.button:hover *.label { text-fill: blue }
In this case, the first 2 rules apply to the Button itself, but the
second two rules apply to the label within a Button. When the hover
changes on the Button, however, we must mark the Button as needing
an UPDATE. StyleHelper though only contains styles for the first two
rules for Button. The pseudoclassStateMask would in this case have
only a single bit set for "hover". In this way the StyleHelper associated
with the Button would know whether a change to "hover" requires the
button and all children to be update. Other pseudo-class state changes
that are not in this hash set are ignored.
*
Called "triggerStates" since they would trigger a CSS update.private static final java.util.Set<PseudoClass> NULL_PSEUDO_CLASS_STATE
private static final CssMetaData dummyFontProperty
static CssStyleHelper createStyleHelper(Node node)
private static void updateParentTriggerStates(Styleable styleable, int depth, PseudoClassState[] triggerStates)
private boolean isUserSetFont(Styleable node)
private static CssStyleHelper getStyleHelper(Node n)
private static Node findFirstStyleableAncestor(Styleable st)
private static boolean isTrue(<any> booleanProperty)
private static void setTrue(<any> booleanProperty)
private static boolean canReuseStyleHelper(Node node, StyleMap styleMap)
private void resetToInitialValues(Styleable styleable)
private StyleMap getStyleMap(Styleable styleable)
boolean pseudoClassStateChanged(PseudoClass pseudoClass)
private java.util.Set<PseudoClass>[] getTransitionStates(Node node)
void transitionToState(Node node)
private CascadingStyle getStyle(Styleable styleable, java.lang.String property, StyleMap styleMap, java.util.Set<PseudoClass> states)
styleable
- property
- styleMap
- states
- @returnprivate CalculatedValue lookup(Styleable styleable, CssMetaData cssMetaData, StyleMap styleMap, java.util.Set<PseudoClass> states, Styleable originatingStyleable, CalculatedValue cachedFont)
styleable
- states
- originatingStyleable
- private CalculatedValue handleNoStyleFound(Styleable styleable, CssMetaData cssMetaData, StyleMap styleMap, java.util.Set<PseudoClass> pseudoClassStates, Styleable originatingStyleable, CalculatedValue cachedFont)
private CascadingStyle getInheritedStyle(Styleable styleable, java.lang.String property)
private CascadingStyle resolveRef(Styleable styleable, java.lang.String property, StyleMap styleMap, java.util.Set<PseudoClass> states)
private ParsedValue resolveLookups(Styleable styleable, ParsedValue parsedValue, StyleMap styleMap, java.util.Set<PseudoClass> states, <any> whence, java.util.Set<ParsedValue> resolves)
private java.lang.String getUnresolvedLookup(ParsedValue resolved)
private java.lang.String formatUnresolvedLookupMessage(Styleable styleable, CssMetaData cssMetaData, Style style, ParsedValue resolved, java.lang.ClassCastException cce)
private java.lang.String formatExceptionMessage(Styleable styleable, CssMetaData cssMetaData, Style style, java.lang.Exception e)
private CalculatedValue calculateValue(CascadingStyle style, Styleable styleable, CssMetaData cssMetaData, StyleMap styleMap, java.util.Set<PseudoClass> states, Styleable originatingStyleable, CalculatedValue fontFromCacheEntry)
private CalculatedValue getCachedFont(Styleable styleable)
FontPosture getFontPosture(Font font)
FontWeight getFontWeight(Font font)
java.lang.String getFontFamily(Font font)
Font deriveFont(Font font, java.lang.String fontFamily, FontWeight fontWeight, FontPosture fontPosture, double fontSize)
CalculatedValue lookupFont(Styleable styleable, java.lang.String property, StyleMap styleMap, CalculatedValue cachedFont)
Text text = new Text("Hello World"); text.setStyle("-fx-font-size: 16px;"); Group group = new Group(); group.setStyle("-fx-font: 12px Arial;"); group.getChildren().add(text);
private CascadingStyle lookupInheritedFontProperty(Styleable styleable, java.lang.String property, StyleMap styleMap, int distance, CascadingStyle fontShorthand)
static java.util.List<Style> getMatchingStyles(Styleable styleable, CssMetaData styleableProperty)
styleable
- styleableProperty
- static java.util.Map<<any>,java.util.List<Style>> getMatchingStyles(java.util.Map<<any>,java.util.List<Style>> map, Node node)
private java.util.List<Style> getMatchingStyles(Styleable node, CssMetaData styleableProperty, boolean matchState)
private void getMatchingStyles(Styleable node, CssMetaData styleableProperty, java.util.List<CascadingStyle> styleList, boolean matchState)
private void getMatchingLookupStyles(Styleable node, ParsedValue parsedValue, java.util.List<CascadingStyle> styleList, boolean matchState)