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