package com.mackemlad.sizing.client.data;

import com.smartgwt.client.data.DataSource;  
import com.smartgwt.client.data.fields.*;  
	  
public class OrderLocalDS extends DataSource {  

	private static OrderLocalDS instance = null;  

	public static OrderLocalDS getInstance() {  
		if (instance == null) {  
			instance = new OrderLocalDS("orderLocalDS");  
		}  
		return instance;  
	}  

	public OrderLocalDS(String id) {  

		setID(id);  

		DataSourceSequenceField riField = new DataSourceSequenceField("ri");  
		riField.setHidden(true);  
		riField.setPrimaryKey(true);  

		DataSourceIntegerField orderNumber = new DataSourceIntegerField("orderNumber", "Order Number");  
		orderNumber.setCanEdit(false);  
		orderNumber.setPluralTitle("Orders");  

		DataSourceFloatField itemsCost= new DataSourceFloatField("itemsCost", "Cost");  
		DataSourceFloatField itemsRetail = new DataSourceFloatField("itemsRetail", "Retail");  
		DataSourceFloatField marginPercent = new DataSourceFloatField("marginPercent", "Margin");  

		setFields(riField, orderNumber, itemsCost, itemsRetail, marginPercent);  

		setTestData(OrderData.getRecords());  
		setClientOnly(true);   
	}
}
