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

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

Introduction

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

Prototype

public RadioButton(String name, String label, DirectionEstimator directionEstimator) 

Source Link

Usage

From source file:cc.alcina.framework.gwt.client.gwittir.widget.RadioButtonList.java

License:Apache License

protected CheckBox createCheckBox(String displayText) {
    RadioButton radioButton = new RadioButton(groupName, displayText, true);
    if (radioButtonContainerStyleName != null) {
        radioButton.setStyleName(radioButtonContainerStyleName);
    }/*from   w w  w . ja  v a  2s  .  co m*/
    return radioButton;
}

From source file:com.allen_sauer.gwt.dnd.demo.client.BehaviorPanel.java

License:Apache License

protected RadioButton newButton(String description, String tooltip) {
    RadioButton radioButton = new RadioButton(StringUtil.getShortTypeName(this), description, true);
    radioButton.setTitle(tooltip);//from   w  w  w. ja v a 2 s  .  co m
    return radioButton;
}

From source file:com.allen_sauer.gwt.dnd.demo.client.example.palette.PaletteWidget.java

License:Apache License

public PaletteWidget cloneWidget() {
    Widget clone;//from   www. j a va2s.  co m

    // Clone our internal widget
    if (widget instanceof Label) {
        Label label = (Label) widget;
        clone = new Label(label.getText());
    } else if (widget instanceof RadioButton) {
        RadioButton radioButton = (RadioButton) widget;
        clone = new RadioButton(radioButton.getName(), radioButton.getHTML(), true);
    } else if (widget instanceof CheckBox) {
        CheckBox checkBox = (CheckBox) widget;
        clone = new CheckBox(checkBox.getHTML(), true);
    } else {
        throw new IllegalStateException("Unhandled Widget class " + widget.getClass().getName());
    }

    // Copy a few obvious common widget properties
    clone.setStyleName(widget.getStyleName());
    clone.setTitle(widget.getTitle());

    // Wrap the cloned widget in a new PaletteWidget instance
    return new PaletteWidget(clone);
}

From source file:com.edgenius.wiki.gwt.client.space.SpaceLinkedBlogForm.java

License:Open Source License

public void onSuccess(BlogMetaList blogs) {
    bloglist.clear();//from  w ww  .  j a  va 2  s  . com
    bloglistDeck.showWidget(0);
    if (!GwtClientUtils.preSuccessCheck(blogs, message)) {
        return;
    }
    if (blogs.blogList == null || blogs.blogList.size() == 0) {
        bloglist.add(new Label(Msg.consts.none()));
        return;
    }
    this.blogMetas = blogs.blogList;

    for (BlogMeta meta : blogs.blogList) {
        RadioButton radio = new RadioButton("blog", meta.getName(), false);
        radio.setFormValue(meta.getId());
        bloglist.add(radio);
    }

}

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

License:Apache License

