01: /**********************************************************************************
02: * $URL: $
03: * $Id: $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2006,2007 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.poll.tool.producers;
21:
22: import org.apache.commons.logging.Log;
23: import org.apache.commons.logging.LogFactory;
24:
25: import uk.org.ponder.messageutil.MessageLocator;
26: import uk.org.ponder.rsf.components.UIContainer;
27: import uk.org.ponder.rsf.components.UIOutput;
28: import uk.org.ponder.rsf.components.UIForm;
29: import uk.org.ponder.rsf.components.UICommand;
30:
31: import uk.org.ponder.rsf.view.ComponentChecker;
32: import uk.org.ponder.rsf.view.ViewComponentProducer;
33: import uk.org.ponder.rsf.viewstate.ViewParameters;
34:
35: import org.sakaiproject.poll.tool.params.VoteBean;
36:
37: import uk.org.ponder.rsf.flow.jsfnav.NavigationCase;
38: import uk.org.ponder.rsf.flow.jsfnav.NavigationCaseReporter;
39: import uk.org.ponder.rsf.viewstate.SimpleViewParameters;
40:
41: import java.util.List;
42: import java.util.ArrayList;
43:
44: public class ConfirmProducer implements ViewComponentProducer,
45: NavigationCaseReporter {
46:
47: public static final String VIEW_ID = "voteThanks";
48: private static Log m_log = LogFactory
49: .getLog(PollVoteProducer.class);
50: private VoteBean voteBean;
51:
52: private MessageLocator messageLocator;
53:
54: public String getViewID() {
55: // TODO Auto-generated method stub
56: return VIEW_ID;
57: }
58:
59: public void setVoteBean(VoteBean vb) {
60: this .voteBean = vb;
61: }
62:
63: public void setMessageLocator(MessageLocator messageLocator) {
64:
65: this .messageLocator = messageLocator;
66: }
67:
68: public void fillComponents(UIContainer tofill, ViewParameters arg1,
69: ComponentChecker arg2) {
70: // TODO Auto-generated method stub
71:
72: String voteId;
73: if (voteBean.voteCollection != null)
74: voteId = voteBean.voteCollection.getId();
75: else
76: voteId = "VoteId is missing!";
77:
78: UIOutput.make(tofill, "confirm-msg", messageLocator
79: .getMessage("thanks_msg"));
80: UIOutput.make(tofill, "confirm-ref-msg", messageLocator
81: .getMessage("thanks_ref"));
82: UIOutput.make(tofill, "ref-number", voteId);
83: UIForm form = UIForm.make(tofill, "back", "");
84: UICommand.make(form, "cancel", messageLocator
85: .getMessage("thanks_done"), "#{pollToolBean.cancel}");
86: }
87:
88: public List reportNavigationCases() {
89: List togo = new ArrayList(); // Always navigate back to this view.
90: //togo.add(new NavigationCase(null, new SimpleViewParameters(VIEW_ID)));
91: //togo.add(new NavigationCase(null, new SimpleViewParameters(VIEW_ID)));
92: togo.add(new NavigationCase("cancel", new SimpleViewParameters(
93: PollToolProducer.VIEW_ID)));
94: return togo;
95: }
96:
97: }
|