Example usage for com.vaadin.shared EventId BLUR

List of usage examples for com.vaadin.shared EventId BLUR

Introduction

In this page you can find the example usage for com.vaadin.shared EventId BLUR.

Prototype

String BLUR

To view the source code for com.vaadin.shared EventId BLUR.

Click Source Link

Usage

From source file:com.eternach.client.RichOptionGroupWidget.java

License:Apache License

@Override
public void onBlur(final BlurEvent arg0) {
    blurOccured = true;/*from  w ww.j a  va2 s.c o  m*/
    if (sendBlurEvents) {
        Scheduler.get().scheduleDeferred(new Command() {
            @Override
            public void execute() {
                // check whether blurOccured still is true and then send the
                // event out to the server
                if (blurOccured) {
                    client.updateVariable(paintableId, EventId.BLUR, "", true);
                    blurOccured = false;
                }
            }
        });
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.textfield.CubaMaskedFieldWidget.java

License:Apache License

@Override
public void valueChange(boolean blurred) {
    if (client != null && paintableId != null) {

        boolean sendBlurEvent = false;
        boolean sendValueChange = false;

        if (blurred && client.hasEventListeners(this, EventId.BLUR)) {
            sendBlurEvent = true;/*from w w w .j a  v a 2s.c o m*/
            client.updateVariable(paintableId, EventId.BLUR, "", false);
        }

        String newText = getText();

        if (!prompting && newText != null && !newText.equals(valueBeforeEdit)) {
            if (isTimeMask && newText.endsWith("__") && !newText.startsWith("__")) {
                newText = newText.replaceAll("__", "00");
            }
            if (validateText(newText)) {
                sendValueChange = immediate;
                String value;
                if (newText.equals(nullRepresentation)) {
                    value = isSendNullRepresentation() ? getText() : getRawText();
                } else {
                    if (maskedMode) {
                        if (isTimeMask) {
                            value = newText;
                        } else {
                            value = getText();
                        }
                    } else {
                        value = getRawText();
                    }
                }
                client.updateVariable(paintableId, "text", value, false);
                valueBeforeEdit = newText;
            } else {
                setText(valueBeforeEdit);
            }
        }

        if (sendBlurEvent || sendValueChange) {
            client.sendPendingVariableChanges();
        }
    }
}

From source file:org.vaadin.alump.ckeditor.client.VCKEditorTextField.java

License:Apache License

@Override
public void onBlur() {
    if (ckEditorIsReady) {
        boolean sendToServer = false;

        if (clientToServer.hasEventListeners(this, EventId.BLUR)) {
            sendToServer = true;//  w ww. java 2 s  . c o  m
            clientToServer.updateVariable(paintableId, EventId.BLUR, "", false);
        }

        // Even though CKEditor 4.2 introduced a change event, it doesn't appear to fire if the user stays in SOURCE mode,
        // so while we do use the change event, we still are stuck with the blur listener to detect other such changes.
        if (!readOnly) {
            String data = ckEditor.getData();
            if (!data.equals(dataBeforeEdit)) {
                clientToServer.updateVariable(paintableId, VAR_TEXT, data, false);
                sendToServer = true;
                dataBeforeEdit = data;
            }
        }

        if (sendToServer) {
            clientToServer.sendPendingVariableChanges();
        }
    }
}