@Override
public void buildOptions(final UIDL uidl) {
    panel.clear();// w ww.j a  v  a  2s. co m
    optionsEnabled.clear();
    for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
        boolean iconDisplayed = false;
        final UIDL opUidl = (UIDL) it.next();
        CheckBox op;

        String itemHtml = opUidl.getStringAttribute("caption");
        if (!htmlContentAllowed) {
            itemHtml = Util.escapeHTML(itemHtml);
        }

        final String icon = opUidl.getStringAttribute("icon");
        if (icon != null && icon.length() != 0) {
            final String iconUrl = client.translateVaadinUri(icon);
            itemHtml = "<span style=\"white-space: normal;\">" + itemHtml + "</span><br/><img src=\"" + iconUrl
                    + "\" class=\"" + Icon.CLASSNAME + "\" alt=\"\" />";
            iconDisplayed = true;
        }

        if (isMultiselect()) {
            op = new VCheckBox();
        } else {
            op = new RadioButton(paintableId, null, true);
            op.setStyleName("v-radiobutton");
        }

        op.addStyleName(CLASSNAME_OPTION);
        op.setValue(opUidl.getBooleanAttribute("selected"));
        final boolean optionEnabled = !opUidl
                .getBooleanAttribute(OptionGroupConstants.ATTRIBUTE_OPTION_DISABLED);
        final boolean enabled = optionEnabled && !isReadonly() && isEnabled();
        op.setEnabled(enabled);
        optionsEnabled.add(optionEnabled);
        setStyleName(op.getElement(), ApplicationConnection.DISABLED_CLASSNAME,
                !(optionEnabled && isEnabled()));
        op.addClickHandler(this);
        optionsToKeys.put(op, opUidl.getStringAttribute("key"));
        String description = opUidl.getStringAttribute("description-text");
        if (description == null) {
            description = "";
        }
        if (opUidl.getStringAttribute("description-icon") != null) {
            description += "<br/><img src=\""
                    + client.translateVaadinUri(opUidl.getStringAttribute("description-icon")) + "\"\\>";
        }

        final FocusableFlexTable table = new FocusableFlexTable();
        table.setWidget(0, 0, op);
        table.setHTML(0, 1, itemHtml);
        table.setCellPadding(0);
        table.setCellSpacing(0);
        panel.add(table);

        if (description != null && description.length() != 0) {
            elementsToDescription.put(table.getElement(), description);
        }
        if (iconDisplayed) {
            Util.sinkOnloadForImages(table.getElement());
            table.addHandler(iconLoadHandler, LoadEvent.getType());
        }
    }

}

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

License:Open Source License

@Override
protected void buildOptions(UIDL uidl) {
    panel.clear();//  w w w  . j  a v a2 s  . c o m
    for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
        final UIDL opUidl = (UIDL) it.next();
        CheckBox op;

        String itemHtml = opUidl.getStringAttribute("caption");
        if (!htmlContentAllowed) {
            itemHtml = Util.escapeHTML(itemHtml);
        }

        String icon = opUidl.getStringAttribute("icon");
        if (icon != null && icon.length() != 0) {
            String iconUrl = client.translateVaadinUri(icon);
            itemHtml = "<img src=\"" + iconUrl + "\" class=\"" + Icon.CLASSNAME + "\" alt=\"\" />" + itemHtml;
        }

        if (isMultiselect()) {
            op = new VCheckBox();
            op.setHTML(itemHtml);
        } else {
            op = new RadioButton(id, itemHtml, true);
            op.setStyleName("v-radiobutton");
        }

        if (icon != null && icon.length() != 0) {
            Util.sinkOnloadForImages(op.getElement());
            op.addHandler(iconLoadHandler, LoadEvent.getType());
        }

        op.addStyleName(CLASSNAME_OPTION);
        op.setValue(opUidl.getBooleanAttribute("selected"));
        boolean enabled = !opUidl.getBooleanAttribute("disabled") && !isReadonly() && !isDisabled();
        op.setEnabled(enabled);
        setStyleName(op.getElement(), ApplicationConnection.DISABLED_CLASSNAME, !enabled);
        op.addClickHandler(this);
        optionsToKeys.put(op, opUidl.getStringAttribute("key"));
        panel.add(op);
    }
}

From source file:edu.cudenver.bios.glimmpse.client.panels.matrix.OptionsConfidenceIntervalsPanel.java

License:Open Source License

private VerticalPanel createTypePanel() {
    typePanel = new VerticalPanel();

    // create the radio buttons
    sigmaCIRadioButton = new RadioButton(ciTypeRadioGroup,
            Glimmpse.constants.confidenceIntervalOptionsTypeSigma(), true);
    sigmaCIRadioButton.addClickHandler(new ClickHandler() {
        @Override/*  ww  w  .  j  a v  a 2  s  .  co  m*/
        public void onClick(ClickEvent event) {
            checkComplete();
        }
    });
    betaSigmaCIRadioButton = new RadioButton(ciTypeRadioGroup,
            Glimmpse.constants.confidenceIntervalOptionsTypeBetaSigma(), true);
    betaSigmaCIRadioButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkComplete();
        }
    });
    // layout the panel
    typePanel.add(new HTML(Glimmpse.constants.confidenceIntervalOptionsTypeQuestion()));
    typePanel.add(sigmaCIRadioButton);
    typePanel.add(betaSigmaCIRadioButton);

    // set style
    sigmaCIRadioButton.setStyleName(GlimmpseConstants.STYLE_WIZARD_INDENTED_CONTENT);
    betaSigmaCIRadioButton.setStyleName(GlimmpseConstants.STYLE_WIZARD_INDENTED_CONTENT);
    typePanel.setStyleName(GlimmpseConstants.STYLE_WIZARD_PARAGRAPH);
    return typePanel;
}

