Source Code Cross Referenced for SequentialWizardPageController.java in  » ERP-CRM-Financial » sakai » org » theospi » portfolio » matrix » control » 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.theospi.portfolio.matrix.control 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL:https://source.sakaiproject.org/svn/osp/trunk/matrix/tool/src/java/org/theospi/portfolio/matrix/control/SequentialWizardPageController.java $
003:         * $Id:SequentialWizardPageController.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2006 The Sakai Foundation.
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.theospi.portfolio.matrix.control;
021:
022:        import java.util.ArrayList;
023:        import java.util.Iterator;
024:        import java.util.List;
025:        import java.util.Map;
026:
027:        import org.sakaiproject.metaobj.shared.model.Id;
028:        import org.springframework.validation.Errors;
029:        import org.springframework.web.servlet.ModelAndView;
030:        import org.theospi.portfolio.matrix.WizardPageHelper;
031:        import org.theospi.portfolio.matrix.model.WizardPage;
032:        import org.theospi.portfolio.wizard.model.CompletedWizard;
033:        import org.theospi.portfolio.wizard.model.CompletedWizardPage;
034:        import org.sakaiproject.metaobj.shared.control.ToolFinishedView;
035:
036:        /**
037:         * The steps are referenced from 1 to n.  this way we can render the step number to the interface correctly
038:         * 
039:         * openEvaluationPageSeqRedirect will put the user here
040:         * 
041:         * User: John Ellis
042:         * Date: Feb 3, 2006
043:         * Time: 1:51:18 PM
044:         * To change this template use File | Settings | File Templates.
045:         */
046:        public class SequentialWizardPageController extends
047:                WizardPageController {
048:
049:            /* (non-Javadoc)
050:             * @see org.theospi.utils.mvc.intf.FormController#referenceData(java.util.Map, java.lang.Object, org.springframework.validation.Errors)
051:             */
052:            public Map referenceData(Map request, Object command, Errors errors) {
053:                Map model = super .referenceData(request, command, errors);
054:                if (request.get(WizardPageHelper.TOTAL_STEPS) != null) {
055:                    model.put("sequential", "true");
056:                    model
057:                            .put(
058:                                    "currentStep",
059:                                    request
060:                                            .get(WizardPageHelper.SEQUENTIAL_WIZARD_CURRENT_STEP));
061:                    model.put("totalSteps", request
062:                            .get(WizardPageHelper.TOTAL_STEPS));
063:                }
064:                return model;
065:            }
066:
067:            public Object fillBackingObject(Object incomingModel, Map request,
068:                    Map session, Map application) throws Exception {
069:                // get the step and get the appropriate page
070:                List steps = (List) session
071:                        .get(WizardPageHelper.SEQUENTIAL_WIZARD_PAGES);
072:
073:                if (steps == null) {
074:                    Id pageId = getIdManager().getId(
075:                            (String) request.get("page_id"));
076:                    WizardPage page = getMatrixManager().getWizardPage(pageId);
077:                    CompletedWizard cw = getWizardManager()
078:                            .getCompletedWizardByPage(pageId);
079:                    List completedPages = cw.getRootCategory().getChildPages();
080:                    steps = getPageList(completedPages);
081:                    session.put(
082:                            WizardPageHelper.SEQUENTIAL_WIZARD_CURRENT_STEP,
083:                            getCurrentStepFromList(steps, page));
084:                    session.put(WizardPageHelper.WIZARD_OWNER, cw.getOwner());
085:                    session
086:                            .put(WizardPageHelper.SEQUENTIAL_WIZARD_PAGES,
087:                                    steps);
088:                }
089:                //TODO: It's probably safe to assume that steps will not be null at this point, 
090:                // but I'm leaving the check here for the time being.
091:                if (steps != null) {
092:                    int currentStep = getCurrentStep(session);
093:                    request.put(WizardPageHelper.TOTAL_STEPS, new Integer(steps
094:                            .size()));
095:                    //if(currentStep == 0)
096:                    //   currentStep = 1;
097:                    currentStep = currentStep + 1;
098:                    WizardPage page = (WizardPage) steps.get(currentStep - 1);
099:                    if (session.get(WizardPageHelper.WIZARD_OWNER) == null)
100:                        session.put(WizardPageHelper.WIZARD_OWNER, page
101:                                .getOwner());
102:
103:                    request.put(
104:                            WizardPageHelper.SEQUENTIAL_WIZARD_CURRENT_STEP,
105:                            new Integer(currentStep));
106:                    //session.put(WizardPageHelper.SEQUENTIAL_WIZARD_CURRENT_STEP, currentStep);
107:
108:                    session.put(WizardPageHelper.WIZARD_PAGE, page);
109:                }
110:                return super .fillBackingObject(incomingModel, request, session,
111:                        application);
112:            }
113:
114:            protected Integer getCurrentStepFromList(List pages,
115:                    WizardPage curPage) {
116:                int counter = 0;
117:                for (Iterator iter = pages.iterator(); iter.hasNext();) {
118:                    WizardPage page = (WizardPage) iter.next();
119:                    if (page.equals(curPage))
120:                        break;
121:                    counter++;
122:                }
123:                return new Integer(counter);
124:            }
125:
126:            protected List getPageList(List completedPages) {
127:                List pageList = new ArrayList();
128:
129:                for (Iterator i = completedPages.iterator(); i.hasNext();) {
130:                    CompletedWizardPage page = (CompletedWizardPage) i.next();
131:                    pageList.add(page.getWizardPage());
132:                }
133:                return pageList;
134:            }
135:
136:            protected int getCurrentStep(Map session) {
137:                int currentStep = 0;
138:                Object stepObj = (Object) session
139:                        .get(WizardPageHelper.SEQUENTIAL_WIZARD_CURRENT_STEP);
140:                if (stepObj != null && stepObj instanceof  Integer) {
141:                    currentStep = ((Integer) stepObj).intValue();
142:                }
143:                return currentStep;
144:            }
145:
146:            public ModelAndView handleRequest(Object requestModel, Map request,
147:                    Map session, Map application, Errors errors) {
148:                if (request.get("matrix") != null) {
149:
150:                    if (getTaggingManager().isTaggable()) {
151:                        session.remove(PROVIDERS_PARAM);
152:                    }
153:
154:                    session.put(ToolFinishedView.ALTERNATE_DONE_URL,
155:                            "finishSeqWizard");
156:                    return new ModelAndView("confirmWizard", "", "");
157:                }
158:
159:                session.put(WizardPageHelper.SEQUENTIAL_WIZARD_CURRENT_STEP,
160:                        getNextStep(request, session));
161:                if (isLast(request)) {
162:                    session.put(WizardPageHelper.IS_LAST_STEP, "true");
163:                } else {
164:                    session.remove(WizardPageHelper.IS_LAST_STEP);
165:                }
166:
167:                String finishAction = (String) request.get("matrix");
168:                if (finishAction != null) {
169:                    //Clear out some session variables
170:                    session
171:                            .remove(WizardPageHelper.SEQUENTIAL_WIZARD_CURRENT_STEP);
172:                    session.remove(WizardPageHelper.SEQUENTIAL_WIZARD_PAGES);
173:                }
174:
175:                return super .handleRequest(requestModel, request, session,
176:                        application, errors);
177:            }
178:
179:            protected boolean isLast(Map request) {
180:                return request.get("_last") != null;
181:            }
182:
183:            protected Integer getNextStep(Map request, Map session) {
184:                int currentStep = getCurrentStep(session);
185:
186:                if (request.get("_next") != null) {
187:                    currentStep++;
188:                } else if (request.get("_back") != null) {
189:                    currentStep--;
190:                }
191:
192:                return new Integer(currentStep);
193:            }
194:
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.