Java Code Examples for javafx.scene.Node#pseudoClassStateChanged()

The following examples show how to use javafx.scene.Node#pseudoClassStateChanged() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValidatorBase.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
/**
 * This method will update the source control after evaluating the validation condition (see {@link #eval()}).
 * <p>
 * If the validator isn't "passing" the {@link #PSEUDO_CLASS_ERROR :error} pseudoclass is applied to the
 * {@link #srcControl}.
 * <p>
 * Applies the {@link #PSEUDO_CLASS_ERROR :error} pseudo class and the errorTooltip to
 * the {@link #srcControl}.
 */
protected void onEval() {
    Node control = getSrcControl();
    boolean invalid = hasErrors.get();
    control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, invalid);
    Tooltip activeTooltip = getActiveTooltip(control);
    if (invalid) {
        Tooltip errorTooltip = errorTooltipSupplier.get();
        errorTooltip.getStyleClass().add(ERROR_TOOLTIP_STYLE_CLASS);
        errorTooltip.setText(getMessage());
        install(control, activeTooltip, errorTooltip);
    } else {
        Tooltip orgTooltip = (Tooltip) control.getProperties().remove(TEMP_TOOLTIP_KEY);
        install(control, activeTooltip, orgTooltip);
    }
}
 
Example 2
Source File: NodeHelper.java    From tornadofx-controls with Apache License 2.0 4 votes vote down vote up
public static void addPseudoClass( Node node, String className ){
    PseudoClass pseudoClass = PseudoClass.getPseudoClass( className );
    node.pseudoClassStateChanged( pseudoClass, true );
}
 
Example 3
Source File: ErrorClassTool.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
public static void updateClass(final Node node, final boolean isFail) {
    node.pseudoClassStateChanged(CLASS_FAIL, isFail);
}
 
Example 4
Source File: StateClassTool.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
public static void updateStateClasses(final Node node, final WordState state) {
    node.pseudoClassStateChanged(CLASS_UNSEEN, state == WordState.UNSEEN);
    node.pseudoClassStateChanged(CLASS_KNOWN, state == WordState.KNOWN);
    node.pseudoClassStateChanged(CLASS_UNKNOWN, state == WordState.UNKNOWN);
}
 
Example 5
Source File: StateClassTool.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
public static void updatedExcludedClass(final Node node, final boolean isExcluded) {
    node.pseudoClassStateChanged(CLASS_EXCLUDED, isExcluded);
}
 
Example 6
Source File: ResponsiveHandler.java    From ResponsiveFX with Apache License 2.0 4 votes vote down vote up
private static void removeAllPseudoClasses(Node n) {
    for (PseudoClass pseudoClass : DeviceType.getAllClasses()) {
        n.pseudoClassStateChanged(pseudoClass, false);
    }
}