- Loading...
...
Note that isSettable
should be implemented in a way that does not cause the expansion of the property. The isSettable
check is performed before the CSS value is looked up. If the property is not settable, then no further CSS processing is done for that property (on any given pulse). The getWritableValue
method is invoked only if there is a CSS value to apply. Thus, if the property is not settable or there is no CSS value, the property is not expandedexpanded^#1^.
The CSS engine does not call setValue
directly on the WritableValue
. Rather, the code calls a set method on the CssMetaData
which, in turn, calls applyStyle
on the StyleableProperty
. This level of indirection allows a CssMetaData
to intercept the value before the calculated style value is applied (in other words, before setValue
is called on the corresponding property). This is used primarily for Number
based properties where the parameterized type is Number
but the actual type might be Integer
and so the value's intValue()
method needs to be invoked.
...
Code Block |
---|
/** * Used to notify that a pseudo-class has changed. Typically, this method is called from the invalidated * method of a property that is used as a pseudo-class. * <code> * private static final PseudoClass.State MY_PSEUDO_CLASS_STATE = PseudoClass.getState("my-state"); * * BooleanProperty myPseudoClassState = new BooleanPropertyBase(false) { * * @Override public void invalidated() { * pseudoClassStateChanged(MY_PSEUDO_CLASS_STATE); * } * * @Override public Object getBean() { * return MyControl.this; * } * * @Override public String getName() { * return "myPseudoClassState"; * } * }; * <code> * @param pseudoClassState The PseudoClass.State that has changed. */ protected void pseudoClassStateChanged(PseudoClass.State pseudoClassState) { // if there are styles that use the given pseudoClassState, mark this node as needing css update } /** * The pseudo-class state of a Node is the state pertaining to this class and all of its super classes. This method is * implemented by getting the pseudo-class state of the super class and then or'ing in the pseudo-class state of this class. * <code> * private static final PseudoClass.State MY_PSEUDO_CLASS_STATE = PseudoClass.getState("my-state"); * * @Override public PseudoClass.States getPseudoClassStates() { * PseudoClass.States states = super.getPseudoClassStates(); * if (isMyPseudoClassState()) { states.addState(MY_PSEUDO_CLASS_STATE); } * return state; * } * <code> * @return PseudoClass.States representing the pseudo-class state of this node and the state of its super classes. * */ public PseudoClass.States getPseudoClassStates() { PseudoClass.States states = PseudoClass.createStatesInstance(); ??[TBD - better to have a instance member and just clear it?]?? if(isHover()) states.addState(HOVER_PSEUDOCLASS_STATE); if(isPressed()) states.addState(PRESSED_PSEUDOCLASS_STATE); if(isDisabled()) states.addState(DISABLED_PSEUDOCLASS_STATE); if(isFocused()) states.addState(FOCUSED_PSEUDOCLASS_STATE); if(impl_isShowMnemonics()) states.addState(SHOW_MNEMONICS_PSEUDOCLASS_STATE); return states; } |
.h4 Footnotes
Anchor | ||||
---|---|---|---|---|
|