I have an simple editor, it works because it shows the data from the
DB. But when I try to save nothing happens no error but also no saved
data. I see the editordriver before flushing and it has the modified
data. What is missing or wrong,

Please Help, thank you.

Here is my code.


public class ArticuloEditor extends Composite implements
Editor<ArticuloProxy> {

          interface Binder extends UiBinder<Widget, ArticuloEditor> {
          }

        public ArticuloEditor() {
                initWidget(GWT.<Binder> 
create(Binder.class).createAndBindUi(this));
        }

          @UiField
          TextBox titulo;

          @UiField
          ValueBoxEditorDecorator<String> autor;

          @UiField
          IntegerBox id;
}
///////////////////////////////////////////////////////

public class PersonEditorWorkflow {
          interface Binder extends UiBinder<DialogBox, PersonEditorWorkflow>
{
            Binder BINDER = GWT.create(Binder.class);
          }

          interface Driver extends
      RequestFactoryEditorDriver<ArticuloProxy, ArticuloEditor> {
  }

          @UiField
          HTMLPanel contents;

          @UiField
          DialogBox dialog;

          @UiField(provided = true)
          ArticuloEditor articuloEditor;

          private Driver editorDriver;

          private ArticuloProxy articulo;

          private TestRequestFactory requestFactory;

          public PersonEditorWorkflow(TestRequestFactory requestFactory,
ArticuloProxy articulo)
                  {
                        this.requestFactory=requestFactory;
                        this.articulo=articulo;

                        articuloEditor = new ArticuloEditor();
                        Binder.BINDER.createAndBindUi(this);

                  }

          @UiHandler("cancel")
          void onCancel(ClickEvent event) {
            dialog.hide();
          }

          @UiHandler("save")
          void onSave(ClickEvent event) {

                    RequestContext context = editorDriver.flush();

                    if (editorDriver.hasErrors()) {
                      dialog.setText("Errors detected locally");
                      return;
                    }

                   context.fire(new Receiver<Void>() {
                      @Override
              public void onConstraintViolation(Set<ConstraintViolation<?>>
errors) {
                dialog.setText("Errors detected on the server");
                editorDriver.setConstraintViolations(errors);
              }

              @Override
              public void onSuccess(Void response) {
                  dialog.setText("SAVED");
              }
            });
          }

          public void edit(RequestContext requestContext)
          {
                    editorDriver = GWT.create(Driver.class);
                    editorDriver.initialize(requestFactory, articuloEditor);
                    editorDriver.edit(articulo, requestContext);
                    dialog.center();

          }

        }
//////////////////////////////////////////////////
Here is where I call PersonEditorWorkflow in OnModuleLoad()

        void settestItemRequestMethod(ArticuloProxy articulo)
        {
                new
PersonEditorWorkflow(testRequestFactory(),articulo).edit(testRequestFactory().getRequest());
        }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to