package com.demo.test.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class test implements EntryPoint {

    /**
     * This is the entry point method.
     */
    public void onModuleLoad() {
    	final VLayout layout = new VLayout();
    	final TabSet tabSet = new TabSet();
    	final Tab tab1 = new Tab("Tab1");
    	final Tab tab2 = new Tab("Tab2");
    	final IButton toggleButton = new IButton("Disable Tab1");

    	toggleButton.addClickHandler(new ClickHandler() {
    		Boolean disable = false;

			@Override
			public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
    			disable = !disable;
    			tab1.setDisabled(disable);
    			toggleButton.setTitle(disable ? "Enable Tab1" : "Disable Tab1");
				
			}
    	});
    	tabSet.setTabs(tab1, tab2);
    	tabSet.setWidth(500);
    	tabSet.setHeight(400);

    	layout.setMembers(tabSet, toggleButton);
    	RootPanel.get().add(layout);
    	
    }   
}
