1 14 package org.wings.plaf.css.msie; 15 16 import java.io.IOException ; 17 18 import org.wings.SClickable; 19 import org.wings.SComponent; 20 import org.wings.SConstants; 21 import org.wings.SFrame; 22 import org.wings.event.SParentFrameEvent; 23 import org.wings.event.SParentFrameListener; 24 import org.wings.externalizer.ExternalizeManager; 25 import org.wings.header.Script; 26 import org.wings.io.Device; 27 import org.wings.plaf.css.Utils; 28 import org.wings.resource.ClasspathResource; 29 import org.wings.resource.DefaultURLResource; 30 import org.wings.session.SessionManager; 31 32 36 public class ClickableCG extends org.wings.plaf.css.ClickableCG implements SParentFrameListener { 37 private static final String FORMS_JS = (String ) SessionManager 38 .getSession().getCGManager().getObject("JScripts.form", 39 String .class); 40 41 42 protected void writeButtonStart(Device device, SClickable button) throws IOException { 43 device.print("<button onclick=\"addHiddenField(this.form,'"); 44 device.print(button.getParentFrame().getEventEpoch()); 45 device.print(SConstants.UID_DIVIDER); 46 device.print(SConstants.IEFIX_BUTTONACTION); 47 device.print("','"); 48 device.print(button.getEventTarget().getEncodedLowLevelEventId()); 49 device.print(SConstants.UID_DIVIDER); 50 Utils.write(device, button.getEvent()); 51 device.print("')\""); 52 } 53 54 public void installCG(SComponent component) { 55 super.installCG(component); 56 component.addParentFrameListener(this); 57 } 58 59 public void parentFrameAdded(SParentFrameEvent e) { 60 SFrame parentFrame = e.getParentFrame(); 61 ClasspathResource res = new ClasspathResource(FORMS_JS, "text/javascript"); 62 String jScriptUrl = SessionManager.getSession().getExternalizeManager().externalize(res, ExternalizeManager.GLOBAL); 63 parentFrame.addHeader(new Script("text/javascript", new DefaultURLResource(jScriptUrl))); 64 } 65 66 public void parentFrameRemoved(SParentFrameEvent e) { 67 } 68 69 } 70 | Popular Tags |