本文整理汇总了Java中com.kotcrab.vis.ui.widget.VisValidatableTextField.addValidator方法的典型用法代码示例。如果您正苦于以下问题:Java VisValidatableTextField.addValidator方法的具体用法?Java VisValidatableTextField.addValidator怎么用?Java VisValidatableTextField.addValidator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.kotcrab.vis.ui.widget.VisValidatableTextField
的用法示例。
在下文中一共展示了VisValidatableTextField.addValidator方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
@Override
public void bind (Spinner spinner) {
super.bind(spinner);
VisValidatableTextField valueText = spinner.getTextField();
valueText.getValidators().clear();
valueText.addValidator(boundsValidator);
valueText.addValidator(Validators.INTEGERS);
valueText.setTextFieldFilter(textFieldFilter = new IntDigitsOnlyFilter(true));
textFieldFilter.setUseFieldCursorPosition(true);
if (min >= 0) {
textFieldFilter.setAcceptNegativeValues(false);
} else {
textFieldFilter.setAcceptNegativeValues(true);
}
spinner.notifyValueChanged(true);
}
示例2: notEmpty
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/** Validates if file is not empty */
public FormInputValidator notEmpty (VisValidatableTextField field, String errorMsg) {
EmptyInputValidator validator = new EmptyInputValidator(errorMsg);
field.addValidator(validator);
add(field);
return validator;
}
示例3: integerNumber
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/** Validates if entered text is integer number */
public FormInputValidator integerNumber (VisValidatableTextField field, String errorMsg) {
ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, Validators.INTEGERS);
field.addValidator(wrapper);
add(field);
return wrapper;
}
示例4: floatNumber
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/** Validates if entered text is float number */
public FormInputValidator floatNumber (VisValidatableTextField field, String errorMsg) {
ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, Validators.FLOATS);
field.addValidator(wrapper);
add(field);
return wrapper;
}
示例5: valueGreaterThan
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/**
* Validates if entered text is greater than (or equal) entered number <p>
* Can be used in combination with {@link #integerNumber(VisValidatableTextField, String)} to only allows integers.
*/
public FormInputValidator valueGreaterThan (VisValidatableTextField field, String errorMsg, float value, boolean validIfEqualsValue) {
ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, new GreaterThanValidator(value, validIfEqualsValue));
field.addValidator(wrapper);
add(field);
return wrapper;
}
示例6: valueLesserThan
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/**
* Validates if entered text is lesser (or equal) than entered number <p>
* Can be used in combination with {@link #integerNumber(VisValidatableTextField, String)} to only allows integers.
*/
public FormInputValidator valueLesserThan (VisValidatableTextField field, String errorMsg, float value, boolean validIfEqualsValue) {
ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, new LesserThanValidator(value, validIfEqualsValue));
field.addValidator(wrapper);
add(field);
return wrapper;
}
示例7: fileExists
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/** Validates if absolute path entered in text field points to an existing file. */
public FormInputValidator fileExists (VisValidatableTextField field, String errorMsg) {
FileExistsValidator validator = new FileExistsValidator(errorMsg);
field.addValidator(validator);
add(field);
return validator;
}
示例8: fileNotExists
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/** Validates if relative path entered in text field points to an non existing file. */
public FormInputValidator fileNotExists (VisValidatableTextField field, String errorMsg) {
FileExistsValidator validator = new FileExistsValidator(errorMsg, true);
field.addValidator(validator);
add(field);
return validator;
}
示例9: directory
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/** Validates if relative path entered in text field points to an existing directory. */
public FormInputValidator directory (VisValidatableTextField field, String errorMsg) {
DirectoryValidator validator = new DirectoryValidator(errorMsg);
field.addValidator(validator);
add(field);
return validator;
}
示例10: directoryEmpty
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/** Validates if relative path entered in text field points to an existing and empty directory. */
public FormInputValidator directoryEmpty (VisValidatableTextField field, String errorMsg) {
DirectoryContentValidator validator = new DirectoryContentValidator(errorMsg, true);
field.addValidator(validator);
add(field);
return validator;
}
示例11: directoryNotEmpty
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/** Validates if relative path entered in text field points to an existing and non empty directory. */
public FormInputValidator directoryNotEmpty (VisValidatableTextField field, String errorMsg) {
DirectoryContentValidator validator = new DirectoryContentValidator(errorMsg, false);
field.addValidator(validator);
add(field);
return validator;
}
示例12: setPrecision
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
private void setPrecision (final int precision, boolean notifySpinner) {
if (precision < 0) throw new IllegalStateException("Precision can't be < 0");
this.precision = precision;
VisValidatableTextField valueText = spinner.getTextField();
valueText.getValidators().clear();
valueText.addValidator(boundsValidator); //Both need the bounds check
if (precision == 0) {
valueText.addValidator(Validators.INTEGERS);
valueText.setTextFieldFilter(textFieldFilter = new IntDigitsOnlyFilter(true));
} else {
valueText.addValidator(Validators.FLOATS);
valueText.addValidator(new InputValidator() {
@Override
public boolean validateInput (String input) {
int dotIndex = input.indexOf('.');
if (dotIndex == -1) return true;
return input.length() - input.indexOf('.') - 1 <= precision;
}
});
valueText.setTextFieldFilter(textFieldFilter = new FloatDigitsOnlyFilter(true));
}
textFieldFilter.setUseFieldCursorPosition(true);
if (min >= 0) {
textFieldFilter.setAcceptNegativeValues(false);
} else {
textFieldFilter.setAcceptNegativeValues(true);
}
if (notifySpinner) {
spinner.notifyValueChanged(spinner.isProgrammaticChangeEvents());
}
}
示例13: custom
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入方法依赖的package包/类
/** Allows to add custom validator to field */
public FormInputValidator custom (VisValidatableTextField field, FormInputValidator customValidator) {
field.addValidator(customValidator);
add(field);
return customValidator;
}