use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.
the class PresentationPane method createMainToolbar.
@Override
protected Toolbar createMainToolbar() {
boolean isTutorial = session_.getSessionInfo().getPresentationState().isTutorial();
Toolbar toolbar = new Toolbar();
slideNavigationMenu_ = new SlideNavigationToolbarMenu(toolbar);
slideNavigationMenu_.setEditButtonVisible(!isTutorial);
toolbar.addLeftSeparator();
toolbar.addLeftWidget(commands_.presentationFullscreen().createToolbarButton());
// More
if (!isTutorial) {
ToolbarPopupMenu moreMenu = new ToolbarPopupMenu();
moreMenu.addItem(commands_.clearPresentationCache().createMenuItem(false));
moreMenu.addSeparator();
moreMenu.addItem(commands_.presentationViewInBrowser().createMenuItem(false));
moreMenu.addItem(commands_.presentationSaveAsStandalone().createMenuItem(false));
ToolbarButton moreButton = new ToolbarButton("More", new ImageResource2x(StandardIcons.INSTANCE.more_actions2x()), moreMenu);
toolbar.addRightWidget(moreButton);
// Create the publish button and wire it to our HTML generator
publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_PRES, false, null);
publishButton_.setPublishHtmlSource(new PublishHtmlSource() {
@Override
public void generatePublishHtml(final CommandWithArg<String> onCompleted) {
server_.createPresentationRPubsSource(new SimpleRequestCallback<PresentationRPubsSource>() {
@Override
public void onResponseReceived(PresentationRPubsSource source) {
onCompleted.execute(source.getSourceFilePath());
}
@Override
public void onError(ServerError error) {
display_.showErrorMessage("Error Saving Presentation", Presentation.getErrorMessage(error));
}
});
}
@Override
public String getTitle() {
return "Presentation:\n" + getPresentationTitle();
}
});
toolbar.addRightSeparator();
toolbar.addRightWidget(publishButton_);
} else {
toolbar.addRightWidget(commands_.tutorialFeedback().createToolbarButton());
}
toolbar.addRightSeparator();
toolbar.addRightWidget(refreshButton_ = commands_.refreshPresentation().createToolbarButton());
progressButton_ = new ToolbarButton(CoreResources.INSTANCE.progress_gray(), new ClickHandler() {
@Override
public void onClick(ClickEvent e) {
}
});
toolbar.addRightWidget(progressButton_);
progressButton_.setVisible(false);
return toolbar;
}
use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.
the class MessageDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
HorizontalPanel horizontalPanel = new HorizontalPanel();
horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
// add image
MessageDialogImages images = MessageDialogImages.INSTANCE;
Image image = null;
switch(type_) {
case INFO:
image = new Image(new ImageResource2x(images.dialog_info2x()));
break;
case WARNING:
image = new Image(new ImageResource2x(images.dialog_warning2x()));
break;
case ERROR:
image = new Image(new ImageResource2x(images.dialog_error2x()));
break;
case QUESTION:
image = new Image(new ImageResource2x(images.dialog_question2x()));
break;
case POPUP_BLOCKED:
image = new Image(new ImageResource2x(images.dialog_popup_blocked2x()));
break;
}
horizontalPanel.add(image);
// add message widget
horizontalPanel.add(messageWidget_);
return horizontalPanel;
}
use of org.rstudio.core.client.resources.ImageResource2x 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 org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.
the class WebApplicationHeader method initCommandsPanel.
private void initCommandsPanel(final SessionInfo sessionInfo) {
// add username
if (sessionInfo.getShowIdentity()) {
ToolbarLabel usernameLabel = new ToolbarLabel();
usernameLabel.getElement().getStyle().setMarginRight(2, Unit.PX);
if (!BrowseCap.isFirefox())
usernameLabel.getElement().getStyle().setMarginTop(2, Unit.PX);
String userIdentity = sessionInfo.getUserIdentity();
usernameLabel.setTitle(userIdentity);
userIdentity = userIdentity.split("@")[0];
usernameLabel.setText(userIdentity);
headerBarCommandsPanel_.add(usernameLabel);
ToolbarButton signOutButton = new ToolbarButton(new ImageResource2x(RESOURCES.signOut2x()), new ClickHandler() {
public void onClick(ClickEvent event) {
eventBus_.fireEvent(new LogoutRequestedEvent());
}
});
signOutButton.setTitle("Sign out");
headerBarCommandsPanel_.add(signOutButton);
headerBarCommandsPanel_.add(signOutSeparator_ = createCommandSeparator());
}
overlay_.addCommands(this);
headerBarCommandsPanel_.add(commands_.quitSession().createToolbarButton());
}
use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.
the class PackagesPane method initPackagesTable.
private void initPackagesTable() {
packagesTable_.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
packagesTable_.setSelectionModel(new NoSelectionModel<PackageInfo>());
LoadedColumn loadedColumn = new LoadedColumn();
NameColumn nameColumn = new NameColumn();
Column<PackageInfo, PackageInfo> descColumn = new Column<PackageInfo, PackageInfo>(new DescriptionCell()) {
@Override
public PackageInfo getValue(PackageInfo object) {
return object;
}
};
Column<PackageInfo, PackageInfo> versionColumn = new Column<PackageInfo, PackageInfo>(new VersionCell(false)) {
@Override
public PackageInfo getValue(PackageInfo object) {
return object;
}
};
ImageButtonColumn<PackageInfo> removeColumn = new ImageButtonColumn<PackageInfo>(new ImageResource2x(ThemeResources.INSTANCE.removePackage2x()), new OperationWithInput<PackageInfo>() {
@Override
public void execute(PackageInfo packageInfo) {
observer_.removePackage(packageInfo);
}
}, "Remove package");
// add common columns
packagesTable_.addColumn(loadedColumn, new TextHeader(""));
packagesTable_.addColumn(nameColumn, new TextHeader("Name"));
packagesTable_.addColumn(descColumn, new TextHeader("Description"));
packagesTable_.addColumn(versionColumn, new TextHeader("Version"));
packagesTable_.setColumnWidth(loadedColumn, 30, Unit.PX);
// set up Packrat-specific columns
if (packratContext_ != null && packratContext_.isModeOn()) {
Column<PackageInfo, PackageInfo> packratVersionColumn = new Column<PackageInfo, PackageInfo>(new VersionCell(true)) {
@Override
public PackageInfo getValue(PackageInfo object) {
return object;
}
};
TextColumn<PackageInfo> packratSourceColumn = new TextColumn<PackageInfo>() {
@Override
public String getValue(PackageInfo pkgInfo) {
if (pkgInfo.getInPackratLibary()) {
String source = pkgInfo.getPackratSource();
if (source.equals("github"))
return "GitHub";
else if (source.equals("Bioconductor"))
return "BioC";
else if (source.equals("source"))
return "Source";
else
return source;
} else
return "";
}
};
packagesTable_.addColumn(packratVersionColumn, new TextHeader("Packrat"));
packagesTable_.addColumn(packratSourceColumn, new TextHeader("Source"));
// distribute columns for extended package information
packagesTable_.setColumnWidth(nameColumn, 20, Unit.PCT);
packagesTable_.setColumnWidth(descColumn, 40, Unit.PCT);
packagesTable_.setColumnWidth(versionColumn, 15, Unit.PCT);
packagesTable_.setColumnWidth(packratVersionColumn, 15, Unit.PCT);
packagesTable_.setColumnWidth(packratSourceColumn, 10, Unit.PCT);
// highlight rows that are out of sync in packrat
packagesTable_.setRowStyles(new PackageRowStyles());
} else {
// distribute columns for non-extended package information
packagesTable_.setColumnWidth(nameColumn, 25, Unit.PCT);
packagesTable_.setColumnWidth(descColumn, 60, Unit.PCT);
packagesTable_.setColumnWidth(versionColumn, 15, Unit.PCT);
}
// remove column is common
packagesTable_.addColumn(removeColumn, new TextHeader(""));
packagesTable_.setColumnWidth(removeColumn, 35, Unit.PX);
packagesTable_.setTableBuilder(new PackageTableBuilder(packagesTable_));
packagesTable_.setSkipRowHoverCheck(true);
packagesTableContainer_.add(packagesTable_);
layoutPackagesTable();
packagesDataProvider_.addDataDisplay(packagesTable_);
}
Aggregations