KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > plaf > css > msie > PageScrollerCG


1 /**
2  *
3  */

4 package org.wings.plaf.css.msie;
5
6 import java.io.IOException JavaDoc;
7
8 import org.wings.SComponent;
9 import org.wings.SConstants;
10 import org.wings.SFrame;
11 import org.wings.SPageScroller;
12 import org.wings.event.SParentFrameEvent;
13 import org.wings.event.SParentFrameListener;
14 import org.wings.externalizer.ExternalizeManager;
15 import org.wings.header.Script;
16 import org.wings.io.Device;
17 import org.wings.resource.ClasspathResource;
18 import org.wings.resource.DefaultURLResource;
19 import org.wings.session.SessionManager;
20
21 /**
22  * @author ole
23  *
24  */

25 public class PageScrollerCG extends org.wings.plaf.css.PageScrollerCG implements SParentFrameListener {
26     private static final String JavaDoc FORMS_JS = (String JavaDoc) SessionManager
27     .getSession().getCGManager().getObject("JScripts.form",
28             String JavaDoc.class);
29
30
31     public void installCG(SComponent component) {
32         super.installCG(component);
33         component.addParentFrameListener(this);
34     }
35
36     public void parentFrameAdded(SParentFrameEvent e) {
37         SFrame parentFrame = e.getParentFrame();
38         ClasspathResource res = new ClasspathResource(FORMS_JS, "text/javascript");
39         String JavaDoc jScriptUrl = SessionManager.getSession().getExternalizeManager().externalize(res, ExternalizeManager.GLOBAL);
40         parentFrame.addHeader(new Script("text/javascript", new DefaultURLResource(jScriptUrl)));
41     }
42
43     public void parentFrameRemoved(SParentFrameEvent e) {
44     }
45
46
47     protected void writeButtonStart(Device device, SPageScroller pageScroller, String JavaDoc event) throws IOException JavaDoc {
48         device.print("<button onclick=\"addHiddenField(this.form,'");
49         device.print(pageScroller.getParentFrame().getEventEpoch());
50         device.print(SConstants.UID_DIVIDER);
51         device.print(SConstants.IEFIX_BUTTONACTION);
52         device.print("','");
53         device.print(pageScroller.getName());
54         device.print(SConstants.UID_DIVIDER);
55         device.print(event);
56         device.print("')\"");
57      }
58
59 }
60
Popular Tags