本文整理匯總了Java中com.vaadin.ui.Grid.sort方法的典型用法代碼示例。如果您正苦於以下問題:Java Grid.sort方法的具體用法?Java Grid.sort怎麽用?Java Grid.sort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Grid
的用法示例。
在下文中一共展示了Grid.sort方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: formatHeaders
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid<HeaderGridRow> formatHeaders(String title, Map<String, List<String>> headers) {
Grid<HeaderGridRow> grid = new Grid<>(HeaderGridRow.class);
grid.removeAllColumns();
Column<HeaderGridRow, String> headerColumn = grid.addColumn(HeaderGridRow::getHeader)
.setCaption("Header")
.setExpandRatio(1);
Column<HeaderGridRow, String> valuesColumn = grid.addColumn(HeaderGridRow::getValues)
.setCaption("Values")
.setDescriptionGenerator(HeaderGridRow::getValues)
.setExpandRatio(1);
grid.setItems(headers.entrySet().stream().map(HeaderGridRow::new));
grid.sort(headerColumn);
HeaderRow titleRow = grid.prependHeaderRow();
titleRow.join(headerColumn, valuesColumn).setHtml(title);
return grid;
}
示例2: ReleasesView
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
public ReleasesView() {
setSizeFull();
setMargin(false);
ButtonBar buttonBar = new ButtonBar();
addButton = buttonBar.addButton("Add", FontAwesome.PLUS, e -> add());
editButton = buttonBar.addButton("Edit", FontAwesome.EDIT, e -> edit());
exportButton = buttonBar.addButton("Export", FontAwesome.DOWNLOAD, e -> export());
archiveButton = buttonBar.addButton("Archive", FontAwesome.ARCHIVE, e -> archive());
// TODO add support for the archive button
archiveButton.setVisible(false);
finalizeButton = buttonBar.addButton("Finalize", FontAwesome.CUBE, e -> finalize());
addComponent(buttonBar);
enableDisableButtonsForSelectionSize(0);
grid = new Grid();
grid.setSizeFull();
grid.setSelectionMode(SelectionMode.MULTI);
grid.addItemClickListener(e->rowClicked(e));
grid.addSelectionListener((e) -> rowSelected(e));
container = new BeanItemContainer<>(ReleasePackage.class);
grid.setContainerDataSource(container);
grid.setColumns("name", "versionLabel", "releaseDate", "released");
grid.sort("releaseDate", SortDirection.DESCENDING);
addComponent(grid);
setExpandRatio(grid, 1);
progressBar = new ProgressBar(0.0f);
}
示例3: getAllMetricsGrid
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
private Grid<MetricsGridRow> getAllMetricsGrid(Map<String, Number> metrics) {
allMetricsRows = metrics.entrySet().stream()
.map(MetricsGridRow::new)
.collect(Collectors.toList());
Grid<MetricsGridRow> grid = new Grid<>(MetricsGridRow.class);
grid.removeAllColumns();
Column<MetricsGridRow, String> nameColumn = grid.addColumn(MetricsGridRow::getName)
.setCaption("Name")
.setExpandRatio(1);
grid.addColumn(MetricsGridRow::getValue).setCaption("Value");
grid.setItems(allMetricsRows);
grid.sort(nameColumn);
grid.setSizeFull();
grid.setRowHeight(40);
TextField filterInput = new TextField();
filterInput.setPlaceholder("filter by metric...");
filterInput.addValueChangeListener(e -> updateMetrics(e.getValue()));
filterInput.setValueChangeMode(ValueChangeMode.LAZY);
filterInput.setSizeFull();
// Header row
HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
filterRow.getCell(nameColumn).setComponent(filterInput);
return grid;
}
示例4: buildGrid
import com.vaadin.ui.Grid; //導入方法依賴的package包/類
protected void buildGrid() {
grid = new Grid();
grid.setEditorEnabled(true);
grid.setSizeFull();
grid.setSelectionMode(SelectionMode.SINGLE);
grid.setColumns("projectName","newDeployName","newDeployVersion",
"newDeployType","existingDeployName","existingDeployVersion",
"existingDeployType","upgrade");
container = new BeanItemContainer<>(DeploymentLine.class);
buildContainer();
grid.setContainerDataSource(container);
grid.sort("projectName", SortDirection.DESCENDING);
}