Search in sources :

Example 1 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project che by eclipse.

the class CustomComboBox method insertItem.

/**
     * Inserts an item into the list box.
     *
     * @param item
     *         the text of the item to be inserted.
     * @param value
     *         the item's value.
     */
public void insertItem(String item, String value) {
    //create new widget
    final RadioButton radioButton = new RadioButton(optionsGroupName, item);
    //remove the default gwt-RadioButton style
    radioButton.removeStyleName("gwt-RadioButton");
    //set value
    final InputElement inputElement = (InputElement) radioButton.getElement().getElementsByTagName("input").getItem(0);
    inputElement.removeAttribute("tabindex");
    inputElement.setAttribute("value", value);
    //set default state
    if (defaultSelectedIndex > -1 && optionsPanel.getElement().getChildCount() == defaultSelectedIndex) {
        inputElement.setChecked(true);
        currentInputElement.setValue("");
    }
    //add to widget
    optionsPanel.add(radioButton);
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton) InputElement(com.google.gwt.dom.client.InputElement)

Example 2 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project gerrit by GerritCodeReview.

the class NewAgreementScreen method renderSelf.

private void renderSelf() {
    current = null;
    agreementGroup.setVisible(false);
    finalGroup.setVisible(false);
    radios.clear();
    final SmallHeading hdr = new SmallHeading();
    if (available.isEmpty()) {
        hdr.setText(Util.C.newAgreementNoneAvailable());
    } else {
        hdr.setText(Util.C.newAgreementSelectTypeHeading());
    }
    radios.add(hdr);
    for (final AgreementInfo cla : available) {
        final RadioButton r = new RadioButton("cla_id", cla.name());
        r.addStyleName(Gerrit.RESOURCES.css().contributorAgreementButton());
        radios.add(r);
        if (mySigned.contains(cla.name())) {
            r.setEnabled(false);
            final Label l = new Label(Util.C.newAgreementAlreadySubmitted());
            l.setStyleName(Gerrit.RESOURCES.css().contributorAgreementAlreadySubmitted());
            radios.add(l);
        } else {
            r.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(final ClickEvent event) {
                    showCLA(cla);
                }
            });
        }
        if (cla.description() != null && !cla.description().equals("")) {
            final Label l = new Label(cla.description());
            l.setStyleName(Gerrit.RESOURCES.css().contributorAgreementShortDescription());
            radios.add(l);
        }
    }
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) AgreementInfo(com.google.gerrit.client.info.AgreementInfo) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Label(com.google.gwt.user.client.ui.Label) InlineLabel(com.google.gwt.user.client.ui.InlineLabel) RadioButton(com.google.gwt.user.client.ui.RadioButton)

Example 3 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project rstudio by rstudio.

the class NewRMarkdownDialog method createFormatOption.

private Widget createFormatOption(String name, String description) {
    HTMLPanel formatWrapper = new HTMLPanel("");
    formatWrapper.setStyleName(style.outputFormat());
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    sb.appendHtmlConstant("<span class=\"" + style.outputFormatName() + "\">");
    sb.appendEscaped(name);
    sb.appendHtmlConstant("</span>");
    RadioButton button = new RadioButton("DefaultOutputFormat", sb.toSafeHtml().asString(), true);
    button.addStyleName(style.outputFormatChoice());
    formatOptions_.add(button);
    formatWrapper.add(button);
    Label label = new Label(description);
    label.setStyleName(style.outputFormatDetails());
    formatWrapper.add(label);
    return formatWrapper;
}
Also used : Label(com.google.gwt.user.client.ui.Label) RadioButton(com.google.gwt.user.client.ui.RadioButton) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) HTMLPanel(com.google.gwt.user.client.ui.HTMLPanel)

Example 4 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project rstudio by rstudio.

the class ModifyKeyboardShortcutsWidget method radioButton.

private RadioButton radioButton(String label, ClickHandler handler) {
    RadioButton button = new RadioButton(RADIO_BUTTON_GROUP, label);
    button.getElement().getStyle().setMarginRight(6, Unit.PX);
    button.getElement().getStyle().setFloat(Style.Float.LEFT);
    button.getElement().getStyle().setMarginTop(-2, Unit.PX);
    button.addClickHandler(handler);
    return button;
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton)

Example 5 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project rstudio by rstudio.

