KickJava   Java API By Example, From Geeks To Geeks.

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


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.SScrollBar;
12 import org.wings.STabbedPane;
13 import org.wings.event.SParentFrameEvent;
14 import org.wings.event.SParentFrameListener;
15 import org.wings.externalizer.ExternalizeManager;
16 import org.wings.header.Script;
17 import org.wings.io.Device;
18 import org.wings.resource.ClasspathResource;
19 import org.wings.resource.DefaultURLResource;
20 import org.wings.session.SessionManager;
21
22 /**
23  * @author ole
24  *
25  */

26 public class ScrollBarCG extends org.wings.plaf.css.ScrollBarCG implements SParentFrameListener {
27     private static final String JavaDoc FORMS_JS = (String JavaDoc) SessionManager
28     .getSession().getCGManager().getObject("JScripts.form",
29             String JavaDoc.class);
30
31
32     public void installCG(SComponent component) {
33         super.installCG(component);
34         component.addParentFrameListener(this);
35     }
36
37     public void parentFrameAdded(SParentFrameEvent e) {
38         SFrame parentFrame = e.getParentFrame();
39         ClasspathResource res = new ClasspathResource(FORMS_JS, "text/javascript");
40         String JavaDoc jScriptUrl = SessionManager.getSession().getExternalizeManager().externalize(res, ExternalizeManager.GLOBAL);
41         parentFrame.addHeader(new Script("text/javascript", new DefaultURLResource(jScriptUrl)));
42     }
43
44     public void parentFrameRemoved(SParentFrameEvent e) {
45     }
46
47     /* (non-Javadoc)
48      * @see org.wings.plaf.css.ScrollBarCG#writeButtonStart(org.wings.io.Device, org.wings.SScrollBar, java.lang.String)
49      */

50     protected void writeButtonStart(Device device, SScrollBar scrollBar, String JavaDoc event) throws IOException JavaDoc {
51         device.print("<button onclick=\"addHiddenField(this.form,'");
52         device.print(scrollBar.getParentFrame().getEventEpoch());
53         device.print(SConstants.UID_DIVIDER);
54         device.print(SConstants.IEFIX_BUTTONACTION);
55         device.print("','");
56         device.print(scrollBar.getName());
57         device.print(SConstants.UID_DIVIDER);
58         device.print(event);
59         device.print("')\"");
60     }
61
62
63 }
64
Popular Tags