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