001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-app/src/java/test/org/sakaiproject/tool/assessment/jsf/TestBackingBean.java $
003: * $Id: TestBackingBean.java 1295 2005-08-19 17:25:46Z esmiley@stanford.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005 The Regents of the University of Michigan, Trustees of Indiana University,
007: * Board of Trustees of the Leland Stanford, Jr., University, and The MIT Corporation
008: *
009: * Licensed under the Educational Community License Version 1.0 (the "License");
010: * By obtaining, using and/or copying this Original Work, you agree that you have read,
011: * understand, and will comply with the terms and conditions of the Educational Community License.
012: * You may obtain a copy of the License at:
013: *
014: * http://cvs.sakaiproject.org/licenses/license_1_0.html
015: *
016: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
017: * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
018: * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
019: * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
020: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
021: *
022: **********************************************************************************/package test.org.sakaiproject.tool.assessment.jsf;
023:
024: import java.io.Serializable;
025: import java.util.ArrayList;
026: import java.util.List;
027:
028: import org.sakaiproject.tool.assessment.ui.listener.author.AuthorActionListener;
029: import org.sakaiproject.tool.assessment.ui.listener.select.SelectActionListener;
030: import org.sakaiproject.tool.assessment.ui.listener.delivery.BeginDeliveryActionListener;
031:
032: /**
033: * <p> </p>
034: * <p>Description: Test Bean with some properties</p>
035: * <p>Copyright: Copyright (c) 2004</p>
036: * @author Ed Smiley
037: * @version $Id: TestBackingBean.java 1295 2005-08-19 17:25:46Z esmiley@stanford.edu $
038: */
039:
040: public class TestBackingBean implements Serializable {
041: private String prop1;
042: private String prop2;
043: private String prop3;
044: private String prop4;
045: private String prop5;
046: private String prop6;
047: private List list;
048:
049: public TestBackingBean() {
050: prop1 = "prop1";
051: prop2 = "prop2";
052: prop3 = "prop3";
053: prop4 = "prop4";
054: prop5 = "prop5";
055: prop6 = "prop6";
056: list = getBackingBeanList();
057: }
058:
059: public String getProp1() {
060: return prop1;
061: }
062:
063: public String chooseAgentAdminGo() {
064: prop1 = "admin";
065:
066: // Call listener before going on.
067: BeginDeliveryActionListener listener = new BeginDeliveryActionListener();
068: listener.processAction(null);
069:
070: return "beginAssessment";
071: }
072:
073: public String chooseAgentRachelGo() {
074: prop1 = "rachel";
075:
076: // Call listener before going on.
077: BeginDeliveryActionListener listener = new BeginDeliveryActionListener();
078: listener.processAction(null);
079:
080: return "beginAssessment";
081: }
082:
083: public String chooseAgentMarithGo() {
084: prop1 = "marith";
085:
086: // Call listener before going on.
087: BeginDeliveryActionListener listener = new BeginDeliveryActionListener();
088: listener.processAction(null);
089:
090: return "beginAssessment";
091: }
092:
093: public String chooseAgentAdmin() {
094: prop1 = "admin";
095:
096: // Call listener before going on.
097: SelectActionListener listener = new SelectActionListener();
098: listener.processAction(null);
099:
100: return "select";
101: }
102:
103: public String chooseAgentRachel() {
104: prop1 = "rachel";
105:
106: // Call listener before going on.
107: SelectActionListener listener = new SelectActionListener();
108: listener.processAction(null);
109:
110: return "select";
111: }
112:
113: public String chooseAgentMarith() {
114: prop1 = "marith";
115:
116: // Call listener before going on.
117: SelectActionListener listener = new SelectActionListener();
118: listener.processAction(null);
119:
120: return "select";
121: }
122:
123: public String chooseAgentAdminInstructor() {
124: prop1 = "admin";
125:
126: // Call listener before going on.
127: AuthorActionListener listener = new AuthorActionListener();
128: listener.processAction(null);
129:
130: return "author";
131: }
132:
133: public void setProp1(String p) {
134: prop1 = p;
135: }
136:
137: public String getProp2() {
138: return prop2;
139: }
140:
141: public String getProp3() {
142: return prop3;
143: }
144:
145: public String getProp5() {
146: return prop5;
147: }
148:
149: public void setProp3(String p) {
150: prop3 = p;
151: }
152:
153: public void setProp4(String p) {
154: prop4 = p;
155: }
156:
157: public void setProp2(String p) {
158: prop2 = p;
159: }
160:
161: public String getProp4() {
162: return prop4;
163: }
164:
165: public void setProp5(String p) {
166: prop5 = p;
167: }
168:
169: public String getProp6() {
170: return prop6;
171: }
172:
173: public void setProp6(String p) {
174: prop6 = p;
175: }
176:
177: public List getList() {
178: return list;
179: }
180:
181: public void setList(List p) {
182: list = p;
183: }
184:
185: // makes a whole bunch of backing beans.
186: private List getBackingBeanList() {
187: ArrayList list = new ArrayList();
188: String[] lastNames = { "Black", "Chang", "Dumbledore",
189: "Granger", "McGonagle", "Potter", "Snape", "Weasley", };
190:
191: String[] firstNames = { "Alice", "Bruce", "Carrie", "David",
192: "Elmer", "Fresia" };
193:
194: for (int ilast = 0; ilast < lastNames.length; ilast++) {
195: for (int ifirst = 0; ifirst < firstNames.length; ifirst++) {
196: for (char c = 'A'; c < 'A' + 2; c++) //6; c++)
197: {
198: SubBackingBean bean = new SubBackingBean();
199: bean.setName(firstNames[ifirst] + " " + c + "."
200: + lastNames[ilast]);
201: bean.setAddress(("" + (ilast + ifirst + c))
202: + " Privet Drive");
203: bean.setId(("" + Math.random()).substring(2));
204:
205: list.add(bean);
206: }
207: }
208: }
209:
210: return list;
211: }
212: }
|