Source Code Cross Referenced for CriterionFormPatterns.java in  » J2EE » Mdarad » org » mdarad » framework » util » struts » criteria » 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 » J2EE » Mdarad » org.mdarad.framework.util.struts.criteria 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:            Mdarad-Toolobox is a collection of tools for Architected RAD
003:            (Rapid Application Development) based on an MDA approach.
004:            The toolbox contains frameworks and generators for many environments
005:            (JAVA, J2EE, Hibernate, .NET, C++, etc.) which allow to generate
006:            applications from a design Model
007:            Copyright (C) 2004-2005  Elapse Technologies Inc.
008:
009:            This library is free software; you can redistribute it and/or
010:            modify it under the terms of the GNU General Public
011:            License as published by the Free Software Foundation; either
012:            version 2.1 of the License, or (at your option) any later version.
013:
014:            This library is distributed in the hope that it will be useful,
015:            but WITHOUT ANY WARRANTY; without even the implied warranty of
016:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:            General Public License for more details.
018:
019:            You should have received a copy of the GNU General Public
020:            License along with this library; if not, write to the Free Software
021:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
022:         */
023:        package org.mdarad.framework.util.struts.criteria;
024:
025:        import java.util.Collection;
026:        import java.util.Hashtable;
027:        import java.util.Iterator;
028:        import java.util.Locale;
029:        import java.util.Map;
030:
031:        /**
032:         * This class keeps the possible values of the display patterns of criteria associated
033:         * to the search criteria. This class has the following patterns :
034:         *       <ul>
035:         *          <li>{@link #NO_OPERATOR_LIST Criterion with no operator, only an allowable list of elements}</li>
036:         *          <li>{@link #OPERATOR_INPUT Criterion with a operator and an input}</li>
037:         *          <li>{@link #NO_OPERATOR_MULTIPLE_LIST Criterition without operator and with a multiple selection list}</li>
038:         *       </ul>
039:         * 
040:         * @author Philippe Brouillette
041:         * @version 1.0
042:         */
043:        public class CriterionFormPatterns {
044:
045:            /**
046:             * Map of the items contained in the enumeration class
047:             */
048:            protected static Map formPatterns = new Hashtable();
049:
050:            //Declaration of the constants of the enumeration class
051:            /**
052:             * Criterion with no operator, only an allowable list of elements
053:             */
054:            static CriterionFormPattern NO_OPERATOR_LIST = new CriterionFormPattern(
055:                    new String("NO_OPERATOR_LIST"), "NO_OPERATOR_LIST");
056:            /**
057:             * Criterion with a operator and an input
058:             */
059:            static CriterionFormPattern OPERATOR_INPUT = new CriterionFormPattern(
060:                    new String("OPERATOR_INPUT"), "OPERATOR_INPUT");
061:            /**
062:             * Criterition without operator and with a multiple selection list
063:             */
064:            static CriterionFormPattern NO_OPERATOR_MULTIPLE_LIST = new CriterionFormPattern(
065:                    new String("NO_OPERATOR_MULTIPLE_LIST"),
066:                    "NO_OPERATOR_MULTIPLE_LIST");
067:
068:            // add the constants to the enumeration
069:            static {
070:                add(NO_OPERATOR_LIST);
071:                add(OPERATOR_INPUT);
072:                add(NO_OPERATOR_MULTIPLE_LIST);
073:            }
074:
075:            /**
076:             * Method that adds an CriterionFormPattern to this map
077:             * @param allowable CriterionFormPattern object that must be added
078:             *                  to the map
079:             */
080:            protected static final void add(CriterionFormPattern allowable) {
081:                formPatterns.put(allowable.getValue(), allowable);
082:            }
083:
084:            /**
085:             * This method returns the Operator
086:             * item associated to the value passed as argument.
087:             * If the item associated to the value doesn't exist,
088:             * the method returns <code>null</code>
089:             * @param value key of the item to get
090:             * @return Operator that is associated to the
091:             *         key passed as argument
092:             */
093:            public static CriterionFormPattern getAllowableFormPattern(
094:                    String value) {
095:                // if the property value is null, return a null value
096:                if (value == null) {
097:                    return null;
098:                }
099:
100:                // get the allowable item
101:                CriterionFormPattern allowable = (CriterionFormPattern) formPatterns
102:                        .get(value);
103:
104:                // catch the exception, if the value is null
105:                if (allowable == null) {
106:                    throw new IllegalStateException("Code:" + value);
107:                }
108:
109:                return allowable;
110:            }
111:
112:            /**
113:             * Method that returns an array of the
114:             * labels of the enumeration
115:             * @return  Array of strings with the labels
116:             *          of the enumeration
117:             */
118:            public static String[] getAllowableLabels(Locale locale) {
119:                // ensure the locale is valid
120:                if (locale == null)
121:                    throw new IllegalArgumentException(
122:                            "The locale object must not be null to retreive the labels");
123:
124:                // variables declaration
125:                String[] labels = new String[formPatterns.size()];
126:                int i = 0;
127:                Iterator iterator = formPatterns.values().iterator();
128:                // iterate through the items of the enumeration
129:                // and get the labels of the items
130:                while (iterator.hasNext()) {
131:                    CriterionFormPattern allowable = (CriterionFormPattern) iterator
132:                            .next();
133:                    labels[i++] = allowable.getLabel(); //allowable.getResource(locale);
134:                }
135:                return labels;
136:            }
137:
138:            /**
139:             * Method that returns a collection of the
140:             * values of the enumeration
141:             * @return  Collection object with the values
142:             *          of the enumeration
143:             */
144:            public static Collection getAllowableValues() {
145:                return formPatterns.keySet();
146:            }
147:
148:            /**
149:             * Method that returns all the values as a string.
150:             * @return the values of the allowable code
151:             */
152:            public String toString() {
153:                return formPatterns.toString();
154:            }
155:
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.