本文整理了Java中com.vaadin.ui.Grid.setColumnOrder()
方法的一些代码示例,展示了Grid.setColumnOrder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Grid.setColumnOrder()
方法的具体详情如下:
包路径:com.vaadin.ui.Grid
类名称:Grid
方法名:setColumnOrder
[英]Sets a new column order for the grid. All columns which are not ordered here will remain in the order they were before as the last columns of grid.
[中]设置网格的新列顺序。此处未排序的所有列都将保持以前作为网格最后一列的顺序。
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Sets a new column order for the grid. All columns which are not ordered
* here will remain in the order they were before as the last columns of
* grid.
*
* @param columns
* the columns in the order they should be
*/
public void setColumnOrder(Column<T, ?>... columns) {
setColumnOrder(Stream.of(columns));
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Sets a new column order for the grid based on their column ids. All
* columns which are not ordered here will remain in the order they were
* before as the last columns of grid.
*
* @param columnIds
* the column ids in the order they should be
*
* @see Column#setId(String)
*/
public void setColumnOrder(String... columnIds) {
setColumnOrder(Stream.of(columnIds).map(this::getColumnOrThrow));
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Sets the columns and their order based on their column ids. Columns
* currently in this grid that are not present in the list of column ids are
* removed. This includes any column that has no id. Similarly, any new
* column in columns will be added to this grid. New columns can only be
* added for a <code>Grid</code> created using {@link Grid#Grid(Class)} or
* {@link #withPropertySet(PropertySet)}.
*
*
* @param columnIds
* the column ids to set
*
* @see Column#setId(String)
*/
public void setColumns(String... columnIds) {
// Must extract to an explicitly typed variable because otherwise javac
// cannot determine which overload of setColumnOrder to use
Column<T, ?>[] newColumnOrder = Stream.of(columnIds)
.map((Function<String, Column<T, ?>>) id -> {
Column<T, ?> column = getColumn(id);
if (column == null) {
column = addColumn(id);
}
return column;
}).toArray(Column[]::new);
setColumnOrder(newColumnOrder);
// The columns to remove are now at the end of the column list
getColumns().stream().skip(columnIds.length)
.forEach(this::removeColumn);
}
代码示例来源:origin: stackoverflow.com
public class MyGridComponent extends VerticalLayout {
public MyGridComponent() {
BeanItemContainer<MyBean> dataSource = new BeanItemContainer<>(MyBean.class);
Grid grid = new Grid(dataSource);
addComponent(grid);
grid.getColumn("image").setRenderer(new ImageRenderer());
grid.setColumnOrder("image", "name", "surname");
dataSource.addItem(new MyBean(
new ExternalResource("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFvElEQVRYha2Xv2skyRXHP60dFCwbyGBNYi3TwzqqcnDBhWe6lSiRQTZcbXIynkvtxLkD9ab6Ay4dLWw0pcDCXKJEPdylBl9QBQd7TDXaaHSBDg5hxC3t4FV1z4zlRRwuGKq6uvp93/u+H/Umq9/WLY8YyydLhu+HLK+XDJ8PZW9l/XPH4FHg10scMHwuz/WbGrdwEIAc9FijCvWzlMkew8DyegnAXXPPl9MLAFywa2d0btD7mt+dnPDjd3OevSgA+PG7+QdlP4qBBH56cryxawCLzg0uWNzUogqFKg3/fgT4oxVwgN0A17lB5aKED/2+PbMcNvfkn+zx7EXx/2HAn9kO1JSgcgO5RWM6BUUJUcrWli+nlsPP3/CbP332QSUGwIOaXl0v2X8uUe9qiy4Ns8qsnDCQAz8doAeX6NC/0xNDFeB0eszL8JbyuGT5ZNm9H77vg3VrFTwFDoCOs43Wn0wiwN6BAO8dwE8H8O5SsmFjVBODzg2zaSXp+n7Y/dYYWLU8rZO2V1+J9aY06AT67jKevuSDIwdTgqslgHkucl0tr8fZvTDwIRk+WHwjwoAV8AfG3kG/DvJT0U2LdhsAF4BgyRrPYiR7W6u0r647QSsCH6J6DXjTAMSVWeO7vSzTtCPHuLln0W6zteqCf9SW8PW7XkLeL93/Qnl3ueEa+U7OW8DgFk6KWTQgazSLdptxdi8uePaioH5TYycvOZ0e486sCAigRoj/EQrdQ0wk8Pg++VnFQpW+zRqPG7lOyRDeMqjf1KhiiSoUs2KGRvLYVhbKHtieWQgWYgHSpHogwOeNp21dV5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h//Qp3VYlQYvM51pTHJUVsbB3pP4VdYSKeb3rZ/wHvo/8tObGxnAAAAABJRU5ErkJggg=="),
"Agent",
"Smith"));
dataSource.addItem(new MyBean(
new ExternalResource("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wgARCAAeAB4DASIAAhEBAxEB/8QAGgAAAQUBAAAAAAAAAAAAAAAABAACAwUGB//EABcBAQEBAQAAAAAAAAAAAAAAAAADAQT/2gAMAwEAAhADEAAAAeftG1UdMKjrOWzrVaZPLo6E/8QAHBAAAgMBAQEBAAAAAAAAAAAAAgMBBAUTABES/9oACAEBAAEFAurI8wvvsSuJ1rPMzFDZEcp05uHITUcULmj09YWd5kqDPturT2ot6NCPzGsqCrQ6SD//xAAYEQADAQEAAAAAAAAAAAAAAAAAARESIf/aAAgBAwEBPwGmVBIs4f/EABoRAAMAAwEAAAAAAAAAAAAAAAABAhESITL/2gAIAQIBAT8BeqL9Mq3nhXVk/8QAIhAAAgEDAwUBAAAAAAAAAAAAAQIAAxESITFRBBMyYXFB/9oACAEBAAY/AiwIZOOIvyNVqDKxsAZoopkcTJVNjO4d76Q0zkr03yYcy7GeFk+Smh0VBZRx7nTspL06gwJb8MYuqlTtfaHSEiE+xBP/xAAgEAEAAgICAwADAAAAAAAAAAABABEhMUFxUWGBoeHx/9oACAEBAAE/IUCo2XHxOkvC2+C3bMZsquH5CaGArmEQAJy/EYfJBFl7bXnlmm0Bkc5ocwrR57Tnzl/ydR6tL2f1AM643KBA6mSoX17v9wvDgcvqf//aAAwDAQACAAMAAAAQbSwf/8QAGREBAQADAQAAAAAAAAAAAAAAAQARITFB/9oACAEDAQ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WJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A860jSYdNKrYqPKRgT3Pz8Yz6Gum1AeEvAXhqbU9elkjt3kKmMnfLM6qcLGvbAOM5xUEyG0vPsJh+ztbSyxhFbphuMke3FR/tA+Bf+Ej0rwnqEdvcXem6dDc395Z2UW6ecDa21MkAklQuOvPQ9K8/T4mfNrl5faS0/rQ4Xwr8cPA2vvdf2vocuhaZbpsW8ikMxEuMqGXA6gHkcdq9E1nwhZ6bFpN/pskV7C8a3scqrhGD4II/D1r2L9nL9p/4S3PwbvIfE/hfWLHT7u+TQ3s7rRHulaWWM7Y96K2QQhOTjBx0rmfHGgW3w+8N6boEQMn2K3WFQxyyKWLhP+Aqdufaq1ktR+/VXvK3kcVaaZfeLdUuJlZjcSzGW4ZuBuyWJPbrmr2s/Fzw5qWkXOh6PcveT6AR9pvkx5D+Y33YyDlsFDz09K+cfjh+07LJpc3hfw3ZyaRZHKXMxbMt0vGAcD5V/wBkE57nivGPC3iDXPC2r/bLC6jvEukC3UEmfLcdgcY5wc5HTNEorl33NK1Lmw7jffa5+xn7K9/cw/DvxJ4nnvor2LVJwsRjn3+WIgVCheccEk9DnHGOa8I+J2ty6v4mvLhlPlurZGOM/dH8hXzLqH7aGoeEvCPw60zwx4ds/DB8M3t3c3P2ZjIuotcLh/NBAyMZGOT0wRgV7P4J+Ofhn4yyRRPZjRNTuz+6USb4JHH8OTyhyRgNnORzSg0opE4dKlSiuh//2Q=="),
"The",
"One"));
}
}
代码示例来源:origin: com.haulmont.cuba/cuba-web
component.setColumnOrder(newColumns.stream()
.map(Column::getId)
.toArray(String[]::new));
代码示例来源:origin: com.haulmont.cuba/cuba-web
@Override
public Column<E> addGeneratedColumn(String columnId, ColumnGenerator<E, ?> generator, int index) {
checkNotNullArgument(columnId, "columnId is null");
checkNotNullArgument(generator, "generator is null for column id '%s'", columnId);
Column<E> existingColumn = getColumn(columnId);
if (existingColumn != null) {
index = columnsOrder.indexOf(existingColumn);
removeColumn(existingColumn);
}
Grid.Column<E, Object> generatedColumn =
component.addColumn(createGeneratedColumnValueProvider(columnId, generator));
ColumnImpl<E> column = new ColumnImpl<>(columnId, generator.getType(), this);
if (existingColumn != null) {
copyColumnProperties(column, existingColumn);
} else {
column.setCaption(columnId);
}
column.setGenerated(true);
columns.put(column.getId(), column);
columnsOrder.add(index, column);
columnGenerators.put(column.getId(), generator);
setupGridColumnProperties(generatedColumn, column);
component.setColumnOrder(getColumnOrder());
return column;
}
代码示例来源:origin: com.haulmont.cuba/cuba-web
@Override
public void setVisible(boolean visible) {
if (this.visible != visible) {
this.visible = visible;
Grid<E> grid = owner.getComponent();
if (visible) {
Grid.Column<E, ?> gridColumn =
grid.addColumn(new EntityValueProvider<>(getPropertyPath()));
owner.setupGridColumnProperties(gridColumn, this);
grid.setColumnOrder(owner.getColumnOrder());
} else {
grid.removeColumn(getId());
setGridColumn(null);
}
}
}
代码示例来源:origin: eclipse/hawkbit
private void setGridColumnProperties() {
grid.getColumn(COLUMN_STATUS).setRenderer(new StatusRenderer());
grid.getColumn(COLUMN_PROGRESS).setRenderer(new ProgressBarRenderer());
grid.setColumnOrder(COLUMN_STATUS, COLUMN_PROGRESS, COLUMN_FILE_NAME, SPUILabelDefinitions.NAME_VERSION,
COLUMN_REASON);
setColumnWidth();
grid.getColumn(SPUILabelDefinitions.NAME_VERSION)
.setHeaderCaption(i18n.getMessage("upload.swModuleTable.header"));
grid.setFrozenColumnCount(5);
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
private void setGridColumnProperties() {
grid.getColumn(COLUMN_STATUS).setRenderer(new StatusRenderer());
grid.getColumn(COLUMN_PROGRESS).setRenderer(new ProgressBarRenderer());
grid.setColumnOrder(COLUMN_STATUS, COLUMN_PROGRESS, COLUMN_FILE_NAME, SPUILabelDefinitions.NAME_VERSION,
COLUMN_REASON);
setColumnWidth();
grid.getColumn(SPUILabelDefinitions.NAME_VERSION)
.setHeaderCaption(i18n.getMessage("upload.swModuleTable.header"));
grid.setFrozenColumnCount(5);
}
代码示例来源:origin: com.haulmont.cuba/cuba-web
protected void addColumnInternal(ColumnImpl<E> column, int index) {
Grid.Column<E, ?> gridColumn = component.addColumn(
new EntityValueProvider<>(column.getPropertyPath()));
columns.put(column.getId(), column);
columnsOrder.add(index, column);
final String caption = StringUtils.capitalize(column.getCaption() != null
? column.getCaption()
: generateColumnCaption(column));
column.setCaption(caption);
if (column.getOwner() == null) {
column.setOwner(this);
}
MetaPropertyPath propertyPath = column.getPropertyPath();
if (propertyPath != null) {
MetaProperty metaProperty = propertyPath.getMetaProperty();
MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(propertyPath);
String storeName = metadataTools.getStoreName(propertyMetaClass);
if (metadataTools.isLob(metaProperty)
&& !persistenceManagerClient.supportsLobSortingAndFiltering(storeName)) {
column.setSortable(false);
}
}
setupGridColumnProperties(gridColumn, column);
component.setColumnOrder(getColumnOrder());
}
代码示例来源:origin: com.haulmont.cuba/cuba-web
component.setColumnOrder(getColumnOrder());
代码示例来源:origin: jreznot/electron-java-app
.setEditorComponent(new TextField());
tasksGrid.setColumnOrder("done", "summary");
内容来源于网络,如有侵权,请联系作者删除!