From source file:edu.purdue.pivot.skwiki.client.dnd.PaletteWidget.java

License:Apache License

public PaletteWidget cloneWidget() {
    Widget clone;/*w w  w .  j  a  v a 2  s .c om*/

    // Clone our internal widget
    if (widget instanceof Label) {
        Label label = (Label) widget;
        clone = new Label(label.getText());
    } else if (widget instanceof RadioButton) {
        RadioButton radioButton = (RadioButton) widget;
        clone = new RadioButton(radioButton.getName(), radioButton.getHTML(), true);
    } else if (widget instanceof CheckBox) {
        CheckBox checkBox = (CheckBox) widget;
        clone = new CheckBox(checkBox.getHTML(), true);
    } else if (widget instanceof TextWindow) {
        TextWindow editWindow = (TextWindow) widget;
        clone = new TextWindow();
    } else if (widget instanceof CanvasWindow) {
        CanvasWindow editWindow = (CanvasWindow) widget;
        clone = new CanvasWindow();
    } else {
        throw new IllegalStateException("Unhandled Widget class " + widget.getClass().getName());
    }

    // Copy a few obvious common widget properties
    clone.setStyleName(widget.getStyleName());
    clone.setTitle(widget.getTitle());

    // Wrap the cloned widget in a new PaletteWidget instance
    return new PaletteWidget(clone);
}

From source file:edu.ucdenver.bios.glimmpseweb.client.shared.OptionsConfidenceIntervalsPanel.java

License:Open Source License

/**
 * Create panel to specify the type of confidence intervals
 * /*from   w  ww .  j a v  a 2  s .  c  o  m*/
 * @return type panel
 */
private VerticalPanel createTypePanel() {
    typePanel = new VerticalPanel();

    // create the radio buttons
    sigmaCIRadioButton = new RadioButton(ciTypeRadioGroup,
            GlimmpseWeb.constants.confidenceIntervalOptionsTypeSigma(), true);
    sigmaCIRadioButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            updateConfidenceIntervalDescription();
            checkComplete();
        }
    });
    betaSigmaCIRadioButton = new RadioButton(ciTypeRadioGroup,
            GlimmpseWeb.constants.confidenceIntervalOptionsTypeBetaSigma(), true);
    betaSigmaCIRadioButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            updateConfidenceIntervalDescription();
            checkComplete();
        }
    });
    // layout the panel
    typePanel.add(new HTML(GlimmpseWeb.constants.confidenceIntervalOptionsTypeQuestion()));
    typePanel.add(sigmaCIRadioButton);
    typePanel.add(betaSigmaCIRadioButton);

    // set style
    sigmaCIRadioButton.setStyleName(GlimmpseConstants.STYLE_WIZARD_INDENTED_CONTENT);
    betaSigmaCIRadioButton.setStyleName(GlimmpseConstants.STYLE_WIZARD_INDENTED_CONTENT);
    typePanel.setStyleName(GlimmpseConstants.STYLE_WIZARD_PARAGRAPH);
    return typePanel;
}

From source file:org.bonitasoft.forms.client.view.widget.RadioButtonGroupWidget.java

License:Open Source License

private RadioButton createRadioButton(final String groupName,
        final ReducedFormFieldAvailableValue availableValue, final boolean allowHTML) {
    final RadioButton radioButton = new RadioButton(radioButtonGroupName, availableValue.getLabel(), allowHTML);
    radioButton.addClickHandler(this);
    radioButton.addValueChangeHandler(this);
    radioButton.setFormValue(availableValue.getValue());
    radioButton.setStyleName("bonita_form_radio");
    return radioButton;
}