package com.test.client;
import com.smartgwt.client.data.RestDataSource;
import com.smartgwt.client.data.fields.DataSourceTextField;

public class TransactionDS extends RestDataSource {

    private static TransactionDS instance = null;

    public static TransactionDS getInstance() {
        if (instance == null) {
            instance = new TransactionDS();
        }
        return instance;
    }

	private TransactionDS() {
        setID("transactionDS");
        setDataURL("Datasource2.xml");
        setRecordXPath("/sites/site"); //the XML path of the element we want to display, in the datasource file (.data.xml)
        setClientOnly(true);

        DataSourceTextField endpointName = new DataSourceTextField("name", "Endpoint Name");
        endpointName.setCanEdit(false);
        endpointName.setForeignKey("endpointConfigDS.endpointName");

        DataSourceTextField code = new DataSourceTextField("transaction");
        code.setValueXPath("transaction");
        code.setTypeAsDataSource(TransactionNestedDS.getInstance());
        setFields(code, endpointName);
	}
}