com.vaadin.v7.ui.Table.refreshRowCache()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(390)

本文整理了Java中com.vaadin.v7.ui.Table.refreshRowCache()方法的一些代码示例,展示了Table.refreshRowCache()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.refreshRowCache()方法的具体详情如下:
包路径:com.vaadin.v7.ui.Table
类名称:Table
方法名:refreshRowCache

Table.refreshRowCache介绍

[英]Discards and recreates the internal row cache. Call this if you make changes that affect the rows but the information about the changes are not automatically propagated to the Table.

Do not call this e.g. if you have updated the data model through a Property. These types of changes are automatically propagated to the Table.

A typical case when this is needed is if you update a generator (e.g. CellStyleGenerator) and want to ensure that the rows are redrawn with new styles.

Note that calling this method is not cheap so avoid calling it unnecessarily.
[中]丢弃并重新创建内部行缓存。如果所做的更改会影响行,但有关更改的信息不会自动传播到表中,请调用此函数。
例如,如果您通过属性更新了数据模型,则不要调用此选项。这些类型的更改会自动传播到表中。
需要这样做的典型情况是,如果更新生成器(例如CellStyleGenerator),并希望确保使用新样式重新绘制行。
请注意,调用此方法并不便宜,因此请避免不必要地调用它。

代码示例

