Search in sources :

Example 11 with ImageResource

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_);
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ImageResource(com.google.gwt.resources.client.ImageResource) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Commands(org.rstudio.studio.client.workbench.commands.Commands) LeftRightToggleButton(org.rstudio.core.client.widget.LeftRightToggleButton)

Example 12 with ImageResource

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);
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 13 with ImageResource

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);
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 14 with ImageResource

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);
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 15 with ImageResource

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);
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource)

Aggregations

ImageResource (com.google.gwt.resources.client.ImageResource)34 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)9 Element (com.google.gwt.dom.client.Element)6 Image (com.google.gwt.user.client.ui.Image)6 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)5 Column (com.google.gwt.user.cellview.client.Column)5 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Test (org.junit.Test)4 ImageResourceCell (com.google.gwt.cell.client.ImageResourceCell)3 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)3 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)3 ArrayList (java.util.ArrayList)3 Context (com.google.gwt.cell.client.Cell.Context)2 JsArray (com.google.gwt.core.client.JsArray)2 JsArrayString (com.google.gwt.core.client.JsArrayString)2 NativeEvent (com.google.gwt.dom.client.NativeEvent)2 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)2 ListHandler (com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler)2 HTML (com.google.gwt.user.client.ui.HTML)2