private void start2() { if (loggedUser == null) return; requests .find(questionPlace.getProxyId()) .with( "previousVersion", "keywords", "questEvent", "comment", "questionType", "mcs", "rewiewer", "autor") .fire( new Receiver<Object>() { public void onFailure(ServerFailure error) { Log.error(error.getMessage()); } @Override public void onSuccess(Object response) { if (response instanceof QuestionProxy) { Log.info(((QuestionProxy) response).getQuestionText()); init((QuestionProxy) response); } } }); }
@Override public PlaceAssesmentDetails getPlace(String token) { Log.debug("Im PlaceAssesmentDetails.getPlace: Token -" + token); String bits[] = token.split(SEPARATOR); Operation operation = Operation.valueOf(bits[1]); if (Operation.DETAILS == operation) { return new PlaceAssesmentDetails(requestFactory.getProxyId(bits[0]), Operation.DETAILS); } if (Operation.EDIT == operation) { return new PlaceAssesmentDetails(requestFactory.getProxyId(bits[0]), Operation.EDIT); } if (Operation.CREATE == operation) { return new PlaceAssesmentDetails(/*requestFactory.getProxyId(bits[0]), */ Operation.CREATE); } return new PlaceAssesmentDetails(token); }
private void initAnswerView() { if (answerRangeChangeHandler != null) { answerRangeChangeHandler.removeHandler(); answerRangeChangeHandler = null; } requests .answerRequestNonRoo() .contAnswersByQuestion(question.getId()) .fire( new Receiver<Long>() { @Override public void onSuccess(Long response) { answerTable.setRowCount(response.intValue(), true); onAnswerTableRangeChanged(); } 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 Antwort hinzufügen -" + message); ErrorPanel erorPanel = new ErrorPanel(); erorPanel.setErrorMessage(message); } }); answerRangeChangeHandler = answerTable.addRangeChangeHandler( new RangeChangeEvent.Handler() { public void onRangeChange(RangeChangeEvent event) { ActivityQuestionDetails.this.onAnswerTableRangeChanged(); } }); }
@Override public void deleteClicked() { requests .questionRequest() .remove() .using(question) .fire( new Receiver<Void>() { public void onSuccess(Void ignore) { Log.debug("Sucessfull deleted"); placeController.goTo(new PlaceQuestion("PlaceQuestion!DELETED")); } @Override public void onFailure(ServerFailure error) { Log.warn(McAppConstant.ERROR_WHILE_DELETE + " in Assesment -" + error.getMessage()); if (error.getMessage().contains("ConstraintViolationException")) { Log.debug("Fehlen beim erstellen: Doppelter name"); // TODO // mcAppFactory.getErrorPanel().setErrorMessage(McAppConstant.EVENT_IS_REFERENCED); } } @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 Event -" + message); // TODO mcAppFactory.getErrorPanel().setErrorMessage(message); } }); }
protected void onAnswerTableRangeChanged() { final Range range = answerTable.getVisibleRange(); requests .answerRequestNonRoo() .findAnswersEntriesByQuestion(question.getId(), range.getStart(), range.getLength()) .fire( new Receiver<List<AnswerProxy>>() { @Override public void onSuccess(List<AnswerProxy> response) { answerTable.setRowData(range.getStart(), response); } 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 Antwort hinzufügen -" + message); ErrorPanel erorPanel = new ErrorPanel(); erorPanel.setErrorMessage(message); } }); }
@Override public void deleteAnswerClicked(AnswerProxy answer) { requests .answerRequestNonRoo() .eliminateAnswer() .using(answer) .fire( new Receiver<Void>() { @Override public void onSuccess(Void arg0) { initAnswerView(); } 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 Antwort löschen -" + 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(); }
@Override public void start2(AcceptsOneWidget panel, EventBus eventBus) { questionDetailsView = new QuestionDetailsViewImpl(); questionDetailsView.setName("hallo"); questionDetailsView.setPresenter(this); this.widget = panel; this.view = questionDetailsView; widget.setWidget(questionDetailsView.asWidget()); // setTable(view.getTable()); eventBus.addHandler( PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() { public void onPlaceChange(PlaceChangeEvent event) { // updateSelection(event.getNewPlace()); // TODO implement } }); // init(); view.setDelegate(this); this.answerListView = view.getAnswerListViewImpl(); answerListView.setDelegate(this); this.answerTable = answerListView.getTable(); requests .personRequestNonRoo() .myGetLoggedPerson() .fire( new Receiver<PersonProxy>() { @Override public void onSuccess(PersonProxy response) { loggedUser = response; start2(); } public void onFailure(ServerFailure error) { ErrorPanel erorPanel = new ErrorPanel(); erorPanel.setErrorMessage(error.getMessage()); Log.error(error.getMessage()); onStop(); } @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 Antwort löschen -" + message); ErrorPanel erorPanel = new ErrorPanel(); erorPanel.setErrorMessage(message); onStop(); } }); }