View Javadoc

1   /*
2    * Created on Apr 27, 2005, Copyright UC Regents
3    */
4   package org.telscenter.pas.steps;
5   
6   import java.awt.Component;
7   
8   import javax.swing.JDialog;
9   
10  import org.telscenter.pas.service.INoteService;
11  import org.telscenter.pas.ui.dialog.PasDialogManager;
12  import org.telscenter.pas.ui.dialog.PasMessageDialogUI;
13  import org.telscenter.pas.ui.dialog.PasNoteMessageDialogUI;
14  import org.telscenter.pas.ui.frames.PasFrame;
15  
16  /***
17   * Implement of the Pas step type, <i>Notes</i>.
18   * 
19   * @author turadg
20   */
21  public class JaxbQtiNote extends JaxbQtiStep implements INoteStep {
22  
23  	private static final long serialVersionUID = 1L;
24  
25  	private transient INoteService noteService;
26  
27  	JaxbQtiNoteUI noteUI;
28  
29  	public JaxbQtiNote() {
30  	}
31  
32  	public String getType() {
33  		return "Note";
34  	}
35  
36  	public Component getComponent() {
37  		noteUI = new JaxbQtiNoteUI(this);
38  		return noteUI;
39  	}
40  
41  	/* (non-Javadoc)
42  	 * @see org.telscenter.pas.steps.IAssessmentType#hasCorrectAnswer()
43  	 */
44  	public boolean hasCorrectAnswer() {
45  		return false;
46  	}
47  	public JDialog showNoteSaveCheckDialog() {
48  		final PasNoteMessageDialogUI ui = new PasNoteMessageDialogUI(noteUI
49  				.getSaveAction());
50  		// TODO note save action NEEDs to ask the note service for
51  		// its info and have not passed in via constructor
52  		ui.setMessage("Do you want to save this note before closing?");
53  		return PasDialogManager.showPasMessageDialog("Alert", ui
54  				.createDialogPanel(), null, true);
55  	}
56  
57  	public JDialog showNotePartsCheckDialog() {
58  		final PasMessageDialogUI ui = new PasMessageDialogUI(true);
59  		// TODO note save action NEEDs to ask the note service for
60  		// its info and have not passed in via constructor
61  		ui.setMessage("You should complete all note parts before saving");
62  		return PasDialogManager.showPasMessageDialog("Warning", ui
63  				.createDialogPanel(), null, true);
64  	}
65  
66  	public JDialog showNoteAlreadyOpenDialog() {
67  		return this.showNoteAlreadyOpenDialog(null);
68  	}
69  
70  	/***
71  	 * @return the noteUI
72  	 */
73  	public INoteUI getNoteUI() {
74  		return noteUI;
75  	}
76  
77  	/***
78  	 * @see org.telscenter.pas.steps.INoteStep#showNoteAlreadyOpenDialog(org.telscenter.pas.ui.frames.PasFrame)
79  	 */
80  	public JDialog showNoteAlreadyOpenDialog(PasFrame pasFrame) {
81  		final PasMessageDialogUI ui = new PasMessageDialogUI(true);
82  		// TODO note save action NEEDs to ask the note service for
83  		// its info and have not passed in via constructor
84  		ui.setMessage("You can only have one note open at a time.");
85  		return PasDialogManager.showPasMessageDialog("Warning", ui
86  				.createDialogPanel(), null, true);
87  		
88  	}
89  
90  
91  }