/*******************************************************************************
 * Copyright 2011 Google Inc. All Rights Reserved.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package com.mycompany.project.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.mycompany.project.client.DataSource.CheckProgressTimer;
import com.mycompany.project.client.view.SampleListGrid;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickHandler;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class timerWithGrid implements EntryPoint {
	private SampleListGrid sampleListGrid = null;
	public void onModuleLoad() {
		RootPanel rootPanel = RootPanel.get();
//
//		clickMeButton = new Button();
//		rootPanel.add(clickMeButton);
//		clickMeButton.setText("Click me!");
//		clickMeButton.addClickHandler(new ClickHandler(){
//			public void onClick(ClickEvent event) {
//				Window.alert("Hello, GWT World!");
//			}
//		});
//		
		sampleListGrid = new SampleListGrid();
//		sampleListGrid.setDataSource();
		
		IButton addButton = new IButton("Add");
		addButton.addClickHandler(new ClickHandler(){

			@Override
			public void onClick(
					com.smartgwt.client.widgets.events.ClickEvent event) {
				sampleListGrid.startEditingNew();
				
			}});
		IButton startOperationButton = new IButton("startOperation");
		
		startOperationButton.addClickHandler(new ClickHandler(){

			@Override
			public void onClick(
					com.smartgwt.client.widgets.events.ClickEvent event) {
				//CheckProgressTimer.getInstance().doCheckProgress();
				com.mycompany.project.client.DataSource.OperationTimer ope = new com.mycompany.project.client.DataSource.OperationTimer();
				ope.CreateTimer();
			}
			
		});
		
		rootPanel.add(sampleListGrid);
		rootPanel.add(startOperationButton);
		rootPanel.add(addButton);
	}
}
