@ 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 ) ; }
Replaces the element body with the ImageResource passed via gwt - image - resource attribute .