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