Java 类com.vaadin.ui.Grid.HeaderRow 实例源码

项目:metl    文件:EditExcelReaderPanel.java   
protected void buildGrid() {
    grid = new Grid();
    grid.setSelectionMode(SelectionMode.NONE);
    grid.setSizeFull();
    grid.setEditorEnabled(!readOnly);
    container = new BeanItemContainer<Record>(Record.class);
    grid.setContainerDataSource(container);
    grid.setColumnOrder("entityName", "attributeName", "excelMapping");
    HeaderRow filterRow = grid.appendHeaderRow();
    addColumn("entityName", filterRow);
    addColumn("attributeName", filterRow);
    TextField tfExcelMapping = new TextField();
    tfExcelMapping.addBlurListener(e->saveExcelMappingSettings());
    tfExcelMapping.setWidth(100, Unit.PERCENTAGE);
    tfExcelMapping.setImmediate(true);
    grid.getColumn("excelMapping").setEditorField(tfExcelMapping).setExpandRatio(1);
    addShowPopulatedFilter("excelMapping", filterRow);
    grid.setEditorBuffered(false);
    addComponent(grid);
    setExpandRatio(grid, 1);
}
项目:metl    文件:EditExcelReaderPanel.java   
protected void addColumn(String propertyId, HeaderRow filterRow) {
    grid.getColumn(propertyId).setEditable(false);
    HeaderCell cell = filterRow.getCell(propertyId);
    TextField filterField = new TextField();
    filterField.setInputPrompt("Filter");
    filterField.setImmediate(true);
    filterField.addStyleName(ValoTheme.TEXTFIELD_TINY);
    filterField.setWidth(100, Unit.PERCENTAGE);
    filterField.addTextChangeListener(change -> {
        container.removeContainerFilters(propertyId);
        if (!change.getText().isEmpty()) {
            container.addContainerFilter(
                    new SimpleStringFilter(propertyId, change.getText(), true, false));
        }
    });
    cell.setComponent(filterField);
}
项目:metl    文件:EditXmlFormatPanel.java   
protected void addColumn(String propertyId, HeaderRow filterRow) {
    grid.getColumn(propertyId).setEditable(false);
    HeaderCell cell = filterRow.getCell(propertyId);
    TextField filterField = new TextField();
    filterField.setInputPrompt("Filter");
    filterField.setImmediate(true);
    filterField.addStyleName(ValoTheme.TEXTFIELD_TINY);
    filterField.setWidth(100, Unit.PERCENTAGE);
    filterField.addTextChangeListener(change -> {
        container.removeContainerFilters(propertyId);
        if (!change.getText().isEmpty()) {
            container.addContainerFilter(
                    new SimpleStringFilter(propertyId, change.getText(), true, false));
        }
    });
    cell.setComponent(filterField);
}
项目:KrishnasSpace    文件:FilterGrid.java   
/**
 * 
 */
private void setUpFiltersOnGrid() {
    HeaderRow filterRow = grid.appendHeaderRow();
    // Demonstrates combobox in header
    setCategoryFilter(filterRow);
    // Demonstrates TextField
    setManufacturerFilter(filterRow);

}
项目:KrishnasSpace    文件:FilterGrid.java   
/**
 * @param filterRow
 */
private void setManufacturerFilter(HeaderRow filterRow) {
    HeaderCell manufacturerFilter = filterRow.getCell(MANUFACTURER);
    TextField textField = new TextField();
    textField.setImmediate(true);
    // On Change of text, trigger filter operation
    textField.addTextChangeListener(getManufacturingFilterListener());
    manufacturerFilter.setComponent(textField);
}
项目:KrishnasSpace    文件:FilterGrid.java   
/**
 * @param filterRow
 * @return
 */
private HeaderCell setCategoryFilter(HeaderRow filterRow) {
    HeaderCell categoryFilter = filterRow.getCell(CATEGORY);
    ComboBox comboBox = new ComboBox();
    comboBox.setHeight(100, Unit.PERCENTAGE);
    comboBox.setImmediate(true);
    comboBox.setNewItemsAllowed(false);
    comboBox.setTextInputAllowed(false);
    comboBox.addValueChangeListener(getCategoryFilterListener());
    comboBox.setContainerDataSource(getCategoryDataSource());
    categoryFilter.setComponent(comboBox);
    return categoryFilter;
}
项目:KrishnasSpace    文件:HeaderGrid.java   
/**
 * 
 */
