Source Code Cross Referenced for HtmlDataSourceTag.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » tags » html » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache beehive 1.0.2 src » org.apache.beehive.netui.tags.html 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.html;
020:
021:        import org.apache.beehive.netui.tags.AbstractClassicTag;
022:        import org.apache.beehive.netui.tags.ByRef;
023:        import org.apache.beehive.netui.tags.ExpressionHandling;
024:        import org.apache.beehive.netui.tags.rendering.AbstractHtmlControlState;
025:
026:        import javax.servlet.http.HttpServletRequest;
027:        import javax.servlet.jsp.JspException;
028:        import java.util.List;
029:
030:        /**
031:         * Abstract Base class adding support for the <code>dataSource</code> attribute.
032:         */
033:        abstract public class HtmlDataSourceTag extends HtmlFocusBaseTag {
034:            protected String _dataSource;
035:
036:            public HtmlDataSourceTag() {
037:                super ();
038:            }
039:
040:            /**
041:             * Sets the tag's data source (can be an expression).
042:             * @param dataSource the data source
043:             * @jsptagref.attributedescription <p>The <code>dataSource</code> attribute determines both
044:             * (1) the source of populating data for the tag and
045:             * (2) the object to which the tag submits data.
046:             *
047:             * <p>For example, assume that the Controller file (= JPF file) contains
048:             * a Form Bean with the property foo.  Then the following &lt;netui:textBox> tag will
049:             * (1) draw populating data from the Form Bean's foo property and (2)
050:             * submit user defined data to the same property.
051:             *
052:             * <p>&nbsp;&nbsp;&nbsp;&nbsp;<code>&lt;netui:textBox dataSource="actionForm.foo" /></code>
053:             *
054:             * <p>The <code>dataSource</code> attribute takes either a data binding expression or
055:             * the name of a Form Bean property.  In the
056:             * above example, <code>&lt;netui:textBox dataSource="foo" /></code>
057:             * would have the exactly same behavior.
058:             *
059:             * <p>When the tag is used to submit data, the data binding expression must
060:             * refer to a Form Bean property.
061:             * In cases where the tag is not used to submit data, but is used for
062:             * displaying data only, the data
063:             * binding expression need not refer to a Form Bean property.  For example,
064:             * assume that myIterativeData is a member variable on
065:             * the Controller file ( = JPF file).  The following &lt;netui-data:repeater>
066:             * tag draws its data from myIterativeData.
067:             *
068:             * <p>&nbsp;&nbsp;&nbsp;&nbsp;<code>&lt;netui-data:repeater dataSource="pageFlow.myIterativeData"></code>
069:             * @jsptagref.databindable true
070:             * @jsptagref.attributesyntaxvalue <i>expression_datasource</i>
071:             * @netui:attribute required="true"
072:             * description="The <code>dataSource</code> attribute determines both
073:             * the source of populating data for the tag and
074:             * the object to which the tag submits data."
075:             */
076:            public void setDataSource(String dataSource) {
077:                _dataSource = dataSource;
078:            }
079:
080:            /**
081:             * Return an <code>ArrayList</code> which represents a chain of <code>INameInterceptor</code>
082:             * objects.  This method by default returns <code>null</code> and should be overridden
083:             * by objects that support naming.
084:             * @return an <code>ArrayList</code> that will contain <code>INameInterceptor</code> objects.
085:             */
086:            protected List getNamingChain() {
087:                return AbstractClassicTag.DefaultNamingChain;
088:            }
089:
090:            /**
091:             * Return the Object that is represented by the specified data source.
092:             * @return Object
093:             * @throws JspException
094:             */
095:            protected Object evaluateDataSource() throws JspException {
096:                // @todo: at some point we need to switch the expression evaluation to not require '{'
097:                ExpressionHandling expr = new ExpressionHandling(this );
098:                String datasource = "{" + _dataSource + "}";
099:                String ds = expr.ensureValidExpression(datasource,
100:                        "dataSource", "DataSourceError");
101:                if (ds == null)
102:                    return null;
103:
104:                // have a valid expression
105:                return expr.evaluateExpression(datasource, "dataSource",
106:                        pageContext);
107:            }
108:
109:            /**
110:             * This method will create the name of the form element (HTML Control) that has a name. The
111:             * <b>name</b> attribute represent the "control name" for the control.  This name is scoped
112:             * into the form element.  In addition, a control may have a <b>id</b> attribute which is
113:             * specified by setting the <b>tagId</b>.  These two value are set in this routine.  The name
114:             * is always the expression mapping the data to it's backing element and is conotrolled
115:             * by the optional naming chain provided by the tag.  The <b>tagId</b> specifies the <b>id</b>
116:             * attribute.  If this is present then we write out a JavaScript that allows mapping
117:             * the tagId set on the tag to both the real <b>id</b> value and also the <b>name</b> value.
118:             * The <b>id</b> is formed by passing the <b>tagId</b> to the URL rewritter service.
119:             * @param state      The tag state structure.  This contains both the name and id attributes.  The
120:             *                   id attribute should be set with the initial value from the tagId.
121:             * @param javaScript A ByRef element that will contain any JavaScript that should be written out
122:             *                   by the calling tag.  A value is returned only if tagId is set and there is not IScriptReporter
123:             *                   found.
124:             * @throws JspException Pass through the exception from applyNamingChain.
125:             */
126:            protected void nameHtmlControl(AbstractHtmlControlState state,
127:                    ByRef javaScript) throws JspException {
128:                assert (javaScript != null) : "paramater 'javaScript' may not be null";
129:                assert (state != null) : "parameter 'state' may not be null";
130:                assert (_dataSource != null) : "dataSource is Null";
131:
132:                // create the expression (name)
133:                String datasource = "{" + _dataSource + "}";
134:                state.name = applyNamingChain(datasource);
135:
136:                Form parentForm = getNearestForm();
137:                String idScript = renderNameAndId(
138:                        (HttpServletRequest) pageContext.getRequest(), state,
139:                        parentForm);
140:                if (idScript != null)
141:                    javaScript.setRef(idScript);
142:            }
143:
144:            /**
145:             * Release any acquired resources.
146:             */
147:            protected void localRelease() {
148:                super.localRelease();
149:                _dataSource = null;
150:            }
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.