Source Code Cross Referenced for TimeZoneWrapper.java in  » J2EE » ICEfaces-1.6.1 » com » icesoft » openajax » beans » 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 » ICEfaces 1.6.1 » com.icesoft.openajax.beans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.icesoft.openajax.beans;
002:
003:        import java.text.DateFormat;
004:        import java.util.Calendar;
005:        import java.util.TimeZone;
006:
007:        /**
008:         * Bean holding time zone specific information.
009:         * Checking a selectBooleanCheckbox in the UI will cause instances of this class to populate the checkedTimeZoneList ArrayList in <code>TimeZoneBean</code>.
010:         * That ArrayList is used to create a DataTable of checked time zones in the UI.
011:         */
012:        public class TimeZoneWrapper {
013:            /* Variables */
014:            /**
015:             * {@link TimeZone} id used to identify the time zone. This id can be passed
016:             * to <code>TimeZone.getTimeZone(String)</code>, to get the appropriate
017:             * {@link TimeZone} object.
018:             */
019:            private String id;
020:
021:            /**
022:             * The component id of the commandButton, in the map UI, corresponding to
023:             * this time zone.
024:             */
025:            private String mapCommandButtonId;
026:
027:            /**
028:             * The component id of the selectBooleanCheckbox, under the map UI,
029:             * corresponding to this time zone.
030:             */
031:            private String checkboxId;
032:
033:            /**
034:             * A cached {@link DateFormat} used to describe what the time is for this
035:             * {@link TimeZone}
036:             */
037:            private DateFormat dateFormat;
038:
039:            /* Constructors */
040:            /**
041:             * @param id      id used to identify the time zone.
042:             * @param mapId   map button component id in web page
043:             * @param checkId checkbox component id in web page
044:             */
045:            public TimeZoneWrapper(String id, String mapId, String checkId) {
046:                this .id = id;
047:                this .mapCommandButtonId = mapId;
048:                this .checkboxId = checkId;
049:                this .dateFormat = TimeZoneBean
050:                        .buildDateFormatForTimeZone(TimeZone.getTimeZone(id));
051:            }
052:
053:            /* Getters */
054:            /**
055:             * Gets the name of this time zone to be displayed in the UI.
056:             *
057:             * @return String
058:             */
059:            public String getDisplayName() {
060:                String displayName = null;
061:                TimeZone timeZone = TimeZone.getTimeZone(id);
062:                synchronized (TimeZone.class) {
063:                    displayName = TimeZoneBean.displayNameTokenizer(timeZone
064:                            .getDisplayName());
065:                }
066:                return displayName;
067:            }
068:
069:            /**
070:             * Gets the {@link TimeZone} id used to identify this time zone in the Java
071:             * code.
072:             *
073:             * @return String
074:             */
075:            public String getId() {
076:                return id;
077:            }
078:
079:            /**
080:             * Gets the dynamic time through the <code>formatCurrentTime</code> method
081:             * in the <code>TimeZoneBean</code>.
082:             *
083:             * @return String
084:             */
085:            public String getTime() {
086:                return TimeZoneBean.formatCurrentTime(dateFormat);
087:            }
088:
089:            /**
090:             * Gets whether or not this time zone uses DayLight time.
091:             *
092:             * @return Returns the useDaylightTime.
093:             */
094:            public String getUseDaylightTime() {
095:                TimeZone timeZone = TimeZone.getTimeZone(id);
096:                if (timeZone.useDaylightTime()) {
097:                    return "Yes";
098:                }
099:
100:                return "No";
101:            }
102:
103:            /**
104:             * Gets the state of DayLight Time in this time zone.
105:             *
106:             * @return Returns the inDaylightTime.
107:             */
108:            public String getInDaylightTime() {
109:                TimeZone timeZone = TimeZone.getTimeZone(id);
110:                Calendar cal = Calendar.getInstance(timeZone);
111:                if (timeZone.inDaylightTime(cal.getTime())) {
112:                    return "Yes";
113:                }
114:
115:                return "No";
116:            }
117:
118:            /**
119:             * Gets the {@link TimeZone} location used to identify this time zone.
120:             *
121:             * @return String
122:             */
123:            public String getLocation() {
124:                return id;
125:            }
126:
127:            /**
128:             * Ascertains whether mapCommandButtonId or checkboxId are a part of
129:             * componentId. componentId might be a fully qualified id, with a prefix
130:             * corresponding to container component(s).
131:             *
132:             * @param componentId Id of some component that may be related to this time
133:             *                    zone
134:             */
135:            public boolean isRelevantComponentId(String componentId) {
136:                boolean relevant = (componentId.endsWith(mapCommandButtonId) || componentId
137:                        .endsWith(checkboxId));
138:                return relevant;
139:            }
140:
141:            /**
142:             * Gets the component id of the commandButton, in the map UI, corresponding
143:             * to this time zone.
144:             */
145:            public String getMapCommandButtonId() {
146:                return mapCommandButtonId;
147:            }
148:
149:            /**
150:             * Gets the component id of the selectBooleanCheckbox, under the map UI,
151:             * corresponding to this time zone.
152:             */
153:            public String getCheckboxId() {
154:                return checkboxId;
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.