View Javadoc

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