Java Code Examples for com.vaadin.ui.TextField#addValueChangeListener()
The following examples show how to use
com.vaadin.ui.TextField#addValueChangeListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FieldFactory.java From vaadin-grid-util with MIT License | 6 votes |
public static <T> TextField genNumberField(Binder<T> binder, String propertyId, Converter converter, String inputPrompt) { final TextField field = new TextField(); field.setWidth("100%"); field.addStyleName(STYLENAME_GRIDCELLFILTER); field.addStyleName(ValoTheme.TEXTFIELD_TINY); field.addValueChangeListener(e -> { if (binder.isValid()) { field.setComponentError(null); } }); binder.forField(field) .withNullRepresentation("") // .withValidator(text -> text != null && text.length() > 0, "invalid") .withConverter(converter) .bind(propertyId); field.setPlaceholder(inputPrompt); return field; }
Example 2
Source File: ValueEntryPopup.java From sensorhub with Mozilla Public License 2.0 | 6 votes |
@SuppressWarnings("serial") public ValueEntryPopup(int width, final ValueCallback callback) { super("New Value"); VerticalLayout layout = new VerticalLayout(); TextField text = new TextField(); text.setWidth(width, Unit.PIXELS); layout.addComponent(text); text.focus(); text.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { ValueEntryPopup.this.close(); callback.newValue((String)event.getProperty().getValue()); } }); setContent(layout); center(); }
Example 3
Source File: Util.java From gantt with Apache License 2.0 | 6 votes |
public static TextField createNumberEditor(String caption, float value, final Component component, final NumberValueChange valueChange) { TextField field = new TextField(caption); field.setMaxLength(5); field.setValue("" + value); field.addValueChangeListener(new ValueChangeListener<String>() { @Override public void valueChange(ValueChangeEvent<String> event) { Object v = event.getValue(); try { float f = Float.parseFloat("" + v); valueChange.onValueChange(f); } catch (NumberFormatException e) { Notification.show("Invalid floating number! Format is 123.345"); } } }); return field; }
Example 4
Source File: AddUpdateRolloutWindowLayout.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private TextField createNoOfGroupsField() { final TextField noOfGroupsField = createIntegerTextField("prompt.number.of.groups", UIComponentIdProvider.ROLLOUT_NO_OF_GROUPS_ID); noOfGroupsField.addValidator(new GroupNumberValidator()); noOfGroupsField.addValidator(new GroupSizeValidator()); noOfGroupsField.setMaxLength(3); noOfGroupsField.addValueChangeListener(this::onGroupNumberChange); return noOfGroupsField; }
Example 5
Source File: Util.java From gantt with Apache License 2.0 | 5 votes |
public static TextField createTextEditor(String caption, String value, final Component component, final TextValueChange valueChange) { TextField field = new TextField(caption); field.setValue("" + value); field.addValueChangeListener(new ValueChangeListener<String>() { @Override public void valueChange(ValueChangeEvent<String> event) { Object v = event.getValue(); valueChange.onValueChange(String.valueOf(v)); } }); return field; }