Example usage for com.vaadin.client.ui ConnectorFocusAndBlurHandler addHandlers

List of usage examples for com.vaadin.client.ui ConnectorFocusAndBlurHandler addHandlers

Introduction

In this page you can find the example usage for com.vaadin.client.ui ConnectorFocusAndBlurHandler addHandlers.

Prototype

public static ConnectorFocusAndBlurHandler addHandlers(AbstractComponentConnector connector) 

Source Link

Document

Add focus/blur handlers to the widget of the connector .

Usage

From source file:org.opencms.ui.client.CmsCopyToClipboardButtonConnector.java

License:Open Source License

/**
 * @see com.vaadin.client.ui.button.ButtonConnector#init()
 *//*from  ww  w.j a va2  s .c om*/
@Override
public void init() {

    VButton button = getWidget();
    button.client = getConnection();
    ConnectorFocusAndBlurHandler.addHandlers(this);

    if (CmsDomUtil.isCopyToClipboardSupported()) {
        button.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {

                event.preventDefault();
                event.stopPropagation();
                CmsDomUtil.copyToClipboard(getState().getSelector());
            }
        });
    } else {
        button.setVisible(false);
    }
}