|
15 | 15 | import fi.helsinki.cs.tmc.langs.domain.RunResult; |
16 | 16 |
|
17 | 17 | import com.google.common.collect.ImmutableList; |
18 | | -import fi.helsinki.cs.tmc.core.domain.ProgressObserver; |
19 | 18 |
|
20 | 19 | import java.awt.Dialog; |
21 | 20 | import java.awt.event.ActionEvent; |
22 | | -import java.awt.event.ActionListener; |
23 | 21 | import java.awt.event.WindowAdapter; |
24 | 22 | import java.awt.event.WindowEvent; |
25 | 23 | import java.net.URI; |
@@ -68,38 +66,38 @@ public void showSubmissionResult(Exercise exercise, SubmissionResult result, fin |
68 | 66 | clearTestCaseView(); |
69 | 67 | displayError(result.getError()); |
70 | 68 | break; |
| 69 | + case HIDDEN: |
| 70 | + dialogs.displayMessage("Submission received and saved.\nResults are hidden for this exercise."); |
| 71 | + break; |
71 | 72 | } |
72 | 73 | } |
73 | 74 |
|
74 | 75 | private void displaySuccessfulSubmissionMsg(Exercise exercise, final SubmissionResult result) { |
75 | 76 | final SuccessfulSubmissionDialog dialog = new SuccessfulSubmissionDialog(exercise, result); |
76 | 77 |
|
77 | | - dialog.addOkListener(new ActionListener() { |
78 | | - @Override |
79 | | - public void actionPerformed(ActionEvent e) { |
80 | | - List<FeedbackAnswer> answers = dialog.getFeedbackAnswers(); |
81 | | - if (!answers.isEmpty()) { |
82 | | - Callable<String> task = new TmcServerCommunicationTaskFactory().getFeedbackAnsweringJob(URI.create(result.getFeedbackAnswerUrl()), answers); |
83 | | - BgTask.start("Sending feedback", task, new BgTaskListener<String>() { |
84 | | - @Override |
85 | | - public void bgTaskReady(String result) { |
86 | | - } |
87 | | - |
88 | | - @Override |
89 | | - public void bgTaskCancelled() { |
90 | | - } |
91 | | - |
92 | | - @Override |
93 | | - public void bgTaskFailed(Throwable ex) { |
94 | | - String msg = "Failed to send feedback :-(\n" + ex.getMessage(); |
95 | | - String msgWithBacktrace = msg + "\n" + ExceptionUtils.backtraceToString(ex); |
96 | | - log.log(Level.INFO, msgWithBacktrace); |
97 | | - SwingUtilities.invokeLater(() -> { |
98 | | - dialogs.displayError(msg); |
99 | | - }); |
100 | | - } |
101 | | - }); |
102 | | - } |
| 78 | + dialog.addOkListener((ActionEvent e) -> { |
| 79 | + List<FeedbackAnswer> answers = dialog.getFeedbackAnswers(); |
| 80 | + if (!answers.isEmpty()) { |
| 81 | + Callable<String> task = new TmcServerCommunicationTaskFactory().getFeedbackAnsweringJob(URI.create(result.getFeedbackAnswerUrl()), answers); |
| 82 | + BgTask.start("Sending feedback", task, new BgTaskListener<String>() { |
| 83 | + @Override |
| 84 | + public void bgTaskReady(String result) { |
| 85 | + } |
| 86 | + |
| 87 | + @Override |
| 88 | + public void bgTaskCancelled() { |
| 89 | + } |
| 90 | + |
| 91 | + @Override |
| 92 | + public void bgTaskFailed(Throwable ex) { |
| 93 | + String msg = "Failed to send feedback :-(\n" + ex.getMessage(); |
| 94 | + String msgWithBacktrace = msg + "\n" + ExceptionUtils.backtraceToString(ex); |
| 95 | + log.log(Level.INFO, msgWithBacktrace); |
| 96 | + SwingUtilities.invokeLater(() -> { |
| 97 | + dialogs.displayError(msg); |
| 98 | + }); |
| 99 | + } |
| 100 | + }); |
103 | 101 | } |
104 | 102 | }); |
105 | 103 |
|
|
0 commit comments