package de.smartgwttest.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.SortNormalizer;

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

	int count = 0;


	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		
        final ListGrid countryGrid = new ListGrid();  
        countryGrid.setWidth(500);  
        countryGrid.setHeight(224);  
        countryGrid.setShowAllRecords(true);  
    
        ListGridField nameField = new ListGridField("name", "Name");  
        ListGridField sortField = new ListGridField("sort", "Sort");  
        ListGridField dateField = new ListGridField("date", "Date");  
        nameField.setSortNormalizer(new SortNormalizer() {

			@Override
			public Object normalize(ListGridRecord record, String fieldName) {
				return record.getAttributeAsInt("sort");
			}
        });  
  
        countryGrid.setFields( nameField, sortField, dateField);  
        countryGrid.setData(ListGridSampleData.getRecords());  
  
  
        countryGrid.draw();  
	}
	
}
