Source Code Cross Referenced for LocalMeetingModel.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » section » jsf » backingbean » 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 » ERP CRM Financial » sakai » org.sakaiproject.tool.section.jsf.backingbean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/sections/tags/sakai_2-4-1/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/LocalMeetingModel.java $
003:         * $Id: LocalMeetingModel.java 20144 2007-01-06 01:30:09Z jholtzman@berkeley.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2005, 2006 The Regents of the University of California and The Regents of the University of Michigan
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.tool.section.jsf.backingbean;
021:
022:        import java.io.Serializable;
023:        import java.sql.Time;
024:        import java.util.Calendar;
025:        import java.util.GregorianCalendar;
026:
027:        import org.apache.commons.lang.StringUtils;
028:        import org.apache.commons.lang.builder.ToStringBuilder;
029:        import org.apache.commons.logging.Log;
030:        import org.apache.commons.logging.LogFactory;
031:        import org.sakaiproject.section.api.coursemanagement.Meeting;
032:        import org.sakaiproject.tool.section.jsf.JsfUtil;
033:
034:        public class LocalMeetingModel implements  Meeting, Serializable {
035:            private static final Log log = LogFactory
036:                    .getLog(LocalMeetingModel.class);
037:            private static final long serialVersionUID = 1L;
038:
039:            public LocalMeetingModel() {
040:                startTimeAm = true;
041:                endTimeAm = true;
042:                startTimeString = JsfUtil
043:                        .getLocalizedMessage("section_start_time_default");
044:                endTimeString = JsfUtil
045:                        .getLocalizedMessage("section_end_time_default");
046:            }
047:
048:            public LocalMeetingModel(Meeting meeting) {
049:                this .location = meeting.getLocation();
050:                this .monday = meeting.isMonday();
051:                this .tuesday = meeting.isTuesday();
052:                this .wednesday = meeting.isWednesday();
053:                this .thursday = meeting.isThursday();
054:                this .friday = meeting.isFriday();
055:                this .saturday = meeting.isSaturday();
056:                this .sunday = meeting.isSunday();
057:                this .startTimeString = JsfUtil.convertTimeToString(meeting
058:                        .getStartTime());
059:                if (startTimeString == null) {
060:                    startTimeString = JsfUtil
061:                            .getLocalizedMessage("section_start_time_default");
062:                }
063:
064:                this .endTimeString = JsfUtil.convertTimeToString(meeting
065:                        .getEndTime());
066:                if (endTimeString == null) {
067:                    endTimeString = JsfUtil
068:                            .getLocalizedMessage("section_end_time_default");
069:                }
070:
071:                Calendar cal = new GregorianCalendar();
072:                if (meeting.getStartTime() == null) {
073:                    this .startTimeAm = true;
074:                } else {
075:                    cal.setTime(meeting.getStartTime());
076:                    if (log.isDebugEnabled())
077:                        log.debug("cal.get(Calendar.AM_PM) = "
078:                                + cal.get(Calendar.AM_PM));
079:                    this .startTimeAm = (cal.get(Calendar.AM_PM) == Calendar.AM);
080:                }
081:                if (meeting.getEndTime() == null) {
082:                    this .endTimeAm = true;
083:                } else {
084:                    cal.setTime(meeting.getEndTime());
085:                    if (log.isDebugEnabled())
086:                        log.debug("cal.get(Calendar.AM_PM) = "
087:                                + cal.get(Calendar.AM_PM));
088:                    this .endTimeAm = (cal.get(Calendar.AM_PM) == Calendar.AM);
089:                }
090:            }
091:
092:            private String location, startTimeString, endTimeString;
093:            private boolean monday, tuesday, wednesday, thursday, friday,
094:                    saturday, sunday;
095:            private boolean startTimeAm, endTimeAm;
096:
097:            public boolean isEmpty() {
098:                return !monday
099:                        && !tuesday
100:                        && !wednesday
101:                        && !thursday
102:                        && !friday
103:                        && !saturday
104:                        && !sunday
105:                        && (StringUtils.trimToNull(startTimeString) == null || isStartTimeDefault())
106:                        && (StringUtils.trimToNull(endTimeString) == null || isEndTimeDefault())
107:                        && StringUtils.trimToNull(location) == null;
108:            }
109:
110:            public Time getStartTime() {
111:                if (isStartTimeDefault()) {
112:                    return null;
113:                }
114:                return JsfUtil
115:                        .convertStringToTime(startTimeString, startTimeAm);
116:            }
117:
118:            public Time getEndTime() {
119:                if (isEndTimeDefault()) {
120:                    return null;
121:                }
122:                return JsfUtil.convertStringToTime(endTimeString, endTimeAm);
123:            }
124:
125:            public String getEndTimeString() {
126:                return endTimeString;
127:            }
128:
129:            public void setEndTimeString(String endTimeString) {
130:                this .endTimeString = endTimeString;
131:            }
132:
133:            // Must use a string due to http://issues.apache.org/jira/browse/MYFACES-570
134:            public String getEndTimeAmString() {
135:                return Boolean.toString(endTimeAm);
136:            }
137:
138:            // Must use a string due to http://issues.apache.org/jira/browse/MYFACES-570
139:            public void setEndTimeAmString(String endTimeAm) {
140:                this .endTimeAm = Boolean.parseBoolean(endTimeAm);
141:            }
142:
143:            public boolean isFriday() {
144:                return friday;
145:            }
146:
147:            public void setFriday(boolean friday) {
148:                this .friday = friday;
149:            }
150:
151:            public String getLocation() {
152:                return location;
153:            }
154:
155:            public void setLocation(String location) {
156:                this .location = location;
157:            }
158:
159:            public boolean isMonday() {
160:                return monday;
161:            }
162:
163:            public void setMonday(boolean monday) {
164:                this .monday = monday;
165:            }
166:
167:            public boolean isSaturday() {
168:                return saturday;
169:            }
170:
171:            public void setSaturday(boolean saturday) {
172:                this .saturday = saturday;
173:            }
174:
175:            public String getStartTimeString() {
176:                return startTimeString;
177:            }
178:
179:            public void setStartTimeString(String startTimeString) {
180:                this .startTimeString = startTimeString;
181:            }
182:
183:            // Must use a string due to http://issues.apache.org/jira/browse/MYFACES-570
184:            public String getStartTimeAmString() {
185:                return Boolean.toString(startTimeAm);
186:            }
187:
188:            // Must use a string due to http://issues.apache.org/jira/browse/MYFACES-570
189:            public void setStartTimeAmString(String startTimeAm) {
190:                this .startTimeAm = Boolean.parseBoolean(startTimeAm);
191:                if (log.isDebugEnabled())
192:                    log.debug("String " + startTimeAm
193:                            + " caused startTimeAm to be set to "
194:                            + this .startTimeAm);
195:            }
196:
197:            public boolean isStartTimeAm() {
198:                return startTimeAm;
199:            }
200:
201:            public boolean isEndTimeAm() {
202:                return endTimeAm;
203:            }
204:
205:            public boolean isSunday() {
206:                return sunday;
207:            }
208:
209:            public void setSunday(boolean sunday) {
210:                this .sunday = sunday;
211:            }
212:
213:            public boolean isThursday() {
214:                return thursday;
215:            }
216:
217:            public void setThursday(boolean thursday) {
218:                this .thursday = thursday;
219:            }
220:
221:            public boolean isTuesday() {
222:                return tuesday;
223:            }
224:
225:            public void setTuesday(boolean tuesday) {
226:                this .tuesday = tuesday;
227:            }
228:
229:            public boolean isWednesday() {
230:                return wednesday;
231:            }
232:
233:            public void setWednesday(boolean wednesday) {
234:                this .wednesday = wednesday;
235:            }
236:
237:            public String toString() {
238:                return new ToStringBuilder(this ).append(location).append(
239:                        startTimeString).append(startTimeAm).append(
240:                        endTimeString).append(endTimeAm).append(monday).append(
241:                        tuesday).append(wednesday).append(thursday).append(
242:                        friday).append(saturday).append(sunday).toString();
243:            }
244:
245:            public boolean isStartTimeDefault() {
246:                return JsfUtil
247:                        .getLocalizedMessage("section_start_time_default")
248:                        .equals(startTimeString);
249:            }
250:
251:            public boolean isEndTimeDefault() {
252:                return JsfUtil.getLocalizedMessage("section_end_time_default")
253:                        .equals(endTimeString);
254:            }
255:
256:            public boolean isLocationDefault() {
257:                return JsfUtil.getLocalizedMessage("section_location_default")
258:                        .equals(location);
259:            }
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.