Revision: 6137 Author: rj...@google.com Date: Fri Sep 11 17:19:58 2009 Log: Did we mention about handler binding? http://code.google.com/p/google-web-toolkit/source/detail?r=6137
Modified: /wiki/UiBinder.wiki ======================================= --- /wiki/UiBinder.wiki Fri Sep 11 17:10:20 2009 +++ /wiki/UiBinder.wiki Fri Sep 11 17:19:58 2009 @@ -192,7 +192,7 @@ }}} {{{ - class MyFoo extends Widget { + public class MyFoo extends Widget { interface MyStyle extends CssResource { String enabled(); String disabled(); @@ -200,11 +200,33 @@ @UiField MyStyle style; + /* ... */ + void setEnabled(boolean enabled) { getElement().addStyle(enabled ? : style.enabled() : style.disabled()); } } }}} + +=Simple binding of event handlers= + +(* Should the value argument ("button") should be optional? If so the handler should get all clickEvents +if it is not provided. But what does "all" mean, exactly? For every named field? *) + +(* Cannot yet bind to non-widgets *) + +{{{ + public class MyFoo extends Widget { + + @UiField Button button; + + /* ... */ + + @UiHandler("button") + void onClick(ClickEvent e) { + Window.alert("Hello, AJAX"); + } +}}} =Using an external resource with a UiBinder= --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---