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


001:        package com.sun.portal.app.sharedevents.faces;
002:
003:        import com.sun.comclient.calendar.RecurrencePattern;
004:        import com.sun.portal.app.sharedevents.models.EventModel;
005:        import com.sun.portal.app.sharedevents.util.AppUtils;
006:        import com.sun.web.ui.component.Checkbox;
007:        import com.sun.web.ui.model.Option;
008:        import com.sun.portal.app.sharedevents.util.SharedConstants;
009:        import com.sun.portal.log.common.PortalLogger;
010:        import java.util.ArrayList;
011:        import java.util.ResourceBundle;
012:        import java.util.logging.Level;
013:        import java.util.logging.Logger;
014:
015:        /** 
016:         * This class provides functionality for table actions.
017:         */
018:        public class EventsTableActions {
019:            private String actionBottom = null; // Action (bottom).
020:            private String actionTop = null; // Action (top).
021:            private EventsTableContainer tableContainer = null; // Model tableContainer.
022:
023:            private String CLASS_NAME = "EventsTableActions";
024:            private boolean deleteFailed = false;
025:            private boolean disabled = false;
026:
027:            private ResourceBundle bundle = null;
028:
029:            /** Action menu items. */
030:
031:            protected static final Option[] actionOptions = null;
032:
033:            private static Logger logger = PortalLogger
034:                    .getLogger(EventsTableActions.class);
035:
036:            /** Default constructor. */
037:            public EventsTableActions(EventsTableContainer tableContainer) {
038:                logger.entering(CLASS_NAME, "EventsTableActions()");
039:                this .tableContainer = tableContainer;
040:                bundle = getResourceBundle();
041:                logger.exiting(CLASS_NAME, "EventsTableActions()");
042:            }
043:
044:            public boolean getDropDownDisabled() {
045:                /*   
046:                if (tableContainer.isSearchInvoked()) {
047:                    disabled = true;
048:                }
049:                 */
050:                String ctx = (String) AppUtils
051:                        .getSessionAttribute(SharedConstants.SESSION_CURR_VIEW_CTX);
052:
053:                if (ctx != null
054:                        && ctx
055:                                .equalsIgnoreCase(SharedConstants.VIEW_CTX_SEARCH)) {
056:                    disabled = true;
057:                }
058:                return disabled;
059:            }
060:
061:            // Action button methods
062:
063:            /**
064:             * Deletes the selected events from the calendar.
065:             * The selected checkbox value is a combination of event UID & RID (if recurring) and this
066:             * is returned as ArrayList. 
067:             * This ArayList is used for deletion.
068:             * An error should be reported if any of the selected events could not be deleted.
069:             * However, the processing is not stopped until all the selected events are attempted to
070:             * deletion. 
071:             * 
072:             */
073:            public void DeleteAction() {
074:                logger.entering(CLASS_NAME, "DeleteAction()");
075:                ArrayList selectedIds = null;
076:                String uid = null;
077:
078:                //tableContainer.setActionsInvoked(true);
079:                AppUtils.setAttributeInSession(
080:                        SharedConstants.SESSION_REFRESH_DATA, "true");
081:                selectedIds = Checkbox.getSelected("selectGroup");
082:
083:                deleteFailed = false;
084:
085:                if (selectedIds != null) {
086:
087:                    deleteEventsList(selectedIds);
088:
089:                } else {
090:
091:                }
092:
093:                tableContainer.setShowAlert(true);
094:
095:                if (deleteFailed) {
096:
097:                    tableContainer
098:                            .setAlertType(SharedConstants.SHOW_ALERT_TYPE_ERROR);
099:                    tableContainer.setAlertMessage(bundle
100:                            .getString("eventsDeleteFailedError"));
101:
102:                } else {
103:                    tableContainer
104:                            .setAlertType(SharedConstants.SHOW_ALERT_TYPE_INFO);
105:                    tableContainer.setAlertMessage(bundle
106:                            .getString("eventsDeleteSuccessMsg"));
107:                }
108:
109:                resetActionMenus();
110:                logger.exiting(CLASS_NAME, "DeleteAction()");
111:
112:            }
113:
114:            /** Action 2 event. */
115:            public void NewEventAction() {
116:                logger.entering(CLASS_NAME, "NewEventAction()");
117:
118:                resetActionMenus();
119:                logger.exiting(CLASS_NAME, "NewEventAction()");
120:            }
121:
122:            // Action menu methods
123:
124:            /** Action menu event (bottom). */
125:            public void actionBottom() {
126:                logger.entering(CLASS_NAME, "actionBottom()");
127:
128:                /*
129:                tableContainer.setActionsInvoked(true);
130:                
131:                if (actionBottom != null && actionBottom.length() > 0) {
132:                    tableContainer.setViewContext(actionBottom);
133:                }
134:                
135:                // Ask the container to compute the new start & end dates based on this action.
136:                // This needs to be done here because that information is required by other
137:                // elements (ex: Table title, navigation) _before_ the container fetches the
138:                // data based on new dates.
139:                tableContainer.constructContextStartAndEndDates();
140:                 */
141:                if (logger.isLoggable(Level.FINE)) {
142:                    logger.fine("Setting the new View Context in Session: "
143:                            + actionBottom);
144:                    logger.fine("Setting refresh data to true in Session");
145:                }
146:
147:                AppUtils.setAttributeInSession(
148:                        SharedConstants.SESSION_CURR_VIEW_CTX, actionBottom);
149:                AppUtils.setAttributeInSession(
150:                        SharedConstants.SESSION_REFRESH_DATA, "true");
151:
152:                // If Day view context is selected, remove the context start and end date from the 
153:                // session because we need to show the current day events and not the day belonging
154:                // to the previous view context
155:                if (actionBottom != null
156:                        && actionBottom
157:                                .equalsIgnoreCase(SharedConstants.VIEW_CTX_DAY)) {
158:                    AppUtils
159:                            .removeAttributeFromSession(SharedConstants.SESSION_CURR_VIEW_CTX_START);
160:                    AppUtils
161:                            .removeAttributeFromSession(SharedConstants.SESSION_CURR_VIEW_CTX_END);
162:
163:                }
164:
165:                actionTop = actionBottom; // Set selected property for both menus.
166:                logger.exiting(CLASS_NAME, "actionBottom()");
167:            }
168:
169:            /** Action menu event (top). */
170:            public void actionTop() {
171:                logger.entering(CLASS_NAME, "actionTop()");
172:
173:                /*
174:                tableContainer.setActionsInvoked(true);
175:                
176:                if (actionTop != null && actionTop.length() > 0) {
177:                    tableContainer.setViewContext(actionTop);
178:                }
179:                
180:                // Ask the container to compute the new start & end dates based on this action.
181:                // This needs to be done here because that information is required by other
182:                // elements (ex: Table title, navigation) _before_ the container fetches the
183:                // data based on new dates.
184:                tableContainer.constructContextStartAndEndDates();
185:                 */
186:
187:                if (logger.isLoggable(Level.FINE)) {
188:                    logger.fine("Setting the new View Context in Session: "
189:                            + actionTop);
190:                    logger.fine("Setting refresh data to true in Session");
191:                }
192:
193:                AppUtils.setAttributeInSession(
194:                        SharedConstants.SESSION_CURR_VIEW_CTX, actionTop);
195:                AppUtils.setAttributeInSession(
196:                        SharedConstants.SESSION_REFRESH_DATA, "true");
197:
198:                // If Day view context is selected, remove the context start and end date from the 
199:                // session because we need to show the current day events and not the day belonging
200:                // to the previous view context
201:                if (actionTop != null
202:                        && actionTop
203:                                .equalsIgnoreCase(SharedConstants.VIEW_CTX_DAY)) {
204:                    AppUtils
205:                            .removeAttributeFromSession(SharedConstants.SESSION_CURR_VIEW_CTX_START);
206:                    AppUtils
207:                            .removeAttributeFromSession(SharedConstants.SESSION_CURR_VIEW_CTX_END);
208:
209:                }
210:
211:                actionBottom = actionTop; // Set selected property for both menus.
212:                logger.exiting(CLASS_NAME, "actionTop()");
213:            }
214:
215:            /** Get action menu options. */
216:            public Option[] getActionOptions() {
217:                Option[] actionOptions = {
218:                        //new Option(SharedConstants.VIEW_CTX_DAY, "Events for Day"),
219:                        new Option(SharedConstants.VIEW_CTX_DAY, bundle
220:                                .getString("dayView")),
221:                        new Option(SharedConstants.VIEW_CTX_WEEK, bundle
222:                                .getString("weekView")),
223:                        new Option(SharedConstants.VIEW_CTX_MONTH, bundle
224:                                .getString("monthView")), };
225:                return actionOptions;
226:            }
227:
228:            /** Get action (bottom). */
229:            public String getActionBottom() {
230:                return actionBottom;
231:            }
232:
233:            /** Set action (bottom). */
234:            public void setActionBottom(String value) {
235:                actionBottom = value;
236:
237:            }
238:
239:            /** Get action (top). */
240:            public String getActionTop() {
241:                return actionTop;
242:            }
243:
244:            /** Set action (top). */
245:            public void setActionTop(String value) {
246:                actionTop = value;
247:
248:            }
249:
250:            /** Helper method to reset action menus. */
251:            protected void resetActionMenus() {
252:                actionBottom = actionTop = null;
253:
254:            }
255:
256:            /** Set disabled value for table actions. */
257:            public boolean getDisabled() {
258:                // If there is at least one checkbox selection, actions are enabled.
259:                return (Checkbox.getSelected("selectGroup") == null);
260:            }
261:
262:            private void deleteEventsList(ArrayList uidRidList) {
263:                if (uidRidList == null) {
264:                    return;
265:                }
266:
267:                String uid = null;
268:                String rid = null;
269:                String uidRid = null;
270:                String[] uidAndRid = null;
271:
272:                EventModel evtModelObj = getEventModel();
273:
274:                // We'll use the evtModelObj for all the delete operations. So, make sure to clear up the
275:                // previously set data
276:
277:                for (int i = 0; i < uidRidList.size(); i++) {
278:
279:                    //Clear any previously set data
280:                    evtModelObj.setEventUID(null);
281:                    evtModelObj.setEventRID(null);
282:                    evtModelObj.setRecurrenceModifier(null);
283:
284:                    uid = null;
285:                    rid = null;
286:                    uidAndRid = null;
287:
288:                    uidRid = (String) uidRidList.get(i);
289:
290:                    if (uidRid.indexOf(SharedConstants.UID_RID_SEPERATOR) != -1) {
291:                        uidAndRid = uidRid
292:                                .split(SharedConstants.UID_RID_SEPERATOR);
293:                        if (uidAndRid.length >= 2) {
294:                            uid = uidAndRid[0];
295:                            rid = uidAndRid[1];
296:                        } else {
297:                            uid = uidAndRid[0];
298:                        }
299:
300:                    } else {
301:                        uid = uidRid;
302:                    }
303:
304:                    evtModelObj.setEventUID(uid);
305:                    evtModelObj.setEventRID(rid);
306:                    evtModelObj
307:                            .setRecurrenceModifier(RecurrencePattern.THIS_INSTANCE);
308:
309:                    try {
310:                        evtModelObj
311:                                .insert(SharedConstants.DELETE_EVENT_CONTEXT);
312:                    } catch (Exception e1) {
313:                        logger.log(Level.SEVERE,
314:                                "Failed to Delete Event: UID: " + uid
315:                                        + " RID: " + rid + e1.getMessage());
316:                        deleteFailed = true;
317:                    }
318:
319:                }
320:
321:            }
322:
323:            private EventModel getEventModel() {
324:                return new EventModel("EventTableActions");
325:            }
326:
327:            private ResourceBundle getResourceBundle() {
328:                return AppUtils.getResourceBundle();
329:            }
330:
331:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.