the class SavePlotAsPdfDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    ExportPlotResources.Styles styles = ExportPlotResources.INSTANCE.styles();
    Grid grid = new Grid(7, 2);
    grid.setStylePrimaryName(styles.savePdfMainWidget());
    // paper size
    grid.setWidget(0, 0, new Label("PDF Size:"));
    // paper size label
    paperSizeEditor_ = new PaperSizeEditor();
    grid.setWidget(0, 1, paperSizeEditor_);
    // orientation
    grid.setWidget(1, 0, new Label("Orientation:"));
    HorizontalPanel orientationPanel = new HorizontalPanel();
    orientationPanel.setSpacing(kComponentSpacing);
    VerticalPanel orientationGroupPanel = new VerticalPanel();
    final String kOrientationGroup = new String("Orientation");
    portraitRadioButton_ = new RadioButton(kOrientationGroup, "Portrait");
    orientationGroupPanel.add(portraitRadioButton_);
    landscapeRadioButton_ = new RadioButton(kOrientationGroup, "Landscape");
    orientationGroupPanel.add(landscapeRadioButton_);
    orientationPanel.add(orientationGroupPanel);
    grid.setWidget(1, 1, orientationPanel);
    boolean haveCairoPdf = sessionInfo_.isCairoPdfAvailable();
    if (haveCairoPdf)
        grid.setWidget(2, 0, new Label("Options:"));
    HorizontalPanel cairoPdfPanel = new HorizontalPanel();
    String label = "Use cairo_pdf device";
    if (BrowseCap.isMacintoshDesktop())
        label = label + " (requires X11)";
    chkCairoPdf_ = new CheckBox(label);
    chkCairoPdf_.getElement().getStyle().setMarginLeft(kComponentSpacing, Unit.PX);
    cairoPdfPanel.add(chkCairoPdf_);
    chkCairoPdf_.setValue(haveCairoPdf && options_.getCairoPdf());
    if (haveCairoPdf)
        grid.setWidget(2, 1, cairoPdfPanel);
    grid.setWidget(3, 0, new HTML("&nbsp;"));
    ThemedButton directoryButton = new ThemedButton("Directory...");
    directoryButton.setStylePrimaryName(styles.directoryButton());
    directoryButton.getElement().getStyle().setMarginLeft(-2, Unit.PX);
    grid.setWidget(4, 0, directoryButton);
    directoryButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            fileDialogs_.chooseFolder("Choose Directory", fileSystemContext_, FileSystemItem.createDir(directoryLabel_.getTitle().trim()), new ProgressOperationWithInput<FileSystemItem>() {

                public void execute(FileSystemItem input, ProgressIndicator indicator) {
                    if (input == null)
                        return;
                    indicator.onCompleted();
                    // update default
                    ExportPlotUtils.setDefaultSaveDirectory(input);
                    // set display
                    setDirectory(input);
                }
            });
        }
    });
    directoryLabel_ = new Label();
    setDirectory(defaultDirectory_);
    directoryLabel_.setStylePrimaryName(styles.savePdfDirectoryLabel());
    grid.setWidget(4, 1, directoryLabel_);
    Label fileNameLabel = new Label("File name:");
    fileNameLabel.setStylePrimaryName(styles.savePdfFileNameLabel());
    grid.setWidget(5, 0, fileNameLabel);
    fileNameTextBox_ = new TextBox();
    fileNameTextBox_.setText(defaultPlotName_);
    fileNameTextBox_.setStylePrimaryName(styles.savePdfFileNameTextBox());
    grid.setWidget(5, 1, fileNameTextBox_);
    // view after size
    viewAfterSaveCheckBox_ = new CheckBox("View plot after saving");
    viewAfterSaveCheckBox_.setStylePrimaryName(styles.savePdfViewAfterCheckbox());
    viewAfterSaveCheckBox_.setValue(options_.getViewAfterSave());
    grid.setWidget(6, 1, viewAfterSaveCheckBox_);
    // set default value
    if (options_.getPortrait())
        portraitRadioButton_.setValue(true);
    else
        landscapeRadioButton_.setValue(true);
    // return the widget
    return grid;
}
Also used : Grid(com.google.gwt.user.client.ui.Grid) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Label(com.google.gwt.user.client.ui.Label) HTML(com.google.gwt.user.client.ui.HTML) RadioButton(com.google.gwt.user.client.ui.RadioButton) TextBox(com.google.gwt.user.client.ui.TextBox) ProgressOperationWithInput(org.rstudio.core.client.widget.ProgressOperationWithInput) ThemedButton(org.rstudio.core.client.widget.ThemedButton) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ExportPlotResources(org.rstudio.studio.client.workbench.exportplot.ExportPlotResources) CheckBox(com.google.gwt.user.client.ui.CheckBox) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel)

Aggregations

RadioButton (com.google.gwt.user.client.ui.RadioButton)31 Test (org.junit.Test)11 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Label (com.google.gwt.user.client.ui.Label)4 Widget (com.google.gwt.user.client.ui.Widget)4 MockValueChangeHandler (com.googlecode.gwt.MockValueChangeHandler)4 InputElement (com.google.gwt.dom.client.InputElement)3 Element (com.google.gwt.dom.client.Element)2 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)2 EntityModelRadioButtonEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor)2 StringEntityModelTextAreaLabelEditor (org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor)2 AgreementInfo (com.google.gerrit.client.info.AgreementInfo)1 SmallHeading (com.google.gerrit.client.ui.SmallHeading)1 HeadingElement (com.google.gwt.dom.client.HeadingElement)1 Node (com.google.gwt.dom.client.Node)1