1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.organization.ui.client.mvc.controller; |
17 | |
|
18 | |
|
19 | |
import static org.kuali.student.core.organization.ui.client.mvc.view.CommonConfigurer.getLabel; |
20 | |
|
21 | |
import java.util.HashMap; |
22 | |
import java.util.List; |
23 | |
import java.util.Map; |
24 | |
|
25 | |
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
26 | |
import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor; |
27 | |
import org.kuali.student.common.ui.client.configurable.mvc.layouts.TabbedSectionLayout; |
28 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.BaseSection; |
29 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
30 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
31 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
32 | |
import org.kuali.student.common.ui.client.event.ModifyActionEvent; |
33 | |
import org.kuali.student.common.ui.client.event.ModifyActionHandler; |
34 | |
import org.kuali.student.common.ui.client.event.SaveActionEvent; |
35 | |
import org.kuali.student.common.ui.client.event.SaveActionHandler; |
36 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
37 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
38 | |
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
39 | |
import org.kuali.student.common.ui.client.mvc.ModelProvider; |
40 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
41 | |
import org.kuali.student.common.ui.client.mvc.View; |
42 | |
import org.kuali.student.common.ui.client.mvc.WorkQueue; |
43 | |
import org.kuali.student.common.ui.client.mvc.WorkQueue.WorkItem; |
44 | |
import org.kuali.student.common.ui.client.service.DataSaveResult; |
45 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
46 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
47 | |
import org.kuali.student.common.ui.client.widgets.KSLightBox; |
48 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.OkGroup; |
49 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.OkEnum; |
50 | |
import org.kuali.student.common.ui.client.widgets.containers.KSTitleContainerImpl; |
51 | |
import org.kuali.student.common.ui.client.widgets.progress.BlockingTask; |
52 | |
import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator; |
53 | |
import org.kuali.student.common.ui.client.widgets.search.KSPicker; |
54 | |
import org.kuali.student.common.ui.shared.IdAttributes; |
55 | |
import org.kuali.student.core.assembly.data.Data; |
56 | |
import org.kuali.student.core.assembly.data.Metadata; |
57 | |
import org.kuali.student.core.assembly.data.QueryPath; |
58 | |
import org.kuali.student.core.assembly.data.Data.StringValue; |
59 | |
import org.kuali.student.core.assembly.data.Data.Value; |
60 | |
import org.kuali.student.core.organization.ui.client.mvc.model.SectionConfigInfo; |
61 | |
import org.kuali.student.core.organization.ui.client.mvc.view.CommonConfigurer; |
62 | |
import org.kuali.student.core.organization.ui.client.mvc.view.CommonConfigurer.SectionsEnum; |
63 | |
import org.kuali.student.core.organization.ui.client.service.OrgRpcService; |
64 | |
import org.kuali.student.core.organization.ui.client.service.OrgRpcServiceAsync; |
65 | |
import org.kuali.student.core.validation.dto.ValidationResultInfo; |
66 | |
import org.kuali.student.core.validation.dto.ValidationResultInfo.ErrorLevel; |
67 | |
|
68 | |
import com.google.gwt.core.client.GWT; |
69 | |
import com.google.gwt.event.dom.client.ClickEvent; |
70 | |
import com.google.gwt.event.dom.client.ClickHandler; |
71 | |
import com.google.gwt.user.client.ui.HorizontalPanel; |
72 | |
import com.google.gwt.user.client.ui.Widget; |
73 | |
|
74 | 0 | public class OrgProposalController extends TabbedSectionLayout{ |
75 | |
|
76 | 0 | private final DataModel orgProposalModel = new DataModel(); |
77 | |
private WorkQueue modelRequestQueue; |
78 | 0 | private static KSTitleContainerImpl container = new KSTitleContainerImpl(getLabel("orgTitleOrg"), getLabel("orgCrud"),""); |
79 | 0 | private boolean initialized = false; |
80 | 0 | private CommonConfigurer commonConfigurer = new CommonConfigurer(); |
81 | 0 | private boolean isMetadataRefreshed = false; |
82 | |
|
83 | |
public static final String ORG_INFO_PATH = "orgInfo"; |
84 | |
public static final String POSITION_PATH = "OrgPositionRestrictionInfo"; |
85 | |
public static final String PERSON_PATH = "orgPersonRelationInfo"; |
86 | |
public static final String ORGORG_PATH = "orgOrgRelationInfo"; |
87 | 0 | public static final String ORG_TAB_NAME = getLabel("orgOrgTab"); |
88 | 0 | public static final String POSITION_TAB_NAME = getLabel("orgPositionTab"); |
89 | 0 | public static final String SEARCH_TAB_NAME = getLabel("orgSearchTab"); |
90 | |
public static final String QUALIFICATION_ORG_ID = "orgId"; |
91 | |
public static final String ORG_PROPOSAL_MODEL = "orgProposalModel"; |
92 | |
|
93 | 0 | private BlockingTask initializingTask = new BlockingTask(getLabel("orgLoading")); |
94 | |
|
95 | 0 | OrgRpcServiceAsync orgProposalRpcServiceAsync = GWT.create(OrgRpcService.class); |
96 | |
|
97 | |
public OrgProposalController(){ |
98 | 0 | super(OrgProposalController.class.getName(), container); |
99 | 0 | initialize(); |
100 | 0 | } |
101 | |
|
102 | |
private void initialize() { |
103 | 0 | super.setDefaultModelId(CommonConfigurer.ORG_PROPOSAL_MODEL); |
104 | 0 | super.registerModel(CommonConfigurer.ORG_PROPOSAL_MODEL, new ModelProvider<DataModel>() { |
105 | |
|
106 | |
@Override |
107 | |
public void requestModel(final ModelRequestCallback<DataModel> callback) { |
108 | 0 | if (modelRequestQueue == null){ |
109 | 0 | modelRequestQueue = new WorkQueue(); |
110 | |
} |
111 | 0 | WorkItem workItem = new WorkItem(){ |
112 | |
@Override |
113 | |
public void exec(Callback<Boolean> workCompleteCallback) { |
114 | 0 | if (orgProposalModel.getRoot() == null || orgProposalModel.getRoot().size() == 0){ |
115 | 0 | createNewOrgModel(callback, workCompleteCallback); |
116 | |
|
117 | |
} else { |
118 | 0 | callback.onModelReady(orgProposalModel); |
119 | 0 | workCompleteCallback.exec(true); |
120 | |
} |
121 | 0 | } |
122 | |
}; |
123 | 0 | modelRequestQueue.submit(workItem); |
124 | 0 | } |
125 | |
}); |
126 | 0 | } |
127 | |
|
128 | |
private KSButton getSaveButton(){ |
129 | 0 | return new KSButton(getLabel("orgSave"), new ClickHandler(){ |
130 | |
public void onClick(ClickEvent event) { |
131 | 0 | fireApplicationEvent(new SaveActionEvent()); |
132 | 0 | } |
133 | |
}); |
134 | |
} |
135 | |
|
136 | |
private KSButton getModifyButton(){ |
137 | 0 | return new KSButton(getLabel("orgModify"), new ClickHandler(){ |
138 | |
public void onClick(ClickEvent event) { |
139 | 0 | getView(SectionsEnum.SEARCH, new Callback<View>(){ |
140 | |
@Override |
141 | |
public void exec(View result) { |
142 | 0 | List<Section> sections = null; |
143 | 0 | String fieldKey = null; |
144 | 0 | Value val = null; |
145 | 0 | View view = result; |
146 | 0 | if(view instanceof SectionView){ |
147 | 0 | List<FieldDescriptor> lfd = ((SectionView)view).getFields(); |
148 | 0 | for(FieldDescriptor fd : lfd){ |
149 | 0 | Widget widget = fd.getFieldWidget(); |
150 | 0 | if(widget instanceof KSPicker){ |
151 | 0 | val = ((KSPicker)widget).getValue(); |
152 | 0 | fieldKey = fd.getFieldKey(); |
153 | |
} |
154 | 0 | } |
155 | 0 | sections = ((SectionView)view).getSections(); |
156 | 0 | String strval = ((StringValue)val).get(); |
157 | 0 | if(strval != null && !strval.equals("")){ |
158 | 0 | getCurrentView().updateModel(); |
159 | 0 | fireApplicationEvent(new ModifyActionEvent((String)orgProposalModel.get("orgSearchInfo/searchOrgs"))); |
160 | |
} else{ |
161 | |
|
162 | 0 | for(Section section : sections){ |
163 | 0 | if(section instanceof BaseSection){ |
164 | |
|
165 | 0 | ValidationResultInfo vr = new ValidationResultInfo(); |
166 | 0 | vr.setError(getLabel("orgFieldCantBeEmpty")); |
167 | 0 | section.getField(fieldKey).getFieldElement().processValidationResult(vr); |
168 | 0 | } |
169 | |
} |
170 | |
} |
171 | |
} |
172 | 0 | } |
173 | |
}); |
174 | 0 | } |
175 | |
}); |
176 | |
} |
177 | |
|
178 | |
private void init(final Callback<Boolean> onReadyCallback){ |
179 | |
|
180 | 0 | if (initialized) { |
181 | 0 | onReadyCallback.exec(true); |
182 | |
} else { |
183 | 0 | KSBlockingProgressIndicator.addTask(initializingTask); |
184 | |
|
185 | 0 | String viewContextId = null; |
186 | 0 | if(getViewContext().getIdType() != null){ |
187 | 0 | viewContextId = getViewContext().getId(); |
188 | |
} |
189 | |
|
190 | 0 | Map<String,String> idAttributes = new HashMap<String,String>(); |
191 | 0 | idAttributes.put(IdAttributes.ID_TYPE, QUALIFICATION_ORG_ID); |
192 | 0 | orgProposalRpcServiceAsync.getMetadata(viewContextId, idAttributes, |
193 | 0 | new KSAsyncCallback<Metadata>(){ |
194 | |
|
195 | |
@Override |
196 | |
public void handleFailure(Throwable caught) { |
197 | 0 | GWT.log("Failure",null); |
198 | 0 | KSBlockingProgressIndicator.removeTask(initializingTask); |
199 | 0 | throw new RuntimeException("Failed to get model definition.", caught); |
200 | |
} |
201 | |
|
202 | |
@Override |
203 | |
public void onSuccess(Metadata result) { |
204 | |
|
205 | 0 | DataModelDefinition def = new DataModelDefinition(result); |
206 | 0 | GWT.log("Loaded OrgMetaData",null); |
207 | 0 | orgProposalModel.setDefinition(def); |
208 | 0 | commonConfigurer.setModelDefinition(def); |
209 | 0 | setSectionConfig(onReadyCallback); |
210 | 0 | KSBlockingProgressIndicator.removeTask(initializingTask); |
211 | 0 | isMetadataRefreshed = true; |
212 | 0 | } |
213 | |
}); |
214 | |
|
215 | |
} |
216 | 0 | } |
217 | |
|
218 | |
private void setSectionConfig(final Callback<Boolean> onReadyCallback){ |
219 | 0 | orgProposalRpcServiceAsync.getSectionConfig( |
220 | 0 | new KSAsyncCallback<SectionConfigInfo>(){ |
221 | |
|
222 | |
@Override |
223 | |
public void handleFailure(Throwable caught) { |
224 | 0 | GWT.log("Failure", null); |
225 | 0 | throw new RuntimeException("Failed to get section config.", caught); |
226 | |
} |
227 | |
|
228 | |
@Override |
229 | |
public void onSuccess(SectionConfigInfo result) { |
230 | 0 | GWT.log("Loaded SectionConfig", null); |
231 | 0 | commonConfigurer.setSectionConfigInfo(result); |
232 | 0 | init(); |
233 | 0 | onReadyCallback.exec(true); |
234 | 0 | } |
235 | |
}); |
236 | 0 | } |
237 | |
|
238 | |
private void init(){ |
239 | |
|
240 | 0 | if(isMetadataRefreshed){ |
241 | 0 | commonConfigurer.configureOrgProposal(this); |
242 | 0 | isMetadataRefreshed = false; |
243 | |
} |
244 | |
|
245 | 0 | if(!initialized){ |
246 | 0 | addButton(ORG_TAB_NAME, getSaveButton()); |
247 | 0 | addButton(POSITION_TAB_NAME, getSaveButton()); |
248 | 0 | addButton(SEARCH_TAB_NAME, getModifyButton()); |
249 | |
|
250 | 0 | addApplicationEventHandler(ModifyActionEvent.TYPE, new ModifyActionHandler(){ |
251 | |
@Override |
252 | |
public void onModify(ModifyActionEvent modifyEvent) { |
253 | 0 | GWT.log("OrgController received save action request.", null); |
254 | 0 | doModifyAction(modifyEvent); |
255 | |
|
256 | 0 | } |
257 | |
}); |
258 | 0 | addApplicationEventHandler(SaveActionEvent.TYPE, new SaveActionHandler(){ |
259 | |
public void doSave(SaveActionEvent saveAction) { |
260 | 0 | GWT.log("OrgController received save action request.", null); |
261 | 0 | doSaveAction(saveAction); |
262 | 0 | } |
263 | |
}); |
264 | 0 | setButtonPermission(); |
265 | |
} |
266 | 0 | initialized = true; |
267 | 0 | } |
268 | |
|
269 | |
|
270 | |
@Override |
271 | |
public Class<? extends Enum<?>> getViewsEnum() { |
272 | 0 | return null; |
273 | |
} |
274 | |
|
275 | |
|
276 | |
@SuppressWarnings("unchecked") |
277 | |
private void createNewOrgModel(final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
278 | 0 | orgProposalModel.setRoot(new Data()); |
279 | 0 | callback.onModelReady(orgProposalModel); |
280 | 0 | workCompleteCallback.exec(true); |
281 | |
|
282 | |
|
283 | 0 | } |
284 | |
|
285 | |
public void doSaveAction(final SaveActionEvent saveActionEvent){ |
286 | 0 | GWT.log("Reached save action",null); |
287 | |
|
288 | |
|
289 | 0 | getView(CommonConfigurer.SectionsEnum.ORG_INFO, new Callback<View>(){ |
290 | |
@Override |
291 | |
public void exec(View result) { |
292 | 0 | View tempView2 = result; |
293 | 0 | tempView2.updateModel(); |
294 | 0 | getCurrentView().updateModel(); |
295 | 0 | requestModel(new ModelRequestCallback<DataModel>() { |
296 | |
@Override |
297 | |
public void onModelReady(DataModel model) { |
298 | 0 | model.validate(new Callback<List<ValidationResultInfo>>() { |
299 | |
|
300 | |
@Override |
301 | |
public void exec(List<ValidationResultInfo> result) { |
302 | 0 | boolean save = true; |
303 | 0 | View v = getCurrentView(); |
304 | 0 | if(v instanceof Section){ |
305 | 0 | ((Section) v).setFieldHasHadFocusFlags(true); |
306 | 0 | ErrorLevel status = ((Section) v).processValidationResults(result); |
307 | 0 | if(status == ErrorLevel.ERROR){ |
308 | 0 | save = false; |
309 | |
} |
310 | |
} |
311 | |
|
312 | 0 | if(save){ |
313 | 0 | GWT.log(" model updated ", null); |
314 | 0 | saveProposalOrg(saveActionEvent); |
315 | 0 | GWT.log("Reached summit 1 ", null); |
316 | |
} |
317 | 0 | } |
318 | |
|
319 | |
}); |
320 | 0 | } |
321 | |
|
322 | |
@Override |
323 | |
public void onRequestFail(Throwable cause) { |
324 | 0 | GWT.log("Unable to retrieve model for validation and save", cause); |
325 | |
|
326 | 0 | } |
327 | |
}); |
328 | 0 | } |
329 | |
}); |
330 | 0 | } |
331 | |
|
332 | |
private void setButtonPermission(){ |
333 | 0 | HorizontalPanel buttonPanel = getButtonPanel(ORG_TAB_NAME); |
334 | 0 | QueryPath orgInfoPath = QueryPath.concat(null, ORG_INFO_PATH); |
335 | 0 | QueryPath orgOrgPath = QueryPath.concat(null, ORGORG_PATH); |
336 | 0 | QueryPath orgPosPath = QueryPath.concat(null, POSITION_PATH); |
337 | 0 | QueryPath orgPersonPath = QueryPath.concat(null, PERSON_PATH); |
338 | 0 | Metadata orgInfometa = orgProposalModel.getMetadata(orgInfoPath); |
339 | 0 | Metadata orgOrgmeta = orgProposalModel.getMetadata(orgOrgPath); |
340 | 0 | Metadata orgPosmeta = orgProposalModel.getMetadata(orgPosPath); |
341 | 0 | Metadata orgPersonmeta = orgProposalModel.getMetadata(orgPersonPath); |
342 | |
|
343 | 0 | if(orgInfometa.isCanEdit()||orgOrgmeta.isCanEdit()||orgPosmeta.isCanEdit()){ |
344 | 0 | buttonPanel.setVisible(true); |
345 | |
} |
346 | |
else{ |
347 | 0 | buttonPanel.setVisible(false); |
348 | |
} |
349 | 0 | buttonPanel = getButtonPanel(POSITION_TAB_NAME); |
350 | 0 | orgInfoPath = QueryPath.concat(null, ORG_INFO_PATH); |
351 | 0 | if(!orgPersonmeta.isCanEdit()){ |
352 | 0 | buttonPanel.setVisible(false); |
353 | |
} |
354 | |
else{ |
355 | 0 | buttonPanel.setVisible(true); |
356 | |
} |
357 | 0 | } |
358 | |
|
359 | |
public void doModifyAction(final ModifyActionEvent modifyActionEvent){ |
360 | 0 | GWT.log("Reached modify action", null); |
361 | |
|
362 | 0 | Map<String,String> idAttributes = new HashMap<String,String>(); |
363 | 0 | idAttributes.put(IdAttributes.ID_TYPE, QUALIFICATION_ORG_ID); |
364 | 0 | orgProposalRpcServiceAsync.getMetadata(modifyActionEvent.getId(),idAttributes, |
365 | 0 | new KSAsyncCallback<Metadata>(){ |
366 | |
|
367 | |
@Override |
368 | |
public void handleFailure(Throwable caught) { |
369 | 0 | GWT.log("Failure",null); |
370 | 0 | throw new RuntimeException("Failed to get model definition.", caught); |
371 | |
} |
372 | |
|
373 | |
@Override |
374 | |
public void onSuccess(Metadata result) { |
375 | |
|
376 | 0 | DataModelDefinition def = new DataModelDefinition(result); |
377 | 0 | GWT.log("Loaded OrgMetaData",null); |
378 | 0 | orgProposalModel.setDefinition(def); |
379 | 0 | commonConfigurer.setModelDefinition(def); |
380 | 0 | isMetadataRefreshed = true; |
381 | 0 | init(); |
382 | 0 | GWT.log(" model updated ",null); |
383 | 0 | fetchProposalOrg(modifyActionEvent); |
384 | 0 | GWT.log("Reached summit 1 ",null); |
385 | |
|
386 | 0 | } |
387 | |
}); |
388 | |
|
389 | |
|
390 | 0 | } |
391 | |
|
392 | |
public void fetchProposalOrg(final ModifyActionEvent modifyActionEvent) { |
393 | |
|
394 | 0 | orgProposalRpcServiceAsync.fetchOrg(modifyActionEvent.getId(), new KSAsyncCallback<Data>() { |
395 | |
public void handleFailure(Throwable caught) { |
396 | 0 | GWT.log("Fetch Failed.", caught); |
397 | 0 | } |
398 | |
|
399 | |
public void onSuccess(Data result) { |
400 | 0 | orgProposalModel.setRoot(result); |
401 | 0 | commonConfigurer.positionTable.setOrgId((String)orgProposalModel.get("orgInfo/id")); |
402 | 0 | commonConfigurer.positionTable.fetchPosition(); |
403 | 0 | commonConfigurer.setOrgId((String)orgProposalModel.get("orgInfo/id")); |
404 | 0 | getContainer().setTitle((String)orgProposalModel.get("orgInfo/longName")); |
405 | 0 | getView(CommonConfigurer.SectionsEnum.ORG_INFO, new Callback<View>(){ |
406 | |
@Override |
407 | |
public void exec(View result) { |
408 | 0 | final View orgView = result; |
409 | 0 | setButtonPermission(); |
410 | |
|
411 | 0 | if (orgView instanceof VerticalSectionView) { |
412 | 0 | ((VerticalSectionView) orgView).beforeShow(new Callback<Boolean>(){ |
413 | |
|
414 | |
@Override |
415 | |
public void exec(Boolean result) { |
416 | 0 | renderView(orgView); |
417 | 0 | } |
418 | |
|
419 | |
}); |
420 | |
|
421 | |
} |
422 | 0 | } |
423 | |
}); |
424 | 0 | } |
425 | |
}); |
426 | 0 | } |
427 | |
|
428 | |
public void saveProposalOrg(final SaveActionEvent saveActionEvent){ |
429 | 0 | final KSLightBox saveWindow = new KSLightBox(); |
430 | 0 | saveWindow.removeCloseLink(); |
431 | 0 | final KSLabel saveMessage = new KSLabel(saveActionEvent.getMessage() + "..."); |
432 | 0 | final OkGroup buttonGroup = new OkGroup(new Callback<OkEnum>(){ |
433 | |
|
434 | |
@Override |
435 | |
public void exec(OkEnum result) { |
436 | 0 | saveWindow.hide(); |
437 | 0 | saveActionEvent.doActionComplete(); |
438 | 0 | } |
439 | |
}); |
440 | |
|
441 | 0 | buttonGroup.setWidth("250px"); |
442 | 0 | buttonGroup.getButton(OkEnum.Ok).setEnabled(false); |
443 | 0 | buttonGroup.setContent(saveMessage); |
444 | |
|
445 | 0 | if (saveActionEvent.isAcknowledgeRequired()){ |
446 | 0 | saveWindow.setWidget(buttonGroup); |
447 | |
} else { |
448 | 0 | saveWindow.setWidget(saveMessage); |
449 | |
} |
450 | 0 | saveWindow.show(); |
451 | |
|
452 | 0 | orgProposalRpcServiceAsync.saveOrgProposal(orgProposalModel.getRoot(), new KSAsyncCallback<DataSaveResult>(){ |
453 | |
public void handleFailure(Throwable caught) { |
454 | 0 | GWT.log("Save Failed.", caught); |
455 | 0 | saveWindow.setWidget(buttonGroup); |
456 | 0 | saveMessage.setText(getLabel("orgSaveFailed")); |
457 | 0 | buttonGroup.getButton(OkEnum.Ok).setEnabled(true); |
458 | 0 | } |
459 | |
|
460 | |
public void onSuccess(DataSaveResult result) { |
461 | |
|
462 | |
|
463 | 0 | orgProposalModel.setRoot(result.getValue()); |
464 | |
|
465 | 0 | View currentView = getCurrentView(); |
466 | 0 | commonConfigurer.positionTable.setOrgId((String)orgProposalModel.get("orgInfo/id")); |
467 | 0 | commonConfigurer.positionTable.fetchPosition(); |
468 | 0 | commonConfigurer.setOrgId((String)orgProposalModel.get("orgInfo/id")); |
469 | 0 | getContainer().setTitle((String)orgProposalModel.get("orgInfo/longName")); |
470 | 0 | if(currentView.getName().equals(getLabel("orgPositionRelationSection"))){ |
471 | 0 | commonConfigurer.positionTable.fetchPosition(); |
472 | |
} |
473 | 0 | if (saveActionEvent.isAcknowledgeRequired()){ |
474 | 0 | saveMessage.setText(getLabel("orgSaveOk")); |
475 | 0 | buttonGroup.getButton(OkEnum.Ok).setEnabled(true); |
476 | 0 | if( viewMap.get(CommonConfigurer.SectionsEnum.POSITIONS) instanceof SectionView){ |
477 | 0 | SectionView view = (SectionView) viewMap.get(CommonConfigurer.SectionsEnum.POSITIONS); |
478 | 0 | orgProposalModel.setRoot(result.getValue()); |
479 | 0 | view.updateView(orgProposalModel); |
480 | |
} |
481 | 0 | if( viewMap.get(CommonConfigurer.SectionsEnum.ORG_INFO) instanceof SectionView){ |
482 | 0 | SectionView view = (SectionView) viewMap.get(CommonConfigurer.SectionsEnum.ORG_INFO); |
483 | 0 | orgProposalModel.setRoot(result.getValue()); |
484 | 0 | view.updateView(orgProposalModel); |
485 | 0 | } |
486 | |
} else { |
487 | 0 | saveWindow.hide(); |
488 | 0 | saveActionEvent.doActionComplete(); |
489 | |
} |
490 | |
|
491 | 0 | GWT.log("OrgSaved",null); |
492 | 0 | } |
493 | |
}); |
494 | 0 | } |
495 | |
|
496 | |
@Override |
497 | |
public void showDefaultView(final Callback<Boolean> onReadyCallback) { |
498 | 0 | init(new Callback<Boolean>() { |
499 | |
|
500 | |
@Override |
501 | |
public void exec(Boolean result) { |
502 | 0 | if (result) { |
503 | 0 | doShowDefaultView(onReadyCallback); |
504 | |
} else { |
505 | 0 | onReadyCallback.exec(false); |
506 | |
} |
507 | 0 | } |
508 | |
}); |
509 | 0 | } |
510 | |
|
511 | |
private void doShowDefaultView(final Callback<Boolean> onReadyCallback) { |
512 | 0 | super.showDefaultView(onReadyCallback); |
513 | 0 | } |
514 | |
} |