private void customizeGrid() {
    grid.setFrozenColumnCount(3);
    HeaderRow mainHeaderRow = grid.prependHeaderRow();
    addNestedHeaderCell(mainHeaderRow, "sales2012", "2012");
    addNestedHeaderCell(mainHeaderRow, "sales2013", "2013");
    addNestedHeaderCell(mainHeaderRow, "sales2014", "2014");
}
项目:KrishnasSpace    文件:HeaderGrid.java   
private HeaderCell addNestedHeaderCell(HeaderRow mainHeaderRow,
        String baseYear, String mainCellText) {
    HeaderCell q1Header = mainHeaderRow.getCell(baseYear + ".q1");
    HeaderCell q2Header = mainHeaderRow.getCell(baseYear + ".q2");
    HeaderCell q3Header = mainHeaderRow.getCell(baseYear + ".q3");
    HeaderCell q4Header = mainHeaderRow.getCell(baseYear + ".q4");
    HeaderCell mainHeaderCell = mainHeaderRow.join(q1Header, q2Header,
            q3Header, q4Header);
    mainHeaderCell.setText(mainCellText);
    return mainHeaderCell;

}
项目:metl    文件:ValidateFlowDeploymentPanel.java   
protected void buildGridHeader() {
    HeaderRow hdr1 = grid.prependHeaderRow();
    HeaderCell newDeployHdr = hdr1.join("newDeployName","newDeployVersion","newDeployType");
    newDeployHdr.setText("New Deployment");
    newDeployHdr.setStyleName("header-center");
    HeaderCell existingDeployHdr = hdr1.join("existingDeployName","existingDeployVersion","existingDeployType");
    existingDeployHdr.setText("Existing Deployment");
    existingDeployHdr.setStyleName("header-center");
    grid.getColumn("newDeployName").setHeaderCaption("Name");
    grid.getColumn("newDeployVersion").setHeaderCaption("Version");
    grid.getColumn("newDeployType").setHeaderCaption("Type");
    grid.getColumn("existingDeployName").setHeaderCaption("Name");
    grid.getColumn("existingDeployVersion").setHeaderCaption("Version");
    grid.getColumn("existingDeployType").setHeaderCaption("Type");
}
项目:metl    文件:EditExcelReaderPanel.java   
protected void addShowPopulatedFilter(String propertyId, HeaderRow filterRow) {
    HeaderCell cell = filterRow.getCell(propertyId);
    CheckBox group = new CheckBox("Show Set Only");
    group.setImmediate(true);
    group.addValueChangeListener(l->{
        container.removeContainerFilters(propertyId);
        if (group.getValue()) {
            container.addContainerFilter(new And(new Not(new Compare.Equal(propertyId,"")), new Not(new IsNull(propertyId))));
        }
    });
    group.addStyleName(ValoTheme.CHECKBOX_SMALL);
    cell.setComponent(group);

}
项目:metl    文件:EditXmlFormatPanel.java   
protected void buildGrid() {
    grid = new Grid();
    grid.setSelectionMode(SelectionMode.NONE);
    grid.setSizeFull();
    grid.setEditorEnabled(!readOnly);
    container = new BeanItemContainer<Record>(Record.class);
    grid.setContainerDataSource(container);
    grid.setColumns("entityName", "attributeName", "xpath");
    HeaderRow filterRow = grid.appendHeaderRow();

    addColumn("entityName", filterRow);

    addColumn("attributeName", filterRow);

    ComboBox combo = new ComboBox();
    combo.addValueChangeListener(e->saveXPathSettings());
    combo.setWidth(100, Unit.PERCENTAGE);
    combo.setImmediate(true);
    combo.setNewItemsAllowed(true);
    combo.setInvalidAllowed(true);
    combo.setTextInputAllowed(true);
    combo.setScrollToSelectedItem(true);
    combo.setFilteringMode(FilteringMode.CONTAINS);
    grid.getColumn("xpath").setEditorField(combo).setExpandRatio(1);
    addShowPopulatedFilter("xpath", filterRow);
    grid.setEditorBuffered(false);
    addComponent(grid);
    setExpandRatio(grid, 1);
}
项目:metl    文件:EditXmlFormatPanel.java   
protected void addShowPopulatedFilter(String propertyId, HeaderRow filterRow) {
    HeaderCell cell = filterRow.getCell(propertyId);
    CheckBox group = new CheckBox("Show Set Only");
    group.setImmediate(true);
    group.addValueChangeListener(l->{
        container.removeContainerFilters(propertyId);
        if (group.getValue()) {
            container.addContainerFilter(new And(new Not(new Compare.Equal(propertyId,"")), new Not(new IsNull(propertyId))));
        }
    });
    group.addStyleName(ValoTheme.CHECKBOX_SMALL);
    cell.setComponent(group);

}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public HeaderRow addRowAt(int index) {
    return grid.getHeaderRow(index);
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public HeaderRow appendRow() {
    return grid.appendHeaderRow();
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public HeaderRow getRowAt(int index) {
    return grid.getHeaderRow(index);
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public HeaderRow getDefaultRow() {
    return grid.getDefaultHeaderRow();
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public HeaderRow prependRow() {
    return grid.prependHeaderRow();
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public void removeRow(HeaderRow row) {
    grid.removeHeaderRow(row);
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public void setDefaultRow(HeaderRow row) {
    grid.setDefaultHeaderRow(row);
}
项目:holon-vaadin7    文件:ItemListingBuilder.java   
/**
 * Build Grid header rows.
 * @param header Header rows container
 */
void buildHeader(GridSection<HeaderRow> header);