package com.smartgwt.sample.showcase.client.data;

import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.*;

public class DetailDS extends DataSource {

    private static DetailDS instance = null;

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

    public DetailDS(String id) {

        setID(id);
        setRecordXPath("/List/t");
        DataSourceIntegerField pkField = new DataSourceIntegerField("id");
        pkField.setHidden(true);
        pkField.setPrimaryKey(true);
        addField(pkField);

        DataSourceTextField nameField = new DataSourceTextField("n", "Name");
        nameField.setRequired(true);
        addField(nameField);

        setDataURL("ds/test_data/Detail.data.xml");
        setClientOnly(true);
    }
}
