I'm trying to create a CellTable where when you click on a row, it
goes to another screen, and I'm trying to keep a correct MVP
architecture.
I have two questions. First, do I initialize my CellTable in the
view, or the presenter?
Right now I have something like this in my view code, but with more
columns.
TextColumn<LightOwner> nameColumn = new TextColumn<LightOwner>() {
public String getValue(LightOwner o) {
return o.getName();
}
};
ownersTable.addColumn(nameColumn, "Name");
It works fine, but is it okay for the view to be knowing about my
LightOwner type like that.
Secondly, I need it to bring up the owner edit screen for the id of
the row clicked when they click on a row. Reading around, it /sounds/
like I need to use the SelectionModel class for this, but I'm unsure
rather that should be in the presenter or view also.
By their example, I need to add code something like this:
final SingleSelectionModel<String> selectionModel = new
SingleSelectionModel<String>();
ownersTable.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new
SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
String selected = selectionModel.getSelectedObject();
if (selected != null) {
// Go to edit screen with selected.getId();
}
}
});
But what I'm used to is having a HasClickHandlers in the view and
attaching the event in the presenter. How am I supposed to use
SingleSelectionModel with MVP? Or am I going about this totally wrong?
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
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.