当前位置: 首页>>代码示例>>Java>>正文


Java ValidatorBase类代码示例

本文整理汇总了Java中com.jfoenix.validation.base.ValidatorBase的典型用法代码示例。如果您正苦于以下问题:Java ValidatorBase类的具体用法?Java ValidatorBase怎么用?Java ValidatorBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ValidatorBase类属于com.jfoenix.validation.base包,在下文中一共展示了ValidatorBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
	api = new APIConnect();
	ValidatorBase require = new RequiredFieldValidator();
	require.setMessage("ユーザIDは必須");
	ValidatorBase validator = new UserValidator(api);
	validator.setMessage("無効なユーザID");
	userField.getValidators().addAll(require, validator);
	userField.focusedProperty().addListener((o, oldVal, newVal)->{
		if(!newVal) userField.validate();
		setProblem();
	});
	postedCode.getEngine().load(getClass().getResource("/resources/html/ace.html").toExternalForm());
	obj = (JSObject) postedCode.getEngine().executeScript("window");
	try {
		contest.getItems().addAll(api.getContests());
	}catch(Exception e) {
		getAlert(e, "コンテスト情報の取得に失敗しました。").show();
	}
}
 
开发者ID:skht777,项目名称:atcoder-code,代码行数:21,代码来源:MainController.java

示例2: validate

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
/**
 * validates the text value using the list of validators provided by the
 * user {{@link #setValidators(ValidatorBase...)}
 *
 * @return true if the value is valid else false
 */
public static boolean validate(Control control) {
    ValidationFacade facade = (ValidationFacade) control.getParent();
    for (ValidatorBase validator : facade.validators) {
        if (validator.getSrcControl() == null) {
            validator.setSrcControl(facade.controlProperty.get());
        }
        validator.validate();
        if (validator.getHasErrors()) {
            facade.activeValidator.set(validator);
            control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, true);
            return false;
        }
    }
    control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, false);
    facade.activeValidator.set(null);
    return true;
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:24,代码来源:ValidationFacade.java

示例3: showError

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
private void showError(ValidatorBase validator) {

        // set text in error label
        errorLabel.setText(validator.getMessage());
        // show error icon
        Node awsomeIcon = validator.getIcon();
        errorIcon.getChildren().clear();
        if (awsomeIcon != null) {
            errorIcon.getChildren().add(awsomeIcon);
            StackPane.setAlignment(awsomeIcon, Pos.TOP_RIGHT);
        }
        // init only once, to fix the text pane from resizing
        if (initYlayout == -1) {
            initYlayout = getBoundsInParent().getMinY();
            initHeight = getHeight();
            currentFieldHeight = initHeight;
        }
        errorContainer.setVisible(true);

        errorShown = true;

    }
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:23,代码来源:ValidationFacade.java

示例4: validate

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
/**
 * validates the text value using the list of validators provided by the user
 * {{@link #setValidators(ValidatorBase...)}
 *
 * @return true if the value is valid else false
 */
