use of com.google.gwt.user.client.ui.CheckBox in project rstudio by rstudio.
the class InstallPackageDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
// vertical panel
VerticalPanel mainPanel = new VerticalPanel();
mainPanel.setSpacing(2);
mainPanel.setStylePrimaryName(RESOURCES.styles().mainWidget());
// source type
reposCaption_ = new CaptionWithHelp("Install from:", "Configuring Repositories", "configuring_repositories");
reposCaption_.setIncludeVersionInfo(false);
reposCaption_.setWidth("100%");
mainPanel.add(reposCaption_);
packageSourceListBox_ = new ListBox();
packageSourceListBox_.setStylePrimaryName(RESOURCES.styles().packageSourceListBox());
packageSourceListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
JsArrayString repos = installContext_.selectedRepositoryNames();
if (repos.length() == 1) {
packageSourceListBox_.addItem("Repository (" + repos.get(0) + ")");
} else {
StringBuilder reposItem = new StringBuilder();
reposItem.append("Repository (");
for (int i = 0; i < repos.length(); i++) {
if (i != 0)
reposItem.append(", ");
reposItem.append(repos.get(i));
}
reposItem.append(")");
packageSourceListBox_.addItem(reposItem.toString());
}
packageSourceListBox_.addItem("Package Archive File (" + installContext_.packageArchiveExtension() + ")");
mainPanel.add(packageSourceListBox_);
// source panel container
sourcePanel_ = new SimplePanel();
sourcePanel_.setStylePrimaryName(RESOURCES.styles().packageSourcePanel());
// repos source panel
reposSourcePanel_ = new FlowPanel();
Label packagesLabel = new Label("Packages (separate multiple with space or comma):");
packagesLabel.setStylePrimaryName(RESOURCES.styles().packagesLabel());
reposSourcePanel_.add(packagesLabel);
packagesTextBox_ = new MultipleItemSuggestTextBox();
packagesSuggestBox_ = new SuggestBox(new PackageOracle(), packagesTextBox_);
packagesSuggestBox_.setWidth("100%");
packagesSuggestBox_.setLimit(20);
packagesSuggestBox_.addStyleName(RESOURCES.styles().extraBottomPad());
reposSourcePanel_.add(packagesSuggestBox_);
sourcePanel_.setWidget(reposSourcePanel_);
mainPanel.add(sourcePanel_);
// archive source panel
packageArchiveFile_ = new TextBoxWithButton("Package archive:", "Browse...", browseForArchiveClickHandler_);
// create check box here because manageUIState accesses it
installDependenciesCheckBox_ = new CheckBox();
if (defaultInstallOptions_.getInstallFromRepository())
packageSourceListBox_.setSelectedIndex(0);
else
packageSourceListBox_.setSelectedIndex(1);
manageUIState();
packageSourceListBox_.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
manageUIState();
if (!installFromRepository())
packageArchiveFile_.click();
}
});
mainPanel.add(new Label("Install to Library:"));
// library list box
libraryListBox_ = new ListBox();
libraryListBox_.setWidth("100%");
libraryListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
JsArrayString libPaths = installContext_.getWriteableLibraryPaths();
int selectedIndex = 0;
for (int i = 0; i < libPaths.length(); i++) {
String libPath = libPaths.get(i);
if (!installContext_.isDevModeOn()) {
if (defaultInstallOptions_.getLibraryPath().equals(libPath))
selectedIndex = i;
}
if (libPath.equals(installContext_.getDefaultLibraryPath()))
libPath = libPath + " [Default]";
libraryListBox_.addItem(libPath);
}
libraryListBox_.setSelectedIndex(selectedIndex);
mainPanel.add(libraryListBox_);
// install dependencies check box
installDependenciesCheckBox_.addStyleName(RESOURCES.styles().installDependenciesCheckBox());
installDependenciesCheckBox_.setText("Install dependencies");
installDependenciesCheckBox_.setValue(defaultInstallOptions_.getInstallDependencies());
mainPanel.add(installDependenciesCheckBox_);
mainPanel.add(new HTML("<br/>"));
return mainPanel;
}
use of com.google.gwt.user.client.ui.CheckBox 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;
}
use of com.google.gwt.user.client.ui.CheckBox in project rstudio by rstudio.
the class RSConnectDeploy method setPrimaryFile.
private void setPrimaryFile(String path) {
if (fileChecks_ == null)
return;
for (int i = 0; i < fileChecks_.size(); i++) {
CheckBox fileCheck = fileChecks_.get(i);
if (fileCheck.getText().equals(path)) {
// don't allow the user to unselect the primary file
fileCheck.setEnabled(false);
// make this bold and move it to the top
fileCheck.getElement().getStyle().setFontWeight(FontWeight.BOLD);
fileListPanel_.remove(fileCheck);
fileListPanel_.insert(fileCheck, 0);
}
}
}
use of com.google.gwt.user.client.ui.CheckBox in project rstudio by rstudio.
the class RSConnectDeploy method checkUncheckAll.
private void checkUncheckAll() {
allChecked_ = !allChecked_;
for (CheckBox box : fileChecks_) {
// don't toggle state for disabled boxes, or common Shiny .R filenames
String file = box.getText().toLowerCase();
if (box.isEnabled() && file != "ui.r" && file != "server.r" && file != "app.r") {
box.setValue(allChecked_);
}
}
checkUncheckAllButton_.setText(allChecked_ ? "Uncheck All" : "Check All");
}
use of com.google.gwt.user.client.ui.CheckBox in project rstudio by rstudio.
the class RSConnectDeploy method addFile.
private void addFile(String path, boolean checked) {
CheckBox fileCheck = new CheckBox(path);
fileCheck.setValue(checked);
fileListPanel_.add(fileCheck);
fileChecks_.add(fileCheck);
}
Aggregations