Search in sources :

Example 1 with GridEvent

use of com.extjs.gxt.ui.client.event.GridEvent in project activityinfo by bedatadriven.

the class PivotGridPanel method show.

@Override
public void show(final PivotReportElement element) {
    if (isRendered()) {
        el().unmask();
    }
    if (grid != null) {
        removeAll();
    }
    PivotTableData data = element.getContent().getData();
    propertyMap = new HashMap<>();
    columnMap = new HashMap<>();
    columnModel = createColumnModel(data);
    store = new ListStore<>();
    addRows(data.getRootRow(), 0);
    grid = new Grid<>(store, columnModel);
    grid.setAutoExpandColumn("header");
    grid.setAutoExpandMin(150);
    grid.setView(new PivotGridView());
    grid.setSelectionModel(new CellSelectionModel<PivotGridPanel.PivotTableRow>());
    grid.addListener(Events.CellDoubleClick, new Listener<GridEvent<PivotTableRow>>() {

        @Override
        public void handleEvent(GridEvent<PivotTableRow> ge) {
            if (ge.getColIndex() != 0) {
                PivotTableData.Axis row = ge.getModel().getRowAxis();
                PivotTableData.Axis column = columnMap.get(ge.getColIndex());
                if (row.getCell(column) != null) {
                    drillDownEditor.drillDown(element, row, column);
                }
            }
        }
    });
    add(grid);
    layout();
}
Also used : GridEvent(com.extjs.gxt.ui.client.event.GridEvent) PivotTableData(org.activityinfo.legacy.shared.reports.content.PivotTableData)

Example 2 with GridEvent

use of com.extjs.gxt.ui.client.event.GridEvent 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);
    EditorGrid<NamedSlice> 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.ui.client.page.common.columns.ReadTextColumn) ArrayList(java.util.ArrayList) EditColorColumn(org.activityinfo.ui.client.page.common.columns.EditColorColumn) EditorGrid(com.extjs.gxt.ui.client.widget.grid.EditorGrid) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel)

Example 3 with GridEvent

use of com.extjs.gxt.ui.client.event.GridEvent in project activityinfo by bedatadriven.

the class HighlightingGridView method onRowOver.

@Override
protected void onRowOver(Element row) {
    int index = findRowIndex(row);
    if (index != -1) {
        ModelData model = grid.getStore().getAt(index);
        if (isHighlightable(model)) {
            fly(row).addStyleName(IndicatorLinkResources.INSTANCE.style().highlight());
            GridEvent event = new GridEvent(grid);
            event.setModel(model);
            grid.fireEvent(HighlightingGridView.ROW_MOUSE_OVER, event);
        }
    }
    overRow = row;
}
Also used : ModelData(com.extjs.gxt.ui.client.data.ModelData) GridEvent(com.extjs.gxt.ui.client.event.GridEvent)

Aggregations

GridEvent (com.extjs.gxt.ui.client.event.GridEvent)3 ModelData (com.extjs.gxt.ui.client.data.ModelData)1 ColumnConfig (com.extjs.gxt.ui.client.widget.grid.ColumnConfig)1 ColumnModel (com.extjs.gxt.ui.client.widget.grid.ColumnModel)1 EditorGrid (com.extjs.gxt.ui.client.widget.grid.EditorGrid)1 VBoxLayoutData (com.extjs.gxt.ui.client.widget.layout.VBoxLayoutData)1 ArrayList (java.util.ArrayList)1 PivotTableData (org.activityinfo.legacy.shared.reports.content.PivotTableData)1 EditColorColumn (org.activityinfo.ui.client.page.common.columns.EditColorColumn)1 ReadTextColumn (org.activityinfo.ui.client.page.common.columns.ReadTextColumn)1