1 /***
2 *
3 */
4 package org.telscenter.pas.steps;
5
6 import java.awt.BorderLayout;
7 import java.awt.Color;
8 import java.awt.Cursor;
9 import java.awt.Dimension;
10 import java.awt.FlowLayout;
11 import java.awt.Font;
12 import java.awt.GridBagConstraints;
13 import java.awt.GridBagLayout;
14 import java.awt.GridLayout;
15 import java.awt.event.ActionEvent;
16 import java.awt.event.ActionListener;
17 import java.io.Serializable;
18 import java.util.List;
19 import java.util.logging.Logger;
20
21 import javax.swing.AbstractAction;
22 import javax.swing.BorderFactory;
23 import javax.swing.BoxLayout;
24 import javax.swing.ImageIcon;
25 import javax.swing.JButton;
26 import javax.swing.JComponent;
27 import javax.swing.JDialog;
28 import javax.swing.JFrame;
29 import javax.swing.JLabel;
30 import javax.swing.JPanel;
31 import javax.swing.JScrollPane;
32 import javax.swing.JSeparator;
33 import javax.swing.JTabbedPane;
34 import javax.swing.event.ChangeEvent;
35 import javax.swing.event.ChangeListener;
36
37 import net.miginfocom.swing.MigLayout;
38 import net.sf.sail.core.entity.ISock;
39 import net.sf.sail.jaxb.extension.BlockInteractionType;
40
41 import org.imsglobal.xsd.imsqti_v2p0.ChoiceInteractionType;
42 import org.imsglobal.xsd.imsqti_v2p0.ResponseDeclarationType;
43 import org.imsglobal.xsd.imsqti_v2p0.SimpleChoiceType;
44 import org.telscenter.pas.common.ui.CommonUI;
45 import org.telscenter.pas.common.ui.panel.SimpleGradientPanel;
46 import org.telscenter.pas.common.ui.tab.PasTabbedPaneUI;
47 import org.telscenter.pas.steps.actions.DialogSaveAction;
48 import org.telscenter.pas.steps.actions.LeaveStudentAssessmentAction;
49 import org.telscenter.pas.ui.dialog.PasDialogManager;
50 import org.telscenter.pas.ui.dialog.PasMessageDialogUI;
51 import org.telscenter.pas.ui.dialog.PasSaveStudentAssesmentDialogUI;
52 import org.telscenter.pas.ui.dialog.PasStudentAssessmentConfirmDialogUI;
53 import org.telscenter.pas.ui.icons.PasCommonIconProvider;
54 import org.telscenter.pas.ui.util.PasColors;
55 import org.xito.dialog.CustomDialog;
56
57 /***
58 * This Creates the Student Assessment UI for the student assesssment bean
59 *
60 * @author aperritano
61 *
62 */
63 public class JaxbQtiStudentAssessmentUI extends JaxbQtiStepUI {
64
65 /***
66 * Logger for this class
67 */
68 static final Logger logger = Logger
69 .getLogger(JaxbQtiStudentAssessmentUI.class.getName());
70
71
72 private static final long serialVersionUID = 1L;
73
74 protected JButton submitQuestionsButton;
75
76 protected String QUESTION_CARD = "QUESTION_CARD";
77
78 protected String RESULT_CARD = "RESULT_CARD";
79
80
81 public boolean leaveStep = false;
82
83 protected JPanel submitButtonPanel;
84
85 protected LeaveStudentAssessmentAction leaveAction;
86
87 public JaxbQtiStudentAssessmentUI(JaxbQtiStep assmt) {
88 super(assmt);
89 leaveStep = true;
90
91 }
92 protected void initUI() {
93
94 showPlaceHolderPanel = false;
95
96 System.out.println("isSubmitted: " + assessment.isSubmitted() );
97
98 if( assessment.getAssessmentItem() == null || assessment.getAssessmentItem().getItemBody().getBlockElementGroup().size() == 0 ) {
99 this.setLayout(new FlowLayout(FlowLayout.CENTER));
100 this.setOpaque(false);
101 JLabel noLabel = new JLabel("This Student Assessment has no items.");
102 noLabel.setOpaque(false);
103 this.add(noLabel, BorderLayout.CENTER);
104 return;
105 }
106
107 List<Object> interactions = assessment.getAssessmentItem().getItemBody().getBlockElementGroup();
108
109 submitButtonPanel = createButtonPanel();
110
111
112
113 JPanel questionsPanel = questionFactory(interactions);
114
115
116 JPanel scrollerPanel = createScrollerPanel(questionsPanel);
117
118 scrollerPanel.setName(QUESTION_CARD);
119
120 JPanel jp = new JPanel();
121 jp.add(new JLabel("dfdf"));
122 jp.setName(RESULT_CARD);
123
124
125 cardPanel.add(scrollerPanel, QUESTION_CARD);
126
127 cardPanel.printCardName();
128 cardPanel.setOpaque(false);
129 cardPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
130
131
132
133 SimpleGradientPanel mainPanel = new SimpleGradientPanel();
134 mainPanel.setDirection(SimpleGradientPanel.VERTICAL);
135
136
137 mainPanel.setStartColor(PasColors.compactNavBackgroundStartColor);
138 mainPanel.setEndColor(PasColors.compactNavBackgroundEndColor);
139
140 mainPanel.setLayout(new GridBagLayout());
141
142 GridBagConstraints c = new GridBagConstraints();
143
144 c.fill = GridBagConstraints.BOTH;
145
146 c.weightx = 1;
147 c.gridx = 0;
148 c.gridy = 0;
149
150
151 c.gridx = 0;
152 c.gridy = 0;
153
154
155 c.weighty = 1;
156 c.gridx = 0;
157 c.gridy = 0;
158
159 c.fill = GridBagConstraints.BOTH;
160 mainPanel.add(cardPanel, c);
161
162
163
164
165 c.weighty = 0;
166
167
168 c.gridx = 0;
169
170 c.gridy = 2;
171 mainPanel.add(submitButtonPanel, c);
172
173 this.setLayout(new BorderLayout(0,0));
174 this.add(mainPanel,BorderLayout.CENTER);
175
176
177 if (!assessment.getResponses().isEmpty()) {
178 JPanel resultsPanel = createResultsCard();
179 cardPanel.add(resultsPanel, RESULT_CARD);
180 cardPanel.showLastCard();
181 }
182
183 }
184
185 /***
186 * Creates all the interactions, flag for long or tab layout.
187 *
188 * @param interactions
189 * @return a panel with all the questions for an assessment
190 */
191 protected JPanel questionFactory(List<Object> interactions) {
192
193 JPanel mainPanel = new JPanel();
194
195 mainPanel.setBackground(PasColors.pandaPanelBackgroundColor);
196 mainPanel.setLayout(new BorderLayout(0, 0));
197
198 String introductionHtml = ((IntroductionHtmlAware)assessment).getIntroductionHtml();
199 JComponent introPanel = null;
200
201 if( introductionHtml != null ) {
202 introPanel = createIntroTextPanel(introductionHtml);
203 introPanel.setBorder(BorderFactory.createEmptyBorder(4, 10,4, 2));
204 }
205
206
207
208
209
210 if( assessment.getTabbed() ) {
211
212 tabbedPane = new JTabbedPane();
213 tabbedPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
214 tabbedPane.setBackground(Color.white);
215
216 tabbedPane.setUI(new PasTabbedPaneUI());
217 tabbedPane.addChangeListener(new ChangeListener() {
218
219 public void stateChanged(ChangeEvent e) {
220
221 if(nextTabButton != null || previousTabButton != null)
222 checkTab();
223 }});
224
225 if( interactions.size() > 1 ) {
226 showTabButtons = true;
227 } else {
228 showTabButtons = false;
229 }
230
231 int questionIndex = 1;
232 for (Object interaction : interactions) {
233 JPanel itemPanel = createAssessmentItemPanel((BlockInteractionType) interaction);
234 itemPanel.setOpaque(true);
235 itemPanel
236 .setBackground(Color.white);
237
238
239
240 JPanel wpanel = new JPanel(new BorderLayout(0, 0));
241 wpanel.setBackground(Color.white);
242
243
244 if (showTabButtons) {
245 wpanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
246 } else {
247 wpanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
248 }
249 wpanel.setBackground(Color.WHITE);
250 wpanel.putClientProperty(ITEM_COMPLETED, new Boolean(false));
251 wpanel.add(itemPanel, BorderLayout.CENTER);
252 tabbedPane.addTab("Q " + questionIndex, wpanel);
253 questionIndex += 1;
254 }
255
256 if (!assessment.getResponses().isEmpty()) {
257 for (int i = 0; i < tabbedPane.getTabCount(); i++) {
258 showTabChecked(i);
259 }
260 }
261
262 JPanel comboPanel = new JPanel(new BorderLayout(0,0));
263 comboPanel.setOpaque(false);
264
265 if( introPanel != null ) {
266 comboPanel.add(introPanel);
267 }
268 comboPanel.add(tabbedPane,BorderLayout.CENTER);
269 comboPanel.setBorder(BorderFactory.createEmptyBorder(4, 2,4, 2));
270
271 JPanel innerButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
272 innerButtonPanel.setBackground(Color.WHITE);
273
274 previousTabButton = new JButton(new PreviousTabAction("prev",new ImageIcon(PasCommonIconProvider.getImage("previousTab.png"))));
275 previousTabButton.setHorizontalAlignment(JButton.RIGHT);
276 previousTabButton.setVerticalAlignment(JButton.TOP);
277 previousTabButton.setVerticalTextPosition(JButton.TOP);
278
279 nextTabButton = new JButton(new NextTabAction("next",new ImageIcon(PasCommonIconProvider.getImage("nextTab.png"))));
280 nextTabButton.setHorizontalTextPosition(JButton.LEFT);
281 nextTabButton.setVerticalAlignment(JButton.TOP);
282 nextTabButton.setVerticalTextPosition(JButton.TOP);
283
284 this.checkTab();
285
286 innerButtonPanel.add(CommonUI.makeEnhancedButton(previousTabButton));
287 innerButtonPanel.add(CommonUI.makeEnhancedButton(nextTabButton));
288
289 JPanel shifterButtonsPanel = new JPanel(new BorderLayout(0,0));
290 shifterButtonsPanel.setBackground(Color.WHITE);
291 shifterButtonsPanel.add(innerButtonPanel,BorderLayout.CENTER);
292 shifterButtonsPanel.setBorder(BorderFactory.createEmptyBorder(0, 2, 2, 2));
293
294 if( showTabButtons )
295 comboPanel.add(shifterButtonsPanel,BorderLayout.SOUTH);
296
297
298 mainPanel.add(comboPanel, BorderLayout.CENTER);
299 } else {
300
301 MigLayout layout = new MigLayout("wrap 1");
302
303 JPanel longPanel = new JPanel();
304 longPanel.setLayout(layout);
305 if( introPanel != null ) {
306 longPanel.add(introPanel,"growx, wrap");
307 }
308 int questionIndex = 1;
309 for (Object interaction : interactions) {
310 JPanel itemPanel = createAssessmentItemPanel((BlockInteractionType) interaction);
311 itemPanel.setOpaque(true);
312 itemPanel
313 .setBackground(Color.white);
314
315
316
317 JPanel wpanel = new JPanel(new BorderLayout(0, 0));
318 wpanel.setBackground(Color.white);
319
320
321 wpanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
322 wpanel.setBackground(Color.WHITE);
323 wpanel.putClientProperty(ITEM_COMPLETED, new Boolean(false));
324
325
326 wpanel.add(itemPanel, BorderLayout.CENTER);
327
328
329 JPanel dividerLinePanel = new JPanel();
330
331 JLabel numberLabel = new JLabel(questionIndex +".");
332 MigLayout divLayout = new MigLayout();
333
334 longPanel.add(numberLabel, "split");
335 longPanel.add(new JSeparator(),"growx, wrap");
336
337 longPanel.add(wpanel,"growx, wrap");
338 longPanel.setBackground(wpanel.getBackground());
339 questionIndex += 1;
340 }
341 mainPanel.add(longPanel,BorderLayout.CENTER);
342 }
343 mainPanel.setBackground(Color.WHITE);
344
345
346
347
348
349 return mainPanel;
350 }
351
352 protected JPanel createScrollerPanel(JPanel questionsPanel) {
353 JScrollPane questionScroller = new JScrollPane(questionsPanel);
354 questionScroller
355 .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
356 questionScroller
357 .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
358 questionScroller.setBorder(BorderFactory.createEmptyBorder());
359 questionScroller.getVerticalScrollBar().setValue(
360 questionScroller.getVerticalScrollBar().getMaximum());
361 questionScroller.setOpaque(false);
362 JPanel scrollerPanel = new JPanel(new BorderLayout(0, 0));
363
364 scrollerPanel.add(questionScroller, BorderLayout.CENTER);
365
366
367 scrollerPanel.setOpaque(true);
368 scrollerPanel.setBackground(PasColors.pandaPanelBackgroundColor);
369 return scrollerPanel;
370 }
371
372 protected JPanel createButtonPanel() {
373 JPanel submitButtonPanel = new JPanel(new BorderLayout(0, 0));
374
375 submitButtonPanel.setBackground(Color.white);
376
377 String bLabel = Messages
378 .getString("StudentAssessment.8");
379 if( assessment.isLockStudentAnswers() == false ) {
380 bLabel = "Save";
381 }
382
383 submitQuestionsButton = new JButton(bLabel);
384 submitQuestionsButton = CommonUI
385 .makeEnhancedButton(submitQuestionsButton);
386 submitQuestionsButton.setCursor(Cursor
387 .getPredefinedCursor(Cursor.HAND_CURSOR));
388
389 final AbstractAction submitAction = new DialogSaveAction() {
390
391 public void actionPerformed(ActionEvent e) {
392 performSubmit();
393 hideRootDialog(e.getSource());
394 }};
395
396 submitQuestionsButton.addActionListener(new ActionListener() {
397
398 public void actionPerformed(ActionEvent e) {
399
400 if( assessment.isLockStudentAnswers() == false ) {
401 performSubmit();
402 } else {
403 JDialog showAreYouSureCheckDialog = showAreYouSureCheckDialog(submitAction);
404 showAreYouSureCheckDialog.setAlwaysOnTop(true);
405 }
406
407
408 }
409 });
410
411 submitButtonPanel.add(new JLabel(" "), BorderLayout.WEST);
412 submitButtonPanel.add(new JLabel(" "), BorderLayout.EAST);
413
414 JPanel buttonFillerPanel = new JPanel();
415 buttonFillerPanel.setOpaque(false);
416 buttonFillerPanel.add(submitQuestionsButton);
417 submitButtonPanel.add(buttonFillerPanel, BorderLayout.CENTER);
418
419 JPanel t = new JPanel(new GridLayout(1, 1));
420 t.setOpaque(false);
421 t.add(submitButtonPanel);
422 return t;
423 }
424
425
426 /***
427 * Switches to the results panel
428 */
429 protected void showResultsCard() {
430 submitButtonPanel.setVisible(false);
431 if( cardPanel.getComponentCount() > 1 ) {
432 cardPanel.remove(1);
433 }
434 JPanel resultsCard = createResultsCard();
435 cardPanel.add(resultsCard, RESULT_CARD);
436
437 logger.info("COUNT " + cardPanel.getComponentCount() );
438 cardPanel.showNextCard();
439 }
440
441
442 /***
443 * Creates the results of the assessment
444 *
445 * @return results card
446 */
447 protected JPanel createResultsCard() {
448
449 SimpleGradientPanel resultsCard = new SimpleGradientPanel(new BorderLayout(0, 0));
450 resultsCard.setDirection(SimpleGradientPanel.VERTICAL);
451 resultsCard.setStartColor(PasColors.compactNavBackgroundStartColor);
452 resultsCard.setEndColor(PasColors.compactNavBackgroundEndColor);
453
454
455 JLabel finishedLabel = new JLabel(Messages
456 .getString("StudentAssessment.11"));
457 Font font = finishedLabel.getFont().deriveFont(Font.BOLD, 16f);
458 finishedLabel.setFont(font);
459 finishedLabel.setForeground(Color.white);
460 finishedLabel.setBorder(BorderFactory.createEmptyBorder(15, 2, 15, 2));
461
462 JPanel itemsPanel = new JPanel();
463
464 itemsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
465 itemsPanel.setLayout(new BoxLayout(itemsPanel, BoxLayout.PAGE_AXIS));
466 itemsPanel.setOpaque(false);
467 List<ResponseDeclarationType> reponseDeclarations = assessment.getAssessmentItem().getResponseDeclaration();
468
469 for (ResponseDeclarationType rd : reponseDeclarations) {
470 String answerId = null;
471 String humanReadableAnswer = null;
472
473 ISock<String> sock = assessment.getResponseDeclarationToSocks().get(rd);
474 if (sock != null && !sock.isEmpty()) {
475 answerId = sock.peek();
476
477 humanReadableAnswer = JaxbQtiStep.lastAnswer(assessment.getResponseDeclarationToSocks(), rd);
478
479 BlockInteractionType bi = JaxbQtiStep.getInteractionByResponseDeclaration(assessment.getAssessmentItem().getItemBody().getBlockElementGroup(),rd);
480
481 if (bi instanceof ChoiceInteractionType) {
482 ChoiceInteractionType ci = (ChoiceInteractionType) bi;
483
484 List<SimpleChoiceType> simpleChoices = ci.getSimpleChoice();
485 for (SimpleChoiceType simpleChoice : simpleChoices) {
486 if( simpleChoice.getIdentifier().equals(answerId)) {
487
488 List<Serializable> choiceContent = simpleChoice.getContent();
489 for (Serializable serializable : choiceContent) {
490 if (serializable instanceof String) {
491 humanReadableAnswer = (String) serializable;
492 }
493 }
494
495 }
496 }
497
498 } else {
499 humanReadableAnswer = answerId;
500 }
501 } else {
502 humanReadableAnswer = Messages
503 .getString("StudentAssessment.12");
504 }
505
506 JPanel aItemPanel = new JPanel(new BorderLayout(0, 0));
507 aItemPanel.setBackground(Color.BLACK);
508 aItemPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 1, 2));
509
510 JPanel promptPanel = new JPanel(new BorderLayout(0, 0));
511
512 JComponent editorPane = JaxbQtiStepUI.createPromptPanel( JaxbQtiStep.getInteractionByResponseDeclaration(assessment.getAssessmentItem().getItemBody().getBlockElementGroup(), rd));
513 editorPane.setBackground(PasColors.studentnAssessmentResultBackgroundColor);
514 promptPanel.add(editorPane, BorderLayout.CENTER);
515 promptPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
516 promptPanel.setBackground(PasColors.studentnAssessmentResultBackgroundColor);
517 aItemPanel.add(promptPanel, BorderLayout.NORTH);
518
519 JPanel answerPanel = new JPanel(new BorderLayout(0, 0));
520
521 humanReadableAnswer = wrapText(humanReadableAnswer,100.0);
522 JLabel answerLabel = getFeedbackLbl(humanReadableAnswer,100.0);
523 answerPanel.add(answerLabel,BorderLayout.CENTER);
524
525
526 System.out.println(humanReadableAnswer);
527 answerPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
528 answerPanel.setBackground(Color.WHITE);
529 aItemPanel.add(answerPanel, BorderLayout.CENTER);
530
531
532
533
534
535 itemsPanel.add(aItemPanel);
536
537 }
538
539 JPanel innerPanel = new JPanel(new BorderLayout(0, 0));
540 innerPanel.setOpaque(false);
541 innerPanel.add(finishedLabel, BorderLayout.NORTH);
542
543 JScrollPane answerScroller = new JScrollPane();
544 answerScroller
545 .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
546 answerScroller
547 .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
548
549 JPanel temp = new JPanel(new BorderLayout(0, 0));
550 temp.add(itemsPanel, BorderLayout.NORTH);
551
552 temp.setOpaque(false);
553 temp.setBorder(BorderFactory.createLineBorder(Color.black, 2));
554 answerScroller.setViewportView(temp);
555 answerScroller.setBorder(BorderFactory.createEmptyBorder());
556 answerScroller.getViewport().setViewPosition(new java.awt.Point(0, 0));
557 answerScroller.getVerticalScrollBar().setValue(
558 answerScroller.getVerticalScrollBar().getMaximum());
559 answerScroller.setBackground(Color.RED);
560
561 resultsCard.add(answerScroller, BorderLayout.CENTER);
562
563 resultsCard.add(innerPanel, BorderLayout.NORTH);
564
565
566 JButton backButton = new JButton(Messages
567 .getString("StudentAssessment.13"));
568 CommonUI.makeEnhancedButton(backButton);
569 backButton.addActionListener(new ActionListener() {
570
571 public void actionPerformed(ActionEvent e) {
572
573
574 submitButtonPanel.setVisible(true);
575 cardPanel.showCard(cardPanel.getComponent(0));
576 }
577 });
578
579 JPanel buttonFillerPanel = new JPanel();
580 buttonFillerPanel.setOpaque(false);
581 if( assessment.isLockStudentAnswers() == false )
582 buttonFillerPanel.add(backButton);
583
584 resultsCard.add(buttonFillerPanel, BorderLayout.SOUTH);
585
586 submitButtonPanel.setVisible(false);
587
588 return resultsCard;
589 }
590
591 /***
592 * @param textLen
593 * @param adjustedWidth
594 * @param inlineFeedbackText
595 * @return
596 */
597 private JLabel getFeedbackLbl(String inlineFeedbackText, double adjustedWidth) {
598 double factor;
599 int textlen = inlineFeedbackText.length();
600 JLabel fiLabel = new JLabel();
601 fiLabel.setLayout(new BoxLayout(fiLabel,BoxLayout.Y_AXIS));
602 fiLabel.setBorder(BorderFactory.createLineBorder(PasColors.blackColor,1));
603 Dimension thisDim = fiLabel.getPreferredSize();
604 factor = Math.ceil((double)textlen/adjustedWidth);
605 thisDim.setSize(adjustedWidth,15*factor);
606 fiLabel.setPreferredSize(thisDim);
607 fiLabel.setMaximumSize(fiLabel.getPreferredSize());
608 fiLabel.setMinimumSize(fiLabel.getPreferredSize());
609 fiLabel.setText(inlineFeedbackText);
610 fiLabel.setVisible(true);
611
612 fiLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
613 return fiLabel;
614 }
615
616 private String wrapText(String comments, double textWidth){
617 String initHtml = "<html><body>";
618 String finalHtml = "</body></html>";
619 String finalStr = "";
620 int lastIndex = 0;
621
622 comments.trim();
623
624 while(comments.length() > textWidth){
625 String substri = comments.substring(0,(int)textWidth);
626 lastIndex = substri.lastIndexOf(" ");
627 finalStr = finalStr + substri.substring(0,lastIndex) + "\n";
628 comments = comments.substring((int)lastIndex, comments.length());
629
630 }
631
632 return initHtml + finalStr + comments.substring(0,comments.length()) + finalHtml;
633 }
634
635 /***
636 * Saves all the responses to rims
637 *
638 * @param clientProperty
639 */
640 protected void doSave() {
641 JaxbQtiStep.saveAssessmentItem(assessment.getAssessmentItem(), assessment.getResponses(),
642 assessment.getResponseDeclarationToSocks());
643 ((JaxbQtiStudentAssessment)assessment).setSubmitted(true);
644 showResultsCard();
645 }
646
647 public JDialog showAssessmentPartsCheckDialog() {
648 final PasMessageDialogUI ui = new PasMessageDialogUI(true);
649
650
651 ui
652 .setMessage("You need to complete all assessment questions before saving");
653 return PasDialogManager.showPasMessageDialog("Warning", ui
654 .createDialogPanel(), null, true);
655 }
656
657 public JDialog showAreYouSureCheckDialog(AbstractAction action) {
658 final PasStudentAssessmentConfirmDialogUI ui = new PasStudentAssessmentConfirmDialogUI(action);
659
660 ui
661 .setMessage("Are all the questions answered? Once submitted all answers are final.");
662 return PasDialogManager.showPasMessageDialog("Warning", ui
663 .createDialogPanel(), null, true);
664 }
665
666
667 /***
668 * @return the leaveAction
669 */
670 public LeaveStudentAssessmentAction getLeaveAction() {
671 return leaveAction;
672 }
673
674 /***
675 * @param projectFrame
676 * @return
677 */
678 public JDialog showSubmitDialog(JFrame projectFrame) {
679
680 leaveAction = new LeaveStudentAssessmentAction(
681 Messages.getString("StudentAssessment.51"));
682
683 PasSaveStudentAssesmentDialogUI ui = new PasSaveStudentAssesmentDialogUI(
684 leaveAction);
685 ui.setMessage(Messages.getString("StudentAssessment.52"));
686
687
688
689
690
691 CustomDialog dialog = PasDialogManager
692 .showPasMessageDialog(
693 Messages.getString("StudentAssessment.53"), ui.createDialogPanel(), projectFrame, true);
694
695
696
697
698
699
700
701
702
703 return dialog;
704
705
706
707
708 }
709 public boolean isLeaveStep() {
710 return leaveStep;
711 }
712 public void setLeaveStep(boolean leaveStep) {
713 this.leaveStep = leaveStep;
714 }
715 /***
716 *
717 */
718 private void performSubmit() {
719 cardPanel.showNextCard();
720
721
722 if( assessment.getTabbed() ) {
723 if( isCompleted() ) {
724 doSave();
725 } else {
726 if( assessment.isLockStudentAnswers() == false )
727 showAssessmentPartsCheckDialog();
728 }
729 } else {
730
731 doSave();
732 }
733 }
734
735
736
737 }