Source Code Cross Referenced for TagConfig.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » tags » 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 
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;
020:
021:        import org.apache.beehive.netui.tags.tree.InheritableState;
022:        import org.apache.beehive.netui.util.config.ConfigUtil;
023:        import org.apache.beehive.netui.util.config.bean.JspTagConfig;
024:        import org.apache.beehive.netui.util.config.bean.IdJavascript;
025:
026:        /**
027:         * This class implements a series of static method that will return configuration information.  The
028:         * information is buffered, and config properties values defined here.  The document type configuration
029:         * is not found in this class.  It is found TagRenderBase {@link org.apache.beehive.netui.tags.rendering.TagRenderingBase}
030:         * and the HTML tag {@link org.apache.beehive.netui.tags.html.Html}.
031:         */
032:        final public class TagConfig {
033:            // This is the value of the javascript support for the webapp.  This should
034:            // be one of the enum values defined above.
035:            private static int javascriptMode = -1;
036:
037:            private static String defaultTreeImageLocation = null;
038:            private static String defaultTreeRendererClassName = null;
039:
040:            /**
041:             * Return true if the legacy JavaScript support should be written to the output stream.
042:             * @return boolean
043:             */
044:            public static boolean isLegacyJavaScript() {
045:                if (javascriptMode == -1) {
046:                    setLegacyJavaScriptMode();
047:                }
048:                assert (javascriptMode != -1);
049:                return (javascriptMode == IdJavascript.INT_LEGACY || javascriptMode == IdJavascript.INT_LEGACY_ONLY);
050:            }
051:
052:            /**
053:             * Return true if the default JavaScript support should be written to the output stream.
054:             * @return boolean
055:             */
056:            public static boolean isDefaultJavaScript() {
057:                if (javascriptMode == -1) {
058:                    setLegacyJavaScriptMode();
059:                }
060:                assert (javascriptMode != -1);
061:                return (javascriptMode == IdJavascript.INT_DEFAULT || javascriptMode == IdJavascript.INT_LEGACY);
062:            }
063:
064:            /**
065:             * This method returns the default location for the tree images.  This may be configured by setting
066:             * the <tree-image-location> element in the netui.config file to the location of the images.
067:             * This location should not include the context path of the webapp or the leading '/', but should be an absolute
068:             * path within the webapp.
069:             * <p>&lt;tree-image-location>resources/images&lt;/tree-image-location>
070:             * </p>
071:             * @return the default location of the tree images.
072:             */
073:            public static String getTreeImageLocation() {
074:                if (defaultTreeImageLocation == null) {
075:                    JspTagConfig tagConfig = ConfigUtil.getConfig()
076:                            .getJspTagConfig();
077:                    if (tagConfig != null) {
078:                        String s = tagConfig.getTreeImageLocation();
079:                        defaultTreeImageLocation = (s != null) ? s
080:                                : InheritableState.DEFAULT_IMAGES;
081:                    } else
082:                        defaultTreeImageLocation = InheritableState.DEFAULT_IMAGES;
083:                }
084:                assert (defaultTreeImageLocation != null);
085:                return defaultTreeImageLocation;
086:            }
087:
088:            /**
089:             * This method returns the class name of the renderer to use for NetUI
090:             * trees in the Web application. The class name returned will usually
091:             * be the predefined default NetUI implementation,
092:             * {@link org.apache.beehive.netui.tags.tree.TreeRenderer}, unless
093:             * NetUI is configured to use a different implementation.
094:             * This may be configured by setting the &lt;tree-renderer-class>
095:             * element in the beehive-netui-config file to the name of a class that
096:             * extends {@link org.apache.beehive.netui.tags.tree.TreeRenderer}.
097:             * <p>&lt;tree-renderer-class>com.xyz.tree.CustomTreeRenderer&lt;/tree-renderer-class>
098:             * </p>
099:             * <p>Note that the NetUI {@link org.apache.beehive.netui.tags.tree.Tree}
100:             * tag has an attribute for setting the name of the TreeRenderer class to
101:             * use on a tree by tree bases.
102:             * </p>
103:             * @return the name of the class to use to renderer the trees in the application.
104:             */
105:            public static String getTreeRendererClassName() {
106:                if (defaultTreeRendererClassName == null) {
107:                    JspTagConfig tagConfig = ConfigUtil.getConfig()
108:                            .getJspTagConfig();
109:                    if (tagConfig != null) {
110:                        // the schema config includes a default value so we shouldn't
111:                        // get a null value from the config object.
112:                        defaultTreeRendererClassName = tagConfig
113:                                .getTreeRendererClass();
114:                    }
115:                }
116:                return defaultTreeRendererClassName;
117:            }
118:
119:            /**
120:             * This will set the JavaScript support level for the id and name attributes.
121:             */
122:            private static void setLegacyJavaScriptMode() {
123:                JspTagConfig tagConfig = ConfigUtil.getConfig()
124:                        .getJspTagConfig();
125:                if (tagConfig != null) {
126:                    javascriptMode = tagConfig.getIdJavascript().getValue();
127:                } else {
128:                    javascriptMode = IdJavascript.INT_DEFAULT;
129:                }
130:            }
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.