List of usage examples for com.vaadin.ui TextField setValueChangeMode
@Override public void setValueChangeMode(ValueChangeMode mode)
From source file:org.rubicone.poc.vpush.uil.sending.SendingUI.java
License:Apache License
private FormLayout createPushMessageSendingForm() { FormLayout pushMessageSendingForm = new FormLayout(); Panel pushMessageSendingPanel = new Panel("push message sending form"); pushMessageSendingPanel.setContent(pushMessageSendingForm); TextField inputField = new TextField("text to send"); inputField.setValueChangeMode(ValueChangeMode.EAGER); pushMessageSendingForm.addComponent(inputField); Button sendButton = new Button("send", VaadinIcons.LOCATION_ARROW); sendButton.setDisableOnClick(true);// w w w. j a va 2 s . co m sendButton.setEnabled(false); sendButton.addClickListener(event -> { this.broadcaster.broadcast(inputField.getValue()); this.sentMessages.addComponent(new Label(new Date() + ": " + inputField.getValue())); inputField.setValue(""); }); inputField.addValueChangeListener(event -> { sendButton.setEnabled(!event.getValue().isEmpty()); }); pushMessageSendingForm.addComponent(sendButton); return pushMessageSendingForm; }