@Override public RequestFactoryEditorDriver< com.my.gae.client.proxy.PersonProxy, com.my.gae.client.managed.ui.PersonEditView> createEditorDriver() { RequestFactoryEditorDriver<PersonProxy, PersonEditView> driver = GWT.create(Driver.class); driver.initialize(this); return driver; }
@SuppressWarnings("deprecation") @Override public void saveEditedTitle() { titleEditorDriver .flush() .fire( new OSCEReceiver<Void>() { @SuppressWarnings("deprecation") @Override public void onSuccess(Void response) { requests .anamnesisCheckTitleRequest() .edittitleInSpportal(editedTitle.getId()) .fire( new OSCEReceiver<Boolean>() { @Override public void onSuccess(Boolean response) { if (response == null) { showErrorMessageToUser( "System could not edit AnamnesisCheckTitle in spportal"); } } }); titlePopupView.hide(); titlePopupView = null; titleEditorDriver = null; fireGetAllTitlesRequest(new FilterTitleReceiver()); getTitlesBySearchStringAndFilter(); } }); }
private void init() { request = requests.anamnesisCheckRequest(); if (anamnesisCheck == null) { AnamnesisCheckProxy anamnesisCheck = request.create(AnamnesisCheckProxy.class); this.anamnesisCheck = anamnesisCheck; view.setEditTitle(false); } else { // cannot be set via editor... view.setEditTitle(true); } // GWT.log("$$$$$$$$$$$$$$$$ anamnesisCheck be // title="+anamnesisCheck.getAnamnesisCheckTitle().getText()); // GWT.log("$$$$$$$$$$$$$$$$ anamnesisCheck be sort oder="+anamnesisCheck.getSort_order()); anamnesisCheckBefore = anamnesisCheck; Log.info("edit"); Log.info("persist"); request.persist().using(anamnesisCheck); editorDriver.edit(anamnesisCheck, request); Log.info("flush"); // editorDriver.flush(); Log.debug("Create für: " + anamnesisCheck.getId()); // manually update value fields... (no editor support) view.update(anamnesisCheck); initInsideTitle(); if (place.getOperation() == Operation.EDIT) { getQuestionsByselected(anamnesisCheck.getAnamnesisCheckTitle()); } else if (place.getOperation() == Operation.CREATE) { requests .anamnesisCheckTitleRequest() .findAnamnesisCheckTitle(Long.valueOf(place.getTitleId())) .fire( new Receiver<AnamnesisCheckTitleProxy>() { @Override public void onSuccess(AnamnesisCheckTitleProxy response) { getQuestionsByselected(response); } }); } }
@Override public void addAnswerClicked() { answerProxy.setAnswerText(answerDialogbox.getRichtTextHTML()); answerDriver .flush() .fire( new Receiver<Void>() { @Override public void onSuccess(Void response) { Log.info("fullSaved"); initAnswerView(); answerDialogbox.close(); // goTo(new PlaceAssesment(person.stableId())); } public void onFailure(ServerFailure error) { ErrorPanel erorPanel = new ErrorPanel(); erorPanel.setErrorMessage(error.getMessage()); Log.error(error.getMessage()); } @Override public void onViolation(Set<Violation> errors) { Iterator<Violation> iter = errors.iterator(); String message = ""; while (iter.hasNext()) { message += iter.next().getMessage() + "<br>"; } Log.warn( McAppConstant.ERROR_WHILE_DELETE_VIOLATION + " in Antworten auflisten -" + message); ErrorPanel erorPanel = new ErrorPanel(); erorPanel.setErrorMessage(message); } }); }
@Override public void addNewAnswerClicked() { answerDialogbox = new AnswerDialogboxImpl(); answerDialogbox.setDelegate(this); answerDriver = answerDialogbox.createEditorDriver(); AnswerRequest request = requests.answerRequest(); this.answerProxy = request.create(AnswerProxy.class); request.persist().using(answerProxy); answerProxy.setQuestion(question); answerProxy.setDateAdded(new Date()); answerProxy.setAutor(loggedUser); if (loggedUser.getIsAdmin()) { answerProxy.setIsAnswerAcceptedAdmin(true); answerProxy.setIsAnswerAcceptedAutor(false); answerProxy.setRewiewer(question.getAutor()); } else { answerProxy.setIsAnswerAcceptedAdmin(false); answerProxy.setIsAnswerAcceptedAutor(true); } answerProxy.setIsAnswerAcceptedReviewWahrer(false); answerDialogbox.setRichPanelHTML(answerProxy.getAnswerText()); answerProxy.setIsAnswerActive(false); answerDriver.edit(answerProxy, request); answerDriver.flush(); answerDialogbox.setValidityPickerValues(Arrays.asList(Validity.values())); answerDialogbox.setRewiewerPickerValues(Collections.<PersonProxy>emptyList()); requests .personRequest() .findPersonEntries(0, 50) .with(medizin.client.managed.ui.PersonProxyRenderer.instance().getPaths()) .fire( new Receiver<List<PersonProxy>>() { public void onSuccess(List<PersonProxy> response) { List<PersonProxy> values = new ArrayList<PersonProxy>(); values.add(null); values.addAll(response); answerDialogbox.setRewiewerPickerValues(values); } }); // answerDialogbox.setAutorPickerValues(Collections.<PersonProxy>emptyList()); // requests.personRequest().findPersonEntries(0, // 50).with(medizin.client.managed.ui.PersonProxyRenderer.instance().getPaths()).fire(new // Receiver<List<PersonProxy>>() { // // public void onSuccess(List<PersonProxy> response) { // List<PersonProxy> values = new ArrayList<PersonProxy>(); // values.add(null); // values.addAll(response); // answerDialogbox.setAutorPickerValues(values); // } // }); answerDialogbox.display(); }
// use this to check if some value has changed since editing has started private boolean changed() { return editorDriver != null && editorDriver.flush().isChanged(); }
@SuppressWarnings("deprecation") @Override public void saveClicked() { Log.info("saveClicked"); request = (AnamnesisCheckRequest) editorDriver.flush(); anamnesisCheck = request.edit(anamnesisCheck); anamnesisCheck.setValue(view.getValue()); Long selectedInsideTitle = -1L; if (view.getSelectedInsideTitle() != null && !view.getSelectedInsideTitle().equals("") && view.getSelectedInsideTitle().length() != 0) { selectedInsideTitle = Long.valueOf(view.getSelectedInsideTitle()); } if (selectedInsideTitle != -1L) { requests .anamnesisCheckTitleRequest() .findAnamnesisCheckTitle(selectedInsideTitle) .fire( new Receiver<AnamnesisCheckTitleProxy>() { public void onFailure(ServerFailure error) { Log.error(error.getMessage()); } @Override public void onSuccess(AnamnesisCheckTitleProxy response) { // GWT.log("$$$$$$$$$$$$$$$$$$$$ anamnesisCheck.getAnamnesisCheckTitle().getText() // = "+anamnesisCheck.getAnamnesisCheckTitle().getText()); // GWT.log("$$$$$$$$$$$$$$$$$$$$ response.getText() = "+response.getText()); // if(anamnesisCheckTitleBefore != null && // anamnesisCheckTitleBefore.getId() == // response.getId()){ // isTitleChange = false ; // }else{ // isTitleChange = true ; // } // GWT.log("$$$$$$$$$$$$$$$$$$$$ isTitleChange = "+isTitleChange); anamnesisCheck.setAnamnesisCheckTitle(response); // if(isTitleChange == true && place.getOperation() // == Operation.EDIT){ // reSorting(anamnesisCheckTitleBefore, // anamnesisCheck.getSort_order()); // }else{ // saveData(); // } // save data // Highlight onViolation Log.info("Map Size: " + view.getAnamnesisCheckMap().size()); request.fire( new OSCEReceiver<Void>(view.getAnamnesisCheckMap()) { // E Highlight onViolation public void onFailure(ServerFailure error) { Log.error(error.getMessage()); } // Highlight onViolation /*@Override public void onViolation(Set<Violation> errors) { Iterator<Violation> iter = errors .iterator(); String message = ""; while (iter.hasNext()) { message += iter.next().getMessage() + "<br>"; } Log.warn(" in AnamnesisCheck -" + message); }*/ // E Highlight onViolation @Override public void onSuccess(Void response) { Log.info("AnamnesisCheck successfully saved."); save = true; saveOrEditAnamnesisCheckTitleInSpportal(anamnesisCheck); sortOderByPrevious(); // placeController.goTo(new // AnamnesisCheckDetailsPlace(anamnesisCheck.stableId(), // Operation.NEW)); } }); } }); } else { Window.alert("Please choose a title!"); } }