Hey Gang,

I've created a lightweight custom cell that extends AbstractCell. I've
included the code below.  What I've determined is that the "parent" is
the DIV associated with the cell.  What I'm trying to do is make it so
if I click anywhere in the cell including the text of the tds that the
onBrowserEvent is fired. I've figured out that what's happening is
that the click on the table I'm rendering or the tds is "swallowing"
the events of the div and therefore the onBrowserEvent isn't being
called.  If this was a regular widget I'd just do a sinkEvent.  The
issue I'm having is hope to sink the td mouse events into the cell
div.  I looked at the source for AbstractCell and saw that public void
setValue(...) is calling render and also has access to the parent so
I've tried to do something like

 
DOM.sinkEvent(parent.getFirstChildElement().getFirstChildElement().getFirstChildElement(),

Event.ONCLICK).  But that didn't see to do the trick either. Any
thoughts would be most appreciated.

        class OrderCell extends AbstractCell<MockOrder> {
            public OrderCell() {
                super("click", "keydown");
            }

            @Override
            public void onBrowserEvent(Element parent, MockOrder value,
Object key,
                        NativeEvent event, ValueUpdater<MockOrder> 
valueUpdater) {
                super.onBrowserEvent(parent, value, key, event, valueUpdater);
                if ("click".equals(event.getType())) {
                        onEnterKeyDown(parent, value, key, event, valueUpdater);
                }
            }

            @Override
            protected void onEnterKeyDown(Element parent, MockOrder value,
Object key,
                        NativeEvent event, ValueUpdater<MockOrder> 
valueUpdater) {
                if (valueUpdater != null) {
                        valueUpdater.update(value);
                }
            }

            @Override
            public void render(MockOrder value, Object key, SafeHtmlBuilder
sb) {
                // Value can be null, so do a null check..
                if (value == null) {
                        return;
                }

                sb.appendHtmlConstant("<table>");

                // Add the name and address.
                sb.appendHtmlConstant("<tr><td>");
                sb.appendEscaped(value.getApplicant().getLastName() + ", " +
value.getApplicant().getFirstName());
                sb.appendHtmlConstant("</td></tr><tr><td>");
                sb.appendEscaped(value.getStatus());
                sb.appendHtmlConstant("</td></tr></table>");
            }
        }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to