Chained ListEditors

46 views
Skip to first unread message

almagnit

unread,
Nov 10, 2013, 6:47:05 PM11/10/13
to google-we...@googlegroups.com
I have multiple entities with a one-to-many relations, such as:
A { List<B> b; }

B { List<C> c; }

C { some fields }

I'm trying to edit these entities by the editors
AEditor extends Editor {
 BListEditor b...
}

BListEditor implements IsEditor<ListEditor<BProxy, BListEditor.BItemEditor>>{
  BItemEditor implements Editor<BProxy>{
    CListEditor c...
  }
}

CListEditor implements IsEditor<ListEditor<CProxy, CListEditor.CItemEditor>>{
  CItemEditor implements Editor<CProxy>{}
}

In the UI it looks like:
A - Container with fields and list of items B(list of grids)
B - Container with combobox and grid - C
C - editable grid

So when I try to edit an already saved data it works fine.
But if I dynamically create B and C, then while saving list B.c == null

Why RF doesn't send list of CListEditor?

almagnit

unread,
Nov 11, 2013, 4:50:24 AM11/11/13
to google-we...@googlegroups.com
Is obtained that the object B was added to the object A, and object C still remains in the array editedProxies

понедельник, 11 ноября 2013 г., 3:47:05 UTC+4 пользователь almagnit написал:

Thomas Broyer

unread,
Nov 12, 2013, 4:43:31 AM11/12/13
to google-we...@googlegroups.com
From the code you sent me by mail, the problem is that you're editing B with a 'null' c and then call listEditor.setValue(newList) as an attempt to assign B.c. This won't work.
You have to assign a non-empty list to B.c before you edit it (i.e. just after the context.create(B.class), before you hand the B proxy to the list for editing).
This is because the list passed to ListEditor#setValue is modified in-place, it's never assigned to the edited field. This is the same for all editors with the exception of LeafValueEditors.

almagnit

unread,
Nov 12, 2013, 10:42:47 AM11/12/13
to google-we...@googlegroups.com
Big thanks Thomas You're absolutely right

вторник, 12 ноября 2013 г., 13:43:31 UTC+4 пользователь Thomas Broyer написал:
Reply all
Reply to author
Forward
0 new messages