1 package org.kuali.student.lum.program.client.credential;
2
3 import com.google.gwt.event.shared.HandlerManager;
4 import org.kuali.student.common.ui.client.application.ViewContext;
5 import org.kuali.student.common.ui.client.mvc.DataModel;
6 import org.kuali.student.lum.program.client.credential.edit.CredentialEditController;
7 import org.kuali.student.lum.program.client.credential.view.CredentialViewController;
8 import org.kuali.student.lum.program.client.events.ProgramViewEvent;
9 import org.kuali.student.lum.program.client.versions.ProgramVersionsController;
10 import org.kuali.student.lum.program.client.widgets.ProgramSideBar;
11
12
13
14
15 public class CredentialManager {
16
17 private CredentialViewController credentialViewController;
18
19 private CredentialEditController credentialEditController;
20
21 private ProgramVersionsController programVersionsController;
22
23 protected DataModel model;
24
25 private ViewContext viewContext = new ViewContext();
26
27 private static HandlerManager eventBus;
28
29 public CredentialManager() {
30 eventBus = new HandlerManager(null);
31 model = new DataModel();
32 }
33
34 public CredentialViewController getBaccViewController() {
35 model.resetRoot();
36 if (credentialViewController == null) {
37 credentialViewController = new CredentialViewController(model, viewContext, eventBus);
38 }
39 eventBus.fireEvent(new ProgramViewEvent());
40 return credentialViewController;
41 }
42
43 public CredentialEditController getBaccEditController() {
44 model.resetRoot();
45 if (credentialEditController == null) {
46 credentialEditController = new CredentialEditController(model, viewContext, eventBus);
47 }
48 return credentialEditController;
49 }
50
51 public ProgramVersionsController getProgramVersionsController() {
52 if (programVersionsController == null) {
53 programVersionsController = new ProgramVersionsController(model, ProgramSideBar.Type.CREDENTIAL, viewContext, eventBus);
54 }
55 return programVersionsController;
56 }
57
58 public static HandlerManager getEventBus() {
59 return eventBus;
60 }
61 }