Hi All,

  I am trying to capture the tab selection event for a TabLayoutPanel
in my app which is based on MVP Pattern.

  I have the following view,uiBInder & presenter. How ever when i
clicked on the Tab the event handler code is not getting processed !!

TabLayoutTestView.java
[VIEW]
public class TabLayoutTestView  implements Display,
HasSelectionHandlers<Integer>

        private static TabLayoutTestViewUiBinder uiBinder =
GWT.create(TabLayoutTestViewUiBinder.class);
        @UiTemplate("TabLayoutTestView.ui.xml")
        interface TabLayoutTestViewUiBinderextends
UiBinder<Widget,TabLayoutTestView> {}

        @UiField TabLayoutPanel tabPanel;

        TabLayoutTestView(){
               initWidget(uiBinder.createAndBindUi(this));
         }

        public HasSelectionHandlers<Integer> getTabSelected() {
                return this;
        }

        public HandlerRegistration
addSelectionHandler(SelectionHandler<Integer> handler) {
                return addHandler(handler,SelectionEvent.getType());
        }
[/VIEW]

TabLayoutTestView.ui.xml

[uiBInder]
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";>
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
        xmlns:g="urn:import:com.google.gwt.user.client.ui">
        <ui:style>

        </ui:style>
        <g:FlowPanel  ui:field="tabContainer"  height="100%">
                        <g:TabLayoutPanel barUnit="PX" barHeight="22" 
ui:field="tabPanel"
height="100%">
                                <g:tab>
                                        <g:header>Tab1</g:header>
                                        <g:Label>Tab1 Contents</g:Label>
                                </g:tab>
                                <g:tab>
                                        <g:header>Tab2</g:header>
                                        <g:Label>Tab2 Contents</g:Label>
                                </g:tab>
                                <g:tab>
                                        <g:header>Tab3</g:header>
                                        <g:Label>Tab3 Contents</g:Label>
                                </g:tab>
                                <g:tab>
                                        <g:header>Tab4</g:header>
                                        <g:Label>Tab4 Contents</g:Label>
                                </g:tab>
                        </g:TabLayoutPanel>
        </g:FlowPanel>
</ui:UiBinder>
[/uiBinder]


TabLayoutTestPresenter.java
[Presenter]
public class TabLayoutTestPresenter {

        public interface Display extends View
        {
                HasSelectionHandlers<Integer> getTabSelected();
        }

public TabLayoutTestPresenter (GreetingServiceAsync rpcService,
HandlerManager eventBus,Display display){
    this.display = display;
    this.rpcService = rpcService;
    this.eventBus = eventBus;
}

public void bind() {
                GWT.log(".bind() : TabLayoutTestPresenter ");
                display.getTabSelected().addSelectionHandler(new
SelectionHandler<Integer>(){
                                public void onSelection(SelectionEvent<Integer> 
event) {
                                        GWT.log("Tab Selected 
=["+event.getSelectedItem()+"]");
                                }
                });
        }

}
[/Presenter]

Thanks

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

Reply via email to