Hello Nicolas.
Thank you for your answer. Very helpful.
I came up with a slightly different solution (for now). I created a
subclass of a column, and overrode the onBrowserEvent() call. There I
receive the context with the subIndex, which is 0 when the root cell was
edited, and reflects the sub row index when a cell in a sub row was edited.
Then I just provide this to the fieldUpdater and the onBrowserEvent of the
Cell.
This also only allows for one level of sub rows, but I need more. This is
where your approach looks more useful.
@Override
public void onBrowserEvent(Context context, Element elem, final T
object,
NativeEvent event) {
// The provided row is always the root row, so we need to find the
// correct one when a sub row was edited
actualIndex = context.getSubIndex();
actualObject = object;
if (0 != context.getSubIndex() && object instanceof RowDTO) {
actualIndex = context.getSubIndex();
actualObject = (T) ((RowDTO) object).getChild(actualIndex - 1);
context = new Context(context.getIndex(), context.getColumn(),
actualObject, actualIndex);
}
ValueUpdater<C> valueUpdater = (getFieldUpdater() == null) ? null
: new ValueUpdater<C>() {
@Override
public void update(C value) {
getFieldUpdater().update(actualIndex, object,
value);
}
};
getCell().onBrowserEvent(context, elem, getValue(actualObject),
event,
valueUpdater);
}
Cheers,
Michael
--
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/-/R2aeJHz6zO8J.
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.