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);
}
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);
}
}
}
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;
}
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;
}
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(" "));
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;
}
Aggregations