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

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

Introduction

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

Prototype

@Override
    public void setFocus(boolean focused) 

Source Link

Usage

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

License:Apache License

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

        JsonObject item = optionsToItems.get(source);
        assert item != null;

        new ArrayList<>(selectionChangeListeners).forEach(listener -> listener.accept(item));
    }
}

From source file:org.jboss.as.console.client.shared.subsys.jca.wizard.ChooseTemplateStep.java

License:Open Source License

@Override
protected Widget asWidget(final Context<T> context) {
    VerticalPanel body = new VerticalPanel();

    RadioButton customButton = new RadioButton("template",
            Console.CONSTANTS.subsys_jca_dataSource_custom_template());
    customButton.getElement().setId("custom");
    customButton.setStyleName("choose_template");
    customButton.setValue(true);//  ww  w  . ja v a  2 s.  co m
    customButton.addClickHandler(event -> {
        RadioButton button = (RadioButton) event.getSource();
        selectedTemplate = templates.getTemplate(button.getElement().getId());
    });
    customButton.setFocus(true);
    body.add(customButton);

    for (DataSourceTemplate<? extends DataSource> template : templates) {
        if (template.isXA() != context.xa) {
            continue;
        }
        RadioButton radioButton = new RadioButton("template", template.toString());
        radioButton.getElement().setId(template.getId());
        radioButton.setStyleName("choose_template");
        radioButton.addClickHandler(event -> {
            RadioButton button = (RadioButton) event.getSource();
            selectedTemplate = templates.getTemplate(button.getElement().getId());
        });
        body.add(radioButton);
    }

    return body;
}