Tuesday, August 4, 2015

Editors framework: IsEditor and HasRequestContext not cooperating together

Consider this common usage of ListEditor:

public class BeanListEditor extends Composite implements IsEditor<ListEditor<BeanProxy, BeanEditor>>, HasRequestContext<List<BeanProxy>> {


 
public BeanListEditor() {


 
/* ... */


 beanListEditor
= ListEditor.of(new BeanEditorSource());


 
/* ... */
 
}


 
@Override
 
public void setRequestContext(RequestContext request) { /* ... */ }


 
/* ... */


 
final ListEditor<BeanProxy, BeanEditor> beanListEditor;


}


class BeanEditorSource extends EditorSource<BeanEditor> {


 
/* straightforward implementation */
 
}


public class BeanEditor extends Composite implements LeafValueEditor<BeanProxy>, HasRequestContext<BeanProxy> {


 
/* ... */


 
@Override
 
public void setRequestContext(RequestContext request) { /* ... */ }


 
/* ... */


}


Common RequestFactoryEditorDriver is driving the editor:

protected interface Driver extends RequestFactoryEditorDriver<List<BeanProxy>, ListEditor<BeanProxy, BeanEditor>> {}


And finally, observed problem:

BeanListEditor.setRequestContext is never called.

I'm aware of the fact that driver is driving ListEditor and not BeanListEditor, and BeanEditor.setRequestContext is called correctly, but I still need RequestContext instance in BeanListEditor itself (more precisely, I need it in BeanEditorSource for creating new proxies).

Is there a way to obtain instance of RequestContext in classes that implement IsEditor instead of Editor?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment