本文整理汇总了Java中com.kotcrab.vis.ui.widget.VisValidatableTextField类的典型用法代码示例。如果您正苦于以下问题:Java VisValidatableTextField类的具体用法?Java VisValidatableTextField怎么用?Java VisValidatableTextField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VisValidatableTextField类属于com.kotcrab.vis.ui.widget包,在下文中一共展示了VisValidatableTextField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createHexTable
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入依赖的package包/类
private VisTable createHexTable () {
VisTable table = new VisTable(true);
table.add(new VisLabel(HEX.get()));
table.add(hexField = new VisValidatableTextField("00000000")).width(HEX_FIELD_WIDTH * sizes.scaleFactor);
table.row();
hexField.setMaxLength(HEX_COLOR_LENGTH);
hexField.setProgrammaticChangeEvents(false);
hexField.setTextFieldFilter(new TextFieldFilter() {
@Override
public boolean acceptChar (VisTextField textField, char c) {
return Character.isDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
}
});
hexField.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
if (hexField.getText().length() == (allowAlphaEdit ? HEX_COLOR_LENGTH_WITH_ALPHA : HEX_COLOR_LENGTH)) {
setColor(Color.valueOf(hexField.getText()), false);
}
}
});
return table;
}
示例3: buildTable
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入依赖的package包/类
@Override
public void buildTable () {
VisTable sizeTable = new VisTable(true);
sizeTable.add(new VisLabel("Grid size: "));
sizeTable.add(gridSizeField = new VisValidatableTextField(Validators.FLOATS));
prepareTable();
settingsTable.add(drawGridCheck = new VisCheckBox("Draw grid", config.drawGrid)).left();
settingsTable.row();
settingsTable.add(sizeTable);
gridSizeField.setTextFieldFilter(new FloatDigitsOnlyFilter(false));
gridSizeField.addValidator(new Validators.GreaterThanValidator(0));
gridSizeField.setText(NumberUtils.floatToString(config.gridSize));
}
示例4: GroupPropertiesTable
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入依赖的package包/类
public GroupPropertiesTable (EntityProperties properties) {
super(true);
this.properties = properties;
VisTable intIdTable = new VisTable(true);
intIdTable.add(new VisLabel("Group Integer ID: "));
intIdTable.add(idLabel = new VisLabel()).expandX().fillX();
VisTable stringIdTable = new VisTable(true);
stringIdTable.add(new VisLabel("Group ID"));
stringIdTable.add(idField = new VisValidatableTextField()).expandX().fillX();
properties.setupStdPropertiesTextField(idField);
defaults().padRight(0).width(EntityProperties.ROW_WIDTH);
add(intIdTable).row();
add(stringIdTable);
}
示例5: IndeterminateTextField
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入依赖的package包/类
public IndeterminateTextField (VisValidatableTextField textField) {
this.textField = textField;
textField.setStyle(new VisTextField.VisTextFieldStyle(textField.getStyle()));
textField.setProgrammaticChangeEvents(false);
textField.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
if (indeterminate) {
textField.getStyle().fontColor = Color.WHITE;
indeterminate = false;
}
text = textField.getText();
}
});
text = textField.getText();
}
示例6: attachTo
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入依赖的package包/类
@Override
public void attachTo(final LmlTag tag) {
final InputValidator validator = initiateValidator();
doBeforeAttach(validator);
if (tag.getActor() instanceof VisValidatableTextField) {
((VisValidatableTextField) tag.getActor()).addValidator(validator);
} else {
getParser().throwErrorIfStrict("Validators can be attached only to VisValidatableTextField actors.");
}
}
示例7: add
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入依赖的package包/类
@Override
public <T extends Actor> Cell<T> add(final T actor) {
if (actor instanceof VisValidatableTextField) {
formValidator.add((VisValidatableTextField) actor);
} else if (actor instanceof Group) {
findValidatables((Group) actor);
}
return super.add(actor);
}
示例8: findValidatables
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入依赖的package包/类
/** @param actor will be searched recursively. All {@link VisValidatableTextField}s will be added to form. */
public void findValidatables(final Group actor) {
final PooledList<Group> groupsToCheck = PooledList.newList();
groupsToCheck.add(actor);
while (groupsToCheck.isNotEmpty()) {
final Group group = groupsToCheck.removeFirst();
for (final Actor child : group.getChildren()) {
if (child instanceof VisValidatableTextField) {
formValidator.add((VisValidatableTextField) child);
} else if (child instanceof Group) {
groupsToCheck.add((Group) child);
}
}
}
}
示例9: add
import com.kotcrab.vis.ui.widget.VisValidatableTextField; //导入依赖的package包/类
@Override
public <T extends Actor> Cell<T> add(final T actor) {
if (actor instanceof VisValidatableTextField) {
formValidator.add((VisValidatableTextField) actor);
}
return super.add(actor);
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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;
}
示例14: 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;
}
示例15: 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;
}