OLD | NEW |
1 package autotest.afe; | 1 package autotest.afe; |
2 | 2 |
3 import autotest.afe.CreateJobView.JobCreateListener; | |
4 import autotest.afe.HostDetailView.HostDetailListener; | 3 import autotest.afe.HostDetailView.HostDetailListener; |
5 import autotest.afe.HostListView.HostListListener; | 4 import autotest.afe.HostListView.HostListListener; |
6 import autotest.afe.JobDetailView.JobDetailListener; | 5 import autotest.afe.JobDetailView.JobDetailListener; |
7 import autotest.afe.JobListView.JobSelectListener; | 6 import autotest.afe.JobListView.JobSelectListener; |
8 import autotest.afe.RecurringView.RecurringSelectListener; | 7 import autotest.afe.RecurringView.RecurringSelectListener; |
9 import autotest.afe.UserPreferencesView.UserPreferencesListener; | 8 import autotest.afe.UserPreferencesView.UserPreferencesListener; |
| 9 import autotest.afe.create.CreateJobViewPresenter.JobCreateListener; |
| 10 import autotest.afe.create.CreateJobViewTab; |
10 import autotest.common.CustomHistory; | 11 import autotest.common.CustomHistory; |
11 import autotest.common.JsonRpcProxy; | 12 import autotest.common.JsonRpcProxy; |
12 import autotest.common.SiteCommonClassFactory; | 13 import autotest.common.SiteCommonClassFactory; |
13 import autotest.common.StaticDataRepository; | 14 import autotest.common.StaticDataRepository; |
14 import autotest.common.ui.CustomTabPanel; | 15 import autotest.common.ui.CustomTabPanel; |
15 import autotest.common.ui.NotifyManager; | 16 import autotest.common.ui.NotifyManager; |
16 import autotest.common.ui.TabView; | 17 import autotest.common.ui.TabView; |
17 | 18 |
18 import com.google.gwt.core.client.EntryPoint; | 19 import com.google.gwt.core.client.EntryPoint; |
19 import com.google.gwt.json.client.JSONValue; | 20 import com.google.gwt.json.client.JSONValue; |
20 import com.google.gwt.user.client.ui.RootPanel; | 21 import com.google.gwt.user.client.ui.RootPanel; |
21 | 22 |
22 | 23 |
23 public class AfeClient implements EntryPoint { | 24 public class AfeClient implements EntryPoint { |
24 private JobListView jobList; | 25 private JobListView jobList; |
25 private JobDetailView jobDetail; | 26 private JobDetailView jobDetail; |
26 private RecurringView recurringView; | 27 private RecurringView recurringView; |
27 private CreateJobView createJob; | 28 private CreateJobViewTab createJob; |
28 private HostListView hostListView; | 29 private HostListView hostListView; |
29 private HostDetailView hostDetailView; | 30 private HostDetailView hostDetailView; |
30 private UserPreferencesView userPreferencesView; | 31 private UserPreferencesView userPreferencesView; |
31 | 32 |
32 public CustomTabPanel mainTabPanel = new CustomTabPanel(); | 33 public CustomTabPanel mainTabPanel = new CustomTabPanel(); |
33 | 34 |
34 /** | 35 /** |
35 * Application entry point. | 36 * Application entry point. |
36 */ | 37 */ |
37 public void onModuleLoad() { | 38 public void onModuleLoad() { |
38 JsonRpcProxy.setDefaultBaseUrl(JsonRpcProxy.AFE_BASE_URL); | 39 JsonRpcProxy.setDefaultBaseUrl(JsonRpcProxy.AFE_BASE_URL); |
39 NotifyManager.getInstance().initialize(); | 40 NotifyManager.getInstance().initialize(); |
40 | 41 |
41 // initialize static data, and don't show main UI until that's done | 42 // initialize static data, and don't show main UI until that's done |
42 StaticDataRepository.getRepository().refresh( | 43 StaticDataRepository.getRepository().refresh( |
43 new StaticDataRepository.FinishedCallback() { | 44 new StaticDataRepository.FinishedCallback() { |
44 public void onFinished() { | 45 public void onFinished() { |
45 finishLoading(); | 46 finishLoading(); |
46 } | 47 } |
47 }); | 48 }); |
48 } | 49 } |
49 | 50 |
50 private JobCreateListener jobCreateListener = new JobCreateListener() { | 51 private JobCreateListener jobCreateListener = new JobCreateListener() { |
51 public void onJobCreated(int jobId) { | 52 public void onJobCreated(int jobId) { |
52 showJob(jobId); | 53 showJob(jobId); |
53 } | 54 } |
54 }; | 55 }; |
55 | 56 |
56 protected void finishLoading() { | 57 protected void finishLoading() { |
57 SiteCommonClassFactory.globalInitialize(); | 58 SiteCommonClassFactory.globalInitialize(); |
58 | 59 |
59 jobList = new JobListView(new JobSelectListener() { | 60 jobList = new JobListView(new JobSelectListener() { |
60 public void onJobSelected(int jobId) { | 61 public void onJobSelected(int jobId) { |
61 showJob(jobId); | 62 showJob(jobId); |
62 } | 63 } |
63 }); | 64 }); |
64 jobDetail = new JobDetailView(new JobDetailListener() { | 65 jobDetail = new JobDetailView(new JobDetailListener() { |
65 public void onHostSelected(String hostname) { | 66 public void onHostSelected(String hostname) { |
66 showHost(hostname); | 67 showHost(hostname); |
67 } | 68 } |
68 | 69 |
69 public void onCloneJob(JSONValue cloneInfo) { | 70 public void onCloneJob(JSONValue cloneInfo) { |
70 createJob.ensureInitialized(); | 71 createJob.ensureInitialized(); |
71 createJob.cloneJob(cloneInfo); | 72 createJob.cloneJob(cloneInfo); |
72 mainTabPanel.selectTabView(createJob); | 73 mainTabPanel.selectTabView(createJob); |
73 } | 74 } |
74 | 75 |
75 public void onCreateRecurringJob(int jobId) { | 76 public void onCreateRecurringJob(int jobId) { |
76 recurringView.ensureInitialized(); | 77 recurringView.ensureInitialized(); |
77 recurringView.createRecurringJob(jobId); | 78 recurringView.createRecurringJob(jobId); |
78 mainTabPanel.selectTabView(recurringView); | 79 mainTabPanel.selectTabView(recurringView); |
79 } | 80 } |
80 }); | 81 }); |
81 | 82 |
82 recurringView = new RecurringView(new RecurringSelectListener() {
| 83 recurringView = new RecurringView(new RecurringSelectListener() { |
83 public void onRecurringSelected(int jobId) { | 84 public void onRecurringSelected(int jobId) { |
84 showJob(jobId); | 85 showJob(jobId); |
85 } | 86 } |
86 }); | 87 }); |
87 | 88 |
88 createJob = AfeUtils.factory.getCreateJobView(jobCreateListener); | 89 createJob = AfeUtils.factory.getCreateJobView(jobCreateListener); |
89 | 90 |
90 hostListView = new HostListView(new HostListListener() { | 91 hostListView = new HostListView(new HostListListener() { |
91 public void onHostSelected(String hostname) { | 92 public void onHostSelected(String hostname) { |
92 showHost(hostname); | 93 showHost(hostname); |
93 } | 94 } |
94 }, jobCreateListener); | 95 }, jobCreateListener); |
95 | 96 |
96 hostDetailView = new HostDetailView(new HostDetailListener() { | 97 hostDetailView = new HostDetailView(new HostDetailListener() { |
97 public void onJobSelected(int jobId) { | 98 public void onJobSelected(int jobId) { |
98 showJob(jobId); | 99 showJob(jobId); |
99 } | 100 } |
100 }, jobCreateListener); | 101 }, jobCreateListener); |
101 | 102 |
102 userPreferencesView = new UserPreferencesView(new UserPreferencesListene
r() { | 103 userPreferencesView = new UserPreferencesView(new UserPreferencesListene
r() { |
103 public void onPreferencesChanged() { | 104 public void onPreferencesChanged() { |
104 createJob.onPreferencesChanged(); | 105 createJob.onPreferencesChanged(); |
105 } | 106 } |
106 }); | 107 }); |
107 | 108 |
108 TabView[] tabViews = new TabView[] {jobList, jobDetail, recurringView, c
reateJob, | 109 TabView[] tabViews = new TabView[] {jobList, jobDetail, recurringView, c
reateJob, |
109 hostListView, hostDetailView, userPr
eferencesView}; | 110 hostListView, hostDetailView, userPr
eferencesView}; |
110 for(int i = 0; i < tabViews.length; i++) { | 111 for (TabView tabView : tabViews) { |
111 mainTabPanel.addTabView(tabViews[i]); | 112 mainTabPanel.addTabView(tabView); |
112 } | 113 } |
113 | 114 |
114 final RootPanel tabsRoot = RootPanel.get("tabs"); | 115 final RootPanel tabsRoot = RootPanel.get("tabs"); |
115 tabsRoot.add(mainTabPanel); | 116 tabsRoot.add(mainTabPanel); |
116 CustomHistory.processInitialToken(); | 117 CustomHistory.processInitialToken(); |
117 mainTabPanel.initialize(); | 118 mainTabPanel.initialize(); |
118 tabsRoot.setStyleName(""); | 119 tabsRoot.setStyleName(""); |
119 } | 120 } |
120 | 121 |
121 protected void showJob(int jobId) { | 122 protected void showJob(int jobId) { |
122 jobDetail.ensureInitialized(); | 123 jobDetail.ensureInitialized(); |
123 jobDetail.updateObjectId(Integer.toString(jobId)); | 124 jobDetail.updateObjectId(Integer.toString(jobId)); |
124 mainTabPanel.selectTabView(jobDetail); | 125 mainTabPanel.selectTabView(jobDetail); |
125 } | 126 } |
126 | 127 |
127 protected void showHost(String hostname) { | 128 protected void showHost(String hostname) { |
128 hostDetailView.ensureInitialized(); | 129 hostDetailView.ensureInitialized(); |
129 hostDetailView.updateObjectId(hostname); | 130 hostDetailView.updateObjectId(hostname); |
130 mainTabPanel.selectTabView(hostDetailView); | 131 mainTabPanel.selectTabView(hostDetailView); |
131 } | 132 } |
132 } | 133 } |
OLD | NEW |