View Javadoc

1   /*
2    * $Id: TreeTag.java 471756 2006-11-06 15:01:43Z husted $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.struts2.views.jsp.ui;
22  
23  import javax.servlet.http.HttpServletRequest;
24  import javax.servlet.http.HttpServletResponse;
25  
26  import org.apache.struts2.components.Component;
27  import org.apache.struts2.components.Tree;
28  
29  import com.opensymphony.xwork2.util.ValueStack;
30  
31  /***
32   * @see Tree
33   */
34  public class TreeTag extends AbstractClosingTag {
35  
36      private static final long serialVersionUID = 2735218501058548013L;
37  
38      private String toggle;
39      private String treeSelectedTopic;
40      private String treeExpandedTopic;
41      private String treeCollapsedTopic;
42      private String rootNode;
43      private String childCollectionProperty;
44      private String nodeTitleProperty;
45      private String nodeIdProperty;
46      private String showRootGrid;
47  
48      private String showGrid;
49      private String blankIconSrc;
50      private String gridIconSrcL;
51      private String gridIconSrcV;
52      private String gridIconSrcP;
53      private String gridIconSrcC;
54      private String gridIconSrcX;
55      private String gridIconSrcY;
56      private String expandIconSrcPlus;
57      private String expandIconSrcMinus;
58      private String iconWidth;
59      private String iconHeight;
60      private String toggleDuration;
61      private String templateCssPath;
62  
63  
64      public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
65          return new Tree(stack,req,res);
66      }
67  
68      protected void populateParams() {
69          super.populateParams();
70  
71          Tree tree = (Tree) component;
72          if (childCollectionProperty != null)
73              tree.setChildCollectionProperty(childCollectionProperty);
74          if (nodeIdProperty != null)
75              tree.setNodeIdProperty(nodeIdProperty);
76          if (nodeTitleProperty != null)
77              tree.setNodeTitleProperty(nodeTitleProperty);
78          if (rootNode != null)
79              tree.setRootNode(rootNode);
80          if (toggle != null)
81              tree.setToggle(toggle);
82          if (treeCollapsedTopic != null)
83              tree.setTreeCollapsedTopic(treeCollapsedTopic);
84          if (treeExpandedTopic != null)
85              tree.setTreeExpandedTopic(treeExpandedTopic);
86          if (treeSelectedTopic != null)
87              tree.setTreeSelectedTopic(treeSelectedTopic);
88          if (showRootGrid != null)
89              tree.setShowRootGrid(showRootGrid);
90  
91          if (showGrid != null)
92              tree.setShowGrid(showGrid);
93          if (blankIconSrc != null)
94              tree.setBlankIconSrc(blankIconSrc);
95          if (gridIconSrcL != null)
96              tree.setGridIconSrcL(gridIconSrcC);
97          if (gridIconSrcV != null)
98              tree.setGridIconSrcV(gridIconSrcV);
99          if (gridIconSrcP != null)
100             tree.setGridIconSrcP(gridIconSrcP);
101         if (gridIconSrcC != null)
102             tree.setGridIconSrcC(gridIconSrcC);
103         if (gridIconSrcX != null)
104             tree.setGridIconSrcX(gridIconSrcX);
105         if (gridIconSrcY != null)
106             tree.setGridIconSrcY(gridIconSrcY);
107         if (expandIconSrcPlus != null)
108             tree.setExpandIconSrcPlus(expandIconSrcPlus);
109         if (expandIconSrcMinus != null)
110             tree.setExpandIconSrcMinus(expandIconSrcMinus);
111         if (iconWidth != null)
112             tree.setIconWidth(iconWidth);
113         if (iconHeight != null)
114             tree.setIconHeight(iconHeight);
115         if (toggleDuration != null)
116             tree.setToggleDuration(toggleDuration);
117         if (templateCssPath != null)
118             tree.setTemplateCssPath(templateCssPath);
119     }
120 
121     public String getToggle() {
122         return toggle;
123     }
124 
125     public void setToggle(String toggle) {
126         this.toggle = toggle;
127     }
128 
129     public String getTreeSelectedTopic() {
130         return treeSelectedTopic;
131     }
132 
133     public void setTreeSelectedTopic(String treeSelectedTopic) {
134         this.treeSelectedTopic = treeSelectedTopic;
135     }
136 
137     public String getTreeExpandedTopic() {
138         return treeExpandedTopic;
139     }
140 
141     public void setTreeExpandedTopic(String treeExpandedTopic) {
142         this.treeExpandedTopic = treeExpandedTopic;
143     }
144 
145     public String getTreeCollapsedTopic() {
146         return treeCollapsedTopic;
147     }
148 
149     public void setTreeCollapsedTopic(String treeCollapsedTopic) {
150         this.treeCollapsedTopic = treeCollapsedTopic;
151     }
152 
153     public String getRootNode() {
154         return rootNode;
155     }
156 
157     public void setRootNode(String rootNode) {
158         this.rootNode = rootNode;
159     }
160 
161     public String getChildCollectionProperty() {
162         return childCollectionProperty;
163     }
164 
165     public void setChildCollectionProperty(String childCollectionProperty) {
166         this.childCollectionProperty = childCollectionProperty;
167     }
168 
169     public String getNodeTitleProperty() {
170         return nodeTitleProperty;
171     }
172 
173     public void setNodeTitleProperty(String nodeTitleProperty) {
174         this.nodeTitleProperty = nodeTitleProperty;
175     }
176 
177     public String getNodeIdProperty() {
178         return nodeIdProperty;
179     }
180 
181     public void setNodeIdProperty(String nodeIdProperty) {
182         this.nodeIdProperty = nodeIdProperty;
183     }
184 
185     public String getShowRootGrid() {
186         return showRootGrid;
187     }
188 
189     public void setShowRootGrid(String showRootGrid) {
190         this.showRootGrid = showRootGrid;
191     }
192 
193     public String getBlankIconSrc() {
194         return blankIconSrc;
195     }
196 
197     public void setBlankIconSrc(String blankIconSrc) {
198         this.blankIconSrc = blankIconSrc;
199     }
200 
201     public String getExpandIconSrcMinus() {
202         return expandIconSrcMinus;
203     }
204 
205     public void setExpandIconSrcMinus(String expandIconSrcMinus) {
206         this.expandIconSrcMinus = expandIconSrcMinus;
207     }
208 
209     public String getExpandIconSrcPlus() {
210         return expandIconSrcPlus;
211     }
212 
213     public void setExpandIconSrcPlus(String expandIconSrcPlus) {
214         this.expandIconSrcPlus = expandIconSrcPlus;
215     }
216 
217     public String getGridIconSrcC() {
218         return gridIconSrcC;
219     }
220 
221     public void setGridIconSrcC(String gridIconSrcC) {
222         this.gridIconSrcC = gridIconSrcC;
223     }
224 
225     public String getGridIconSrcL() {
226         return gridIconSrcL;
227     }
228 
229     public void setGridIconSrcL(String gridIconSrcL) {
230         this.gridIconSrcL = gridIconSrcL;
231     }
232 
233     public String getGridIconSrcP() {
234         return gridIconSrcP;
235     }
236 
237     public void setGridIconSrcP(String gridIconSrcP) {
238         this.gridIconSrcP = gridIconSrcP;
239     }
240 
241     public String getGridIconSrcV() {
242         return gridIconSrcV;
243     }
244 
245     public void setGridIconSrcV(String gridIconSrcV) {
246         this.gridIconSrcV = gridIconSrcV;
247     }
248 
249     public String getGridIconSrcX() {
250         return gridIconSrcX;
251     }
252 
253     public void setGridIconSrcX(String gridIconSrcX) {
254         this.gridIconSrcX = gridIconSrcX;
255     }
256 
257     public String getGridIconSrcY() {
258         return gridIconSrcY;
259     }
260 
261     public void setGridIconSrcY(String gridIconSrcY) {
262         this.gridIconSrcY = gridIconSrcY;
263     }
264 
265     public String getIconHeight() {
266         return iconHeight;
267     }
268 
269     public void setIconHeight(String iconHeight) {
270         this.iconHeight = iconHeight;
271     }
272 
273     public String getIconWidth() {
274         return iconWidth;
275     }
276 
277     public void setIconWidth(String iconWidth) {
278         this.iconWidth = iconWidth;
279     }
280 
281     public String getTemplateCssPath() {
282         return templateCssPath;
283     }
284 
285     public void setTemplateCssPath(String templateCssPath) {
286         this.templateCssPath = templateCssPath;
287     }
288 
289     public String getToggleDuration() {
290         return toggleDuration;
291     }
292 
293     public void setToggleDuration(String toggleDuration) {
294         this.toggleDuration = toggleDuration;
295     }
296 
297     public String getShowGrid() {
298         return showGrid;
299     }
300 
301     public void setShowGrid(String showGrid) {
302         this.showGrid = showGrid;
303     }
304 }
305