like this?

public void edit() {
        ProjectRequest request = commonRf.projectRequest();
        ProjectProxy project = request.create(ProjectProxy.class);
        request.save(project).to(new Receiver<Void>() {
           ...
        });

        ProjectEditor pe = view.getProjectEditor();
        driver.initialize(pe);
        driver.edit(project, request);
    }


    public void createProject(ProjectEditor projectEditor) {
        RequestContext request = driver.flush();
        request.fire();
    }



On Fri, Sep 2, 2011 at 3:18 AM, Brian Chapman <[email protected]>wrote:

> I have a question about using the RequestFactoryEditorDriver. I am trying
> to use the editor with request factory on the client side. On the server
> side I am using Objectify which is modeled after the 
> listWidget<http://code.google.com/p/listwidget/>example. I have a 
> ProjectRequest class (implementing RequestContext) that
> defines a save method.
>
> My question is how do I invoke the save method from the editor. It appears
> that after a driver.flush() I only have a RequestContext object to work
> with. That object only has the fire method, but I cannot tell it to use my
> save(project) method. When I invoke the requestContext.fire() method after
> doing a .flush(), the request factory appears to contact the server but
> nothing is persisted. Are there implied methods that the editor or
> RequestFactory is expecting to be implemented on the server? Should I be
> using the SimpleBeanEditorDriver instead?
>
> My Editor:
>
> public class ProjectEditor extends Composite implements
> Editor<ProjectProxy> {
>     interface Binder extends UiBinder<HTMLPanel, ProjectEditor> { }
>     private static Binder uiBinder = GWT.create(Binder.class);
>     @UiField
>     TextBox name;
>     public ProjectEditor() {
>       initWidget(uiBinder.createAndBindUi(this));
>     }
> }
>
>  My workflow class:
>
> public class ProjectAddPresenter extends
>         Presenter<ProjectAddPresenter.MyView, ProjectAddPresenter.MyProxy>
> {
>     ...
>     interface Driver extends
>             SimpleBeanEditorDriver<ProjectProxy, ProjectEditor> {}
>     @Inject private CommonRequestFactory commonRf;
>     private Driver driver;
>     @Inject
>     public ProjectAddPresenter(final EventBus eventBus,
>             final MyView view,
>             final MyProxy proxy) {
>         super(eventBus, view, proxy);
>         this.view = view;
>         view.setPresetner(this);
>         driver = GWT.create(Driver.class);
>     }
>     ...
>     public void edit() {
>         ProjectRequest request = commonRf.projectRequest();
>         ProjectProxy project = request.create(ProjectProxy.class);
>         ProjectEditor pe = view.getProjectEditor();
>         driver.initialize(pe);
>         driver.edit(project, request);
>     }
>     public void createProject(ProjectEditor projectEditor) {
>         RequestContext request = driver.flush();
>         request.fire(new Receiver<Void>() {
>             ...
>         });
>     }
>     ...
> }
>
> My ProjectRequest class:
>
> @Service(value = ProjectDao.class, locator = DaoServiceLocator.class)
> public interface ProjectRequest extends RequestContext {
>   ...
>   Request<Void> save(ProjectProxy project);
>   ...
> }
>
>  Thank you.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/qpOhqiJGc4sJ.
> 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.
>

-- 
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