View Javadoc

1   /*
2    * Created on Apr 27, 2005, Copyright UC Regents
3    */
4   package org.telscenter.pas.steps;
5   
6   import java.awt.Color;
7   import java.awt.Component;
8   import java.util.ArrayList;
9   import java.util.Date;
10  import java.util.HashMap;
11  import java.util.List;
12  import java.util.Map;
13  
14  import javax.swing.JLabel;
15  import javax.swing.JPanel;
16  
17  import net.sf.sail.core.beans.service.AnnotationService;
18  
19  import org.telscenter.pas.beans.IWorkReporter;
20  import org.telscenter.pas.beans.PasStep;
21  import org.telscenter.pas.service.NavigateAction;
22  
23  
24  import com.lowagie.text.pdf.PdfPCell;
25  
26  /***
27   * A generic Pas step type, used for testing and demonstration purposes.
28   * 
29   * @author turadg
30   */
31  
32  public class Generic extends PasStep implements IWorkReporter {
33  
34  	String string1;
35  
36  	Color color1;
37  
38  	Date date1;
39  
40  	
41  	private Integer possibleScore;
42  	
43  	public Color getColor1() {
44  		return color1;
45  	}
46  
47  	// bound
48  	public void setColor1(Color color1) {
49  		Object old = this.color1;
50  		this.color1 = color1;
51  		firePropertyChange("color1", old, color1); //$NON-NLS-1$
52  	}
53  
54  	public Date getDate1() {
55  		return date1;
56  	}
57  
58  	public void setDate1(Date date1) {
59  		Object old = this.date1;
60  		this.date1 = date1;
61  		firePropertyChange("date1", old, date1); //$NON-NLS-1$
62  	}
63  
64  	// bound
65  	public String getString1() {
66  		return string1;
67  	}
68  
69  	public void setString1(String string1) {
70  		Object old = this.string1;
71  		this.string1 = string1;
72  		firePropertyChange("string1", old, string1); //$NON-NLS-1$
73  	}
74  
75  	public Component getComponent() {
76  		JPanel panel = new JPanel();
77  		panel.setBackground(getColor1());
78  		panel.add(new JLabel(getTitle()));
79  		panel.add(new JLabel("string1: " + getString1())); //$NON-NLS-1$
80  		panel.add(new JLabel("date1: " + getDate1())); //$NON-NLS-1$
81  		return panel;
82  	}
83  
84  	public JPanel getReportForLearner() {
85  		JPanel panel = new JPanel();
86  		panel.add(new JLabel("generic is useless")); //$NON-NLS-1$
87  		panel.setOpaque(false);
88  		return panel;
89  	}
90  	
91  	public PdfPCell getReportForLearnerPDF(boolean withAnnotations) {
92  		// TODO Auto-generated method stub
93  		return null;
94  	}
95  
96  	/* (non-Javadoc)
97  	 * @see org.telscenter.pas.beans.IWorkReporter#getReportForLearnerWithAnnotations()
98  	 */
99  	public JPanel getReportForLearnerWithAnnotations() {
100 		// TODO Auto-generated method stub
101 		return null;
102 	}
103 		
104 	/* (non-Javadoc)
105 	 * @see org.telscenter.pas.beans.IWorkReporter#getCurrentAnswers()
106 	 */
107 	public List<JLabel> getCurrentAnswers(){
108 		List<JLabel> answers = new ArrayList<JLabel>();
109 		answers.add(new JLabel("here is an answer"));
110 		return answers;
111 	}
112 
113 	/* (non-Javadoc)
114 	 * @see org.telscenter.pas.beans.IWorkReporter#getCurrentPrompts()
115 	 */
116 	public List<String> getCurrentPrompts(){
117 		List<String> promptList = new ArrayList<String>();
118 		promptList.add("Here is a prompt");
119 		return promptList;
120 	}
121 
122 	/* (non-Javadoc)
123 	 * @see org.telscenter.pas.beans.IWorkReporter#getCurrentStepParts()
124 	 */
125 	public List<JPanel> getCurrentStepParts(){
126 		JPanel panel = new JPanel();
127 		panel.add(new JLabel("nothing"));
128 		List<JPanel> panelList = new ArrayList<JPanel>();
129 		panelList.add(panel);
130 		return panelList;
131 	}
132 
133 	/* (non-Javadoc)
134 	 * @see org.telscenter.pas.beans.IWorkReporter#initStepParts()
135 	 */
136 	public void initStepParts() {
137 		// TODO Auto-generated method stub
138 		
139 	}
140 
141 	/***
142 	 * @see org.telscenter.pas.beans.IWorkReporter#getEntityToPromptMap()
143 	 */
144 	public Map<String, String> getEntityToPromptMap() {
145 		return new HashMap<String, String>();
146 	}
147 
148 	public Integer getPossibleScore() {
149 		return possibleScore;
150 	}
151 
152 	public void setPossibleScore(Integer possibleScore) {
153 		this.possibleScore = possibleScore;
154 	}
155 
156 	/* (non-Javadoc)
157 	 * @see org.telscenter.pas.beans.IWorkReporter#getReportForLearner(org.telscenter.pas.service.NavigateAction)
158 	 */
159 	public JPanel getReportForLearner(NavigateAction navigateAction) {
160 		// TODO Auto-generated method stub
161 		return null;
162 	}
163 
164 	/* (non-Javadoc)
165 	 * @see org.telscenter.pas.beans.IWorkReporter#getReportForLearnerWithAnnotations(org.telscenter.pas.service.NavigateAction)
166 	 */
167 	public JPanel getReportForLearnerWithAnnotations(
168 			NavigateAction navigateAction) {
169 		// TODO Auto-generated method stub
170 		return null;
171 	}
172 
173 	/* (non-Javadoc)
174 	 * @see org.telscenter.pas.beans.IWorkReporter#getReportForLearnerPDF(net.sf.sail.core.beans.service.AnnotationService)
175 	 */
176 	public PdfPCell getReportForLearnerPDF(AnnotationService annotationService) {
177 		// TODO Auto-generated method stub
178 		return null;
179 	}
180 
181 }