Search in sources :

Example 1 with EditColorColumn

use of org.activityinfo.client.page.common.columns.EditColorColumn in project activityinfo by bedatadriven.

the class PiechartLayerOptions method setupIndicatorOptionsGrid.

private void setupIndicatorOptionsGrid() {
    List<ColumnConfig> columnConfigs = new ArrayList<ColumnConfig>();
    columnConfigs.add(new EditColorColumn());
    columnConfigs.add(new ReadTextColumn("name", I18N.CONSTANTS.indicators(), 50));
    ColumnModel columnmodelIndicators = new ColumnModel(columnConfigs);
    indicatorOptionGrid = new EditorGrid<NamedSlice>(indicatorsStore, columnmodelIndicators);
    indicatorOptionGrid.setBorders(false);
    indicatorOptionGrid.setAutoExpandColumn("name");
    indicatorOptionGrid.setAutoWidth(true);
    indicatorOptionGrid.setHeight(100);
    indicatorOptionGrid.getView().setShowDirtyCells(false);
    indicatorOptionGrid.setSelectionModel(new CellSelectionModel<PiechartLayerOptions.NamedSlice>());
    indicatorOptionGrid.addListener(Events.AfterEdit, new Listener<GridEvent<NamedSlice>>() {

        @Override
        public void handleEvent(GridEvent<NamedSlice> be) {
            be.getModel().getSlice().setColor(be.getModel().getColor());
            ValueChangeEvent.fire(PiechartLayerOptions.this, piechartMapLayer);
        }
    });
    VBoxLayoutData vbld = new VBoxLayoutData();
    vbld.setFlex(1);
    panel.add(indicatorOptionGrid);
}
Also used : VBoxLayoutData(com.extjs.gxt.ui.client.widget.layout.VBoxLayoutData) GridEvent(com.extjs.gxt.ui.client.event.GridEvent) ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) ReadTextColumn(org.activityinfo.client.page.common.columns.ReadTextColumn) ArrayList(java.util.ArrayList) EditColorColumn(org.activityinfo.client.page.common.columns.EditColorColumn) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel)

Aggregations

GridEvent (com.extjs.gxt.ui.client.event.GridEvent)1 ColumnConfig (com.extjs.gxt.ui.client.widget.grid.ColumnConfig)1 ColumnModel (com.extjs.gxt.ui.client.widget.grid.ColumnModel)1 VBoxLayoutData (com.extjs.gxt.ui.client.widget.layout.VBoxLayoutData)1 ArrayList (java.util.ArrayList)1 EditColorColumn (org.activityinfo.client.page.common.columns.EditColorColumn)1 ReadTextColumn (org.activityinfo.client.page.common.columns.ReadTextColumn)1