代码示例来源:origin: OpenNMS/opennms

  1. @Override
  2. public void refreshRowCache() {
  3. if (m_disableRowCacheRefresh) {
  4. return;
  5. }
  6. super.refreshRowCache();
  7. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Assigns a row generator to the table. The row generator will be able to
  3. * replace rows in the table when it is rendered.
  4. *
  5. * @param generator
  6. * the new row generator
  7. */
  8. public void setRowGenerator(RowGenerator generator) {
  9. rowGenerator = generator;
  10. refreshRowCache();
  11. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Sets the TableFieldFactory that is used to create editor for table cells.
  3. *
  4. * The TableFieldFactory is only used if the Table is editable. By default
  5. * the DefaultFieldFactory is used.
  6. *
  7. * @param fieldFactory
  8. * the field factory to set.
  9. * @see #isEditable
  10. * @see DefaultFieldFactory
  11. */
  12. public void setTableFieldFactory(TableFieldFactory fieldFactory) {
  13. this.fieldFactory = fieldFactory;
  14. // Assure visual refresh
  15. refreshRowCache();
  16. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Sets the editable property.
  3. *
  4. * If table is editable a editor of type Field is created for each table
  5. * cell. The assigned FieldFactory is used to create the instances.
  6. *
  7. * To provide custom editors for table cells create a class implementing the
  8. * FieldFactory interface, and assign it to table, and set the editable
  9. * property to true.
  10. *
  11. * @param editable
  12. * true if table should be editable by user.
  13. * @see Field
  14. * @see FieldFactory
  15. *
  16. */
  17. public void setEditable(boolean editable) {
  18. this.editable = editable;
  19. // Assure visual refresh
  20. refreshRowCache();
  21. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Sets the page length.
  3. *
  4. * <p>
  5. * Setting page length 0 disables paging. The page length defaults to 15.
  6. * </p>
  7. *
  8. * <p>
  9. * If Table has height set ({@link #setHeight(float, Unit)} ) the client
  10. * side may update the page length automatically the correct value.
  11. * </p>
  12. *
  13. * @param pageLength
  14. * the length of one page.
  15. */
  16. public void setPageLength(int pageLength) {
  17. if (pageLength >= 0 && this.pageLength != pageLength) {
  18. this.pageLength = pageLength;
  19. // Assures the visual refresh
  20. refreshRowCache();
  21. }
  22. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. @Override
  2. public void markAsDirtyRecursive() {
  3. super.markAsDirtyRecursive();
  4. // Avoid sending a partial repaint (#8714)
  5. refreshRowCache();
  6. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Sets whether the given column is collapsible. Note that collapsible
  3. * columns can only be actually collapsed (via UI or with
  4. * {@link #setColumnCollapsed(Object, boolean) setColumnCollapsed()}) if
  5. * {@link #isColumnCollapsingAllowed()} is true. By default all columns are
  6. * collapsible.
  7. *
  8. * @param propertyId
  9. * the propertyID identifying the column.
  10. * @param collapsible
  11. * true if the column should be collapsible, false otherwise.
  12. */
  13. public void setColumnCollapsible(Object propertyId, boolean collapsible) {
  14. if (collapsible) {
  15. noncollapsibleColumns.remove(propertyId);
  16. } else {
  17. noncollapsibleColumns.add(propertyId);
  18. collapsedColumns.remove(propertyId);
  19. }
  20. refreshRowCache();
  21. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Adds new item after the given item.
  3. *
  4. * @see Container.Ordered#addItemAfter(java.lang.Object)
  5. */
  6. @Override
  7. public Object addItemAfter(Object previousItemId)
  8. throws UnsupportedOperationException {
  9. Object itemId = ((Container.Ordered) items)
  10. .addItemAfter(previousItemId);
  11. if (!(items instanceof Container.ItemSetChangeNotifier)) {
  12. refreshRowCache();
  13. }
  14. return itemId;
  15. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Adds new item after the given item.
  3. *
  4. * @see Container.Ordered#addItemAfter(java.lang.Object, java.lang.Object)
  5. */
  6. @Override
  7. public Item addItemAfter(Object previousItemId, Object newItemId)
  8. throws UnsupportedOperationException {
  9. Item item = ((Container.Ordered) items).addItemAfter(previousItemId,
  10. newItemId);
  11. if (!(items instanceof Container.ItemSetChangeNotifier)) {
  12. refreshRowCache();
  13. }
  14. return item;
  15. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. private void setColumnOrder(Object[] columnOrder) {
  2. if (columnOrder == null || !isColumnReorderingAllowed()) {
  3. return;
  4. }
  5. final LinkedList<Object> newOrder = new LinkedList<Object>();
  6. for (Object id : columnOrder) {
  7. if (id != null && visibleColumns.contains(id)) {
  8. visibleColumns.remove(id);
  9. newOrder.add(id);
  10. }
  11. }
  12. for (final Object columnId : visibleColumns) {
  13. if (!newOrder.contains(columnId)) {
  14. newOrder.add(columnId);
  15. }
  16. }
  17. visibleColumns = newOrder;
  18. // Assure visual refresh
  19. refreshRowCache();
  20. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Removes a generated column previously added with addGeneratedColumn.
  3. *
  4. * @param columnId
  5. * id of the generated column to remove
  6. * @return true if the column could be removed (existed in the Table)
  7. */
  8. public boolean removeGeneratedColumn(Object columnId) {
  9. if (columnGenerators.containsKey(columnId)) {
  10. columnGenerators.remove(columnId);
  11. // remove column from visibleColumns list unless it exists in
  12. // container (generator previously overrode this column)
  13. if (!items.getContainerPropertyIds().contains(columnId)) {
  14. visibleColumns.remove(columnId);
  15. }
  16. refreshRowCache();
  17. return true;
  18. } else {
  19. return false;
  20. }
  21. }

代码示例来源:origin: com.haulmont.cuba/cuba-web

  1. @Override
  2. public void setIconProvider(Function<? super E, String> iconProvider) {
  3. this.iconProvider = iconProvider;
  4. if (iconProvider != null) {
  5. setRowHeaderMode(RowHeaderMode.ICON);
  6. } else {
  7. setRowHeaderMode(RowHeaderMode.NONE);
  8. }
  9. component.refreshRowCache();
  10. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Removes the Item identified by <code>ItemId</code> from the Container.
  3. *
  4. * @see Container#removeItem(Object)
  5. */
  6. @Override
  7. public boolean removeItem(Object itemId) {
  8. final Object nextItemId = nextItemId(itemId);
  9. final boolean ret = super.removeItem(itemId);
  10. if (ret && (itemId != null)
  11. && (itemId.equals(currentPageFirstItemId))) {
  12. currentPageFirstItemId = nextItemId;
  13. }
  14. if (!(items instanceof Container.ItemSetChangeNotifier)) {
  15. refreshRowCache();
  16. }
  17. return ret;
  18. }

代码示例来源:origin: OpenNMS/opennms

  1. @Override
  2. public void buttonClick(Button.ClickEvent clickEvent) {
  3. ColumnDef columnDef = (ColumnDef) columnsTable.getValue();
  4. if (columnDef != null) {
  5. int columnDefIndex = columnOrder.get(columnDef);
  6. ColumnDef columnDefToSwap = null;
  7. for (Map.Entry<ColumnDef, Integer> entry : columnOrder.entrySet()) {
  8. if (entry.getValue().intValue() == columnDefIndex - 1) {
  9. columnDefToSwap = entry.getKey();
  10. break;
  11. }
  12. }
  13. if (columnDefToSwap != null) {
  14. columnsTable.unselect(columnDef);
  15. columnOrder.remove(columnDef);
  16. columnOrder.remove(columnDefToSwap);
  17. columnOrder.put(columnDef, columnDefIndex - 1);
  18. columnOrder.put(columnDefToSwap, columnDefIndex);
  19. columns.sort(new Object[]{"label"}, new boolean[]{true});
  20. columnsTable.refreshRowCache();
  21. columnsTable.select(columnDef);
  22. }
  23. }
  24. }
  25. });

代码示例来源:origin: OpenNMS/opennms

  1. @Override
  2. public void buttonClick(Button.ClickEvent clickEvent) {
  3. ColumnDef columnDef = (ColumnDef) columnsTable.getValue();
  4. if (columnDef != null) {
  5. columnsTable.unselect(columnDef);
  6. columns.removeItem(columnDef);
  7. }
  8. columnsTable.refreshRowCache();
  9. }
  10. });

代码示例来源:origin: OpenNMS/opennms

  1. @Override
  2. public void buttonClick(Button.ClickEvent clickEvent) {
  3. RowDef rowDef = (RowDef) rowsTable.getValue();
  4. if (rowDef != null) {
  5. rowsTable.unselect(rowDef);
  6. rows.removeItem(rowDef);
  7. }
  8. rowsTable.refreshRowCache();
  9. }
  10. });

代码示例来源:origin: com.haulmont.cuba/cuba-web

  1. @Override
  2. public void removeColumn(Table.Column column) {
  3. if (column == null) {
  4. return;
  5. }
  6. component.removeContainerProperty(column.getId());
  7. columns.remove(column.getId());
  8. columnsOrder.remove(column);
  9. // vaadin8 it seems that it is not required
  10. if (!(component.getContainerDataSource() instanceof com.vaadin.v7.data.Container.ItemSetChangeNotifier)) {
  11. component.refreshRowCache();
  12. }
  13. column.setOwner(null);
  14. }

代码示例来源:origin: com.haulmont.reports/reports-web

  1. @Override
  2. public void initControlBtnsActions(Button button, final Table table) {
  3. button.unwrap(com.vaadin.ui.Button.class).addClickListener((com.vaadin.ui.Button.ClickListener) event -> {
  4. com.vaadin.v7.ui.Table vaadinTable = table.unwrap(com.vaadin.v7.ui.Table.class);
  5. vaadinTable.setCurrentPageFirstItemId(vaadinTable.lastItemId());
  6. vaadinTable.refreshRowCache();
  7. });
  8. }

代码示例来源:origin: OpenNMS/opennms

  1. void refreshTable() {
  2. if (m_table != null) {
  3. m_beanItemContainer = WallboardProvider.getInstance().getBeanContainer();
  4. m_table.setContainerDataSource(m_beanItemContainer);
  5. m_table.setVisibleColumns(new Object[]{"title", "Edit", "Remove", "Preview", "Default"});
  6. m_table.setColumnHeader("title", "Title");
  7. m_table.sort();
  8. m_table.refreshRowCache();
  9. }
  10. }
  11. }

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

  1. /**
  2. * Notifies this listener that the Property's value has changed.
  3. *
  4. * Also listens changes in rendered items to refresh content area.
  5. *
  6. * @see Property.ValueChangeListener#valueChange(Property.ValueChangeEvent)
  7. */
  8. @Override
  9. public void valueChange(Property.ValueChangeEvent event) {
  10. if (equals(event.getProperty())
  11. || event.getProperty() == getPropertyDataSource()) {
  12. super.valueChange(event);
  13. } else {
  14. refreshRowCache();
  15. containerChangeToBeRendered = true;
  16. }
  17. markAsDirty();
  18. }

相关文章

Table类方法