Java Code Examples for com.google.gwt.user.client.ui.Image#getWidth()

The following examples show how to use com.google.gwt.user.client.ui.Image#getWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
/**
         * Shows a resource as the {@code <img>} element.
         */
        public void loadImage(String url) {
            ClientUtils.setMembers(display, imgContainer);
            image = new Image();
            image.addLoadHandler(this);
            image.addErrorHandler(this);
            image.setUrl(url);
            drawHandler = imgContainer.addDrawHandler(this);
            resizedHandler = imgContainer.addResizedHandler(this);
            ClientUtils.fine(LOG, "loadImage url: %s, width: %s", url, image.getWidth());
            if (image.getWidth() == 0) {
                WidgetCanvas widgetCanvas = new WidgetCanvas(image);
                widgetCanvas.setVisible(false);
                widgetCanvas.setWidth(1);
                widgetCanvas.setHeight(1);
                widgetCanvas.draw();
                Img loadingImg = new Img("[SKIN]/loadingSmall.gif", 16, 16);
//                Img loadingImg = new Img("[SKIN]/shared/progressCursorTracker.gif", 16, 16);
                loadingImg.setAltText(i18n.ImportBatchDataSource_State_LOADING());
                loadingImg.setPrompt(i18n.ImportBatchDataSource_State_LOADING());
                loadingImg.setLayoutAlign(Alignment.CENTER);
                imgContainer.setMembers(loadingImg, widgetCanvas);
            }
            scheduleForRender();
        }