use of com.google.gwt.resources.client.ImageResource in project che by eclipse.
the class GithubImporterPageViewImpl method createRepositoriesTable.
/**
* Creates table what contains list of available repositories.
*
* @param resources
*/
private void createRepositoriesTable(final Resources resources, GitHubLocalizationConstant locale) {
repositories = new CellTable<>(15, resources);
Column<ProjectData, ImageResource> iconColumn = new Column<ProjectData, ImageResource>(new ImageResourceCell()) {
@Override
public ImageResource getValue(ProjectData item) {
return null;
}
};
Column<ProjectData, SafeHtml> repositoryColumn = new Column<ProjectData, SafeHtml>(new SafeHtmlCell()) {
@Override
public SafeHtml getValue(final ProjectData item) {
return SafeHtmlUtils.fromString(item.getName());
}
};
Column<ProjectData, SafeHtml> descriptionColumn = new Column<ProjectData, SafeHtml>(new SafeHtmlCell()) {
@Override
public SafeHtml getValue(final ProjectData item) {
return new SafeHtmlBuilder().appendHtmlConstant("<span>").appendEscaped(item.getDescription() == null ? "" : item.getDescription()).appendHtmlConstant("</span>").toSafeHtml();
}
};
repositories.addColumn(iconColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
repositories.setColumnWidth(iconColumn, 28, Style.Unit.PX);
repositories.addColumn(repositoryColumn, locale.samplesListRepositoryColumn());
repositories.addColumn(descriptionColumn, locale.samplesListDescriptionColumn());
// don't show loading indicator
repositories.setLoadingIndicator(null);
final SingleSelectionModel<ProjectData> selectionModel = new SingleSelectionModel<>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
ProjectData selectedObject = selectionModel.getSelectedObject();
delegate.onRepositorySelected(selectedObject);
}
});
repositories.setSelectionModel(selectionModel);
}
use of com.google.gwt.resources.client.ImageResource in project rstudio by rstudio.
the class TextEditingTargetWidget method createCodeTransformMenuButton.
private Widget createCodeTransformMenuButton() {
if (codeTransform_ == null) {
ImageResource icon = new ImageResource2x(ThemeResources.INSTANCE.codeTransform2x());
ToolbarPopupMenu menu = new ToolbarPopupMenu();
menu.addItem(commands_.codeCompletion().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.goToHelp().createMenuItem(false));
menu.addItem(commands_.goToFunctionDefinition().createMenuItem(false));
menu.addItem(commands_.findUsages().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.extractFunction().createMenuItem(false));
menu.addItem(commands_.extractLocalVariable().createMenuItem(false));
menu.addItem(commands_.renameInScope().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.reflowComment().createMenuItem(false));
menu.addItem(commands_.commentUncomment().createMenuItem(false));
menu.addItem(commands_.insertRoxygenSkeleton().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.reindent().createMenuItem(false));
menu.addItem(commands_.reformatCode().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.showDiagnosticsActiveDocument().createMenuItem(false));
menu.addItem(commands_.showDiagnosticsProject().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.profileCode().createMenuItem(false));
codeTransform_ = new ToolbarButton("", icon, menu);
codeTransform_.setTitle("Code Tools");
}
return codeTransform_;
}
use of com.google.gwt.resources.client.ImageResource in project rstudio by rstudio.
the class TextEditingTargetWidget method setFormatOptions.
@Override
public void setFormatOptions(TextFileType fileType, boolean showRmdFormatMenu, boolean canEditFormatOptions, List<String> options, List<String> values, List<String> extensions, String selectedOption) {
if (!canEditFormatOptions) {
setFormatText("");
}
setRmdFormatButtonVisible(showRmdFormatMenu);
rmdFormatButton_.setEnabled(showRmdFormatMenu);
rmdFormatButton_.clearMenu();
int parenPos = selectedOption.indexOf('(');
if (parenPos != -1)
selectedOption = selectedOption.substring(0, parenPos).trim();
// don't show format text (but leave the code in for now in case
// we change our mind)
// setFormatText(selectedOption);
setFormatText("");
String prefix = fileType.isPlainMarkdown() ? "Preview " : "Knit to ";
for (int i = 0; i < Math.min(options.size(), values.size()); i++) {
String ext = extensions.get(i);
ImageResource img = ext != null ? fileTypeRegistry_.getIconForFilename("output." + ext) : fileTypeRegistry_.getIconForFilename("Makefile");
final String valueName = values.get(i);
ScheduledCommand cmd = new ScheduledCommand() {
@Override
public void execute() {
handlerManager_.fireEvent(new RmdOutputFormatChangedEvent(valueName));
}
};
String text = ext == ".nb.html" ? "Preview Notebook" : prefix + options.get(i);
MenuItem item = ImageMenuItem.create(img, text, cmd, 2);
rmdFormatButton_.addMenuItem(item, values.get(i));
}
if (session_.getSessionInfo().getKnitParamsAvailable()) {
final AppCommand knitWithParams = commands_.knitWithParameters();
rmdFormatButton_.addSeparator();
ScheduledCommand cmd = new ScheduledCommand() {
@Override
public void execute() {
knitWithParams.execute();
}
};
MenuItem item = new MenuItem(knitWithParams.getMenuHTML(false), true, cmd);
rmdFormatButton_.addMenuItem(item, knitWithParams.getMenuLabel(false));
}
if (session_.getSessionInfo().getKnitWorkingDirAvailable()) {
MenuBar knitDirMenu = new MenuBar(true);
DocPropMenuItem knitInDocDir = new DocShadowPropMenuItem("Document Directory", docUpdateSentinel_, uiPrefs_.knitWorkingDir(), RenderRmdEvent.WORKING_DIR_PROP, UIPrefsAccessor.KNIT_DIR_DEFAULT);
knitDirMenu.addItem(knitInDocDir);
DocPropMenuItem knitInProjectDir = new DocShadowPropMenuItem("Project Directory", docUpdateSentinel_, uiPrefs_.knitWorkingDir(), RenderRmdEvent.WORKING_DIR_PROP, UIPrefsAccessor.KNIT_DIR_PROJECT);
knitDirMenu.addItem(knitInProjectDir);
DocPropMenuItem knitInCurrentDir = new DocShadowPropMenuItem("Current Working Directory", docUpdateSentinel_, uiPrefs_.knitWorkingDir(), RenderRmdEvent.WORKING_DIR_PROP, UIPrefsAccessor.KNIT_DIR_CURRENT);
knitDirMenu.addItem(knitInCurrentDir);
rmdFormatButton_.addSeparator();
rmdFormatButton_.addMenuItem(knitDirMenu, "Knit Directory");
}
addClearKnitrCacheMenu(rmdFormatButton_);
showRmdViewerMenuItems(true, canEditFormatOptions, fileType.isRmd(), RmdOutput.TYPE_STATIC);
if (publishButton_ != null)
publishButton_.setIsStatic(true);
isShiny_ = false;
}
use of com.google.gwt.resources.client.ImageResource in project rstudio by rstudio.
the class CompilePanel method connectToolbar.
public void connectToolbar(Toolbar toolbar) {
Commands commands = RStudioGinjector.INSTANCE.getCommands();
ImageResource stopImage = commands.interruptR().getImageResource();
stopButton_ = new ToolbarButton(stopImage, null);
stopButton_.setVisible(false);
toolbar.addRightWidget(stopButton_);
showOutputButton_ = new LeftRightToggleButton("Output", "Issues", false);
showOutputButton_.setVisible(false);
showOutputButton_.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
showOutputButton_.setVisible(false);
showErrorsButton_.setVisible(true);
panel_.setWidget(outputDisplay_.asWidget());
outputDisplay_.scrollToBottom();
}
});
toolbar.addRightWidget(showOutputButton_);
showErrorsButton_ = new LeftRightToggleButton("Output", "Issues", true);
showErrorsButton_.setVisible(false);
showErrorsButton_.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
showOutputButton_.setVisible(true);
showErrorsButton_.setVisible(false);
panel_.setWidget(errorList_);
}
});
toolbar.addRightWidget(showErrorsButton_);
}
use of com.google.gwt.resources.client.ImageResource in project rstudio by rstudio.
the class RSConnectDeploy method applySource.
private void applySource() {
// show the description of what we're about to publish
if (source_.isSelfContained() && source_.isStatic() && !source_.isWebsiteRmd()) {
filePanel_.setVisible(false);
descriptionPanel_.setVisible(true);
if (contentType_ == RSConnect.CONTENT_TYPE_PLOT || contentType_ == RSConnect.CONTENT_TYPE_HTML) {
descriptionImage_.setResource(new ImageResource2x(RSConnectResources.INSTANCE.previewPlot2x()));
} else if (contentType_ == RSConnect.CONTENT_TYPE_PRES) {
descriptionImage_.setResource(new ImageResource2x(RSConnectResources.INSTANCE.previewPresentation2x()));
} else {
descriptionImage_.setResource(new ImageResource2x(RSConnectResources.INSTANCE.previewDoc2x()));
}
}
// (for apps and documents--other content types use temporary filenames)
if (appName_.getTitle().isEmpty()) {
if (contentType_ == RSConnect.CONTENT_TYPE_APP || contentType_ == RSConnect.CONTENT_TYPE_APP_SINGLE || contentType_ == RSConnect.CONTENT_TYPE_DOCUMENT) {
// set the app name to the filename
String appTitle = FilePathUtils.fileNameSansExtension(source_.getSourceFile());
// as the content name rather than the file
if (contentType_ == RSConnect.CONTENT_TYPE_DOCUMENT && appTitle.toLowerCase().equals("index")) {
appTitle = FilePathUtils.fileNameSansExtension(source_.getDeployDir());
}
setUnsanitizedAppName(appTitle);
} else if (contentType_ == RSConnect.CONTENT_TYPE_WEBSITE) {
setUnsanitizedAppName(FilePathUtils.fileNameSansExtension(source_.getWebsiteDir()));
}
}
ImageResource illustration = null;
if (contentType_ == RSConnect.CONTENT_TYPE_APP)
illustration = new ImageResource2x(RESOURCES.publishShinyIllustration2x());
else if (contentType_ == RSConnect.CONTENT_TYPE_PLOT)
illustration = new ImageResource2x(RESOURCES.publishPlotIllustration2x());
else if (contentType_ == RSConnect.CONTENT_TYPE_DOCUMENT)
illustration = new ImageResource2x(RESOURCES.publishRmdIllustration2x());
else if (contentType_ == RSConnect.CONTENT_TYPE_HTML)
illustration = new ImageResource2x(RESOURCES.publishHTMLIllustration2x());
else if (contentType_ == RSConnect.CONTENT_TYPE_PRES)
illustration = new ImageResource2x(RESOURCES.publishPresentationIllustration2x());
if (illustration != null)
deployIllustration_.setResource(illustration);
}
Aggregations