package com.smartgwt.sample.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.data.*;
import com.smartgwt.client.data.fields.*;
import com.smartgwt.client.types.*;
import com.smartgwt.client.util.*;
import com.smartgwt.client.widgets.*;
import com.smartgwt.client.widgets.events.*;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.grid.*;
import com.smartgwt.client.widgets.grid.events.*;
import com.smartgwt.client.widgets.layout.*;
import com.smartgwt.client.widgets.viewer.DetailViewer;

public class TestDataSource extends DataSource {
    private static TestDataSource instance = null;

    public TestDataSource(String id) {
        this.setID(id);
        this.setDataURL("ds/dataSource.data.xml");
        this.setRecordXPath("/List/country");

        DataSourceIntegerField idField = new DataSourceIntegerField("itemID");
        idField.setHidden(true);
        idField.setPrimaryKey(true);

        DataSourceTextField itemNameField = new DataSourceTextField("textItem", "textItem", 128, true);

        DataSourceDateField itemDateField = new DataSourceDateField("dateItem", "dateItem");

        this.setFields(idField, itemNameField, itemDateField );
    }

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