01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: * $Header:$
18: */
19: package org.apache.beehive.netui.tags.html;
20:
21: import javax.servlet.jsp.JspException;
22:
23: /**
24: * Abstract base class extending the <code>HtmlDataSourceTag</code> and adding support
25: * for the <code>defaultValue</code> attribute.
26: */
27: abstract public class HtmlDefaultableDataSourceTag extends
28: HtmlDataSourceTag {
29: protected Object _defaultValue; // A String that contains or references the data to render for the default value of this tag.
30:
31: /**
32: * Sets the default value (can be an expression).
33: * @param defaultValue the default value
34: * @jsptagref.attributedescription <p><b>Use in <netui:checkBoxGroup>, <netui:checkBox>,
35: * <netui:radioButtonGroup>, and <netui:select> tags</b></p>
36: * <p>Sets the preselected value or values.
37: * <p>The <code>defaultValue</code> attribute takes either a String literal or
38: * a data binding expression.
39: * <p>If the <code>defaultValue</code> attribute has a String value (or if
40: * the data binding expression points to a String), then a single value
41: * will be preselected.
42: * <p>If the <code>defaultValue</code> attribute points to a String[] object
43: * (or any object which can be iterated over), then
44: * multiple values will be preselected.
45: *
46: *
47: * <p><b>Use in <netui:textArea> and <netui:textBox> tags</b></p>
48: * <p>Sets the initial display text.</p>
49: * <p>The <code>defaultValue</code> attribute takes either a String literal or
50: * a data binding expression that points to a String.
51: * @jsptagref.databindable Read / Write
52: * @jsptagref.attributesyntaxvalue <i>string_or_expression_default</i>
53: * @netui:attribute required="false" rtexprvalue="true" type="java.lang.Object"
54: * description="Sets the default value of the control which is used if the object bound to is null."
55: */
56: public void setDefaultValue(Object defaultValue)
57: throws JspException {
58: _defaultValue = defaultValue;
59: }
60:
61: /**
62: * Release any acquired resources.
63: */
64: protected void localRelease() {
65: super.localRelease();
66: _defaultValue = null;
67: }
68: }
|