use of com.google.gwt.user.client.ui.VerticalPanel in project rstudio by rstudio.
the class RPubsUploadDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
Styles styles = RESOURCES.styles();
SimplePanel mainPanel = new SimplePanel();
mainPanel.addStyleName(styles.mainWidget());
VerticalPanel verticalPanel = new VerticalPanel();
HorizontalPanel headerPanel = new HorizontalPanel();
headerPanel.addStyleName(styles.headerPanel());
headerPanel.add(new Image(new ImageResource2x(RESOURCES.publishLarge2x())));
Label headerLabel = new Label("Publish to RPubs");
headerLabel.addStyleName(styles.headerLabel());
headerPanel.add(headerLabel);
headerPanel.setCellVerticalAlignment(headerLabel, HasVerticalAlignment.ALIGN_MIDDLE);
verticalPanel.add(headerPanel);
String msg;
if (!isPublished_ && uploadId_.isEmpty()) {
msg = "RPubs is a free service from RStudio for sharing " + "documents on the web. Click Publish to get " + "started.";
} else {
msg = "This document has already been published on RPubs. You can " + "choose to either update the existing RPubs document, or " + "create a new one.";
}
Label descLabel = new Label(msg);
descLabel.addStyleName(styles.descLabel());
verticalPanel.add(descLabel);
// if we have a generator then show title and comment UI
if (htmlGenerator_ != null) {
Label titleLabel = new Label("Title (optional):");
titleLabel.addStyleName(styles.fieldLabel());
verticalPanel.add(titleLabel);
titleTextBox_ = new TextBox();
titleTextBox_.addStyleName(styles.titleTextBox());
titleTextBox_.getElement().setAttribute("spellcheck", "false");
verticalPanel.add(titleTextBox_);
Label commentLabel = new Label("Comment (optional):");
commentLabel.addStyleName(styles.fieldLabel());
verticalPanel.add(commentLabel);
commentTextArea_ = new FixedTextArea(6);
commentTextArea_.addStyleName(styles.commentTextArea());
verticalPanel.add(commentTextArea_);
// not using either for now
titleLabel.setVisible(false);
titleTextBox_.setVisible(false);
commentLabel.setVisible(false);
commentTextArea_.setVisible(false);
previewButton_ = new ThemedButton("Preview");
previewButton_.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
htmlGenerator_.generateStaticHtml(titleTextBox_.getText().trim(), commentTextArea_.getText().trim(), new CommandWithArg<String>() {
@Override
public void execute(String rpubsFile) {
globalDisplay_.showHtmlFile(rpubsFile);
}
});
}
});
addLeftButton(previewButton_);
}
HTML warningLabel = new HTML("<strong>IMPORTANT: All documents published to RPubs are " + "publicly visible.</strong> You should " + "only publish documents that you wish to share publicly.");
warningLabel.addStyleName(styles.warningLabel());
verticalPanel.add(warningLabel);
ThemedButton cancelButton = createCancelButton(new Operation() {
@Override
public void execute() {
// if an upload is in progress then terminate it
if (uploader_.isUploadInProgress()) {
uploader_.terminateUpload();
}
}
});
continueButton_ = new ThemedButton("Publish", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
performUpload(false);
}
});
updateButton_ = new ThemedButton("Update Existing", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
performUpload(true);
}
});
createButton_ = new ThemedButton("Create New", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
performUpload(false);
}
});
if (!isPublished_ && uploadId_.isEmpty()) {
addOkButton(continueButton_);
addCancelButton(cancelButton);
} else {
addOkButton(updateButton_);
addButton(createButton_);
addCancelButton(cancelButton);
}
mainPanel.setWidget(verticalPanel);
return mainPanel;
}
use of com.google.gwt.user.client.ui.VerticalPanel in project rstudio by rstudio.
the class RStudioAPI method showDialog.
private void showDialog(String caption, String message, final String url) {
VerticalPanel verticalPanel = new VerticalPanel();
verticalPanel.addStyleName(RES.styles().textInfoWidget());
SafeHtml safeMsg = DialogHtmlSanitizer.sanitizeHtml(message);
HTML msg = new HTML(safeMsg.asString());
msg.setWidth("100%");
verticalPanel.add(msg);
if (!StringUtil.isNullOrEmpty(url)) {
HyperlinkLabel link = new HyperlinkLabel(url, new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
RStudioGinjector.INSTANCE.getGlobalDisplay().openWindow(url);
}
});
link.addStyleName(RES.styles().installLink());
verticalPanel.add(link);
}
MessageDialog dlg = new MessageDialog(MessageDialog.INFO, caption, verticalPanel);
dlg.addButton("OK", new Operation() {
@Override
public void execute() {
server_.showDialogCompleted(null, false, new SimpleRequestCallback<Void>());
}
}, true, false);
dlg.showModal();
}
use of com.google.gwt.user.client.ui.VerticalPanel 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.VerticalPanel 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.VerticalPanel in project opennms by OpenNMS.
the class OpenLayersMapPanel method showLocationDetails.
/**
* {@inheritDoc}
*/
@Override
public void showLocationDetails(String name, String htmlTitle, String htmlContent) {
final Marker marker = getMarker(name);
if (marker != null) {
m_map.setCenter(marker.getLonLat());
final VerticalPanel panel = new VerticalPanel();
panel.add(new Label(htmlTitle));
panel.add(new HTML(htmlContent));
Popup p = new Popup(name, marker.getLonLat(), new Size(300, 300), panel.toString(), true);
// p.setAutoSize(true);
p.getJSObject().setProperty("autoSize", true);
m_map.addPopupExclusive(p);
}
}
Aggregations