public void maybeUpdateSortingView(List<SortModel> sorting) { if(!currentSorting.equals(sorting)) { ColumnModel<Integer> columnModel = grid.getColumnModel(); ColumnHeader<Integer> tableHeading = grid.getView().getHeader(); if (sorting.isEmpty()) { tableHeading.updateSortIcon(-1, SortDir.ASC); } else { SortModel sortModel = sorting.get(0); for (int i = 0; i < columnModel.getColumnCount(); i++) { String path = columnModel.getValueProvider(i).getPath(); if (path.equals(sortModel.getField())) { tableHeading.updateSortIcon(i, sortModel.getDir() == org.activityinfo.model.query.SortDir.ASC ? SortDir.ASC : SortDir.DESC); break; } } } currentSorting = sorting; } }
@Override protected void onAttach() { super.onAttach(); subscription = columnSet.subscribe(observable -> updateColumnView(observable)); loader.load(0, gridView.getCacheSize()); }
@Override protected void onDetach() { super.onDetach(); subscription.unsubscribe(); } };
grid.setLoader(loader); grid.setLoadMask(true); grid.setView(gridView); grid.setSelectionModel(sm);
toolbar.add(exportButton); this.grid = new Grid<>(store, buildColumnModel(new PivotTable())); this.grid.getView().setSortingEnabled(false); this.grid.setSelectionModel(new CellSelectionModel<>());
public RawTableView(AnalysisViewModel model) { this.model = model; this.store = new ListStore<>(point -> point.toString()); this.grid = new Grid<>(store, buildColumnModel(new DimensionSet())); this.grid.getView().setSortingEnabled(false); this.panel = new ContentPanel(); this.panel.setHeading("Results"); this.panel.add(grid); model.getResultTable().subscribe(observable -> { if (observable.isLoaded()) { update(observable.get()); } else { store.clear(); } }); }
@Override protected void doSort(int colIndex, SortDir sortDir) { String field = grid.getColumnModel().getValueProvider(colIndex).getPath(); org.activityinfo.model.query.SortDir dir; // sortDir is null if the column header is clicked to // toggle the sort direction if(sortDir == null) { if(isFieldSortedAscending(field)) { dir = org.activityinfo.model.query.SortDir.DESC; } else { dir = org.activityinfo.model.query.SortDir.ASC; } } else if(sortDir == SortDir.ASC) { dir = org.activityinfo.model.query.SortDir.ASC; } else { dir = org.activityinfo.model.query.SortDir.DESC; } fireEvent(new SortChangeEvent(field, dir)); }
private void update(PivotTable pivotTable) { grid.reconfigure(store, buildColumnModel(pivotTable)); store.replaceAll(buildRows(pivotTable)); }
private void changeColumnWidth(ColumnResizeEvent e) { ColumnConfig<Integer, Object> column = grid.getColumnModel().getColumn(e.getColumnIndex()); LOGGER.info("Column " + column.getValueProvider().getPath() + " resized to " + e.getColumnWidth() + "px"); tableUpdater.updateColumnWidth(column.getValueProvider().getPath(), e.getColumnWidth()); }
private void update(AnalysisResult analysisResult) { grid.reconfigure(store, buildColumnModel(analysisResult.getDimensionSet())); store.replaceAll(analysisResult.getPoints()); }