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 | 0 | private ViewContext viewContext = new ViewContext(); |
26 | |
|
27 | |
private static HandlerManager eventBus; |
28 | |
|
29 | 0 | public CredentialManager() { |
30 | 0 | eventBus = new HandlerManager(null); |
31 | 0 | model = new DataModel(); |
32 | 0 | } |
33 | |
|
34 | |
public CredentialViewController getBaccViewController() { |
35 | 0 | model.resetRoot(); |
36 | 0 | if (credentialViewController == null) { |
37 | 0 | credentialViewController = new CredentialViewController(model, viewContext, eventBus); |
38 | |
} |
39 | 0 | eventBus.fireEvent(new ProgramViewEvent()); |
40 | 0 | return credentialViewController; |
41 | |
} |
42 | |
|
43 | |
public CredentialEditController getBaccEditController() { |
44 | 0 | model.resetRoot(); |
45 | 0 | if (credentialEditController == null) { |
46 | 0 | credentialEditController = new CredentialEditController(model, viewContext, eventBus); |
47 | |
} |
48 | 0 | return credentialEditController; |
49 | |
} |
50 | |
|
51 | |
public ProgramVersionsController getProgramVersionsController() { |
52 | 0 | if (programVersionsController == null) { |
53 | 0 | programVersionsController = new ProgramVersionsController(model, ProgramSideBar.Type.CREDENTIAL, viewContext, eventBus); |
54 | |
} |
55 | 0 | return programVersionsController; |
56 | |
} |
57 | |
|
58 | |
public static HandlerManager getEventBus() { |
59 | 0 | return eventBus; |
60 | |
} |
61 | |
} |