package com.smartgwt.sample.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.events.ClickEvent;
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;
import com.smartgwt.client.widgets.tab.events.CloseClickHandler;
import com.smartgwt.client.widgets.tab.events.TabCloseClickEvent;

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

	private TabSet tabSet;
    /**
     * This is the entry point method.
     */
    public void onModuleLoad() {
    	VLayout layout = new VLayout();
    	layout.setWidth100();
    	layout.setHeight100();
    	
    	tabSet = new TabSet();
    	tabSet.addCloseClickHandler(new CloseClickHandler() {
    		@Override
    		public void onCloseClick(TabCloseClickEvent event) {
    			Tab tab = event.getTab();
    			tab.getPane().destroy();
    		}
    	});
    	
    	Button button = new Button("open tab");
    	button.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				MyTab myTab = new MyTab();
				tabSet.addTab(myTab);
//				MyWindow window = new MyWindow("xxxx");
//				window.show();
			}
		});
    	layout.addMember(button);
    	layout.addMember(tabSet);
    	layout.draw();
    }
}