@Override
public boolean validate() {
    for (ValidatorBase validator : validators) {
        if (validator.getSrcControl() == null) {
            validator.setSrcControl(this);
        }
        validator.validate();
        if (validator.getHasErrors()) {
            activeValidator.set(validator);
            return false;
        }
    }
    activeValidator.set(null);
    return true;
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:22,代码来源:JFXTextField.java

示例5: validate

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
/**
 * validates the password value using the list of validators provided by the user
 * {{@link #setValidators(ValidatorBase...)}
 *
 * @return true if the value is valid else false
 */
@Override
public boolean validate() {
    for (ValidatorBase validator : validators) {
        if (validator.getSrcControl() == null) {
            validator.setSrcControl(this);
        }
        validator.validate();
        if (validator.getHasErrors()) {
            activeValidator.set(validator);
            return false;
        }
    }
    activeValidator.set(null);
    return true;
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:22,代码来源:JFXPasswordField.java

示例6: showError

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
private void showError(ValidatorBase validator) {
    // set text in error label
    errorLabel.setText(validator.getMessage());
    // show error icon
    Node icon = validator.getIcon();
    errorIcon.getChildren().clear();
    if (icon != null) {
        errorIcon.getChildren().add(icon);
        StackPane.setAlignment(icon, Pos.CENTER_RIGHT);
    }
    errorContainer.setVisible(true);
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:13,代码来源:JFXTextAreaSkin.java

示例7: showError

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
private void showError(ValidatorBase validator) {
    // set text in error label
    errorLabel.setText(validator.getMessage());
    // show error icon
    Node icon = validator.getIcon();
    errorIcon.getChildren().clear();
    if (icon != null) {
        errorIcon.getChildren().setAll(icon);
        StackPane.setAlignment(icon, Pos.CENTER_RIGHT);
    }
    errorContainer.setVisible(true);
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:13,代码来源:JFXTextFieldSkin.java

示例8: validate

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
/**
 * validates the text value using the list of validators provided by the user
 * {{@link #setValidators(ValidatorBase...)}
 *
 * @return true if the value is valid else false
 */
public boolean validate() {
    for (ValidatorBase validator : validators) {
        if (validator.getSrcControl() == null) {
            validator.setSrcControl(this);
        }
        validator.validate();
        if (validator.getHasErrors()) {
            activeValidator.set(validator);
            return false;
        }
    }
    activeValidator.set(null);
    return true;
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:21,代码来源:JFXTextArea.java

示例9: layoutChildren

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    super.layoutChildren(x, y, w, h);

    // change control properties if and only if animations are stopped
    if (!focusTimer.isRunning() && !unfocusTimer.isRunning()) {
        if (getSkinnable().isFocused() && ((JFXTextArea) getSkinnable()).isLabelFloat()) {
            animatedPromptTextFill.set(((JFXTextArea) getSkinnable()).getFocusColor());
        }
    }

    if (invalid) {
        invalid = false;
        animatedPromptTextFill.set(promptTextFill.get());
        // set the default background of text area viewport to white
        Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
        viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
            CornerRadii.EMPTY,
            Insets.EMPTY)));
        // reapply css of scroll pane in case set by the user
        viewPort.applyCss();
        // create floating label
        focusTimer.setCacheNodes(promptContainer);
        unfocusTimer.setCacheNodes(promptContainer);
        createFloatingLabel();
        // to position the prompt node properly
        super.layoutChildren(x, y, w, h);
        // update validation container
        final ValidatorBase activeValidator = ((JFXTextArea) getSkinnable()).getActiveValidator();
        if (activeValidator != null) {
            showError(activeValidator);
            final double errorContainerWidth = w - errorIcon.prefWidth(-1);
            errorContainer.setOpacity(1);
            errorContainer.resize(w, computeErrorHeight(errorContainerWidth));
            errorContainerClip.setWidth(w);
            errorContainerClip.setHeight(errorContainer.getHeight());
            errorClipScale.setY(1);
        }
        // focus
        if (getSkinnable().isFocused()) {
            focus();
        }
    }

    final double height = h - focusedLine.prefHeight(-1);
    focusedLine.resizeRelocate(x, height, w, focusedLine.prefHeight(-1));
    line.resizeRelocate(x, height, w, line.prefHeight(-1));
    errorContainer.relocate(x, y);
    // resize error container if animation is disabled
    if (((JFXTextArea) getSkinnable()).isDisableAnimation()) {
        errorContainer.resize(w, computeErrorHeight(computeErrorWidth(w)));
    }else{
        errorContainer.resize(w, errorContainer.getHeight());
        errorContainerClip.setWidth(w);
    }
    errorContainer.setTranslateY(h + focusedLine.getHeight() + 4);
    scale.setPivotX(w / 2);
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:59,代码来源:JFXTextAreaSkin.java

示例10: layoutChildren

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
@Override
    protected void layoutChildren(final double x, final double y, final double w, final double h) {
        super.layoutChildren(x, y, w, h);

        // change control properties if and only if animations are stopped
        if (!focusTimer.isRunning() && !unfocusTimer.isRunning()) {
            if (getSkinnable().isFocused() && ((IFXTextInputControl) getSkinnable()).isLabelFloat()) {
                animatedPromptTextFill.set(((IFXTextInputControl) getSkinnable()).getFocusColor());
            }
        }
        if (invalid) {
            invalid = false;
            animatedPromptTextFill.set(promptTextFill.get());
//            focusTimer.setCacheNodes(textPane);
//            unfocusTimer.setCacheNodes(textPane);
            // create floating label
            createFloatingLabel();
            // update validation container
            final ValidatorBase activeValidator = ((IFXTextInputControl) getSkinnable()).getActiveValidator();
            if (activeValidator != null) {
                showError(activeValidator);
                final double errorContainerWidth = w - errorIcon.prefWidth(-1);
                errorContainer.setOpacity(1);
                errorContainer.resize(w, computeErrorHeight(errorContainerWidth));
                errorContainerClip.setWidth(w);
                errorContainerClip.setHeight(errorContainer.getHeight());
                errorClipScale.setY(1);
            }
            // to position the prompt node properly
            super.layoutChildren(x, y, w, h);

            // focus
            if (getSkinnable().isFocused()) {
                focus();
            }
        }

        final double height = getSkinnable().getHeight();
        final double focusedLineHeight = focusedLine.prefHeight(-1);
        focusedLine.resizeRelocate(x, height, w, focusedLineHeight);
        line.resizeRelocate(x, height, w, line.prefHeight(-1));
        errorContainer.relocate(x, height + focusedLineHeight);
        // resize error container if animation is disabled
        if (((IFXTextInputControl) getSkinnable()).isDisableAnimation() || isErrorVisible()) {
            errorContainer.resize(w, computeErrorHeight(computeErrorWidth(w)));
        }
        scale.setPivotX(w / 2);
    }
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:49,代码来源:JFXTextFieldSkin.java

示例11: getActiveValidator

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
public ValidatorBase getActiveValidator() {
    return activeValidator == null ? null : activeValidator.get();
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:4,代码来源:ValidationFacade.java

示例12: activeValidatorProperty

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
public ReadOnlyObjectProperty<ValidatorBase> activeValidatorProperty() {
    return this.activeValidator.getReadOnlyProperty();
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:4,代码来源:ValidationFacade.java

示例13: getValidators

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
public ObservableList<ValidatorBase> getValidators() {
    return validators;
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:4,代码来源:ValidationFacade.java

示例14: setValidators

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
public void setValidators(ValidatorBase... validators) {
    this.validators.addAll(validators);
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:4,代码来源:ValidationFacade.java

示例15: layoutChildren

import com.jfoenix.validation.base.ValidatorBase; //导入依赖的package包/类
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    super.layoutChildren(x, y, w, h);

    // change control properties if and only if animations are stopped
    if (!focusTimer.isRunning() && !unfocusTimer.isRunning()) {
        if (getSkinnable().isFocused() && ((JFXTextArea) getSkinnable()).isLabelFloat()) {
            animatedPromptTextFill.set(((JFXTextArea) getSkinnable()).getFocusColor());
        }
    }

    if (invalid) {
        invalid = false;
        animatedPromptTextFill.set(promptTextFill.get());
        // set the default background of text area viewport to white
        Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
        viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
            CornerRadii.EMPTY,
            Insets.EMPTY)));
        // reapply css of scroll pane in case set by the user
        viewPort.applyCss();
        // create floating label
        focusTimer.setCacheNodes(promptContainer);
        unfocusTimer.setCacheNodes(promptContainer);
        createFloatingLabel();
        // to position the prompt node properly
        super.layoutChildren(x, y, w, h);
        // update validation container
        final ValidatorBase activeValidator = ((JFXTextArea) getSkinnable()).getActiveValidator();
        if (activeValidator != null) {
            showError(activeValidator);
            final double errorContainerWidth = w - errorIcon.prefWidth(-1);
            errorContainer.setOpacity(1);
            errorContainer.resize(w, computeErrorHeight(errorContainerWidth));
            errorContainerClip.setWidth(w);
            errorContainerClip.setHeight(errorContainer.getHeight());
            errorClipScale.setY(1);
        }
        // focus
        if (getSkinnable().isFocused()) {
            focus();
        }
    }

    final double height = h - focusedLine.prefHeight(-1);
    focusedLine.resizeRelocate(x, height, w, focusedLine.prefHeight(-1));
    line.resizeRelocate(x, height, w, line.prefHeight(-1));
    errorContainer.relocate(x, y);
    // resize error container if animation is disabled
    if (((JFXTextArea) getSkinnable()).isDisableAnimation()) {
        errorContainer.resize(w, computeErrorHeight(computeErrorWidth(w)));
    }
    errorContainer.setTranslateY(h + focusedLine.getHeight() + 4);
    scale.setPivotX(w / 2);
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:56,代码来源:JFXTextAreaSkinAndroid.java


注:本文中的com.jfoenix.validation.base.ValidatorBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。