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.STable; 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 TableCG extends org.wings.plaf.css.TableCG implements SParentFrameListener { 34 35 private static final String FORMS_JS = (String ) SessionManager 36 .getSession().getCGManager().getObject("JScripts.form", 37 String .class); 38 39 protected void writeButtonStart(Device device, STable table, String parameter) throws IOException { 40 device.print("<button onclick=\"addHiddenField(this.form,'"); 41 device.print(table.getParentFrame().getEventEpoch()); 42 device.print(SConstants.UID_DIVIDER); 43 device.print(SConstants.IEFIX_BUTTONACTION); 44 device.print("','"); 45 device.print(table.getName()); 46 device.print(SConstants.UID_DIVIDER); 47 Utils.write(device, parameter); 48 device.print("')\""); 49 } 50 51 public void installCG(SComponent component) { 52 super.installCG(component); 53 component.addParentFrameListener(this); 54 } 55 56 public void parentFrameAdded(SParentFrameEvent e) { 57 SFrame parentFrame = e.getParentFrame(); 58 ClasspathResource res = new ClasspathResource(FORMS_JS, "text/javascript"); 59 String jScriptUrl = SessionManager.getSession().getExternalizeManager().externalize(res, ExternalizeManager.GLOBAL); 60 parentFrame.addHeader(new Script("text/javascript", new DefaultURLResource(jScriptUrl))); 61 } 62 63 public void parentFrameRemoved(SParentFrameEvent e) { 64 } 65 66 protected void writeLinkStart(Device device, RequestURL selectionAddr) throws IOException { 67 device.print("<a onclick=\"javascript:location.href='"); 68 Utils.write(device, selectionAddr.toString()); 69 device.print("';\""); 70 } 71 } 72 | Popular Tags |