Source Code Cross Referenced for TaskTableContainer.java in  » Portal » Open-Portal » com » sun » portal » app » sharedtasks » faces » 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 » Portal » Open Portal » com.sun.portal.app.sharedtasks.faces.beans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.sun.portal.app.sharedtasks.faces.beans;
002:
003:        import com.sun.portal.app.sharedtasks.faces.models.TaskListModel;
004:        import com.sun.portal.app.sharedtasks.util.CalTaskListItem;
005:        import com.sun.portal.app.sharedtasks.util.SharedTaskException;
006:        import com.sun.portal.app.sharedtasks.util.SharedConstants;
007:        import com.sun.portal.app.sharedtasks.util.TaskBeanFactory;
008:
009:        import com.sun.data.provider.impl.ObjectArrayDataProvider;
010:        import com.sun.web.ui.model.Option;
011:
012:        import com.sun.comclient.calendar.DateTime;
013:
014:        import javax.faces.context.FacesContext;
015:
016:        import java.util.Map;
017:        import java.util.Calendar;
018:        import java.util.ResourceBundle;
019:        import java.util.Locale;
020:        import java.text.SimpleDateFormat;
021:
022:        import com.sun.portal.log.common.PortalLogger;
023:        import java.util.logging.Logger;
024:        import java.util.logging.Level;
025:
026:        /**
027:         * Container class for the task list table.
028:         *
029:         * @author ashwin.mathew@sun.com
030:         */
031:        public class TaskTableContainer {
032:
033:            private TaskListModel model;
034:
035:            private TaskTableActions actions;
036:
037:            private TaskTableSelect select;
038:
039:            private String message;
040:
041:            private TaskListSessionBackingBean listSession;
042:            private TaskUserSessionBackingBean userSession;
043:
044:            private TaskListBackingBean parent;
045:
046:            private static Logger logger = PortalLogger
047:                    .getLogger(TaskTableContainer.class);
048:
049:            private static final String VIEW_CONTEXT_DATE_HYPHEN = " - ";
050:            private static final String VIEW_CONTEXT_DATE_COMMA = ", ";
051:
052:            public TaskTableContainer(TaskListBackingBean parent) {
053:                this .parent = parent;
054:
055:                listSession = (TaskListSessionBackingBean) TaskBeanFactory
056:                        .getBean(TaskListSessionBackingBean.BEAN_NAME);
057:
058:                userSession = (TaskUserSessionBackingBean) TaskBeanFactory
059:                        .getBean(TaskUserSessionBackingBean.BEAN_NAME);
060:
061:                model = new TaskListModel(listSession, userSession);
062:                actions = new TaskTableActions(userSession, this );
063:                select = new TaskTableSelect(this );
064:            }
065:
066:            public TaskListBackingBean getParent() {
067:                return parent;
068:            }
069:
070:            public String getMessage() {
071:                return message;
072:            }
073:
074:            public void setMessage(String message) {
075:                this .message = message;
076:            }
077:
078:            public void setRefreshData() {
079:                listSession.setDataProvider(null);
080:            }
081:
082:            public TaskListModel getModel() {
083:                return model;
084:            }
085:
086:            public void setModel(TaskListModel model) {
087:                this .model = model;
088:            }
089:
090:            public TaskTableActions getActions() {
091:                return actions;
092:            }
093:
094:            public ObjectArrayDataProvider getDataProvider() {
095:                if (logger.isLoggable(Level.FINEST)) {
096:                    logger.finest("Entered getDataProvider()");
097:                }
098:
099:                if (listSession.getDataProvider() == null) {
100:                    if (logger.isLoggable(Level.FINEST)) {
101:                        logger.finest("Retrieving tasks");
102:                    }
103:
104:                    try {
105:                        CalTaskListItem[] tasks = model.retrieve();
106:
107:                        listSession
108:                                .setDataProvider(new ObjectArrayDataProvider(
109:                                        tasks));
110:                    } catch (SharedTaskException se) {
111:                        logger.log(Level.SEVERE, "Error retrieving tasks", se);
112:                        parent.setException(se);
113:                    }
114:                }
115:
116:                return listSession.getDataProvider();
117:            }
118:
119:            public TaskTableSelect getSelect() {
120:                return select;
121:            }
122:
123:            public String getViewContextDate() {
124:                StringBuffer viewContextDate = new StringBuffer();
125:
126:                ResourceBundle bundle = userSession.getResourceBundle();
127:                Locale cLocale = userSession.getLocale();
128:
129:                if (listSession.getViewContext().equals(
130:                        SharedConstants.VIEW_CTX_DAY)) {
131:                    String DayFormat = bundle
132:                            .getString(SharedConstants.KEY_DAY_FORMAT);
133:                    viewContextDate.append(bundle
134:                            .getString(SharedConstants.KEY_VIEW_DAY));
135:                    SimpleDateFormat formatter = new SimpleDateFormat(
136:                            DayFormat, cLocale);
137:                    viewContextDate.append(formatter.format(listSession
138:                            .getViewDateTime().getTime()));
139:                } else if (listSession.getViewContext().equals(
140:                        SharedConstants.VIEW_CTX_WEEK)) {
141:                    String WeekFormat = bundle
142:                            .getString(SharedConstants.KEY_WEEK_FORMAT);
143:                    viewContextDate.append(bundle
144:                            .getString(SharedConstants.KEY_VIEW_WEEK));
145:
146:                    SimpleDateFormat formatter = new SimpleDateFormat(
147:                            WeekFormat, cLocale);
148:
149:                    DateTime contextStartDate = listSession
150:                            .getContextStartDateTime();
151:
152:                    viewContextDate.append(formatter.format(contextStartDate
153:                            .getTime()));
154:                    viewContextDate.append(VIEW_CONTEXT_DATE_HYPHEN);
155:
156:                    DateTime contextEndDate = listSession
157:                            .getContextEndDateTime();
158:
159:                    viewContextDate.append(formatter.format(contextEndDate
160:                            .getTime()));
161:                    viewContextDate.append(VIEW_CONTEXT_DATE_COMMA).append(
162:                            listSession.getViewDateTime().getYear());
163:                } else if (listSession.getViewContext().equals(
164:                        SharedConstants.VIEW_CTX_MONTH)) {
165:                    String MonthFormat = bundle
166:                            .getString(SharedConstants.KEY_MONTH_FORMAT);
167:                    viewContextDate.append(bundle
168:                            .getString(SharedConstants.KEY_VIEW_MONTH));
169:                    SimpleDateFormat formatter = new SimpleDateFormat(
170:                            MonthFormat, cLocale);
171:                    viewContextDate.append(formatter.format(listSession
172:                            .getViewDateTime().getTime()));
173:                }
174:
175:                return viewContextDate.toString();
176:            }
177:
178:            public void goNextViewContext() {
179:                setRefreshData();
180:
181:                if (listSession.getViewContext().equals(
182:                        SharedConstants.VIEW_CTX_DAY)) {
183:                    listSession.getViewDateTime().add(Calendar.DAY_OF_MONTH, 1);
184:                } else if (listSession.getViewContext().equals(
185:                        SharedConstants.VIEW_CTX_WEEK)) {
186:                    listSession.getViewDateTime().add(Calendar.WEEK_OF_YEAR, 1);
187:                } else if (listSession.getViewContext().equals(
188:                        SharedConstants.VIEW_CTX_MONTH)) {
189:                    listSession.getViewDateTime().add(Calendar.MONTH, 1);
190:                }
191:            }
192:
193:            public void goPreviousViewContext() {
194:                setRefreshData();
195:
196:                if (listSession.getViewContext().equals(
197:                        SharedConstants.VIEW_CTX_DAY)) {
198:                    listSession.getViewDateTime()
199:                            .add(Calendar.DAY_OF_MONTH, -1);
200:                } else if (listSession.getViewContext().equals(
201:                        SharedConstants.VIEW_CTX_WEEK)) {
202:                    listSession.getViewDateTime()
203:                            .add(Calendar.WEEK_OF_YEAR, -1);
204:                } else if (listSession.getViewContext().equals(
205:                        SharedConstants.VIEW_CTX_MONTH)) {
206:                    listSession.getViewDateTime().add(Calendar.MONTH, -1);
207:                }
208:            }
209:
210:            public Option[] getFilterOptions() {
211:                ResourceBundle bundle = userSession.getResourceBundle();
212:
213:                Option[] filterOptions = {
214:                        new Option(
215:                                SharedConstants.FILTER_ALL_TASKS,
216:                                bundle
217:                                        .getString(SharedConstants.KEY_FILTER_ALL_TASKS)),
218:                        new Option(
219:                                SharedConstants.FILTER_INCOMPLETE_TASKS,
220:                                bundle
221:                                        .getString(SharedConstants.KEY_FILTER_INCOMPLETE_TASKS)),
222:                        new Option(
223:                                SharedConstants.FILTER_COMPLETED_TASKS,
224:                                bundle
225:                                        .getString(SharedConstants.KEY_FILTER_COMPLETED_TASKS)) };
226:
227:                return filterOptions;
228:            }
229:
230:            public String getFilterText() {
231:                String filter = listSession.getStatusFilter();
232:
233:                return filter;
234:            }
235:
236:            public TaskListSessionBackingBean getListSession() {
237:                return listSession;
238:            }
239:
240:            public void applyFilter() {
241:                setRefreshData();
242:            }
243:
244:        }
ww___w___.j___a_v__a_2__s_._c_o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.