001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: * $Header:$
018: */
019: package org.apache.beehive.netui.tags.tree;
020:
021: import org.apache.beehive.netui.tags.AbstractSimpleTag;
022: import org.apache.beehive.netui.util.logging.Logger;
023:
024: import javax.servlet.jsp.JspException;
025:
026: /**
027: *
028: * @jsptagref.tagdescription Overrides the tree properties.
029: *
030: * <p>Note that this tag automatically applies to descendent nodes in the tree.</p>
031: * @netui:tag name="treePropertyOverride" body-content="empty" description="Overrides the tree properties"
032: */
033: public class TreePropertyOverride extends AbstractSimpleTag {
034: private static final Logger logger = Logger
035: .getInstance(TreePropertyOverride.class);
036: private InheritableState _iState = new InheritableState();
037:
038: /**
039: * Return the name of the Tag.
040: */
041: public String getTagName() {
042: return "TreePropertyOverride";
043: }
044:
045: /**
046: * Sets the action used for expanding and contracting tree nodes.
047: * @param action the action
048: * @jsptagref.attributedescription Sets the action used for expanding and contracting tree nodes.
049: * @jsptagref.databindable true
050: * @jsptagref.attributesyntaxvalue <i>string</i>
051: * @netui:attribute required="false"
052: * description="Sets the action used for expanding and contracting tree nodes."
053: */
054: public void setSelectionAction(String action) {
055: _iState.setSelectionAction(action);
056: }
057:
058: /**
059: * Sets the action used for expanding and contracting tree nodes.
060: * @param action the action
061: * @jsptagref.attributedescription Sets the action used for expanding and contracting tree nodes.
062: * @jsptagref.databindable true
063: * @jsptagref.attributesyntaxvalue <i>string_or_expression</i>
064: * @netui:attribute required="false"
065: * description="Sets the action used for expanding and contracting tree nodes."
066: */
067: public void setExpansionAction(String action) {
068: _iState.setExpansionAction(action);
069: }
070:
071: /**
072: * Sets the image name for an open non-leaf node with no
073: * line below it. (Defaults to "lastNodeExpanded.gif").
074: * @param lastNodeExpandedImage the image name (including extension)
075: * @jsptagref.attributedescription Sets the image name for an open non-leaf node with no
076: * line below it. (Defaults to "lastNodeExpanded.gif").
077: * @jsptagref.databindable true
078: * @jsptagref.attributesyntaxvalue <i>string</i>
079: * @netui:attribute required="false"
080: * description="Sets the image name for an open non-leaf node with no
081: * line below it."
082: */
083: public void setLastNodeExpandedImage(String lastNodeExpandedImage) {
084: _iState.setLastNodeExpandedImage(lastNodeExpandedImage);
085: }
086:
087: /**
088: * Sets the image name for an open non-leaf node with a
089: * line below it. (Defaults to "nodeExpanded.gif").
090: * @param nodeExpandedImage the image name (including extension)
091: * @jsptagref.attributedescription Sets the image name for an open non-leaf node with a
092: * line below it. (Defaults to "nodeExpanded.gif").
093: * @jsptagref.databindable true
094: * @jsptagref.attributesyntaxvalue <i>string</i>
095: * @netui:attribute required="false"
096: * description="Sets the image name for an open non-leaf node with a
097: * line below it."
098: */
099: public void setNodeExpandedImage(String nodeExpandedImage) {
100: _iState.setNodeExpandedImage(nodeExpandedImage);
101: }
102:
103: /**
104: * Sets the image name for a closed non-leaf node with no
105: * line below it. (Defaults to "lastNodeCollapsed.gif").
106: * @param lastNodeCollapsedImage the image name (including extension)
107: * @jsptagref.attributedescription Sets the image name for a closed non-leaf node with no
108: * line below it. (Defaults to "lastNodeCollapsed.gif").
109: * @jsptagref.databindable true
110: * @jsptagref.attributesyntaxvalue <i>string</i>
111: * @netui:attribute required="false"
112: * description="Sets the image name for a closed non-leaf node with no
113: * line below it."
114: */
115: public void setLastNodeCollapsedImage(String lastNodeCollapsedImage) {
116: _iState.setLastNodeCollapsedImage(lastNodeCollapsedImage);
117: }
118:
119: /**
120: * Sets the image name for a closed non-leaf node with a
121: * line below it. (Defaults to "nodeCollapsed.gif").
122: * @param nodeCollapsedImage the image name (including extension)
123: * @jsptagref.attributedescription Sets the image name for a closed non-leaf node with a
124: * line below it. (Defaults to "nodeCollapsed.gif").
125: * @jsptagref.databindable true
126: * @jsptagref.attributesyntaxvalue <i>string</i>
127: * @netui:attribute required="false"
128: * description="Sets the image name for a closed non-leaf node with a
129: * line below it."
130: */
131: public void setNodeCollapsedImage(String nodeCollapsedImage) {
132: _iState.setNodeCollapsedImage(nodeCollapsedImage);
133: }
134:
135: /**
136: * Sets the image name for a blank area of the tree.
137: * (Defaults to "lastLineJoin.gif").
138: * @param lastLineJoinImage the image name (including extension)
139: * @jsptagref.attributedescription Sets the image name for a blank area of the tree.
140: * (Defaults to "lastLineJoin.gif").
141: * @jsptagref.databindable true
142: * @jsptagref.attributesyntaxvalue <i>string</i>
143: * @netui:attribute required="false"
144: * description="Sets the image name for a blank area of the tree."
145: */
146: public void setLastLineJoinImage(String lastLineJoinImage) {
147: _iState.setLastLineJoinImage(lastLineJoinImage);
148: }
149:
150: /**
151: * Sets the image name for an image used to align the other images inside of a tree. (Defaults to "spacer.gif").
152: * @param spacerImage the image name (including extension)
153: * @jsptagref.attributedescription Sets the image name for an image used to align the other images inside of a tree.
154: * (Defaults to "spacer.gif")
155: * @jsptagref.databindable true
156: * @jsptagref.attributesyntaxvalue <i>string</i>
157: * @netui:attribute required="false"
158: * description="Sets the image name for an image used to align the other images inside of a tree."
159: */
160: public void setSpacerImage(String spacerImage) {
161: _iState.setImageSpacer(spacerImage);
162: }
163:
164: /**
165: * Sets the default icon for TreeElements for a blank area of the tree.
166: * (Defaults to "folder.gif").
167: * @param itemIcon the image name of the itemIcon
168: * @jsptagref.attributedescription Sets the default icon for tree nodes
169: * for a blank area of the tree. (Defaults to "folder.gif").
170: * @jsptagref.databindable true
171: * @jsptagref.attributesyntaxvalue <i>string</i>
172: * @netui:attribute required="false"
173: * description="Sets the default icon for TreeElements for a blank area of the tree."
174: */
175: public void setItemIcon(String itemIcon) {
176: _iState.setItemIcon(itemIcon);
177: }
178:
179: /**
180: * Sets the image name for an area with a line through it.
181: * (Defaults to "lineJoin.gif").
182: * @param lineJoinImage the image name (including extension)
183: * @jsptagref.attributedescription Sets the image name for an area with a line through it.
184: * (Defaults to "lineJoin.gif").
185: * @jsptagref.databindable true
186: * @jsptagref.attributesyntaxvalue <i>string</i>
187: * @netui:attribute required="false"
188: * description="Sets the image name for an area with a line through it."
189: */
190: public void setLineJoinImage(String lineJoinImage) {
191: _iState.setLineJoinImage(lineJoinImage);
192: }
193:
194: /**
195: * Sets the image name for an area with a line through it.
196: * (Defaults to "verticalLine.gif").
197: * @param verticalLineImage the image name (including extension)
198: * @jsptagref.attributedescription Sets the image name for an area with a line through it.
199: * (Defaults to "verticalLine.gif").
200: * @jsptagref.databindable true
201: * @jsptagref.attributesyntaxvalue <i>string</i>
202: * @netui:attribute required="false"
203: * description="Sets the image name for an area with a line through it."
204: */
205: public void setVerticalLineImage(String verticalLineImage) {
206: _iState.setVerticalLineImage(verticalLineImage);
207: }
208:
209: /**
210: * Sets the name of the directory containing the images for our icons,
211: * relative to the page including this tag.
212: * @param imageRoot the directory name
213: * @jsptagref.attributedescription Sets the name of the directory containing the images for our icons,
214: * relative to the page including this tag.
215: * @jsptagref.databindable true
216: * @jsptagref.attributesyntaxvalue <i>string_or_expression</i>
217: * @netui:attribute required="false" rtexprvalue="true"
218: * description="Sets the name of the directory containing the images for our icons,
219: * relative to the page including this tag."
220: */
221: public void setImageRoot(String imageRoot) {
222: _iState.setImageRoot(imageRoot);
223: }
224:
225: /**
226: * This will set the location of the icon images. When the location
227: * is explicitly set, this works exactly the same as all other inheritable
228: * properties. When this is not set, it will return the <code>getImageRoot</code>
229: * location.
230: * @param iconRoot the directory name for the icons
231: * @jsptagref.attributedescription The directory containing the icon images for tree items.
232: * @jsptagref.databindable false
233: * @jsptagref.attributesyntaxvalue <i>string_iconRoot</i>
234: * @netui:attribute required="false" rtexprvalue="true"
235: * description="Sets the name of the directory containing the images for our icons."
236: */
237: public void setIconRoot(String iconRoot) {
238: _iState.setIconRoot(iconRoot);
239: }
240:
241: /**
242: * Render this Tree control.
243: * @throws JspException if a processing error occurs
244: */
245: public void doTag() throws JspException {
246: Object o = getParent();
247: assert (o != null);
248: if (!(o instanceof TreeItem)) {
249: logger.error("Invalid Parent (expected a TreeItem):"
250: + o.getClass().getName());
251: return;
252: }
253:
254: // assign the value to the parent's label value
255: TreeItem ti = (TreeItem) o;
256: ti.setItemInheritableState(_iState);
257: }
258: }
|