package com.alea.client.data;


import com.alea.client.WelcomeService;
import com.alea.client.WelcomeServiceAsync;
import com.google.gwt.core.client.GWT;
import com.smartgwt.client.data.RestDataSource;
import com.smartgwt.client.data.fields.DataSourceDateField;
import com.smartgwt.client.data.fields.DataSourceTextField;

public class TransportResultDataSource extends RestDataSource {

	
	private static TransportResultDataSource instance = null ;
	protected final WelcomeServiceAsync welcomeService = GWT.create(WelcomeService.class);
	
	public static TransportResultDataSource getInstance() {
		if (instance == null) {  
			instance = new TransportResultDataSource();  
		}  
		return instance; 
	}
	
	private TransportResultDataSource() {
		this.setID("transportResult");
		this.setRecordXPath("/response/data/transportResult"); 
		DataSourceTextField ituCode = new DataSourceTextField("ituCode","Itu Code");
		DataSourceTextField lastStatus = new DataSourceTextField("lastStatus","Last Status");
		DataSourceTextField terminals = new DataSourceTextField("terminals","Departure Terminal<br/>Destination Terminal<br/>Final Terminal");
		DataSourceTextField fullOrEmpty = new DataSourceTextField("fullOrEmpty","Full/Empty");
		DataSourceTextField weights = new DataSourceTextField("weights","Net Weight (kg)<br/>Gross Weight(kg)");
		
		DataSourceDateField statusDate = new DataSourceDateField("statusDate","Status Date");
		DataSourceDateField departureDate = new DataSourceDateField("departureDate","Departure Date");
		
		DataSourceTextField actors = new DataSourceTextField("actors","Invoicing<br/>Sender<br/>Receiver");
		DataSourceTextField refNumbers = new DataSourceTextField("refNumbers","Customer Ref<br/>Operator Ref");
		DataSourceTextField controlNumbers = new DataSourceTextField("controlNumbers","Ctrl train Number<br/>Railway train number<br/>Wagon number");
		
		this.setFields(ituCode,lastStatus,terminals,fullOrEmpty,weights,statusDate,departureDate,actors,refNumbers,controlNumbers);
		this.setDataURL("/transport/getTransports.xml");
	}

}
