@Override public void applyTo(ImagePrototypeElement imageElement) { impl.adjust(imageElement, url, left, top, width, height); }
@Override public ImagePrototypeElement createElement() { return (ImagePrototypeElement) impl.createStructure(url, left, top, width, height); }
@Override public ImageElement getImageElement(Image image) { return impl.getImgElement(image).cast(); }
public Element createStructure(SafeUri url, int left, int top, int width, int height) { Element tmp = Document.get().createSpanElement(); tmp.setInnerSafeHtml(getSafeHtml(url, left, top, width, height)); Element elem = tmp.getFirstChildElement(); elem.setPropertyJSO("onload", createOnLoadHandlerFunction()); return elem; }
public SafeHtml getSafeHtml(SafeUri url, int left, int top, int width, int height, boolean isDraggable) { SafeStylesBuilder builder = new SafeStylesBuilder(); builder.width(width, Unit.PX).height(height, Unit.PX).trustedNameAndValue("background", "url(" + url.asString() + ") " + "no-repeat " + (-left + "px ") + (-top + "px")); if (!isDraggable) { return getTemplate().image(clearImage, SafeStylesUtils.fromTrustedString(builder.toSafeStyles().asString())); } else { return getDraggableTemplate().image(clearImage, SafeStylesUtils.fromTrustedString(builder.toSafeStyles().asString())); } }
public SafeHtml getSafeHtml(SafeUri url, int left, int top, int width, int height) { return getSafeHtml(url, left, top, width, height, false); }
public SafeHtml getSafeHtml(SafeUri url, int left, int top, int width, int height, boolean isDraggable) { SafeStylesBuilder builder = new SafeStylesBuilder(); builder.width(width, Unit.PX).height(height, Unit.PX).trustedNameAndValue("background", "url(" + url.asString() + ") " + "no-repeat " + (-left + "px ") + (-top + "px")); if (!isDraggable) { return getTemplate().image(clearImage, SafeStylesUtils.fromTrustedString(builder.toSafeStyles().asString())); } else { return getDraggableTemplate().image(clearImage, SafeStylesUtils.fromTrustedString(builder.toSafeStyles().asString())); } }
@Override public SafeHtml getSafeHtml() { return impl.getSafeHtml(url, left, top, width, height, isDraggable); }
public SafeHtml getSafeHtml(SafeUri url, int left, int top, int width, int height, boolean isDraggable) { SafeStylesBuilder builder = new SafeStylesBuilder(); builder.width(width, Unit.PX).height(height, Unit.PX).trustedNameAndValue("background", "url(" + url.asString() + ") " + "no-repeat " + (-left + "px ") + (-top + "px")); if (!isDraggable) { return getTemplate().image(clearImage, SafeStylesUtils.fromTrustedString(builder.toSafeStyles().asString())); } else { return getDraggableTemplate().image(clearImage, SafeStylesUtils.fromTrustedString(builder.toSafeStyles().asString())); } }
public SafeHtml getSafeHtml(SafeUri url, int left, int top, int width, int height) { return getSafeHtml(url, left, top, width, height, false); }
ClippedState(Image image, SafeUri url, int left, int top, int width, int height) { this.left = left; this.top = top; this.width = width; this.height = height; this.url = url; image.replaceElement(impl.createStructure(url, left, top, width, height)); // Todo(ecc) This is wrong, we should not be sinking these here on such a // common widget.After the branch is stable, this should be fixed. image.sinkEvents(Event.ONCLICK | Event.ONDBLCLICK | Event.MOUSEEVENTS | Event.ONMOUSEWHEEL | Event.ONLOAD | Event.TOUCHEVENTS | Event.GESTUREEVENTS); }
@Override public void setUrlAndVisibleRect(Image image, SafeUri url, int left, int top, int width, int height) { /* * In the event that the clipping rectangle has not changed, we want to * skip all of the work required with a getImpl().adjust, and we do not * want to fire a load event. */ if (!this.url.equals(url) || this.left != left || this.top != top || this.width != width || this.height != height) { this.url = url; this.left = left; this.top = top; this.width = width; this.height = height; impl.adjust(image.getElement(), url, left, top, width, height); /* * The native load event hasn't fired yet, so we don't need to * synthesize an event. If we did synthesize an event, we would get two * load events. */ if (!pendingNativeLoadEvent) { fireSyntheticLoadEvent(image); } } }
@Override public ImageElement getImageElement(Image image) { return impl.getImgElement(image).cast(); }
@Override public SafeHtml getSafeHtml() { return impl.getSafeHtml(url, left, top, width, height, isDraggable); }
@Override public ImagePrototypeElement createElement() { return (ImagePrototypeElement) impl.createStructure(url, left, top, width, height); }
@Override public void applyTo(ImagePrototypeElement imageElement) { impl.adjust(imageElement, url, left, top, width, height); }
@Override public ImageElement getImageElement(Image image) { return impl.getImgElement(image).cast(); }
@Override public SafeHtml getSafeHtml() { return impl.getSafeHtml(url, left, top, width, height, isDraggable); }
@Override public ImagePrototypeElement createElement() { return (ImagePrototypeElement) impl.createStructure(url, left, top, width, height); }
@Override public void applyTo(ImagePrototypeElement imageElement) { impl.adjust(imageElement, url, left, top, width, height); }