Example usage for com.google.gwt.user.client.ui CheckBox setFocus

List of usage examples for com.google.gwt.user.client.ui CheckBox setFocus

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui CheckBox setFocus.

Prototype

@Override
    public void setFocus(boolean focused) 

Source Link

Usage

From source file:com.vaadin.client.ui.VOptionGroup.java

License:Apache License

@Override
public void onClick(ClickEvent event) {
    super.onClick(event);
    if (event.getSource() instanceof CheckBox) {
        CheckBox source = (CheckBox) event.getSource();
        if (!source.isEnabled()) {
            // Click events on the text are received even though the
            // checkbox is disabled
            return;
        }//from www . j  av  a2s  . c  o  m
        if (BrowserInfo.get().isWebkit()) {
            // Webkit does not focus non-text input elements on click
            // (#11854)
            source.setFocus(true);
        }

        final boolean selected = source.getValue();
        final String key = optionsToKeys.get(source);
        if (!isMultiselect()) {
            selectedKeys.clear();
        }
        if (selected) {
            selectedKeys.add(key);
        } else {
            selectedKeys.remove(key);
        }
        client.updateVariable(paintableId, "selected", getSelectedItems(), isImmediate());
    }
}