private TextInput textinputDateRegex = null;
private TextInput textinputCustomBoolean = null;
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
window = new Window((Component)wtkxSerializer.readObject(
getClass().getResource("textInputValidator_test.wtkx")));
textinputFloatRange = (TextInput)wtkxSerializer.get("textinputFloatRange");
textinputIntRange = (TextInput)wtkxSerializer.get("textinputIntRange");
textinputDateRegex = (TextInput)wtkxSerializer.get("textinputDateRegex");
textinputCustomBoolean = (TextInput)wtkxSerializer.get("textinputCustomBoolean");
// standard float range model
textinputFloatRange.setText("0.5");
textinputFloatRange.setValidator(new FloatRangeValidator(0.3f, 2000f));
// test the listener by updating a label
textinputFloatRange.getTextInputListeners().add(new TextInputListener.Adapter() {
@Override
public void textValidChanged(TextInput textInput) {
invalidLabel.setText(textInput.isTextValid() ? "valid" : "invalid");
}
});
invalidLabel = (Label)wtkxSerializer.get("invalidLabel");
// standard int range model
textinputIntRange.setText("0");
textinputIntRange.setValidator(new IntRangeValidator(0, 100));