1 | |
package org.kuali.student.lum.lu.ui.course.client.requirements; |
2 | |
|
3 | |
import java.util.HashMap; |
4 | |
import java.util.HashSet; |
5 | |
import java.util.LinkedHashMap; |
6 | |
import java.util.List; |
7 | |
import java.util.Map; |
8 | |
import java.util.Set; |
9 | |
|
10 | |
import org.kuali.student.common.dto.RichTextInfo; |
11 | |
import org.kuali.student.common.ui.client.application.Application; |
12 | |
import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; |
13 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
14 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
15 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
16 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
17 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
18 | |
import org.kuali.student.common.ui.client.mvc.View; |
19 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
20 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract; |
21 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations; |
22 | |
import org.kuali.student.common.ui.client.widgets.dialog.ConfirmationDialog; |
23 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.ActionCancelGroup; |
24 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrButton; |
25 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrButton.AbbrButtonType; |
26 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.LabelPanel; |
27 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel; |
28 | |
import org.kuali.student.core.statement.dto.ReqCompFieldInfo; |
29 | |
import org.kuali.student.core.statement.dto.ReqComponentInfo; |
30 | |
import org.kuali.student.core.statement.dto.StatementTreeViewInfo; |
31 | |
import org.kuali.student.core.statement.dto.StatementTypeInfo; |
32 | |
import org.kuali.student.core.statement.ui.client.widgets.rules.RulesUtil; |
33 | |
import org.kuali.student.core.statement.ui.client.widgets.rules.SubrulePreviewWidget; |
34 | |
import org.kuali.student.lum.common.client.widgets.AppLocations; |
35 | |
import org.kuali.student.lum.common.client.widgets.CluSetDetailsWidget; |
36 | |
import org.kuali.student.lum.common.client.widgets.CluSetRetriever; |
37 | |
import org.kuali.student.lum.common.client.widgets.CluSetRetrieverImpl; |
38 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.AbstractCourseConfigurer; |
39 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.CourseProposalConfigurer; |
40 | |
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController; |
41 | |
|
42 | |
import com.google.gwt.core.client.GWT; |
43 | |
import com.google.gwt.event.dom.client.ClickEvent; |
44 | |
import com.google.gwt.event.dom.client.ClickHandler; |
45 | |
import com.google.gwt.user.client.Window; |
46 | |
import com.google.gwt.user.client.ui.FlowPanel; |
47 | |
import com.google.gwt.user.client.ui.HorizontalPanel; |
48 | |
import com.google.gwt.user.client.ui.VerticalPanel; |
49 | |
import com.google.gwt.user.client.ui.Widget; |
50 | |
|
51 | |
public class CourseRequirementsSummaryView extends VerticalSectionView { |
52 | |
|
53 | 0 | private static CluSetRetriever cluSetRetriever = new CluSetRetrieverImpl(); |
54 | |
|
55 | |
|
56 | 0 | protected FlowPanel layout = new FlowPanel(); |
57 | 0 | protected ActionCancelGroup actionCancelButtons = new ActionCancelGroup( |
58 | |
ButtonEnumerations.SaveContinueCancelEnum.SAVE_CONTINUE, ButtonEnumerations.SaveContinueCancelEnum.CANCEL); |
59 | 0 | protected Map<String, Widget> addButtonsList = new HashMap<String, Widget>(); |
60 | |
|
61 | |
|
62 | |
protected CourseRequirementsViewController parentController; |
63 | |
protected CourseRequirementsDataModel rules; |
64 | |
protected boolean isReadOnly; |
65 | |
protected boolean showSaveButtons; |
66 | 0 | private static int tempProgReqInfoID = 9999; |
67 | |
public static final String NEW_STMT_TREE_ID = "NEWSTMTTREE"; |
68 | |
public static final String NEW_REQ_COMP_ID = "NEWREQCOMP"; |
69 | |
|
70 | 0 | protected Map<String, SpanPanel> perCourseRequisiteTypePanel = new LinkedHashMap<String, SpanPanel>(); |
71 | |
|
72 | 0 | protected boolean displayInitialized = false; |
73 | |
|
74 | |
public CourseRequirementsSummaryView() { |
75 | 0 | super(); |
76 | 0 | } |
77 | |
|
78 | |
public CourseRequirementsSummaryView(final CourseRequirementsViewController parentController, Enum<?> viewEnum, String name, |
79 | |
String modelId, CourseRequirementsDataModel rulesData, boolean isReadOnly, boolean showSaveButtons) { |
80 | 0 | super(viewEnum, name, modelId); |
81 | 0 | this.parentController = parentController; |
82 | 0 | rules = rulesData; |
83 | 0 | rules.setInitialized(false); |
84 | 0 | this.isReadOnly = isReadOnly; |
85 | 0 | this.showSaveButtons = showSaveButtons; |
86 | 0 | if (!isReadOnly && showSaveButtons) { |
87 | 0 | setupSaveCancelButtons(); |
88 | |
} |
89 | 0 | } |
90 | |
|
91 | |
public void init(final CourseRequirementsViewController parentController, Enum<?> viewEnum, String name, |
92 | |
String modelId, CourseRequirementsDataModel rulesData, boolean isReadOnly, boolean showSaveButtons) { |
93 | 0 | super.init(viewEnum, name, modelId, true); |
94 | 0 | this.parentController = parentController; |
95 | 0 | rules = rulesData; |
96 | 0 | rules.setInitialized(false); |
97 | 0 | this.isReadOnly = isReadOnly; |
98 | 0 | this.showSaveButtons = showSaveButtons; |
99 | 0 | if (!isReadOnly && showSaveButtons) { |
100 | 0 | setupSaveCancelButtons(); |
101 | |
} |
102 | 0 | } |
103 | |
|
104 | |
@Override |
105 | |
public boolean isDirty() { |
106 | 0 | return rules.isDirty(); |
107 | |
} |
108 | |
|
109 | |
@Override |
110 | |
public void beforeShow(final Callback<Boolean> onReadyCallback) { |
111 | |
|
112 | |
|
113 | 0 | if (!rules.isInitialized()) { |
114 | 0 | rules.retrieveCourseRequirements(AbstractCourseConfigurer.COURSE_PROPOSAL_MODEL, new Callback<Boolean>() { |
115 | |
@Override |
116 | |
public void exec(Boolean result) { |
117 | 0 | if (result) { |
118 | 0 | displayRules(); |
119 | |
} |
120 | 0 | onReadyCallback.exec(result); |
121 | 0 | } |
122 | |
}); |
123 | 0 | return; |
124 | |
} |
125 | |
|
126 | |
|
127 | 0 | if (isReadOnly) { |
128 | 0 | displayRules(); |
129 | 0 | onReadyCallback.exec(true); |
130 | 0 | return; |
131 | |
} |
132 | |
|
133 | |
|
134 | 0 | if(!displayInitialized){ |
135 | 0 | displayRules(); |
136 | |
} |
137 | |
|
138 | |
|
139 | 0 | parentController.getView(CourseRequirementsViewController.CourseRequirementsViews.MANAGE, new Callback<View>(){ |
140 | |
@Override |
141 | |
public void exec(View result) { |
142 | 0 | CourseRequirementsManageView manageView = (CourseRequirementsManageView) result; |
143 | |
|
144 | |
|
145 | 0 | if (!manageView.isDirty() || !manageView.isUserClickedSaveButton()) { |
146 | 0 | rules.removeEmptyRules(); |
147 | 0 | onReadyCallback.exec(true); |
148 | 0 | return; |
149 | |
} |
150 | |
|
151 | |
|
152 | 0 | ((SectionView)parentController.getCurrentView()).setIsDirty(false); |
153 | 0 | manageView.setUserClickedSaveButton(false); |
154 | |
|
155 | |
|
156 | 0 | StatementTreeViewInfo affectedRule = rules.updateRules(manageView.getRuleTree(), manageView.getInternalCourseReqID(), manageView.isNewRule()); |
157 | 0 | updateRequirementWidgets(affectedRule); |
158 | |
|
159 | 0 | onReadyCallback.exec(true); |
160 | 0 | } |
161 | |
}); |
162 | 0 | } |
163 | |
|
164 | |
public void revertRuleChanges() { |
165 | 0 | rules.revertRuleChanges(); |
166 | 0 | displayRules(); |
167 | 0 | } |
168 | |
|
169 | |
protected void updateRequirementWidgets(StatementTreeViewInfo rule) { |
170 | 0 | if (rule != null) { |
171 | 0 | StatementTypeInfo affectedStatementTypeInfo = rules.getStmtTypeInfo(rule.getType()); |
172 | 0 | SpanPanel reqPanel = perCourseRequisiteTypePanel.get(affectedStatementTypeInfo.getId()); |
173 | |
|
174 | |
|
175 | 0 | addButtonsList.get(rule.getType()).setVisible(false); |
176 | |
|
177 | |
|
178 | 0 | if (reqPanel.getWidgetCount() == 0) { |
179 | 0 | SubrulePreviewWidget newRulePreviewWidget = addCourseRequisite(reqPanel, rule); |
180 | 0 | reqPanel.add(newRulePreviewWidget); |
181 | 0 | return; |
182 | |
} |
183 | |
|
184 | 0 | for (int i = 0; i < reqPanel.getWidgetCount(); i++) { |
185 | 0 | SubrulePreviewWidget subrulePreviewWidget = (SubrulePreviewWidget)reqPanel.getWidget(i); |
186 | 0 | if (!rule.getStatements().isEmpty() || !rule.getReqComponents().isEmpty()) { |
187 | 0 | SubrulePreviewWidget newRulePreviewWidget = addCourseRequisite(reqPanel, rule); |
188 | 0 | reqPanel.insert(newRulePreviewWidget, i); |
189 | |
} |
190 | 0 | reqPanel.remove(subrulePreviewWidget); |
191 | 0 | if (rule.getStatements().isEmpty() && rule.getReqComponents().isEmpty()) |
192 | 0 | addButtonsList.get(rule.getType()).setVisible(true); |
193 | |
break; |
194 | |
} |
195 | |
} |
196 | 0 | } |
197 | |
|
198 | |
public void displayRules() { |
199 | 0 | remove(layout); |
200 | 0 | layout.clear(); |
201 | |
|
202 | |
|
203 | 0 | if (!isReadOnly) { |
204 | 0 | SectionTitle pageTitle = SectionTitle.generateH2Title("Course Requisites"); |
205 | 0 | pageTitle.addStyleName("ks-layout-header"); |
206 | 0 | layout.add(pageTitle); |
207 | |
} |
208 | |
|
209 | |
|
210 | 0 | boolean firstSubHeader = true; |
211 | 0 | for (StatementTypeInfo stmtTypeInfo : rules.getStmtTypes()) { |
212 | |
|
213 | |
|
214 | 0 | if (isTopStatement(stmtTypeInfo)) { |
215 | 0 | SectionTitle title = SectionTitle.generateH3Title(stmtTypeInfo.getName()); |
216 | 0 | title.addStyleName("KS-Course-Requisites-Top-Stmt-Header"); |
217 | 0 | layout.add(title); |
218 | 0 | firstSubHeader = true; |
219 | 0 | continue; |
220 | |
} |
221 | |
|
222 | |
|
223 | 0 | SpanPanel requirementsPanel = new SpanPanel(); |
224 | 0 | perCourseRequisiteTypePanel.put(stmtTypeInfo.getId(), requirementsPanel); |
225 | 0 | displayRequirementSectionForGivenType(requirementsPanel, stmtTypeInfo, firstSubHeader); |
226 | 0 | firstSubHeader = false; |
227 | |
|
228 | |
|
229 | 0 | for (StatementTreeViewInfo ruleInfo : rules.getCourseReqInfo(stmtTypeInfo.getId())) { |
230 | 0 | if (!ruleInfo.getStatements().isEmpty() || !ruleInfo.getReqComponents().isEmpty()) { |
231 | 0 | SubrulePreviewWidget subrulePreviewWidget = addCourseRequisite(requirementsPanel, ruleInfo); |
232 | 0 | requirementsPanel.add(subrulePreviewWidget); |
233 | 0 | } |
234 | |
} |
235 | 0 | } |
236 | |
|
237 | |
|
238 | 0 | if (!isReadOnly && showSaveButtons) { |
239 | 0 | layout.add(actionCancelButtons); |
240 | |
} |
241 | |
|
242 | 0 | addWidget(layout); |
243 | |
|
244 | 0 | displayInitialized = true; |
245 | 0 | } |
246 | |
|
247 | |
protected void displayRequirementSectionForGivenType(final SpanPanel requirementsPanel, |
248 | |
final StatementTypeInfo stmtTypeInfo, boolean firstSubHeader) { |
249 | |
|
250 | |
|
251 | 0 | SectionTitle title = SectionTitle.generateH3Title(stmtTypeInfo.getName()); |
252 | 0 | title.setStyleName((firstSubHeader ? "KS-Course-Requisites-Preview-Rule-Type-First-Header" : "KS-Course-Requisites-Preview-Rule-Type-Header")); |
253 | 0 | layout.add(title); |
254 | |
|
255 | 0 | LabelPanel labelExamples = new LabelPanel(stmtTypeInfo.getDescr()); |
256 | 0 | labelExamples.getElement().setAttribute("style", "font-weight: normal; width: 80%;"); |
257 | |
|
258 | 0 | String examplesHtml = Application.getApplicationContext().getMessage(stmtTypeInfo.getId()); |
259 | |
|
260 | 0 | if (examplesHtml != null && !examplesHtml.equals("")) { |
261 | 0 | AbbrButton examples = new AbbrButton(AbbrButtonType.EXAMPLES); |
262 | 0 | examples.setVisible(true); |
263 | 0 | examples.setHoverHTML(examplesHtml); |
264 | 0 | examples.getHoverPopup().addStyleName("ks-example-popup"); |
265 | 0 | labelExamples.add(examples); |
266 | |
} |
267 | |
|
268 | 0 | HorizontalPanel spacer0 = new HorizontalPanel(); |
269 | 0 | spacer0.addStyleName("KS-Course-Requisites-Button-Spacer"); |
270 | 0 | labelExamples.add(spacer0); |
271 | |
|
272 | 0 | layout.add(labelExamples); |
273 | |
|
274 | |
|
275 | 0 | final String stmtId = stmtTypeInfo.getId(); |
276 | 0 | if (!isReadOnly) { |
277 | 0 | KSButton addCourseReqButton = new KSButton("Add " + stmtTypeInfo.getName(), KSButtonAbstract.ButtonStyle.FORM_SMALL); |
278 | 0 | addCourseReqButton.addClickHandler(new ClickHandler(){ |
279 | |
public void onClick(ClickEvent event) { |
280 | |
|
281 | 0 | storeRules(false, new Callback<Boolean>() { |
282 | |
@Override |
283 | |
public void exec(Boolean courseExists) { |
284 | 0 | if (courseExists) { |
285 | 0 | final StatementTreeViewInfo newRule = new StatementTreeViewInfo(); |
286 | 0 | newRule.setId(generateStatementTreeId()); |
287 | 0 | newRule.setType(stmtId); |
288 | 0 | RichTextInfo text = new RichTextInfo(); |
289 | 0 | text.setPlain(""); |
290 | 0 | newRule.setDesc(text); |
291 | 0 | parentController.getView( |
292 | |
CourseRequirementsViewController.CourseRequirementsViews.MANAGE, |
293 | 0 | new Callback<View>() { |
294 | |
@Override |
295 | |
public void exec(View result) { |
296 | 0 | rules.addRule(newRule); |
297 | 0 | ((CourseRequirementsManageView) result).setRuleTree(newRule, true, rules.getInternalCourseReqID(newRule)); |
298 | 0 | parentController.showView(CourseRequirementsViewController.CourseRequirementsViews.MANAGE); |
299 | 0 | } |
300 | |
}); |
301 | |
} |
302 | 0 | } |
303 | |
}); |
304 | 0 | }; |
305 | |
}); |
306 | 0 | if (!rules.getCourseReqInfo(stmtId).isEmpty()) { |
307 | 0 | boolean checkReqs = true; |
308 | 0 | for(StatementTreeViewInfo ruleInfo : rules.getCourseReqInfo(stmtId)) { |
309 | 0 | if (!ruleInfo.getStatements().isEmpty() || !ruleInfo.getReqComponents().isEmpty()) { |
310 | 0 | checkReqs = false; |
311 | 0 | break; |
312 | |
} |
313 | |
} |
314 | 0 | addCourseReqButton.setVisible(checkReqs); |
315 | 0 | } else |
316 | 0 | addCourseReqButton.setVisible(rules.getCourseReqInfo(stmtId).isEmpty()); |
317 | 0 | addButtonsList.put(stmtId, addCourseReqButton); |
318 | 0 | layout.add(addCourseReqButton); |
319 | 0 | VerticalPanel spacer = new VerticalPanel(); |
320 | 0 | spacer.addStyleName("KS-Course-Requisites-Button-Spacer"); |
321 | 0 | layout.add(spacer); |
322 | |
} |
323 | |
|
324 | 0 | layout.add(requirementsPanel); |
325 | 0 | } |
326 | |
|
327 | |
protected SubrulePreviewWidget addCourseRequisite(final SpanPanel requirementsPanel, |
328 | |
final StatementTreeViewInfo rule) { |
329 | |
|
330 | 0 | Integer internalProgReqID = rules.getInternalCourseReqID(rule); |
331 | 0 | String stmtTypeId = rule.getType(); |
332 | |
|
333 | 0 | final SubrulePreviewWidget rulePreviewWidget = new SubrulePreviewWidget(rule, isReadOnly, getCluSetWidgetList(rule)); |
334 | |
|
335 | 0 | addRulePreviewWidgetHandlers(requirementsPanel, rulePreviewWidget, stmtTypeId, internalProgReqID); |
336 | 0 | return rulePreviewWidget; |
337 | |
} |
338 | |
|
339 | |
protected void addRulePreviewWidgetHandlers(final SpanPanel requirementsPanel, |
340 | |
final SubrulePreviewWidget subRuleWidget, final String stmtTypeId, final Integer internalProgReqID) { |
341 | |
|
342 | 0 | subRuleWidget.addEditButtonClickHandler(new ClickHandler() { |
343 | |
public void onClick(ClickEvent event) { |
344 | 0 | parentController.getView(CourseRequirementsViewController.CourseRequirementsViews.MANAGE, new Callback<View>(){ |
345 | |
@Override |
346 | |
public void exec(View result) { |
347 | 0 | ((CourseRequirementsManageView) result).setRuleTree(rules.getRule(internalProgReqID), false, internalProgReqID); |
348 | 0 | parentController.showView(CourseRequirementsViewController.CourseRequirementsViews.MANAGE); |
349 | 0 | } |
350 | |
}); |
351 | 0 | } |
352 | |
}); |
353 | |
|
354 | 0 | subRuleWidget.addDeleteButtonClickHandler(new ClickHandler() { |
355 | |
public void onClick(ClickEvent event) { |
356 | |
|
357 | 0 | rules.markRuleAsEdited(internalProgReqID); |
358 | |
|
359 | 0 | rules.deleteRule(internalProgReqID); |
360 | 0 | requirementsPanel.remove(subRuleWidget); |
361 | 0 | addButtonsList.get(stmtTypeId).setVisible(true); |
362 | 0 | } |
363 | |
}); |
364 | 0 | } |
365 | |
|
366 | |
static public boolean isTopStatement(StatementTypeInfo stmtInfo) { |
367 | 0 | return ((stmtInfo.getAllowedStatementTypes() != null) && !stmtInfo.getAllowedStatementTypes().isEmpty()); |
368 | |
} |
369 | |
|
370 | |
static public Map<String, Widget> getCluSetWidgetList(StatementTreeViewInfo rule) { |
371 | 0 | Map<String, Widget> widgetList = new HashMap<String, Widget>(); |
372 | 0 | Set<String> cluSetIds = new HashSet<String>(); |
373 | 0 | findCluSetIds(rule, cluSetIds); |
374 | 0 | for (String clusetId : cluSetIds) { |
375 | 0 | widgetList.put(clusetId, new CluSetDetailsWidget(clusetId, cluSetRetriever)); |
376 | |
} |
377 | |
|
378 | 0 | return widgetList; |
379 | |
} |
380 | |
|
381 | |
static private void findCluSetIds(StatementTreeViewInfo rule, Set<String> list) { |
382 | |
|
383 | 0 | List<StatementTreeViewInfo> statements = rule.getStatements(); |
384 | 0 | List<ReqComponentInfo> reqComponentInfos = rule.getReqComponents(); |
385 | |
|
386 | 0 | if ((statements != null) && (statements.size() > 0)) { |
387 | |
|
388 | 0 | for (StatementTreeViewInfo statement : statements) { |
389 | 0 | findCluSetIds(statement, list); |
390 | |
} |
391 | 0 | } else if ((reqComponentInfos != null) && (reqComponentInfos.size() > 0)) { |
392 | |
|
393 | 0 | for (ReqComponentInfo reqComponent : reqComponentInfos) { |
394 | 0 | List<ReqCompFieldInfo> fieldInfos = reqComponent.getReqCompFields(); |
395 | 0 | for (ReqCompFieldInfo fieldInfo : fieldInfos) { |
396 | 0 | if (RulesUtil.isCluSetWidget(fieldInfo.getType())) { |
397 | 0 | list.add(fieldInfo.getValue()); |
398 | |
} |
399 | |
} |
400 | 0 | } |
401 | |
} |
402 | 0 | } |
403 | |
|
404 | |
private void setupSaveCancelButtons() { |
405 | 0 | actionCancelButtons.addStyleName("KS-Course-Requisites-Save-Button"); |
406 | 0 | actionCancelButtons.addCallback(new Callback<ButtonEnumerations.ButtonEnum>(){ |
407 | |
@Override |
408 | |
public void exec(ButtonEnumerations.ButtonEnum result) { |
409 | 0 | if (result == ButtonEnumerations.SaveContinueCancelEnum.SAVE_CONTINUE) { |
410 | 0 | storeRules(true, new Callback<Boolean>() { |
411 | |
@Override |
412 | |
public void exec(Boolean result) { |
413 | 0 | if (result) { |
414 | 0 | CourseProposalController courseController = ((CourseProposalController) parentController.getParentController()); |
415 | 0 | courseController.showNextViewOnMenu(); |
416 | |
|
417 | |
} |
418 | 0 | } |
419 | |
}); |
420 | |
} else { |
421 | 0 | if(! ((CourseProposalController)parentController.getController()).isNew()){ |
422 | 0 | (parentController.getController()).showView(CourseProposalConfigurer.CourseSections.SUMMARY); |
423 | |
} |
424 | |
else{ |
425 | 0 | Application.navigate(AppLocations.Locations.CURRICULUM_MANAGEMENT.getLocation()); |
426 | |
} |
427 | |
} |
428 | 0 | } |
429 | |
}); |
430 | 0 | } |
431 | |
|
432 | |
public void storeRules(final boolean storeRules, final Callback<Boolean> callback) { |
433 | 0 | parentController.requestModel(CourseRequirementsViewController.COURSE_PROPOSAL_MODEL, new ModelRequestCallback<DataModel>() { |
434 | |
@Override |
435 | |
public void onRequestFail(Throwable cause) { |
436 | 0 | Window.alert(cause.getMessage()); |
437 | 0 | GWT.log("Unable to retrieve model for course requirements view", cause); |
438 | 0 | callback.exec(false); |
439 | 0 | } |
440 | |
@Override |
441 | |
public void onModelReady(DataModel model) { |
442 | 0 | String courseId = model.getRoot().get("id"); |
443 | 0 | String courseState = model.getRoot().get("state"); |
444 | 0 | if (courseId == null) { |
445 | 0 | final ConfirmationDialog dialog = new ConfirmationDialog("Submit Course Title", "Before saving rules please submit course proposal title"); |
446 | 0 | dialog.getConfirmButton().addClickHandler(new ClickHandler(){ |
447 | |
@Override |
448 | |
public void onClick(ClickEvent event) { |
449 | 0 | dialog.hide(); |
450 | 0 | } |
451 | |
}); |
452 | 0 | dialog.show(); |
453 | 0 | callback.exec(false); |
454 | 0 | } else { |
455 | 0 | if (storeRules) { |
456 | 0 | rules.updateCourseRequisites(courseId, courseState, new Callback<List<StatementTreeViewInfo>>() { |
457 | |
@Override |
458 | |
public void exec(List<StatementTreeViewInfo> rules) { |
459 | 0 | for (StatementTreeViewInfo rule : rules) { |
460 | 0 | updateRequirementWidgets(rule); |
461 | |
} |
462 | 0 | callback.exec(true); |
463 | 0 | } |
464 | |
}); |
465 | |
} else { |
466 | 0 | callback.exec(true); |
467 | |
} |
468 | |
} |
469 | 0 | } |
470 | |
}); |
471 | 0 | } |
472 | |
|
473 | |
static public String generateStatementTreeId() { |
474 | 0 | return (NEW_STMT_TREE_ID + Integer.toString(tempProgReqInfoID++)); |
475 | |
} |
476 | |
} |