/** Replaces the element body with the ImageResource passed via gwt-image-resource attribute. */ @Override public void link(NGScope scope, JQElement element, JSON attrs) { ImageResource resource = scope.get(getName()); if (resource == null) { LOG.log(Level.WARNING, "Mandatory attribute " + getName() + " value is mssing"); return; } Image image = new Image(resource); Element target = image.asWidget().getElement(); String className = element.attr("class"); target.addClassName(className); String style = element.attr("style"); target.setAttribute("style", style); element.replaceWith(target); }
/** * Creates isolateScope and registers the following attribute definition. * * <ul> * <li>{@code ImageResource} gwt-image-resource * </ul> */ @Override public NGScope scope() { NGScope scope = NGScope.create(); scope.put(getName(), "="); return scope; }