Editing list of child objects in CellTable

74 views
Skip to first unread message

Maiku

unread,
Jan 19, 2012, 8:47:49 PM1/19/12
to Google Web Toolkit
I am trying to set up a CellTable with a HasDataEditor and it appeared
to work up until I tried to create an ActionCell column that launches
a dialog to edit a list of child objects (ex. My main CellTable edits
"Fields" and my dialog should provide a way to add "Attributes" like
read-only, enabled, etc. to those Fields). This dialog also uses its
own CellTable (although I suppose I could use a simple ListEditor if
need be) but the CellTable never seems to get any information.

I think I am having problems understanding fundamentally how this
would be hooked up and so I am asking

1. How do others usually deal with a situation of modifying lists of
child objects from their CellTable? Do you use a popup or is there
some way to edit them in place that I am not aware of?

2. Does hooking a CellTable up to a HasDataEditor work at all? I saw
old posts from the beginning of 2011 that suggested it did not but
they referenced a bug in 2.2 that appears to be fixed now.

3. If the q1 is "use a popup/dialog" and q2 is true, then how would I
set it up that the ActionCell knows to hook up the proxy it receives
to an editor? I couldn't think of it and thus produced the following
which is obviously wrong (given the error I stated in the paragraph
above):

ActionCell<AttributeListProxy> presentsCell = new
ActionCell<PresentsListProxy>("Edit...",
new ActionCell.Delegate<AttributeListProxy>()
{
@Override
public void execute(AttributeListProxy alproxy)
{
// Setup a dialog
// Pass in the RequestContext
// Start the driver
// Launch the dialog
plproxy =
requestContext.create(AttributeListProxy.class);
AttributeListProxy attributeEditor = new
AttributeListEditor();
attributeEditor .setRequestContext(requestContext);
attributeEditor .edit(plproxy);
attributeEditor .center();
}
});

Maiku

unread,
Jan 19, 2012, 8:48:20 PM1/19/12
to Google Web Toolkit
I am trying to set up a CellTable with a HasDataEditor and it appeared
to work up until I tried to create an ActionCell column that launches
a dialog to edit a list of child objects (ex. My main CellTable edits
"Fields" and my dialog should provide a way to add "Attributes" like
read-only, enabled, etc. to those Fields). This dialog also uses its
own CellTable (although I suppose I could use a simple ListEditor if
need be) but the CellTable never seems to get any information.

I think I am having problems understanding fundamentally how this
would be hooked up and so I am asking

1. How do others usually deal with a situation of modifying lists of
child objects from their CellTable? Do you use a popup or is there
some way to edit them in place that I am not aware of?

2. Does hooking a CellTable up to a HasDataEditor work at all? I saw
old posts from the beginning of 2011 that suggested it did not but
they referenced a bug in 2.2 that appears to be fixed now.

3. If the q1 is "use a popup/dialog" and q2 is true, then how would I
set it up that the ActionCell knows to hook up the proxy it receives
to an editor? I couldn't think of it and thus produced the following
which is obviously wrong (given the error I stated in the paragraph
above):

ActionCell<AttributeListProxy> presentsCell = new
ActionCell<AttributeListProxy>("Edit...",

Thomas Broyer

unread,
Jan 20, 2012, 4:50:29 AM1/20/12
to google-we...@googlegroups.com
The Editor framework works with a "flow synchronization" pattern, so your editors (including your CellTable "rows" and "cells") shouldn't directly modify your edited objects, but rather wait for the "flush".

In other words, as-is, HasData editing doesn't play well with the Editor framework (or the other way around).

You'd have to "queue" changes done from your cells (and using the cell's "view data" to display the "edited value") and only apply them on flush() (which means you'd have to wrap the HasDataEditor, as you cannot extend it).

Have a look at http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellSampler for an example of "queuing changes" and "committing" them later (in this case, clicking a button, as the sample doesn't use the Editor framework). And search the group for earlier (and more in-depth) discussions on the subject.
Reply all
Reply to author
Forward
0 new messages