CellTree with CellTable nodes

577 views
Skip to first unread message

johan

unread,
Apr 28, 2011, 10:29:53 AM4/28/11
to Google Web Toolkit
Hi,

We have to implement a tree that contains some table nodes at third
level(leaf).
To achieve that, I have used a CellTree and a custom cell, which
renders a CellTable (using GWT 2.1).
It worked fine but now we have to make some cells of the CellTable
clickable.
I managed to do it outside of the tree context(standalone table), but
once the table is used inside a tree node, the table's events are not
managed.

Do you have any idea about how I could fix this ?

Notes:

With EventBug(a Firebug extension), I can see that a click handler is
registered on the table element in the first case, while it is not in
the second case (inside the tree).
I have also noticed that the events are sunk in the Widget.onAttach()
method. However that method is invoked only in the first case.


class ATMTableCell extends AbstractCell<List<ATMDTO>> {

// Contains the CellTable
ATMTableWidget atmTable;

public ATMTableCell() {
atmTable = new ATMTableWidget(false);
}

@Override
public void render(com.google.gwt.cell.client.Cell.Context
context, List<ATMDTO> data, SafeHtmlBuilder sb) {

atmTable.setData(data);

sb.append(SafeHtmlUtils.fromTrustedString(atmTable.getElement().getInnerHTML()));

}

}


Thx

johan

unread,
Apr 29, 2011, 5:27:36 AM4/29/11
to Google Web Toolkit

When I use a classic Tree widget, it works fine with my CellTable as a
TreeItem. I'll go that way...

lamre

unread,
May 2, 2011, 11:13:22 AM5/2/11
to Google Web Toolkit
Cell<Cartella> cell = new AbstractCell<Cartella>("click")
{
@Override
public void render(Context context, Cartella value,
SafeHtmlBuilder sb)
{
sb.appendEscaped(value.getDescCartella());
}
//gestiamo gli eventi
@Override
public void onBrowserEvent(Context context, Element parent,
Cartella value,NativeEvent event, ValueUpdater<Cartella>
valueUpdater)
{
if (value == null) { return; }
super.onBrowserEvent(context, parent, value, event,
valueUpdater);
if ("click".equals(event.getType()))
{

ControllerPqm.getInstance().loadCartella(value.getIdCartella());
// Window.alert("Click sulla cartella "+
value.getDescCartella());
}
}
};

lamre

unread,
May 2, 2011, 11:14:59 AM5/2/11
to Google Web Toolkit
Cell<Cartella> cell = new AbstractCell<Cartella>("click")
{
@Override
public void render(Context context, Cartella value,
SafeHtmlBuilder sb)
{

sb.appendEscaped(value.getDescCartella());
}
@Override
public void onBrowserEvent(Context context, Element parent,
Cartella value,NativeEvent event, ValueUpdater<Cartella>
valueUpdater)
{
if ("click".equals(event.getType()))
{

johan

unread,
May 3, 2011, 11:21:20 AM5/3/11
to Google Web Toolkit
Well, this works fine as long as the event is managed by the tree item
itself.
But in my case, the tree item contains a CellTable and that CellTable
contains some clickable cells.
In such a case, I can't make it work.

Tatchan

unread,
May 10, 2011, 10:48:35 PM5/10/11
to Google Web Toolkit
Hi,

I have a similar problem.
I my case, a complex widget (which is basically MyCompoSite.InnerHTML)
is rendered as the inner HTML of each cell.
The cell itself can catch click/mouseout event but not my inner HTML.
The weird thing is that: Mouseover event can be caught both in the
cell and in my HTML.
Could any one give suggessions please?

-Tatchan
> >                                   };- Hide quoted text -
>
> - Show quoted text -

Fille

unread,
Aug 3, 2012, 10:29:19 AM8/3/12
to google-we...@googlegroups.com
I have a similar situation with expandable CellTable rows, inspired from this showcase:  http://showcase3.jlabanca-testing.appspot.com/#!CwCustomDataGrid 

Lets say I have a CellTable displaying instances of class Book on each row. 
When I click one row (using SelectionModel), it gets expanded, where the Authors of the Book is displayed 
in a custom UiBinder widget.

I would like be able to click on a row for an Author to show some more information. 
But the selectionModel's changehandler gets fired. If I remove the selectionModel and just use a
ClickableTextCell to expand the row, the events in the Authors custom widgets isnt fired (@UiHandler("infoButton"))

Any suggestions how I can acheive this?

Regards
Reply all
Reply to author
Forward
0 new messages