package com.vaadin.components.gwt.polymer.client.sampler.gwt;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.vaadin.components.gwt.polymer.client.widget.PaperTab;
import com.vaadin.components.gwt.polymer.client.widget.PaperTabs;
import com.vaadin.components.gwt.polymer.client.widget.PaperToast;
import com.vaadin.components.gwt.polymer.client.widget.event.CoreSelectEvent;
import com.vaadin.components.gwt.polymer.client.widget.event.CoreSelectEventHandler;

public class PaperTabsWidgetView extends Composite {
    interface PaperTabsWidgetUiBinder extends UiBinder<HTMLPanel, PaperTabsWidgetView> {
    }

    private static PaperTabsWidgetUiBinder ourUiBinder = GWT.create(PaperTabsWidgetUiBinder.class);
    
    @UiField
    PaperTabs tabs;
    @UiField
    PaperToast toast;

    public PaperTabsWidgetView() {
        initWidget(ourUiBinder.createAndBindUi(this));
        
        tabs.setSelected(0);

        PaperTab tab = new PaperTab("dynamically created item");
        tabs.add(tab);
        
        tabs.addCoreSelectHandler(new CoreSelectEventHandler() {
            @Override
            public void onCoreSelect(CoreSelectEvent event) {
                toast.setText("widget event handler");
                toast.show();
            }
        });
    }
}
@@ -190,16 +190,65 @@
 iField;%0A
+import com.google.gwt.uibinder.client.UiHandler;%0A
 import c
@@ -287,16 +287,16 @@
 posite;%0A
-
 import c
@@ -614,93 +614,8 @@
 ent;
-%0Aimport com.vaadin.components.gwt.polymer.client.widget.event.CoreSelectEventHandler;
 %0A%0Apu
@@ -861,20 +861,16 @@
 class);%0A
-    
 %0A    @Ui
@@ -870,28 +870,24 @@
     @UiField
-%0A   
  PaperTabs t
@@ -903,20 +903,16 @@
 @UiField
-%0A   
  PaperTo
@@ -1013,25 +1013,17 @@
 this));%0A
-        
 %0A
+
         
@@ -1140,136 +1140,59 @@
     
-    %0A        tabs.addCoreSelectHandler(new CoreSelectEventHandler() %7B%0A            @Override%0A            public void onCoreSelect
+%7D%0A%0A    @UiHandler(%22tabs%22)%0A    void onNameGotPressed
 (Cor
@@ -1217,32 +1217,24 @@
 ) %7B%0A        
-   
-     
 toast.setTex
@@ -1260,24 +1260,16 @@
 dler%22);%0A
-        
         
@@ -1286,37 +1286,12 @@
 ();%0A
-            %7D%0A        %7D);%0A
     %7D%0A
-
 %7D
+%0A

Use UiHandler in the example