2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.shale.usecases.rolodex;
18  
19  import javax.faces.component.UIOutput;
20  import javax.faces.context.FacesContext;
21  import javax.faces.el.ValueBinding;
22  
23  public class WebPager extends UIOutput {
24      
25      private String prevPageStyleClass = null;
26      private String prevImage = null;
27      private String nextPageStyleClass = null;
28      private String nextImage = null;
29      private String captionStyleClass = null;
30      private String pageLinksStyleClass = null;
31  
32      /***
33       * <p>Sets the renderer type to "org.apache.shale.WebPager".</p>
34       */
35      public WebPager() {
36          setRendererType("org.apache.shale.WebPager");
37      }
38  
39      /***
40       * <p>Saves the components state.</p>
41       */
42      public Object saveState(FacesContext facescontext) {
43          Object aobj[] = new Object[5];
44          aobj[0] = super.saveState(facescontext);
45          aobj[1] = prevPageStyleClass;
46          aobj[2] = nextPageStyleClass;
47          aobj[3] = pageLinksStyleClass;
48          aobj[4] = captionStyleClass;
49          return ((Object) (aobj));
50      }
51  
52      /***
53       * <p>Restores the components state.</p>
54       */
55      public void restoreState(FacesContext facescontext, Object obj) {
56          Object aobj[] = (Object[]) obj;
57          super.restoreState(facescontext, aobj[0]);
58          prevPageStyleClass = (String) aobj[1];
59          nextPageStyleClass = (String) aobj[2];
60          pageLinksStyleClass = (String) aobj[3];
61          captionStyleClass = (String) aobj[4];
62      };
63  
64      
65      /***
66       * <p>Returns the pager captionStyleClass attribute.</p>
67       */
68      public String getCaptionStyleClass() {
69          if (null != captionStyleClass)
70              return captionStyleClass;
71          ValueBinding valuebinding = getValueBinding("captionStyleClass");
72          if (valuebinding != null)
73              return (String) valuebinding.getValue(getFacesContext());
74          else
75              return null;
76      }
77  
78         
79      /***
80       * <p>Sets the pager captionStyleClass attribute.</p>
81       */
82      public void setCaptionStyleClass(String captionStyleClass) {
83         this.captionStyleClass = captionStyleClass;
84      }
85  
86      
87      /***
88       * <p>Returns the pager pageLinksStyleClass attribute.</p>
89       */
90      public String getPageLinksStyleClass() {
91          if (null != pageLinksStyleClass)
92              return pageLinksStyleClass;
93          ValueBinding valuebinding = getValueBinding("pageLinksStyleClass");
94          if (valuebinding != null)
95              return (String) valuebinding.getValue(getFacesContext());
96          else
97              return null;
98      }
99      
100    
101     /***
102      * <p>Sets the pager pageLinksStyleClass attribute.</p>
103      */
104     public void setPageLinksStyleClass(String pageLinksStyleClass) {
105        this.pageLinksStyleClass = pageLinksStyleClass;
106     }
107 
108 
109     
110     /***
111      * <p>Returns the pager prevPageStyleClass attribute.</p>
112      */
113     public String getPrevPageStyleClass() {
114         if (null != prevPageStyleClass)
115             return prevPageStyleClass;
116         ValueBinding valuebinding = getValueBinding("prevPageStyleClass");
117         if (valuebinding != null)
118             return (String) valuebinding.getValue(getFacesContext());
119         else
120             return null;
121     }
122 
123     
124     /***
125      * <p>Sets the pager prevPageStyleClass attribute.</p>
126      */
127     public void setPrevPageStyleClass(String s) {
128         prevPageStyleClass = s;
129     }
130 
131     /***
132      * <p>Returns the pager nextPageStyleClass attribute.</p>
133      */
134     public String getNextPageStyleClass() {
135         if (null != nextPageStyleClass)
136             return nextPageStyleClass;
137         ValueBinding valuebinding = getValueBinding("nextPageStyleClass");
138         if (valuebinding != null)
139             return (String) valuebinding.getValue(getFacesContext());
140         else
141             return null;
142     }
143 
144     /***
145      * <p>Sets the pager nextPageStyleClass attribute.</p>
146      */
147     public void setNextPageStyleClass(String s) {
148         nextPageStyleClass = s;
149     }
150 
151     
152     /***
153      * <p>Sets the pager prevImage attribute.</p>
154      */
155     public void setPrevImage(String s) {
156         prevImage = s;
157     }
158 
159     /***
160      * <p>Returns the pager prevImage attribute.</p>
161      */
162     public String getPrevImage() {
163         if (null != prevImage)
164             return prevImage;
165         ValueBinding valuebinding = getValueBinding("prevImage");
166         if (valuebinding != null)
167             return (String) valuebinding.getValue(getFacesContext());
168         else
169             return null;
170     }
171    
172     /***
173      * <p>Sets the pager nextImage attribute.</p>
174      */
175     public void setNextImage(String s) {
176         nextImage = s;
177     }
178 
179     /***
180      * <p>Returns the pager nextImage attribute.</p>
181      */
182     public String getNextImage() {
183         if (null != nextImage)
184             return nextImage;
185         ValueBinding valuebinding = getValueBinding("nextImage");
186         if (valuebinding != null)
187             return (String) valuebinding.getValue(getFacesContext());
188         else
189             return null;
190     }
191     
192       
193     
194     /***
195      * <p>Returns the component's family to "org.apache.shale.Pager".</p>
196      */
197     public String getFamily() {
198         return "org.apache.shale.Pager";
199     }
200 
201     /***
202      * <p>The pager component renders children.</p>
203      */
204     public boolean getRendersChildren() {
205         return true;
206     }
207 }