public void setValue(AnswerProxy proxy) {
   this.proxy = proxy;
   dateAdded.setInnerText(
       proxy.getDateAdded() == null
           ? ""
           : DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT)
               .format(proxy.getDateAdded()));
   dateChanged.setInnerText(
       proxy.getDateChanged() == null
           ? ""
           : DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT)
               .format(proxy.getDateChanged()));
   rewiewer.setInnerText(
       proxy.getRewiewer() == null
           ? ""
           : medizin.client.managed.ui.PersonProxyRenderer.instance().render(proxy.getRewiewer()));
   autor.setInnerText(
       proxy.getAutor() == null
           ? ""
           : medizin.client.managed.ui.PersonProxyRenderer.instance().render(proxy.getAutor()));
   answerText.setInnerText(
       proxy.getAnswerText() == null ? "" : String.valueOf(proxy.getAnswerText()));
   isAnswerActive.setInnerText(
       proxy.getIsAnswerActive() == null ? "" : String.valueOf(proxy.getIsAnswerActive()));
   isPicture.setInnerText(
       proxy.getIsPicture() == null ? "" : String.valueOf(proxy.getIsPicture()));
   isAnswerAcceptedReviewWahrer.setInnerText(
       proxy.getIsAnswerAcceptedReviewWahrer() == null
           ? ""
           : String.valueOf(proxy.getIsAnswerAcceptedReviewWahrer()));
   isAnswerAcceptedAutor.setInnerText(
       proxy.getIsAnswerAcceptedAutor() == null
           ? ""
           : String.valueOf(proxy.getIsAnswerAcceptedAutor()));
   isAnswerAcceptedAdmin.setInnerText(
       proxy.getIsAnswerAcceptedAdmin() == null
           ? ""
           : String.valueOf(proxy.getIsAnswerAcceptedAdmin()));
   validity.setInnerText(proxy.getValidity() == null ? "" : String.valueOf(proxy.getValidity()));
   picturePath.setInnerText(
       proxy.getPicturePath() == null ? "" : String.valueOf(proxy.getPicturePath()));
   question.setInnerText(
       proxy.getQuestion() == null
           ? ""
           : medizin.client.managed.ui.QuestionProxyRenderer.instance()
               .render(proxy.getQuestion()));
   id.setInnerText(proxy.getId() == null ? "" : String.valueOf(proxy.getId()));
   version.setInnerText(proxy.getVersion() == null ? "" : String.valueOf(proxy.getVersion()));
   displayRenderer.setInnerText(
       medizin.client.managed.ui.AnswerProxyRenderer.instance().render(proxy));
 }
public abstract class QuestionSumPerPersonEditView_Roo_Gwt extends Composite
    implements View<QuestionSumPerPersonEditView> {

  @UiField(provided = true)
  ValueListBox<PersonProxy> responsiblePerson =
      new ValueListBox<PersonProxy>(
          medizin.client.managed.ui.PersonProxyRenderer.instance(),
          new com.google.gwt.requestfactory.ui.client.EntityProxyKeyProvider<
              medizin.client.managed.request.PersonProxy>());

  @UiField(provided = true)
  ValueListBox<QuestionEventProxy> questionEvent =
      new ValueListBox<QuestionEventProxy>(
          medizin.client.managed.ui.QuestionEventProxyRenderer.instance(),
          new com.google.gwt.requestfactory.ui.client.EntityProxyKeyProvider<
              medizin.client.managed.request.QuestionEventProxy>());

  @UiField(provided = true)
  ValueListBox<AssesmentProxy> assesment =
      new ValueListBox<AssesmentProxy>(
          medizin.client.managed.ui.AssesmentProxyRenderer.instance(),
          new com.google.gwt.requestfactory.ui.client.EntityProxyKeyProvider<
              medizin.client.managed.request.AssesmentProxy>());

  @UiField IntegerBox questionSum;

  @UiField IntegerBox sort_order;

  public void setAssesmentPickerValues(Collection<AssesmentProxy> values) {
    assesment.setAcceptableValues(values);
  }

  public void setQuestionEventPickerValues(Collection<QuestionEventProxy> values) {
    questionEvent.setAcceptableValues(values);
  }

  public void setResponsiblePersonPickerValues(Collection<PersonProxy> values) {
    responsiblePerson.setAcceptableValues(values);
  }
}
  @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();
  }
示例#4
0
public class AnswerDialogboxImpl extends DialogBox implements AnswerDialogbox, Editor<AnswerProxy> {

  private static EventAccessDialogboxImplUiBinder uiBinder =
      GWT.create(EventAccessDialogboxImplUiBinder.class);

  interface EventAccessDialogboxImplUiBinder extends UiBinder<Widget, AnswerDialogboxImpl> {}

  private Presenter presenter;

  @UiField Button closeButton;

  @UiHandler("closeButton")
  public void onCloseButtonClick(ClickEvent event) {
    hide();
  }

  interface EditorDriver extends RequestFactoryEditorDriver<AnswerProxy, AnswerDialogboxImpl> {}
  // private final EditorDriver editorDriver = GWT.create(EditorDriver.class);

  @Override
  public RequestFactoryEditorDriver<AnswerProxy, AnswerDialogboxImpl> createEditorDriver() {
    RequestFactoryEditorDriver<AnswerProxy, AnswerDialogboxImpl> driver =
        GWT.create(EditorDriver.class);
    driver.initialize(this);
    return driver;
  }

  @UiField SimplePanel toolbarPanel;

  public AnswerDialogboxImpl() {
    setWidget(uiBinder.createAndBindUi(this));
    setGlassEnabled(true);
    setAnimationEnabled(true);
    setTitle("Anzahl Fragentypen pro Prüfung hinzufügen");
    setText("Anzahl Fragentypen pro Prüfung hinzufügen");

    RichTextToolbar toolbar = new RichTextToolbar(answerTextArea);

    toolbarPanel.add(toolbar);
  }

  @Override
  public void setRichPanelHTML(String html) {
    // Log.error(html);
    answerTextArea.setHTML(html);
  }

  @Override
  public String getRichtTextHTML() {
    //		Log.info(questionTextArea.getHTML());
    //		Log.info(questionTextArea.getText());
    return answerTextArea.getHTML();
    //		return new String("<b>hallo</b>");
  }

  @UiField RichTextArea answerTextArea;

  private Delegate delegate;

  @Override
  public void setDelegate(Delegate delegate) {
    this.delegate = delegate;
  }

  @Override
  public void display() {
    center();
    show();
  }

  @UiField(provided = true)
  ValueListBox<PersonProxy> rewiewer =
      new ValueListBox<PersonProxy>(
          medizin.client.managed.ui.PersonProxyRenderer.instance(),
          new com.google.gwt.requestfactory.ui.client.EntityProxyKeyProvider<
              medizin.client.managed.request.PersonProxy>());

  @UiField(provided = true)
  ValueListBox<Validity> validity =
      new ValueListBox<Validity>(
          new AbstractRenderer<medizin.client.shared.Validity>() {

            public String render(medizin.client.shared.Validity obj) {
              return obj == null ? "" : String.valueOf(obj);
            }
          });

  @Override
  public void setRewiewerPickerValues(Collection<PersonProxy> values) {
    rewiewer.setAcceptableValues(values);
  }

  @Override
  public void setValidityPickerValues(Collection<Validity> values) {
    validity.setAcceptableValues(values);
  }

  @UiField Button save;

  @UiHandler("save")
  void onSave(ClickEvent event) {
    delegate.addAnswerClicked();
    // hide();
  }

  @Override
  public void close() {
    hide();
  }
}