1 24 package org.riotfamily.forms.element; 25 26 import org.riotfamily.forms.DHTMLElement; 27 import org.riotfamily.forms.resource.FormResource; 28 import org.riotfamily.forms.resource.ResourceElement; 29 import org.riotfamily.forms.resource.Resources; 30 import org.riotfamily.forms.resource.ScriptResource; 31 32 public class ImageCheckbox extends Checkbox 33 implements DHTMLElement, ResourceElement { 34 35 private static final String STYLE_CLASS = "hidden"; 36 37 protected static final FormResource RESOURCE = new ScriptResource( 38 "riot-js/checkbox.js", "RiotImageCheckbox", Resources.PROTOTYPE); 39 40 public ImageCheckbox() { 41 setStyleClass(STYLE_CLASS); 42 } 43 44 public FormResource getResource() { 45 return RESOURCE; 46 } 47 48 public String getInitScript() { 49 StringBuffer sb = new StringBuffer (); 50 sb.append("new RiotImageCheckbox('"); 51 sb.append(getId()); 52 sb.append("', '"); 53 sb.append(getEditorBinding().getProperty()); 54 sb.append("');"); 55 return sb.toString(); 56 } 57 58 } 59 | Popular Tags |