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);
}
use of com.google.gwt.resources.client.ImageResource in project gwt-test-utils by gwt-test-utils.
the class ClientBundleTest method rootClasspathImg.
@Test
public void rootClasspathImg() {
// Given
ImageResource rootClasspathImg = MyClientBundle.INSTANCE.rootClasspathImg();
// When
String name = rootClasspathImg.getName();
String url = rootClasspathImg.getSafeUri().asString();
int heigh = rootClasspathImg.getHeight();
int left = rootClasspathImg.getLeft();
int width = rootClasspathImg.getWidth();
int top = rootClasspathImg.getTop();
String toString = rootClasspathImg.toString();
// Then
assertThat(name).isEqualTo("rootClasspathImg");
assertThat(url).isEqualTo("http://127.0.0.1:8888/gwt_test_utils_module/root-classpath-img.png");
assertThat(heigh).isEqualTo(0);
assertThat(left).isEqualTo(0);
assertThat(width).isEqualTo(0);
assertThat(top).isEqualTo(0);
assertThat(toString).isEqualTo("com.googlecode.gwt.test.internal.resources.ImageResourceCallback generated for 'com.googlecode.gwt.test.resources.MyClientBundle.rootClasspathImg()'");
assertThat(MyClientBundle.INSTANCE.rootClasspathImg()).isEqualTo(rootClasspathImg);
}
use of com.google.gwt.resources.client.ImageResource in project gwt-test-utils by gwt-test-utils.
the class MyOverridedClientBundleTest method testImageResource_OverrideWithAnnotation.
@Test
public void testImageResource_OverrideWithAnnotation() {
// Given
ImageResource testImageResource = MyOverridedClientBundle.INSTANCE.imageResource();
// When
String name = testImageResource.getName();
String url = testImageResource.getSafeUri().asString();
int heigh = testImageResource.getHeight();
int left = testImageResource.getLeft();
int width = testImageResource.getWidth();
int top = testImageResource.getTop();
// Then
assertThat(name).isEqualTo("imageResource");
assertThat(url).isEqualTo("http://127.0.0.1:8888/gwt_test_utils_module/override_testImageResource.gif");
assertThat(heigh).isEqualTo(0);
assertThat(left).isEqualTo(0);
assertThat(width).isEqualTo(0);
assertThat(top).isEqualTo(0);
assertThat(MyOverridedClientBundle.INSTANCE.imageResource()).isEqualTo(testImageResource);
}
use of com.google.gwt.resources.client.ImageResource in project che by eclipse.
the class Presentation method setImageResource.
/**
* Sets icon image resource.
*
* @param imageResource image resource
*/
public void setImageResource(ImageResource imageResource) {
ImageResource oldImaheResource = imageResource;
this.imageResource = imageResource;
firePropertyChange(PROP_ICON, oldImaheResource, imageResource);
}
Aggregations