Source Code Cross Referenced for BaseFormElementLabelTag.java in  » Web-Framework » aranea-mvc-1.1.1 » org » araneaframework » jsp » tag » uilib » form » 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 » Web Framework » aranea mvc 1.1.1 » org.araneaframework.jsp.tag.uilib.form 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright 2006 Webmedia Group Ltd.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *  http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         **/package org.araneaframework.jsp.tag.uilib.form;
016:
017:        import java.io.Writer;
018:        import javax.servlet.jsp.JspException;
019:        import org.araneaframework.jsp.exception.MissingFormElementIdAraneaJspException;
020:        import org.araneaframework.jsp.tag.PresentationTag;
021:        import org.araneaframework.jsp.util.JspUtil;
022:        import org.araneaframework.jsp.util.JspWidgetUtil;
023:        import org.araneaframework.uilib.form.Control;
024:        import org.araneaframework.uilib.form.FormElement;
025:        import org.araneaframework.uilib.form.FormWidget;
026:
027:        /**
028:         * Base form element label tag.
029:         * 
030:         * @author Oleg Mürk
031:         */
032:        public class BaseFormElementLabelTag extends PresentationTag {
033:            protected FormWidget.ViewModel formViewModel;
034:
035:            protected FormElement.ViewModel formElementViewModel;
036:            protected Control.ViewModel controlViewModel;
037:            protected String localizedLabel;
038:            protected String accessKeyId;
039:            protected String derivedId;
040:
041:            //Attributes
042:
043:            protected String id;
044:            protected boolean showMandatory = true;
045:            protected boolean showColon = true;
046:            protected String accessKey;
047:
048:            protected int doStartTag(Writer out) throws Exception {
049:                super .doStartTag(out);
050:
051:                // Get form data    
052:                formViewModel = (FormWidget.ViewModel) requireContextEntry(FormTag.FORM_VIEW_MODEL_KEY);
053:                FormWidget form = (FormWidget) requireContextEntry(FormTag.FORM_KEY);
054:
055:                //In case the tag is in formElement tag
056:                derivedId = id;
057:                if (derivedId == null
058:                        && getContextEntry(FormElementTag.ID_KEY) != null)
059:                    derivedId = (String) getContextEntry(FormElementTag.ID_KEY);
060:
061:                if (derivedId == null)
062:                    throw new MissingFormElementIdAraneaJspException(this );
063:
064:                formElementViewModel = (FormElement.ViewModel) JspWidgetUtil
065:                        .traverseToSubWidget(form, derivedId)._getViewable()
066:                        .getViewModel();
067:
068:                // Get control  
069:                controlViewModel = (formElementViewModel).getControl();
070:                localizedLabel = JspUtil.getResourceString(pageContext,
071:                        formElementViewModel.getLabel());
072:
073:                if (accessKeyId == null) {
074:
075:                    // If controlViewModel.getLabel() did not specify a resource, we 
076:                    // assume that controlViewModel.getLabel() + ".access-key" will also 
077:                    // _not_ specify a legal resource.
078:                    accessKey = JspUtil.getResourceStringOrNull(pageContext,
079:                            formElementViewModel.getLabel() + ".access-key");
080:                } else {
081:                    accessKey = JspUtil.getResourceStringOrNull(pageContext,
082:                            accessKeyId);
083:                }
084:                if (accessKey != null && accessKey.length() != 1)
085:                    accessKey = null;
086:
087:                // Continue
088:                return EVAL_BODY_INCLUDE;
089:            }
090:
091:            /* ***********************************************************************************
092:             * Tag attributes
093:             * ***********************************************************************************/
094:
095:            /**
096:             * @jsp.attribute
097:             *   type = "java.lang.String"
098:             *   required = "false"
099:             *   description = "Element id." 
100:             */
101:            public void setId(String id) throws JspException {
102:                this .id = (String) evaluateNotNull("id", id, String.class);
103:            }
104:
105:            /**
106:             * @jsp.attribute
107:             *   type = "java.lang.String"
108:             *   required = "false"
109:             *   description = "Whether an asterisk is shown when the element is mandatory." 
110:             */
111:            public void setShowMandatory(String showMandatory)
112:                    throws JspException {
113:                this .showMandatory = ((Boolean) (evaluateNotNull(
114:                        "showMandatory", showMandatory, Boolean.class)))
115:                        .booleanValue();
116:            }
117:
118:            /**
119:             * @jsp.attribute
120:             *   type = "java.lang.String"
121:             *   required = "false"
122:             *   description = "Whether a colon (":") is draw after the label." 
123:             */
124:            public void setShowColon(String showColon) throws JspException {
125:                this .showColon = ((Boolean) (evaluateNotNull("showColumn",
126:                        showColon, Boolean.class))).booleanValue();
127:            }
128:
129:            /**
130:             * Set the id of the resource containing the access key for this label.
131:             * It may be null. In this case the default resource id is used: 
132:             *   <label-id>.access-key
133:             * (where label-id is the resource id containing the label for the element.
134:             *  if it exists).
135:             * If such resource exists and specifies a single character, the 
136:             * tag outputs an additional accesskey attribute for the HTML a <label> element.
137:             * If given resource does not exist, it's also ok. Noone will die. 
138:             */
139:            public void setAccessKeyId(String accessKeyId) throws JspException {
140:                this .accessKeyId = (String) evaluate("accessKeyId",
141:                        accessKeyId, String.class);
142:            }
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.