Source Code Cross Referenced for AbstractAttributeState.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » tags » rendering » 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.rendering 
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.rendering;
020:
021:        import org.apache.beehive.netui.util.Bundle;
022:        import org.apache.beehive.netui.util.logging.Logger;
023:
024:        import java.util.HashMap;
025:        import java.util.Map;
026:
027:        abstract public class AbstractAttributeState extends AbstractTagState {
028:            private static final Logger logger = Logger
029:                    .getInstance(AbstractAttributeState.class);
030:
031:            /**
032:             * String constant for the empty string.
033:             */
034:            public static final String EMPTY_STRING = "";
035:
036:            /**
037:             * The integer type constant indentifying the General Attributes  <code>AbstractBaseTag</code>
038:             * reserves 0-9 for indentification.
039:             */
040:            public static final int ATTR_GENERAL = 0;
041:
042:            private HashMap generalMap = null; // the map of general attributes
043:
044:            public HashMap getGeneralAttributeMap() {
045:                return generalMap;
046:            }
047:
048:            /**
049:             * This method will return the map that represents the passed in <code>type</code>.  The boolean flag
050:             * </code>createIfNull</code> indicates that the map should be created or not if it's null. This
051:             * class defines two maps defined by  <code>@see #ATTR_GENERAL</code> and <code>ATTR_GENERAL_EXPRESSION</code>
052:             * @param type         <code>integer</code> type indentifying the map to be created.
053:             * @param createIfNull <code>boolean</code> flag indicating if the map should be created if it doesn't exist.
054:             * @return The map or null
055:             * @see #ATTR_GENERAL
056:             */
057:            public Map selectMap(int type, boolean createIfNull) {
058:                Map ret = null;
059:                if (type == ATTR_GENERAL) {
060:                    if (generalMap == null && createIfNull)
061:                        generalMap = new HashMap();
062:                    ret = generalMap;
063:                }
064:
065:                return ret;
066:            }
067:
068:            public void clear() {
069:                if (generalMap != null)
070:                    generalMap.clear();
071:            }
072:
073:            /**
074:             * Register a name/value pair into a named attribute map.  The base type
075:             * supports the <code>ATTR_GENERAL<code> named map.  Subclasses may add additional maps
076:             * enabling attributes to be treated with different behavior.
077:             * @param type     an integer key identifying the map.
078:             * @param attrName the name of the attribute
079:             * @param value    the value of the attribute
080:             */
081:            public void registerAttribute(int type, String attrName,
082:                    String value, boolean ignoreEmpty) {
083:                assert (attrName != null);
084:
085:                // If the value is null or the empty string ignore the expression.
086:                if (value == null)
087:                    return;
088:                if (ignoreEmpty && "".equals(value))
089:                    return;
090:
091:                Map map = selectMap(type, true);
092:                if (map == null) {
093:                    String s = Bundle.getString("Tags_ParameterAccessError",
094:                            new Object[] { new Integer(type), attrName });
095:                    logger.error(s);
096:                    return;
097:                }
098:                map.put(attrName, value);
099:            }
100:
101:            public void registerAttribute(int type, String attrName,
102:                    String value) {
103:                registerAttribute(type, attrName, value, true);
104:            }
105:
106:            /**
107:             * Remove a previously registered attribute value from map.
108:             * @param type     an integer key indentifying the map
109:             * @param attrName the name of the attribute to remove from the specified map
110:             */
111:            public void removeAttribute(int type, String attrName) {
112:                Map map = selectMap(type, false);
113:                if (map == null) {
114:                    String s = Bundle.getString("Tags_ParameterAccessError",
115:                            new Object[] { new Integer(type), attrName });
116:                    logger.error(s);
117:                    return;
118:                }
119:
120:                map.remove(attrName);
121:            }
122:
123:            /**
124:             * Return a named attribute value from the specified attribute map.
125:             * @param type     an integer key indentifying the map
126:             * @param attrName the name of the attribute we will get the value from.
127:             * @return a string value of the attribute if set or null.
128:             */
129:            public String getAttribute(int type, String attrName) {
130:                Map map = selectMap(type, false);
131:                if (map == null)
132:                    return null;
133:                return (String) map.get(attrName);
134:            }
135:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.