package com.sample.client;

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

/**
 * DataSource for Profile.
 */
public class ProfileElevDS extends DataSource {

    private static ProfileElevDS instance = null;

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

    /**
     * Default constructor for the custom datasource.
     */
    public ProfileElevDS() {
        setID("ProfileElev");
        setRecordXPath("/List/Profile");
        final DataSourceTextField profileID = new DataSourceTextField("profileID");
        profileID.setHidden(true);

        final DataSourceTextField elevationID = new DataSourceTextField("elevationID");
        elevationID.setForeignKey("ElevationLayout.elevationID");
        final DataSourceTextField profileType = new DataSourceTextField("profileType");
        final DataSourceTextField side1Type = new DataSourceTextField("side1Type");
        final DataSourceTextField side2Type = new DataSourceTextField("side2Type");
        final DataSourceTextField side3Type = new DataSourceTextField("side3Type");

        setFields(profileID, profileType, side1Type, side2Type, side3Type);
        setDataURL("ds/data/ProfilesElev.xml");
        setClientOnly(true);
    }
}
