View Javadoc

1   /***
2    * Created on Jan 6, 2006, Copyright UC Regents
3    */
4   package org.telscenter.pas.steps.quickEditors.qti.assessment;
5   
6   import java.awt.event.FocusListener;
7   import java.util.ArrayList;
8   import java.util.List;
9   
10  import javax.swing.JPanel;
11  import javax.swing.JScrollPane;
12  
13  import org.telscenter.pas.steps.JaxbQtiStep;
14  import org.telscenter.pas.steps.domain.ResponseDeclaration;
15  import org.telscenter.pas.steps.quickEditors.IQuickEditorControllable;
16  
17  import com.jgoodies.binding.beans.BeanAdapter;
18  
19  /***
20   * @author aperritano
21   * 
22   */
23  public class ChallengeQuestionQuickEditorUI extends AssessmentQuickEditorUI implements IQuickEditorControllable, FocusListener {
24  	
25  	//private AssessmentItem assessmentItem = null;
26  	private InteractionCardContainerUI interactionCardContainerUI;
27  
28  	private BeanAdapter beanAdapter;
29  
30  	private List<ResponseDeclaration> responseDeclarations = new ArrayList<ResponseDeclaration>();
31  	private JScrollPane listScroller;
32  
33  	//private Random generator = new Random( 19580427 );
34  	private JPanel buttonPanel;
35  	private JaxbQtiStep assmtBean;
36  
37  	/***
38  	 * @param assessmentBean
39  	 */
40  	public ChallengeQuestionQuickEditorUI(JaxbQtiStep assessmentBean) {
41  		super(assessmentBean);
42  		// TODO Auto-generated constructor stub
43  	}
44  	
45  //	/***
46  //	 * @param assmtBean 
47  //	 * @param note
48  //	 */
49  //	public ChallengeQuestionQuickEditorUI(ChallengeQuestion cqBean) {
50  //		super(cqBean);
51  ////		this.assmtBean = cqBean;
52  ////		assessmentItem = assmtBean.getAssessmentItem();
53  //	  //  this.init();
54  //	}
55  //		
56  //
57  ///* (non-Javadoc)
58  // * @see org.telscenter.pas.steps.quickEditors.qti.assessment.QTIAssessmentQuickEditorUI#createButtonPanel()
59  // */
60  //@Override
61  //protected JPanel createButtonPanel() {
62  //	// TODO Auto-generated method stub
63  //	return null;
64  //}
65  //	
66  //	public static void main(String[] args){
67  //		JFrame frame = new JFrame("note quick editor test");
68  //
69  //		Container contentPane = frame.getContentPane();		
70  //		JButton showButton = new JButton("show ui");
71  //
72  //		showButton.addActionListener(new ActionListener() {
73  //
74  //			public void actionPerformed(ActionEvent e){
75  //
76  //				JFrame frame = new JFrame("note quick editor test");
77  //
78  //				Container contentPane = frame.getContentPane();	
79  //				
80  //				
81  //				ChallengeQuestion cqStep = new ChallengeQuestion();
82  //				cqStep.setMaxAttempts(4);
83  //				//cqStep.setGotoStep(webStep);
84  //				Vector<Integer> scores = new Vector<Integer>();
85  //				scores.add(new Integer(5));
86  //				scores.add(new Integer(4));
87  //				scores.add(new Integer(2));
88  //				scores.add(new Integer(1));
89  //				cqStep.setScores(scores);
90  //				AssessmentItem assessmentItem = new AssessmentItem();
91  //				cqStep.setAssessmentItem(assessmentItem);
92  //				
93  //				HashMap<String, FeedbackModal> modalFeedbacks = new HashMap<String, FeedbackModal>();
94  //				// key is modal feedback identifer: firstAttempt, ..., choice 1, ...
95  //				modalFeedbacks.put("1", new FeedbackModal("FEEDBACK", true,
96  //						"firstAttempt", "First attempt feedback",
97  //						"Click the link below to re-review Evidence.  Then return to this Challenge Question for a second try."));
98  //				modalFeedbacks.put("2", new FeedbackModal("FEEDBACK", true,
99  //						"secondAttempt", "second attempt feedback",
100 //						"Click the link below to re-review Evidence.  Make sure to read carefully.  Then return to this Challenge Question for a third try."));
101 //				modalFeedbacks.put("3", new FeedbackModal("FEEDBACK", true,
102 //						"thirdAttempt", "third attempt feedback",
103 //						"Click the link below OR click the button to immediately have a 4th and final try."));
104 //				modalFeedbacks.put("4", new FeedbackModal("FEEDBACK", true,
105 //						"fourthAttempt", "fourth attempt feedback",
106 //						"Sorry, you're out of tries.  Move on to the next Step."));
107 //				modalFeedbacks.put("choice 1", new FeedbackModal("FEEDBACK", true,
108 //						"choice 1", "Correct modal feedback", "Goldilocks would have liked the Greenhouse Effect.  It keeps the Earth from getting too cold or too hot.  We humans like it just right!"));
109 //				assessmentItem.setModalFeedbacks(modalFeedbacks);
110 //				
111 //				ItemBody itemBody1 = new ItemBody();
112 //				assessmentItem.setItemBody(itemBody1);
113 //				// collect the interactions and responseDeclarations
114 //				ArrayList<BlockInteraction> interactions1 = new ArrayList<BlockInteraction>();
115 //				
116 //				
117 //				itemBody1.setInteractions(interactions1);
118 //				ArrayList<ResponseDeclaration> responseDeclarations1 = new ArrayList<ResponseDeclaration>();
119 //				assessmentItem.setResponseDeclarations(responseDeclarations1);
120 //				
121 //				// BlockInteraction
122 //				FeedbackInline feedback1 = new FeedbackInline("choice 1",
123 //						"Correct!");
124 //				SimpleChoice<String> sc11 = new SimpleChoice<String>("choice 1", "to keep Earth at a temperature comfortable for life", feedback1);
125 //				
126 //				FeedbackInline feedback2 = new FeedbackInline("choice 2",
127 //						"Sorry.");
128 //				SimpleChoice<String> sc21 = new SimpleChoice<String>("choice 2", "to keep the atmosphere from floating away", feedback2);
129 //				
130 //				FeedbackInline feedback3 = new FeedbackInline("choice 3",
131 //						"Afraid not.");
132 //				SimpleChoice<String> sc31 = new SimpleChoice<String>("choice 3", "to grow plants indoors", feedback3);
133 //				
134 //				FeedbackInline feedback4 = new FeedbackInline("choice 4",
135 //						"Try again.  The \"ozone layer\" blocks ultraviolet radiation.  The Greenhouse Effect does something different.");
136 //				SimpleChoice<String> sc41 = new SimpleChoice<String>("choice 4", "to keep out ultraviolet radiation", feedback4);
137 //				
138 //				FeedbackInline feedback5 = new FeedbackInline("choice 5",
139 //				"Try again.  Al Gore is an important part of the political movement to address global climate change.");
140 //				SimpleChoice<String> sc51 = new SimpleChoice<String>("choice 5", "to give Al Gore something to talk about", feedback5);
141 //				
142 //		/*		ExtendedTextInteraction eti = new ExtendedTextInteraction();
143 //				eti.setPrompt("<html><body>what?</body></html>");
144 //				eti.setPlaceholderText("I'm just sayin");
145 //				eti.setResponseIdentifier("noteItem1");
146 //				eti.setExpectedLines(6);
147 //				interactions1.add(eti);*/
148 //				
149 //				ChoiceInteraction<String> ci1 = new ChoiceInteraction<String>();
150 //				ci1.setResponseIdentifier("cqItem1");
151 //				ci1.addSimpleChoice(sc11);
152 //				ci1.addSimpleChoice(sc21);
153 //				ci1.addSimpleChoice(sc31);
154 //				ci1.addSimpleChoice(sc41);
155 //				ci1.addSimpleChoice(sc51);
156 //				ci1.setPrompt("<html><body>The main purpose of the Greenhouse Effect is...</body></html>");
157 //				ci1.setMaxChoices(1);
158 //				interactions1.add(ci1);
159 //				
160 //				ResponseDeclaration rd1 = new ResponseDeclaration();
161 //				rd1.setIdentifier("cqItem1");
162 //				rd1.addCorrectResponse("choice 1");
163 //				Rim<String> rim1 = new Rim<String>();
164 //				rim1.setName("cq1RIM");
165 //				rim1.setShape(String.class);
166 //			
167 //				
168 //				rd1.setRim(rim1);
169 //				
170 //				responseDeclarations1.add(rd1);
171 //				
172 //				ChallengeQuestionQuickEditorUI cqUI = new ChallengeQuestionQuickEditorUI(cqStep);  				
173 //				cqUI.setAssessmentItem(cqUI.getAssessmentItem());
174 //				contentPane.add(cqUI);
175 //				frame.setSize(cqUI.getPreferredSize());
176 //				frame.setVisible(true);
177 //			}
178 //
179 //		});
180 //		contentPane.add(showButton);
181 //
182 //		frame.setSize(200, 200);
183 //		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
184 //		frame.setVisible(true);
185 //	}
186 //
187 //	
188 //	/*
189 //	 * (non-Javadoc)
190 //	 * 
191 //	 * @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
192 //	 */
193 //	public void focusGained(FocusEvent e) {
194 //		// TODO Auto-generated method stub
195 //		System.out.println("QTIAssessmentQuickEditorUI.focusGained()");
196 //	}
197 //
198 //	/*
199 //	 * (non-Javadoc)
200 //	 * 
201 //	 * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
202 //	 */
203 //	public void focusLost(FocusEvent e) {
204 //		// fire`
205 //		System.out.println("QTIAssessmentQuickEditorUI.focusLost()");
206 //
207 //	}
208 //
209 //	/* (non-Javadoc)
210 //	 * @see org.telscenter.pas.steps.quickEditors.IQuickEditorControllable#getControllPanel()
211 //	 */
212 //	public JPanel getControllPanel() {
213 //		return buttonPanel;
214 //	}
215 
216 	
217 
218 	
219 	
220 			
221 		
222 			
223 		
224 	
225 	
226 	
227 }