This actually makes sense to me but if the composite editor is set or
a list, the framework will still be able to construct those types?
You have
> CompositeEditor<PersonProxy, PersonProxy, NameLabel>,
> LeafValueEditor<PersonProxy> {
But if the generic parameter was a collection, wouldn't the fact that
it's a leaf editor prevent the framework from entering sub-editors?
On Sat, Oct 2, 2010 at 7:31 PM, BobV <[email protected]> wrote:
> It's possible to set a null field to a non-null value by making a Leaf
> CompositeEditor. I'll update the DynaTableRf sample with something
> better than this, but I think it demonstrates the point. The
> assumption is that PersonProxy.getManager() returns null in the
> default dataset.
>
>
> public class ManagerSelector extends Composite implements
> CompositeEditor<PersonProxy, PersonProxy, NameLabel>,
> LeafValueEditor<PersonProxy> {
>
> private EditorChain<PersonProxy, NameLabel> chain;
> private NameLabel nameLabel = new NameLabel(new SimpleEventBus());
> private PersonProxy manager;
>
> public ManagerSelector() {
> FlowPanel fp = new FlowPanel();
> Button b = new Button("Choose randomly");
>
> b.addClickHandler(new ClickHandler() {
> public void onClick(ClickEvent event) {
> DynaTableRequestFactory rf = DynaTableRf.getRequestFactory();
>
> int i = new Random().nextInt(100);
> rf.schoolCalendarRequest().getPeople(i, 1).to(
> new Receiver<List<PersonProxy>>() {
> �...@override
> public void onSuccess(List<PersonProxy> response) {
> assert response.size() == 1;
> setValue(response.get(0));
> }
> }).fire();
> }
> });
>
> fp.add(b);
> fp.add(nameLabel);
> initWidget(fp);
> }
>
> public void flush() {
> }
>
> public String getPathElement(NameLabel subEditor) {
> return "";
> }
>
> public PersonProxy getValue() {
> return manager;
> }
>
> public void onPropertyChange(String... paths) {
> }
>
> public void setDelegate(EditorDelegate<PersonProxy> delegate) {
> }
>
> public void setEditorChain(EditorChain<PersonProxy, NameLabel> chain) {
> this.chain = chain;
> }
>
> public void setValue(PersonProxy value) {
> this.manager = value;
>
> if (manager != null) {
> chain.attach(manager, nameLabel);
> }
> }
>
>
> --
> Bob Vawter
> Google Web Toolkit Team
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors