KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > common > actions > TreeViewAbstractAction


1 package org.infoglue.cms.applications.common.actions;
2
3 import java.util.Collection JavaDoc;
4
5 import com.frovi.ss.Tree.INodeSupplier;
6 import com.frovi.ss.Tree.MakeTree;
7
8 /**
9  * @author Stefan Sik
10  *
11  */

12
13 public abstract class TreeViewAbstractAction extends InfoGlueAbstractAction
14 {
15     private Collection JavaDoc nodes;
16     private String JavaDoc exp="";
17     private String JavaDoc rkey = "";
18     private String JavaDoc akey = "";
19                 
20     // Implement this method
21
protected abstract INodeSupplier getNodeSupplier() throws Exception JavaDoc;
22
23
24     protected Collection JavaDoc initialize(String JavaDoc expString) throws Exception JavaDoc
25     {
26         return new MakeTree(getNodeSupplier()).makeNodeList(expString);
27     }
28
29     public String JavaDoc doExecute() throws Exception JavaDoc
30     {
31         // Fix key
32
setExp(getExp().replaceAll(getRkey(), "") + getAkey());
33         
34         // Set nodes
35
setNodes(this.initialize(getExp()));
36         getResponse().setBufferSize(0);
37         
38         getResponse().setHeader("Cache-Control","no-cache");
39         getResponse().setHeader("Pragma","no-cache");
40         getResponse().setDateHeader ("Expires", 0);
41        
42         // return
43
return "success";
44     }
45
46     /**
47      * Sets the nodes.
48      * @param nodes The nodes to set
49      */

50     protected void setNodes(Collection JavaDoc nodes)
51     {
52         this.nodes = nodes;
53     }
54         
55     public Collection JavaDoc getNodes() throws Exception JavaDoc
56     {
57         return this.nodes;
58     }
59          
60     /**
61      * Returns the expStr.
62      * @return String
63      */

64     public String JavaDoc getExp() {
65         return exp;
66     }
67
68     /**
69      * Sets the expStr.
70      * @param expStr The expStr to set
71      */

72     public void setExp(String JavaDoc expStr) {
73         this.exp = expStr;
74     }
75
76
77     /**
78      * Returns the akey.
79      * @return String
80      */

81     public String JavaDoc getAkey()
82     {
83         return akey;
84     }
85
86     /**
87      * Returns the rkey.
88      * @return String
89      */

90     public String JavaDoc getRkey()
91     {
92         return rkey;
93     }
94
95     /**
96      * Sets the akey.
97      * @param akey The akey to set
98      */

99     public void setAkey(String JavaDoc akey)
100     {
101         this.akey = akey;
102     }
103
104     /**
105      * Sets the rkey.
106      * @param rkey The rkey to set
107      */

108     public void setRkey(String JavaDoc rkey)
109     {
110         this.rkey = rkey;
111     }
112
113   }
114
Popular Tags