KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > tags > tree > TreePropertyOverride


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.tags.tree;
19
20 import org.apache.beehive.netui.tags.AbstractSimpleTag;
21 import org.apache.beehive.netui.util.logging.Logger;
22
23 import javax.servlet.jsp.JspException JavaDoc;
24
25 /**
26  *
27  * @jsptagref.tagdescription Overrides the tree properties.
28  *
29  * <p>Note that this tag automatically applies to descendent nodes in the tree.</p>
30  * @netui:tag name="treePropertyOverride" body-content="empty" description="Overrides the tree properties"
31  */

32 public class TreePropertyOverride extends AbstractSimpleTag
33 {
34     private static final Logger logger = Logger.getInstance(TreePropertyOverride.class);
35     private InheritableState _iState = new InheritableState();
36
37     /**
38      * Return the name of the Tag.
39      */

40     public String JavaDoc getTagName()
41     {
42         return "TreePropertyOverride";
43     }
44
45     /**
46      * Sets the action used for expanding and contracting tree nodes.
47      * @param action the action
48      * @jsptagref.attributedescription Sets the action used for expanding and contracting tree nodes.
49      * @jsptagref.databindable true
50      * @jsptagref.attributesyntaxvalue <i>string</i>
51      * @netui:attribute required="false"
52      * description="Sets the action used for expanding and contracting tree nodes."
53      */

54     public void setSelectionAction(String JavaDoc action)
55     {
56         _iState.setSelectionAction(action);
57     }
58
59     /**
60      * Sets the action used for expanding and contracting tree nodes.
61      * @param action the action
62      * @jsptagref.attributedescription Sets the action used for expanding and contracting tree nodes.
63      * @jsptagref.databindable true
64      * @jsptagref.attributesyntaxvalue <i>string_or_expression</i>
65      * @netui:attribute required="false"
66      * description="Sets the action used for expanding and contracting tree nodes."
67      */

68     public void setExpansionAction(String JavaDoc action)
69     {
70         _iState.setExpansionAction(action);
71     }
72
73     /**
74      * Sets the image name for an open non-leaf node with no
75      * line below it. (Defaults to "lastNodeExpanded.gif").
76      * @param lastNodeExpandedImage the image name (including extension)
77      * @jsptagref.attributedescription Sets the image name for an open non-leaf node with no
78      * line below it. (Defaults to "lastNodeExpanded.gif").
79      * @jsptagref.databindable true
80      * @jsptagref.attributesyntaxvalue <i>string</i>
81      * @netui:attribute required="false"
82      * description="Sets the image name for an open non-leaf node with no
83      * line below it."
84      */

85     public void setLastNodeExpandedImage(String JavaDoc lastNodeExpandedImage)
86     {
87         _iState.setLastNodeExpandedImage(lastNodeExpandedImage);
88     }
89
90     /**
91      * Sets the image name for an open non-leaf node with a
92      * line below it. (Defaults to "nodeExpanded.gif").
93      * @param nodeExpandedImage the image name (including extension)
94      * @jsptagref.attributedescription Sets the image name for an open non-leaf node with a
95      * line below it. (Defaults to "nodeExpanded.gif").
96      * @jsptagref.databindable true
97      * @jsptagref.attributesyntaxvalue <i>string</i>
98      * @netui:attribute required="false"
99      * description="Sets the image name for an open non-leaf node with a
100      * line below it."
101      */

102     public void setNodeExpandedImage(String JavaDoc nodeExpandedImage)
103     {
104         _iState.setNodeExpandedImage(nodeExpandedImage);
105     }
106
107     /**
108      * Sets the image name for a closed non-leaf node with no
109      * line below it. (Defaults to "lastNodeCollapsed.gif").
110      * @param lastNodeCollapsedImage the image name (including extension)
111      * @jsptagref.attributedescription Sets the image name for a closed non-leaf node with no
112      * line below it. (Defaults to "lastNodeCollapsed.gif").
113      * @jsptagref.databindable true
114      * @jsptagref.attributesyntaxvalue <i>string</i>
115      * @netui:attribute required="false"
116      * description="Sets the image name for a closed non-leaf node with no
117      * line below it."
118      */

119     public void setLastNodeCollapsedImage(String JavaDoc lastNodeCollapsedImage)
120     {
121         _iState.setLastNodeCollapsedImage(lastNodeCollapsedImage);
122     }
123
124     /**
125      * Sets the image name for a closed non-leaf node with a
126      * line below it. (Defaults to "nodeCollapsed.gif").
127      * @param nodeCollapsedImage the image name (including extension)
128      * @jsptagref.attributedescription Sets the image name for a closed non-leaf node with a
129      * line below it. (Defaults to "nodeCollapsed.gif").
130      * @jsptagref.databindable true
131      * @jsptagref.attributesyntaxvalue <i>string</i>
132      * @netui:attribute required="false"
133      * description="Sets the image name for a closed non-leaf node with a
134      * line below it."
135      */

136     public void setNodeCollapsedImage(String JavaDoc nodeCollapsedImage)
137     {
138         _iState.setNodeCollapsedImage(nodeCollapsedImage);
139     }
140
141     /**
142      * Sets the image name for a blank area of the tree.
143      * (Defaults to "lastLineJoin.gif").
144      * @param lastLineJoinImage the image name (including extension)
145      * @jsptagref.attributedescription Sets the image name for a blank area of the tree.
146      * (Defaults to "lastLineJoin.gif").
147      * @jsptagref.databindable true
148      * @jsptagref.attributesyntaxvalue <i>string</i>
149      * @netui:attribute required="false"
150      * description="Sets the image name for a blank area of the tree."
151      */

152     public void setLastLineJoinImage(String JavaDoc lastLineJoinImage)
153     {
154         _iState.setLastLineJoinImage(lastLineJoinImage);
155     }
156
157     /**
158      * Sets the default icon for TreeElements for a blank area of the tree.
159      * (Defaults to "folder.gif").
160      * @param itemIcon the image name of the itemIcon
161      * @jsptagref.attributedescription Sets the default icon for tree nodes
162      * for a blank area of the tree. (Defaults to "folder.gif").
163      * @jsptagref.databindable true
164      * @jsptagref.attributesyntaxvalue <i>string</i>
165      * @netui:attribute required="false"
166      * description="Sets the default icon for TreeElements for a blank area of the tree."
167      */

168     public void setItemIcon(String JavaDoc itemIcon)
169     {
170         _iState.setItemIcon(itemIcon);
171     }
172
173     /**
174      * Sets the image name for an area with a line through it.
175      * (Defaults to "lineJoin.gif").
176      * @param lineJoinImage the image name (including extension)
177      * @jsptagref.attributedescription Sets the image name for an area with a line through it.
178      * (Defaults to "lineJoin.gif").
179      * @jsptagref.databindable true
180      * @jsptagref.attributesyntaxvalue <i>string</i>
181      * @netui:attribute required="false"
182      * description="Sets the image name for an area with a line through it."
183      */

184     public void setLineJoinImage(String JavaDoc lineJoinImage)
185     {
186         _iState.setLineJoinImage(lineJoinImage);
187     }
188
189     /**
190      * Sets the image name for an area with a line through it.
191      * (Defaults to "verticalLine.gif").
192      * @param verticalLineImage the image name (including extension)
193      * @jsptagref.attributedescription Sets the image name for an area with a line through it.
194      * (Defaults to "verticalLine.gif").
195      * @jsptagref.databindable true
196      * @jsptagref.attributesyntaxvalue <i>string</i>
197      * @netui:attribute required="false"
198      * description="Sets the image name for an area with a line through it."
199      */

200     public void setVerticalLineImage(String JavaDoc verticalLineImage)
201     {
202         _iState.setVerticalLineImage(verticalLineImage);
203     }
204
205     /**
206      * Sets the name of the directory containing the images for our icons,
207      * relative to the page including this tag.
208      * @param imageRoot the directory name
209      * @jsptagref.attributedescription Sets the name of the directory containing the images for our icons,
210      * relative to the page including this tag.
211      * @jsptagref.databindable true
212      * @jsptagref.attributesyntaxvalue <i>string_or_expression</i>
213      * @netui:attribute required="false" rtexprvalue="true"
214      * description="Sets the name of the directory containing the images for our icons,
215      * relative to the page including this tag."
216      */

217     public void setImageRoot(String JavaDoc imageRoot)
218     {
219         _iState.setImageRoot(imageRoot);
220     }
221
222     /**
223      * This will set the location of the icon images. When the location
224      * is explicitly set, this works exactly the same as all other inheritable
225      * properties. When this is not set, it will return the <code>getImageRoot</code>
226      * location.
227      * @param iconRoot the directory name for the icons
228      * @jsptagref.attributedescription The directory containing the icon images for tree items.
229      * @jsptagref.databindable false
230      * @jsptagref.attributesyntaxvalue <i>string_iconRoot</i>
231      * @netui:attribute required="false" rtexprvalue="true"
232      * description="Sets the name of the directory containing the images for our icons."
233      */

234     public void setIconRoot(String JavaDoc iconRoot)
235     {
236         _iState.setIconRoot(iconRoot);
237     }
238
239     /**
240      * Render this Tree control.
241      * @throws JspException if a processing error occurs
242      */

243     public void doTag()
244             throws JspException JavaDoc
245     {
246         Object JavaDoc o = getParent();
247         assert (o != null);
248         if (!(o instanceof TreeItem)) {
249             logger.error("Invalid Parent (expected a TreeItem):" + o.getClass().getName());
250             return;
251         }
252
253         // assign the value to the parent's label value
254
TreeItem ti = (TreeItem) o;
255         ti.setItemInheritableState(_iState);
256     }
257 }
258
Popular Tags