Source Code Cross Referenced for Label.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.HtmlUtils;
022:        import org.apache.beehive.netui.tags.rendering.AbstractHtmlState;
023:        import org.apache.beehive.netui.tags.rendering.LabelTag;
024:        import org.apache.beehive.netui.tags.rendering.TagRenderingBase;
025:        import org.apache.beehive.netui.tags.rendering.WriteRenderAppender;
026:        import org.apache.beehive.netui.util.Bundle;
027:        import org.apache.beehive.netui.util.logging.Logger;
028:
029:        import javax.servlet.ServletRequest;
030:        import javax.servlet.http.HttpServletRequest;
031:        import javax.servlet.jsp.JspException;
032:
033:        /**
034:         * @jsptagref.tagdescription Associates text with an input element in a {@link Form}.
035:         * @netui:tag name="label" description="a <label> element which may point to a form control."
036:         */
037:        public class Label extends LabelBase implements  IFormattable {
038:            private static final Logger logger = Logger
039:                    .getInstance(Label.class);
040:
041:            private LabelTag.State _state = new LabelTag.State();
042:
043:            /**
044:             * Return the name of the Tag.
045:             */
046:            public String getTagName() {
047:                return "Label";
048:            }
049:
050:            /**
051:             * This method will return the state associated with the tag.  This is used by this
052:             * base class to access the individual state objects created by the tags.
053:             * @return a subclass of the <code>AbstractHtmlState</code> class.
054:             */
055:            protected AbstractHtmlState getState() {
056:                return _state;
057:            }
058:
059:            /**
060:             * Set the <code>for</code> attribute.
061:             * @param forAttr the for attribute.
062:             * @jsptagref.attributedescription The value of this attribute matches a tagId on an form input and links the value to that control.
063:             * @jsptagref.databindable false
064:             * @jsptagref.attributesyntaxvalue <i>string_forAttr</i>
065:             * @netui:attribute required="false" rtexprvalue="true"
066:             * description="The value of this attribute matches a tagId on an form input and links the value to that control."
067:             */
068:            public void setFor(String forAttr) {
069:                _state.forAttr = forAttr;
070:            }
071:
072:            /**
073:             * Prepare the label formatters.
074:             * @throws JspException if a JSP exception has occurred
075:             */
076:            public int doStartTag() throws JspException {
077:                return EVAL_BODY_BUFFERED;
078:            }
079:
080:            /**
081:             * Render the label.
082:             * @throws JspException if a JSP exception has occurred
083:             */
084:            public int doEndTag() throws JspException {
085:                boolean usingDefault = false;
086:                boolean bypassEscape = false;
087:
088:                String scriptId = null;
089:                ServletRequest req = pageContext.getRequest();
090:                Object labelObject = null;
091:
092:                String labelValue = null;
093:
094:                // if this is not client side binding, evalute the value
095:                if (_value != null)
096:                    labelObject = _value;
097:                else {
098:                    if (_defaultValue != null) {
099:                        labelObject = _defaultValue;
100:                        bypassEscape = HtmlUtils.containsEntity(_defaultValue
101:                                .toString());
102:                    } else {
103:                        logger.warn(Bundle.getString(
104:                                "Tags_LabelExpressionNull", _value));
105:                        labelObject = DEFAULT_NULL_TEXT;
106:                    }
107:                    usingDefault = true;
108:                }
109:
110:                // we assume that tagId will over have override id if both
111:                // are defined.
112:                if (_state.id != null) {
113:                    scriptId = renderNameAndId((HttpServletRequest) req,
114:                            _state, null);
115:                }
116:
117:                // push the evaluated expression when we are not client side bound...
118:                labelValue = (usingDefault && !_formatDefaultValue) ? labelObject
119:                        .toString()
120:                        : formatText(labelObject);
121:
122:                if (hasErrors())
123:                    return reportAndExit(EVAL_PAGE);
124:
125:                // fully qualify the for attribute if it exists
126:                if (_state.forAttr != null) {
127:                    _state.forAttr = getIdForTagId(_state.forAttr);
128:
129:                }
130:
131:                WriteRenderAppender writer = new WriteRenderAppender(
132:                        pageContext);
133:                TagRenderingBase br = TagRenderingBase.Factory.getRendering(
134:                        TagRenderingBase.LABEL_TAG, req);
135:                br.doStartTag(writer, _state);
136:
137:                // push the evaluated expression when we are not client side bound...
138:                //if (!usingDefault)
139:                //    labelValue = formatText(labelValue);
140:
141:                if (!bypassEscape)
142:                    filter(labelValue, writer, _escapeWhiteSpace);
143:                else
144:                    write(labelValue);
145:                br.doEndTag(writer);
146:
147:                if (scriptId != null)
148:                    write(scriptId);
149:
150:                localRelease();
151:                return EVAL_PAGE;
152:            }
153:
154:            /**
155:             * Release any acquired resources.
156:             */
157:            protected void localRelease() {
158:                super.localRelease();
159:
160:                _state.clear();
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.