package com.test.client;
import com.smartgwt.client.types.ExpansionMode;
import com.smartgwt.client.types.ListGridEditEvent;
import com.smartgwt.client.types.RowEndEditAction;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.layout.HLayout;

/* 
* Created by dazais on 5/21/2014.
 */
public class EndpointsConfigWidget extends HLayout {
    private ListGrid endpointGrid;
    private boolean endpointValueSelected = false;

    public EndpointsConfigWidget() {
        endpointGrid = createEndpointGrid();
        addMember(endpointGrid);
    }

    public ListGrid createEndpointGrid() {

        final ListGrid grid = new ListGrid();
        grid.setHeight(500);
        grid.setWidth(800);
        grid.setAlternateRecordStyles(true);
        grid.setDataSource(EndpointConfigDSNew.getInstance());
        grid.setAutoFetchData(true);
        grid.setDrawAheadRatio(4);
        grid.setCanExpandRecords(true);
        grid.setCanExpandMultipleRecords(true);
        grid.setExpansionMode(ExpansionMode.RELATED);
        grid.setDetailDS(TransactionDS.getInstance()); // other TransactionDS
        grid.setCanEdit(true);
        grid.setModalEditing(true);
        grid.setEditEvent(ListGridEditEvent.CLICK);
        grid.setListEndEditAction(RowEndEditAction.NEXT);
        grid.setAutoSaveEdits(false);

        return grid;
    }

    }