KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > table > navi > StaticClickableMember


1 package com.tonbeller.jpivot.table.navi;
2
3 import javax.servlet.http.HttpSession JavaDoc;
4
5 import org.w3c.dom.Element JavaDoc;
6
7 import com.tonbeller.jpivot.table.ClickableMember;
8 import com.tonbeller.jpivot.table.SpanBuilder;
9 import com.tonbeller.jpivot.table.SpanBuilderDecorator;
10 import com.tonbeller.jpivot.table.TableComponent;
11 import com.tonbeller.jpivot.table.span.Span;
12 import com.tonbeller.wcf.controller.RequestContext;
13
14 /**
15  * wraps a ClickableMemberSupport into a SpanBuilderDecorator, so the clickable member
16  * may be attached statically to the table component. Once attached, the clickable
17  * will be available independent of the current query.
18  *
19  * @author av
20  * @since 15.12.2004
21  */

22 public class StaticClickableMember extends SpanBuilderDecorator {
23
24   ClickableMember clickable;
25
26   public StaticClickableMember(SpanBuilder delegate, ClickableMember clickable) {
27     super(delegate);
28     this.clickable = clickable;
29   }
30
31   public void initialize(RequestContext context, TableComponent table) throws Exception JavaDoc {
32     super.initialize(context, table);
33     table.getDispatcher().addRequestListener(null, null, clickable);
34     table.getOlapModel().addModelChangeListener(clickable);
35   }
36
37   public void destroy(HttpSession JavaDoc session) throws Exception JavaDoc {
38     table.getDispatcher().removeRequestListener(clickable);
39     table.getOlapModel().removeModelChangeListener(clickable);
40     super.destroy(session);
41   }
42
43   public void startBuild(RequestContext context) {
44     super.startBuild(context);
45     clickable.startRendering(context, table);
46   }
47
48   public void stopBuild() {
49     clickable.stopRendering();
50     super.stopBuild();
51   }
52
53   public Element JavaDoc build(SBContext sbctx, Span span, boolean even) {
54     Element JavaDoc elem = super.build(sbctx, span, even);
55     clickable.decorate(sbctx, span.getObject());
56     return elem;
57   }
58   
59 }
Popular Tags