viktorthang / mgwt

Automatically exported from code.google.com/p/mgwt
Other
0 stars 0 forks source link

CellList misses @UiHandler support #282

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
With GWT's standard CellLists one can define UI handlers in the Cells via 
@UiHandler, which allows for much cleaner code:
https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder#UiRenderer
_for_event_handling

This seems to be missing from MGWT's CellList at the moment.

Original issue reported on code.google.com by goo...@collaborne.com on 2 Jan 2013 at 9:58

GoogleCodeExporter commented 8 years ago

Original comment by kurka.da...@gmail.com on 10 Jan 2013 at 11:24

GoogleCodeExporter commented 8 years ago
can you provide a non working example. The whole thing seems to look quite 
alright?

Original comment by kurka.da...@gmail.com on 30 Mar 2013 at 7:09

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Here a non-working example for MGWT cell:

public class PersonCell implements Cell<Person> {
    interface PersonCellRenderer extends UiRenderer {
        void render(SafeHtmlBuilder sb, String title);

        void onBrowserEvent(PersonCell cell, NativeEvent element,
                Element parent, Person value);
    }

    private static PersonCellRenderer renderer = GWT
            .create(PersonCellRenderer.class);

    @Override
    public void render(SafeHtmlBuilder safeHtmlBuilder, Person person) {
        renderer.render(safeHtmlBuilder, "Developer");
    }

    @Override
    public boolean canBeSelected(Person model) {
        return true;
    }

    @UiHandler("title")
    void onClicked(ClickEvent event, Element parent, Person person) {
        Window.alert("I was clicked!");
    }

    @UiHandler("title")
    void onClicked(TapEvent event, Element parent, Person person) {
        Window.alert("I was tapped!");
    }
}

GWT AbstractCell allows to define in the constructor the events that should be 
passed to @UiHandlers. I don't see how I can tell the MGWT Cell to delegate 
click and tap events to my @UiHandlers.

Another problem is that TapEvent is not inherited from DomEvent (which is 
required by @UiHandler).

Original comment by goo...@collaborne.com on 21 Aug 2013 at 8:37

GoogleCodeExporter commented 8 years ago
Moved: https://github.com/mgwt/mgwt/issues/123

Original comment by kurka.da...@gmail.com on 9 Aug 2014 at 9:13