KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > deprecated > taglibs > container > RelativeContainerListTag


1 package org.jahia.deprecated.taglibs.container;
2
3 import javax.servlet.jsp.JspException JavaDoc;
4
5 import org.jahia.data.JahiaData;
6 import org.jahia.data.containers.JahiaContainerList;
7 import org.jahia.exceptions.JahiaException;
8
9
10 /**
11  * Class RelativeContainerListTag : extends class ContainerListTag
12  *
13  * @author Jerome Tamiotti
14  */

15 public class RelativeContainerListTag extends ContainerListTag {
16
17     private int windowSize = -1;
18     private int windowOffset = -1;
19
20     private int levelNb = 0;
21
22     public void setLevelNb(int nb) {
23         this.levelNb = nb;
24     }
25
26     public void setWindowSize(String JavaDoc windowSize) {
27         try {
28             this.windowSize = Integer.parseInt(windowSize);
29         } catch (NumberFormatException JavaDoc nfe) {
30             this.windowSize = -1;
31         }
32     }
33
34     /*
35     public int getWindowSize() {
36         return this.windowSize;
37     }
38     */

39
40     public void setWindowOffset(String JavaDoc windowOffset) {
41         try {
42             this.windowOffset = Integer.parseInt(windowOffset);
43         } catch (NumberFormatException JavaDoc nfe) {
44             this.windowOffset = -1;
45         }
46     }
47
48     /*
49     public int getWindowOffset() {
50         return this.windowOffset;
51     }
52     */

53
54     // redefines only the method allowing to read the container list
55

56     // reads the container list from a container set
57
protected JahiaContainerList getContainerList( JahiaData jData, String JavaDoc listName ) throws JahiaException {
58         return jData.containers().getRelativeContainerList(listName, this.levelNb);
59     }
60
61     public int doEndTag() throws JspException JavaDoc {
62         // let's reinitialize the tag variables to allow tag object reuse in
63
// pooling.
64
super.doEndTag();
65         windowSize = -1;
66         windowOffset = -1;
67
68         levelNb = 0;
69         return EVAL_PAGE;
70     }
71
72 }
73
Popular Tags