List of usage examples for com.google.gwt.resources.client ImageResource getURL
@Deprecated String getURL();
From source file:co.fxl.gui.gwt.GWTImage.java
License:Open Source License
public static String getImageURL(String path, String treeIcon) { if (USE_IMAGE_RESOURCES) { ImageResource ir = GWTImage.resolve(treeIcon); if (ir != null) return ir.getURL(); }/*from w ww .j av a 2 s .c o m*/ return path + treeIcon; }
From source file:com.example.texture_mapping.client.Texture_mapping.java
License:Apache License
/** * Handles image loading./* w w w . j a v a 2s . c o m*/ * @param imageResource * @return {@link Image} to be used as a texture */ public Image getImage(final ImageResource imageResource) { final Image img = new Image(); img.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { RootPanel.get().remove(img); } }); img.setVisible(false); RootPanel.get().add(img); img.setUrl(imageResource.getURL()); return img; }
From source file:com.google.speedtracer.client.util.dom.ImageResourceElementCreator.java
License:Apache License
public static Element createElementFrom(ImageResource resource) { SpanElement img = DocumentExt.get().createSpanElement(); String style = "url(" + resource.getURL() + ") no-repeat " + (-resource.getLeft() + "px ") + (-resource.getTop() + "px"); img.getStyle().setProperty("background", style); img.getStyle().setPropertyPx("width", resource.getWidth()); img.getStyle().setPropertyPx("height", resource.getHeight()); img.getStyle().setDisplay(Display.INLINE_BLOCK); return img;// ww w. j av a 2s.c o m }
From source file:com.googlecode.gwtgl.example.client.examples.skybox.SkyboxExample.java
License:Apache License
private WebGLTexture createTexture(ImageResource imageResource) { final WebGLTexture texture = glContext.createTexture(); final Image img = new Image(); img.addLoadHandler(new LoadHandler() { @Override// w w w . j a v a2 s . co m public void onLoad(LoadEvent event) { RootPanel.get().remove(img); glContext.activeTexture(WebGLRenderingContext.TEXTURE0); glContext.bindTexture(WebGLRenderingContext.TEXTURE_2D, texture); glContext.texParameteri(WebGLRenderingContext.TEXTURE_2D, WebGLRenderingContext.TEXTURE_MIN_FILTER, WebGLRenderingContext.NEAREST); glContext.texParameteri(WebGLRenderingContext.TEXTURE_2D, WebGLRenderingContext.TEXTURE_MAG_FILTER, WebGLRenderingContext.NEAREST); glContext.texParameteri(WebGLRenderingContext.TEXTURE_2D, WebGLRenderingContext.TEXTURE_WRAP_S, WebGLRenderingContext.CLAMP_TO_EDGE); glContext.texParameteri(WebGLRenderingContext.TEXTURE_2D, WebGLRenderingContext.TEXTURE_WRAP_T, WebGLRenderingContext.CLAMP_TO_EDGE); glContext.texImage2D(WebGLRenderingContext.TEXTURE_2D, 0, WebGLRenderingContext.RGBA, WebGLRenderingContext.RGBA, WebGLRenderingContext.UNSIGNED_BYTE, img.getElement()); checkErrors(); } }); img.setVisible(false); RootPanel.get().add(img); // image.setResource(imageResource); // TODO doesn't work with more than one image bundled to one // ImageBundle if the browser doesn't support data:... urls // So it's no problem at the moment because Chrome and FF support it img.setUrl(imageResource.getURL()); return texture; }
From source file:com.googlecode.gwtgl.example.client.examples.texturedcube.binding.TexturedCubeBindingExample.java
License:Apache License
/** * Converts ImageResource to Image./*from w ww. j av a2s . c o m*/ * @param imageResource * @return {@link Image} to be used as a texture */ public Image getImage(final ImageResource imageResource) { final Image img = new Image(); img.setVisible(false); RootPanel.get().add(img); img.setUrl(imageResource.getURL()); return img; }
From source file:com.googlecode.gwtgl.wrapper.Texture2D.java
License:Apache License
/** * Sets the image to be used for this texture. The image is loaded and set * when the texture is activated via setActiveAndBind. * //w ww. j ava 2 s . c o m * @param imageResource */ public void setImage(final ImageResource imageResource) { if (destroyed) { throw new IllegalStateException("The Texture2D is already destroyed"); } final Image img = new Image(); handlerRegistration = img.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { imageToSet = img; RootPanel.get().remove(img); if (handlerRegistration != null) { handlerRegistration.removeHandler(); handlerRegistration = null; } } }); img.setVisible(false); RootPanel.get().add(img); // image.setResource(imageResource); // TODO doesn't work with more than one image bundled to one // ImageBundle if the browser doesn't support data:... urls // So it's no problem at the moment because Chrome and FF support it img.setUrl(imageResource.getURL()); }
From source file:eu.cloud4soa.frontend.widget.monitoring.client.views.gxt.DeployedApplicationsGXTViewImpl.java
License:Open Source License
private Image getStatusIcon(ApplicationModel model, String property) { boolean enabled = Boolean .valueOf(model.get(property).equals(ApplicationModel.STATUS_ONLINE) ? true : false); ImageResource resource = enabled ? rb.online() : rb.offline(); if (enabled) { //Checking available violations for this application if (hasViolations(model.getKey())) { resource = rb.violations();/* ww w .ja v a 2 s .c om*/ } } Image icon = new Image(); icon.setUrl(resource.getURL()); return icon; }
From source file:forplay.flash.FlashAssetManager.java
License:Apache License
@Override protected Image loadImage(String path) { String url = pathPrefix + path; ForPlay.log().info("Looking to load " + url); AutoClientBundleWithLookup clientBundle = getBundle(path); if (clientBundle != null) { String key = getKey(path); ImageResource resource = (ImageResource) getResource(key, clientBundle); if (resource != null) { url = resource.getURL(); }//w ww . jav a 2s. c o m } return adaptImage(url); }
From source file:forplay.html.HtmlAssetManager.java
License:Apache License
@Override protected Image loadImage(String path) { String url = pathPrefix + path; AutoClientBundleWithLookup clientBundle = getBundle(path); if (clientBundle != null) { String key = getKey(path); ImageResource resource = (ImageResource) getResource(key, clientBundle); if (resource != null) { url = resource.getURL(); }// w w w . j a v a 2 s .c o m } return adaptImage(url); }
From source file:gwt.material.design.client.ui.MaterialTopNav.java
License:Apache License
@SuppressWarnings("deprecation") public void setResource(ImageResource resource) { this.resource = resource; generateBackground(resource.getURL()); }