本文整理汇总了Java中com.vaadin.ui.components.grid.HeaderRow类的典型用法代码示例。如果您正苦于以下问题:Java HeaderRow类的具体用法?Java HeaderRow怎么用?Java HeaderRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HeaderRow类属于com.vaadin.ui.components.grid包,在下文中一共展示了HeaderRow类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: formatHeaders
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的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;
}
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:22,代码来源:TracePage.java
示例2: getAllMetricsGrid
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的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;
}
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:30,代码来源:MetricsPage.java
示例3: initFilterRow
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
private void initFilterRow(Column<Application, String> appColumn, Column<Application, String> envColumn, Column<Application, String> urlColumn) {
TextField filterApp = new TextField();
TextField filterEnv = new TextField();
TextField filterUrl = new TextField();
filterApp.setPlaceholder("filter by application...");
filterApp.addValueChangeListener(e -> updateApplications(e.getValue(), filterEnv.getValue(), filterUrl.getValue()));
filterApp.setValueChangeMode(ValueChangeMode.LAZY);
filterApp.focus();
filterApp.setSizeFull();
filterEnv.setPlaceholder("filter by environment...");
filterEnv.addValueChangeListener(e -> updateApplications(filterApp.getValue(), e.getValue(), filterUrl.getValue()));
filterEnv.setValueChangeMode(ValueChangeMode.LAZY);
filterEnv.setSizeFull();
filterUrl.setPlaceholder("filter by URL...");
filterUrl.addValueChangeListener(e -> updateApplications(filterApp.getValue(), filterEnv.getValue(), e.getValue()));
filterUrl.setValueChangeMode(ValueChangeMode.LAZY);
filterUrl.setSizeFull();
// Header row
HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
filterRow.getCell(appColumn).setComponent(filterApp);
filterRow.getCell(envColumn).setComponent(filterEnv);
filterRow.getCell(urlColumn).setComponent(filterUrl);
}
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:28,代码来源:ApplicationsPage.java
示例4: addHeaderFooterRow
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private int addHeaderFooterRow(Sheet sheet, int rowNum,
final ExportExcelComponentConfiguration<BEANTYPE> componentConfiguration,
AbstractComponentHeaderFooterConfiguration headerFooterConfig) {
int tmpRowNum = rowNum;
Row myRow = sheet.createRow(tmpRowNum);
int startMerge = -999;
for (int columns = 0; columns < componentConfiguration.getVisibleProperties().length; columns++) {
Cell myCell = myRow.createCell(columns, XSSFCell.CELL_TYPE_STRING);
String columnId = componentConfiguration.getVisibleProperties()[columns];
if (headerFooterConfig.getMergedCells() != null) {
startMerge = addMergedCell( sheet, tmpRowNum, componentConfiguration, headerFooterConfig, startMerge,
columns, myCell);
} else if (headerFooterConfig.getRow() != null) {
if (headerFooterConfig.getRow() instanceof HeaderRow) {
ExcelStyleUtil.addGenericGridHeaderRow( ((HeaderRow) headerFooterConfig.getRow()).getCell(columnId),
myCell);
} else if (headerFooterConfig.getRow() instanceof FooterRow) {
ExcelStyleUtil.addGenericGridFooterRow( ((FooterRow) headerFooterConfig.getRow()).getCell(columnId),
myCell);
}
} else if (headerFooterConfig.getColumnKeys() != null) {
myCell.setCellValue(headerFooterConfig.getColumnKeys()[columns]);
}
myCell.setCellStyle(componentConfiguration.getHeaderStyleFunction()
.apply(this.workbook, columnId));
}
if (headerFooterConfig instanceof ComponentHeaderConfiguration
&& ((ComponentHeaderConfiguration) headerFooterConfig).isAutoFilter()) {
sheet.setAutoFilter(new CellRangeAddress(tmpRowNum, tmpRowNum, 0,
componentConfiguration.getVisibleProperties().length - 1));
}
tmpRowNum++;
return tmpRowNum;
}
开发者ID:bonprix,项目名称:vaadin-excel-exporter,代码行数:40,代码来源:ExportToExcel.java
示例5: initGrid
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
private void initGrid() {
this.grid = new Grid<>(PropertyItem.class);
this.grid.removeAllColumns();
Column<PropertyItem, String> propertyColumn = this.grid.addColumn(PropertyItem::getKey)
.setCaption("Property")
.setExpandRatio(1);
Column<PropertyItem, String> valueColumn = this.grid.addColumn(PropertyItem::getValue)
.setCaption("Value")
.setExpandRatio(1);
Column<PropertyItem, String> originColumn = this.grid.addColumn(PropertyItem::getOrigin).setCaption("Origin");
this.grid.sort(propertyColumn);
this.grid.setSizeFull();
this.grid.setRowHeight(40);
// distinct origin
List<String> origins = this.currentEnv.getProperties().stream()
.map(PropertyItem::getOrigin)
.distinct()
.sorted(String::compareTo)
.collect(Collectors.toList());
// Filters
TextField filterProperty = new TextField();
TextField filterValue = new TextField();
NativeSelect<String> filterOrigin = new NativeSelect<>(null, origins);
filterProperty.setPlaceholder("filter by key...");
filterProperty.addValueChangeListener(e -> updateProperties(e.getValue(), filterValue.getValue(), filterOrigin.getValue()));
filterProperty.setValueChangeMode(ValueChangeMode.LAZY);
filterProperty.focus();
filterProperty.setSizeFull();
filterValue.setPlaceholder("filter by value...");
filterValue.addValueChangeListener(e -> updateProperties(filterProperty.getValue(), e.getValue(), filterOrigin.getValue()));
filterValue.setValueChangeMode(ValueChangeMode.LAZY);
filterValue.setSizeFull();
filterOrigin.addValueChangeListener(e -> updateProperties(filterProperty.getValue(), filterValue.getValue(), e.getValue()));
filterOrigin.setSizeFull();
// Header row
HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
filterRow.getCell(propertyColumn).setComponent(filterProperty);
filterRow.getCell(valueColumn).setComponent(filterValue);
filterRow.getCell(originColumn).setComponent(filterOrigin);
}
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:49,代码来源:PropertiesPage.java
示例6: enter
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
@Override
public void enter(ViewChangeEvent event) {
pageHelper.setErrorHandler(this);
this.removeAllComponents();
// Get application
int appId = Integer.parseInt(event.getParameters());
Application app = pageHelper.getApp(appId);
// Get loggers config
Optional<Loggers> loggers = getLoggers(app);
if(loggers.isPresent()) {
// Display loggers in a grid
grid = new Grid<>(LoggerGridRow.class);
grid.removeAllColumns();
Column<LoggerGridRow, String> nameColumn = grid.addColumn(LoggerGridRow::getName)
.setCaption("Name")
.setExpandRatio(2);
grid.addComponentColumn(logger -> {
NativeSelect<String> levelsDropdown = new NativeSelect<>(null, loggers.get().getLevels());
levelsDropdown.setEmptySelectionAllowed(false);
levelsDropdown.setSelectedItem(logger.getLevel());
// on selected level
levelsDropdown.addValueChangeListener(value -> {
// change logger level
loggersService.changeLevel(app, logger.getName(), value.getValue());
// refresh data in grid (several loggers might have been impacted)
updateLoggers(app);
Notification.show(
String.format("Logger %s level changed to %s", logger.getName(), value.getValue())
, Notification.Type.TRAY_NOTIFICATION);
});
return levelsDropdown;
}) .setCaption("Level")
.setExpandRatio(1);
grid.setSizeFull();
grid.setRowHeight(40);
grid.setItems(loggersRows);
grid.sort(nameColumn);
// Filter grid by logger name
filterInput = new TextField();
filterInput.setPlaceholder("filter by logger name...");
filterInput.addValueChangeListener(e -> filterLoggers(e.getValue()));
filterInput.setValueChangeMode(ValueChangeMode.LAZY);
filterInput.focus();
filterInput.setSizeFull();
// Header row
HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
filterRow.getCell(nameColumn).setComponent(filterInput);
this.addComponent(new PageHeader(app, "Loggers"));
this.addComponent(new Label("Changing a level will update one/many logger(s) level(s)"));
this.addComponent(grid);
} else {
this.addComponent(new PageHeader(app, "Loggers"));
this.addComponent(new Label(String.format("Failed to call %s<br />This endpoint is available since Spring Boot 1.5", app.endpoints().loggers()), ContentMode.HTML));
}
}
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:74,代码来源:LoggersPage.java
示例7: HeaderRowWrapper
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
public HeaderRowWrapper(HeaderRow row, Function<P, String> converter) {
super();
this.row = row;
this.converter = converter;
}
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:6,代码来源:AbstractGridItemListingBuilder.java
示例8: WeaponTypeGrid
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
public WeaponTypeGrid() {
super();
// withProperties("name", "proficiencyType", "handleType", "usageType", "oneHandBaseDamage",
// "twoHandBaseDamage", "damageType", "isReach", "isFinesse", "isLoading");
// withColumnHeaders("Nom", "Maitrise", "Manipulation", "Usage", "1 main", "2 mains",
// "Type de dommage", "Allonge", "Finesse", "Load");
//
// Grid.Column reach = getColumn("isReach");
// reach.setRenderer(new HtmlRenderer(),
// new StringToBooleanConverter(FontAwesome.CHECK_CIRCLE_O.getHtml(), FontAwesome.CIRCLE_O.getHtml()));
//
// Grid.Column finesse = getColumn("isFinesse");
// finesse.setRenderer(new HtmlRenderer(),
// new StringToBooleanConverter(FontAwesome.CHECK_CIRCLE_O.getHtml(), FontAwesome.CIRCLE_O.getHtml()));
//
// Grid.Column loading = getColumn("isLoading");
// loading.setRenderer(new HtmlRenderer(),
// new StringToBooleanConverter(FontAwesome.CHECK_CIRCLE_O.getHtml(), FontAwesome.CIRCLE_O.getHtml()));
//
// Grid.HeaderRow groupingHeader = prependHeaderRow();
// Grid.HeaderCell namesCell = groupingHeader.join(groupingHeader.getCell("oneHandBaseDamage"),
// groupingHeader.getCell("twoHandBaseDamage"));
// namesCell.setText("Dommage");
StringToBooleanConverter converter = new StringToBooleanConverter("", VaadinIcons.CHECK_CIRCLE_O.getHtml(),
VaadinIcons.CIRCLE_THIN.getHtml());
addColumn(WeaponType::getName).setCaption("Nom").setId("name");
addColumn(WeaponType::getProficiencyType).setCaption("Maitrise").setId("proficiencyType");
addColumn(WeaponType::getHandleType).setCaption("Manipulation").setId("handleType");
addColumn(WeaponType::getUsageType).setCaption("Usage").setId("usage");
addColumn(WeaponType::getOneHandBaseDamage).setCaption("1 main").setId("oneHandBaseDamage");
addColumn(WeaponType::getTwoHandBaseDamage).setCaption("2 mains").setId("twoHandBaseDamage");
addColumn(WeaponType::getDamageType).setCaption("Type de dommage").setId("damageType");
addColumn(weaponType -> converter.convertToPresentation(weaponType.getIsReach(), new ValueContext()), new HtmlRenderer())
.setCaption("Allonge");
addColumn(weaponType -> converter.convertToPresentation(weaponType.getIsFinesse(), new ValueContext()), new HtmlRenderer())
.setCaption("Finesse");
addColumn(weaponType -> converter.convertToPresentation(weaponType.getIsLoading(), new ValueContext()), new HtmlRenderer())
.setCaption("Recharge");
HeaderRow groupingHeader = prependHeaderRow();
HeaderCell namesCell = groupingHeader.join(groupingHeader.getCell("oneHandBaseDamage"), groupingHeader.getCell("twoHandBaseDamage"));
namesCell.setText("Dommage");
}
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:46,代码来源:WeaponTypeGrid.java
示例9: init
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
@Override
protected void init(final VaadinRequest request) {
// Creating the Export Tool Bar
MenuBar exportToolBar = createToolBar();
final VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
// Adding the Export Tool Bar to the Layout
layout.addComponent(exportToolBar);
/*********
* Adding Components to the Layout namely Tables, Grids and Tree Table
*******/
this.gridDefault = new Grid<>(DataModel.class);
this.gridDefault.setDataProvider(new ListDataProvider<>(DataModelGenerator.generate(20)));
this.gridDefault.setSizeFull();
this.gridDefault.setColumns(this.visibleColumns);
this.gridMergedCells = new Grid<>(DataModel.class);
this.gridMergedCells.setDataProvider(new ListDataProvider<>(DataModelGenerator.generate(20)));
this.gridMergedCells.setColumns(this.visibleColumns);
this.gridMergedCells.setSizeFull();
HeaderRow headerRow = this.gridMergedCells.addHeaderRowAt(0);
HeaderCell joinHeaderColumns1 = headerRow.join("country", "productType");
joinHeaderColumns1.setText("mergedCell");
HeaderCell joinHeaderColumns2 = headerRow.join("cheapest", "contractor");
joinHeaderColumns2.setText("mergedCell");
FooterRow footerRow1 = this.gridMergedCells.addFooterRowAt(0);
FooterCell joinFooterColumns1 = footerRow1.join("country", "productType");
joinFooterColumns1.setText("mergedCell");
FooterCell joinFooterColumns2 = footerRow1.join("cheapest", "contractor");
joinFooterColumns2.setText("mergedCell");
FooterRow footerRow2 = this.gridMergedCells.addFooterRowAt(0);
for (int i = 0; i < this.visibleColumns.length; i++) {
footerRow2.getCell(this.visibleColumns[i])
.setText(this.columnHeaders[i]);
}
this.gridFrozenColumns = new Grid<>(DataModel.class);
this.gridFrozenColumns.setDataProvider(new ListDataProvider<>(DataModelGenerator.generate(20)));
this.gridFrozenColumns.setColumns(this.visibleColumns);
this.gridFrozenColumns.getColumn("country")
.setWidth(300);
this.gridFrozenColumns.getColumn("productType")
.setWidth(300);
this.gridFrozenColumns.getColumn("catalogue")
.setWidth(300);
this.gridFrozenColumns.setSizeFull();
this.gridFrozenColumns.setFrozenColumnCount(3);
TabSheet tabSheet = new TabSheet();
tabSheet.setSizeFull();
tabSheet.addTab(this.gridDefault, "Grid (Default)");
tabSheet.addTab(this.gridMergedCells, "Grid (Merged Cells)");
tabSheet.addTab(this.gridFrozenColumns, "Grid (Frozen Columns&Rows)");
layout.addComponent(tabSheet);
layout.setExpandRatio(tabSheet, 1);
/*********
* Adding Components to the Layout namely Tables, Grids and Tree Table
*******/
/*********
* Adding the above data to the containers or components
*******/
setContent(layout);
}
开发者ID:bonprix,项目名称:vaadin-excel-exporter,代码行数:71,代码来源:DemoUI.java
示例10: HeaderWrapExtensionLayout
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
public HeaderWrapExtensionLayout() {
setMargin(true);
final SelectGrid<RowData> grid = new SelectGrid<>();
final WrappingGrid wrap = WrappingGrid.extend(grid);
TableSelectionModel<RowData> selectionModel = new TableSelectionModel<>();
selectionModel.setMode(TableSelectionMode.SHIFT);
grid.setSelectionModel(selectionModel);
generateData(grid, 5, 100);
HeaderRow headerRow = grid.prependHeaderRow();
headerRow.join(grid.getColumns().get(1), grid.getColumns().get(2));
HeaderRow headerRow1 = grid.appendHeaderRow();
headerRow1.join(grid.getColumns().get(2), grid.getColumns().get(3));
grid.setWidth("100%");
grid.setHeight("100%");
final Button button = new Button(BUTTON_WRAPPING_DISABLED_TEXT);
button.addClickListener(new Button.ClickListener() {
int state = 0;
public void buttonClick(ClickEvent event) {
state = (state + 1) % 2;
switch (state) {
case 0:
// Disable wrapping, attempt to restore original behavior
wrap.setWrapping(false);
button.setCaption(BUTTON_WRAPPING_DISABLED_TEXT);
break;
case 1:
// Apply wrapping rules
wrap.setWrapping(true);
button.setCaption(BUTTON_WRAPPING_ENABLED_TEXT);
break;
}
}
});
addComponent(button);
addComponent(grid);
CacheStrategyExtension.extend(grid, 5, 0.2d);
}
开发者ID:tsuoanttila,项目名称:GridExtensionPack,代码行数:50,代码来源:HeaderWrapExtensionLayout.java
示例11: withDefaultHeaderRow
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
/**
* Sets the default row of the header. The default row is a special header
* row that displays column captions and sort indicators. By default Grid
* has a single row which is also the default row. When a header row is set
* as the default row, any existing cell content is replaced by the column
* captions.
*
* @param row
* the new default row, or null for no default row
* @return this for method chaining
* @see Grid#setDefaultHeaderRow(HeaderRow)
*
* @throws IllegalArgumentException
* if the header does not contain the row
*/
@SuppressWarnings("unchecked")
public default THIS withDefaultHeaderRow(HeaderRow row) {
((Grid<ITEM>) this).setDefaultHeaderRow(row);
return (THIS) this;
}
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:21,代码来源:FluentGrid.java
示例12: getFilterRow
import com.vaadin.ui.components.grid.HeaderRow; //导入依赖的package包/类
/**
* generated HeaderRow
*
* @return added HeaderRow during intialization
*/
public HeaderRow getFilterRow() {
return filterHeaderRow;
}
开发者ID:melistik,项目名称:vaadin-grid-util,代码行数:9,代码来源:GridCellFilter.java
注:本文中的com.vaadin.ui.components.grid.HeaderRow类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论