1 16 package com.google.gwt.user.client.ui.impl; 17 18 import com.google.gwt.user.client.ui.Image; 19 import com.google.gwt.user.client.ui.AbstractImagePrototype; 20 import com.google.gwt.core.client.GWT; 21 22 27 public class ClippedImagePrototype extends AbstractImagePrototype { 28 29 private static final ClippedImageImpl impl = (ClippedImageImpl) GWT.create(ClippedImageImpl.class); 30 31 private int left = 0; 32 private int top = 0; 33 private int width = 0; 34 private int height = 0; 35 private String url = null; 36 37 public ClippedImagePrototype(String url, int left, int top, int width, 38 int height) { 39 this.url = url; 40 this.left = left; 41 this.top = top; 42 this.width = width; 43 this.height = height; 44 } 45 46 public void applyTo(Image image) { 47 image.setUrlAndVisibleRect(url, left, top, width, height); 48 } 49 50 public Image createImage() { 51 return new Image(url, left, top, width, height); 52 } 53 54 public String getHTML() { 55 return impl.getHTML(url, left, top, width, height); 56 } 57 } 58 | Popular Tags |