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


Java VisValidatableTextField.addValidator方法代码示例

本文整理汇总了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);
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:20,代码来源:IntSpinnerModel.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:8,代码来源:SimpleFormValidator.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:8,代码来源:SimpleFormValidator.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:8,代码来源:SimpleFormValidator.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:11,代码来源:SimpleFormValidator.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:11,代码来源:SimpleFormValidator.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:8,代码来源:FormValidator.java

示例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;

}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:9,代码来源:FormValidator.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:8,代码来源:FormValidator.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:8,代码来源:FormValidator.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:8,代码来源:FormValidator.java

示例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());
	}
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:35,代码来源:SimpleFloatSpinnerModel.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:7,代码来源:SimpleFormValidator.java


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