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

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

本文整理了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

@Override
public void refreshRowCache() {
  if (m_disableRowCacheRefresh) {
    return;
  }
  super.refreshRowCache();
}

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

/**
 * Assigns a row generator to the table. The row generator will be able to
 * replace rows in the table when it is rendered.
 *
 * @param generator
 *            the new row generator
 */
public void setRowGenerator(RowGenerator generator) {
  rowGenerator = generator;
  refreshRowCache();
}

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

/**
 * Sets the TableFieldFactory that is used to create editor for table cells.
 *
 * The TableFieldFactory is only used if the Table is editable. By default
 * the DefaultFieldFactory is used.
 *
 * @param fieldFactory
 *            the field factory to set.
 * @see #isEditable
 * @see DefaultFieldFactory
 */
public void setTableFieldFactory(TableFieldFactory fieldFactory) {
  this.fieldFactory = fieldFactory;
  // Assure visual refresh
  refreshRowCache();
}

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

/**
 * Sets the editable property.
 *
 * If table is editable a editor of type Field is created for each table
 * cell. The assigned FieldFactory is used to create the instances.
 *
 * To provide custom editors for table cells create a class implementing the
 * FieldFactory interface, and assign it to table, and set the editable
 * property to true.
 *
 * @param editable
 *            true if table should be editable by user.
 * @see Field
 * @see FieldFactory
 *
 */
public void setEditable(boolean editable) {
  this.editable = editable;
  // Assure visual refresh
  refreshRowCache();
}

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

/**
 * Sets the page length.
 *
 * <p>
 * Setting page length 0 disables paging. The page length defaults to 15.
 * </p>
 *
 * <p>
 * If Table has height set ({@link #setHeight(float, Unit)} ) the client
 * side may update the page length automatically the correct value.
 * </p>
 *
 * @param pageLength
 *            the length of one page.
 */
public void setPageLength(int pageLength) {
  if (pageLength >= 0 && this.pageLength != pageLength) {
    this.pageLength = pageLength;
    // Assures the visual refresh
    refreshRowCache();
  }
}

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

@Override
public void markAsDirtyRecursive() {
  super.markAsDirtyRecursive();
  // Avoid sending a partial repaint (#8714)
  refreshRowCache();
}

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

/**
 * Sets whether the given column is collapsible. Note that collapsible
 * columns can only be actually collapsed (via UI or with
 * {@link #setColumnCollapsed(Object, boolean) setColumnCollapsed()}) if
 * {@link #isColumnCollapsingAllowed()} is true. By default all columns are
 * collapsible.
 *
 * @param propertyId
 *            the propertyID identifying the column.
 * @param collapsible
 *            true if the column should be collapsible, false otherwise.
 */
public void setColumnCollapsible(Object propertyId, boolean collapsible) {
  if (collapsible) {
    noncollapsibleColumns.remove(propertyId);
  } else {
    noncollapsibleColumns.add(propertyId);
    collapsedColumns.remove(propertyId);
  }
  refreshRowCache();
}

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

/**
 * Adds new item after the given item.
 *
 * @see Container.Ordered#addItemAfter(java.lang.Object)
 */
@Override
public Object addItemAfter(Object previousItemId)
    throws UnsupportedOperationException {
  Object itemId = ((Container.Ordered) items)
      .addItemAfter(previousItemId);
  if (!(items instanceof Container.ItemSetChangeNotifier)) {
    refreshRowCache();
  }
  return itemId;
}

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

/**
 * Adds new item after the given item.
 *
 * @see Container.Ordered#addItemAfter(java.lang.Object, java.lang.Object)
 */
@Override
public Item addItemAfter(Object previousItemId, Object newItemId)
    throws UnsupportedOperationException {
  Item item = ((Container.Ordered) items).addItemAfter(previousItemId,
      newItemId);
  if (!(items instanceof Container.ItemSetChangeNotifier)) {
    refreshRowCache();
  }
  return item;
}

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

private void setColumnOrder(Object[] columnOrder) {
  if (columnOrder == null || !isColumnReorderingAllowed()) {
    return;
  }
  final LinkedList<Object> newOrder = new LinkedList<Object>();
  for (Object id : columnOrder) {
    if (id != null && visibleColumns.contains(id)) {
      visibleColumns.remove(id);
      newOrder.add(id);
    }
  }
  for (final Object columnId : visibleColumns) {
    if (!newOrder.contains(columnId)) {
      newOrder.add(columnId);
    }
  }
  visibleColumns = newOrder;
  // Assure visual refresh
  refreshRowCache();
}

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

/**
 * Removes a generated column previously added with addGeneratedColumn.
 *
 * @param columnId
 *            id of the generated column to remove
 * @return true if the column could be removed (existed in the Table)
 */
public boolean removeGeneratedColumn(Object columnId) {
  if (columnGenerators.containsKey(columnId)) {
    columnGenerators.remove(columnId);
    // remove column from visibleColumns list unless it exists in
    // container (generator previously overrode this column)
    if (!items.getContainerPropertyIds().contains(columnId)) {
      visibleColumns.remove(columnId);
    }
    refreshRowCache();
    return true;
  } else {
    return false;
  }
}

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

@Override
public void setIconProvider(Function<? super E, String> iconProvider) {
  this.iconProvider = iconProvider;
  if (iconProvider != null) {
    setRowHeaderMode(RowHeaderMode.ICON);
  } else {
    setRowHeaderMode(RowHeaderMode.NONE);
  }
  component.refreshRowCache();
}

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

/**
 * Removes the Item identified by <code>ItemId</code> from the Container.
 *
 * @see Container#removeItem(Object)
 */
@Override
public boolean removeItem(Object itemId) {
  final Object nextItemId = nextItemId(itemId);
  final boolean ret = super.removeItem(itemId);
  if (ret && (itemId != null)
      && (itemId.equals(currentPageFirstItemId))) {
    currentPageFirstItemId = nextItemId;
  }
  if (!(items instanceof Container.ItemSetChangeNotifier)) {
    refreshRowCache();
  }
  return ret;
}

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

@Override
  public void buttonClick(Button.ClickEvent clickEvent) {
    ColumnDef columnDef = (ColumnDef) columnsTable.getValue();
    if (columnDef != null) {
      int columnDefIndex = columnOrder.get(columnDef);
      ColumnDef columnDefToSwap = null;
      for (Map.Entry<ColumnDef, Integer> entry : columnOrder.entrySet()) {
        if (entry.getValue().intValue() == columnDefIndex - 1) {
          columnDefToSwap = entry.getKey();
          break;
        }
      }
      if (columnDefToSwap != null) {
        columnsTable.unselect(columnDef);
        columnOrder.remove(columnDef);
        columnOrder.remove(columnDefToSwap);
        columnOrder.put(columnDef, columnDefIndex - 1);
        columnOrder.put(columnDefToSwap, columnDefIndex);
        columns.sort(new Object[]{"label"}, new boolean[]{true});
        columnsTable.refreshRowCache();
        columnsTable.select(columnDef);
      }
    }
  }
});

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

@Override
  public void buttonClick(Button.ClickEvent clickEvent) {
    ColumnDef columnDef = (ColumnDef) columnsTable.getValue();
    if (columnDef != null) {
      columnsTable.unselect(columnDef);
      columns.removeItem(columnDef);
    }
    columnsTable.refreshRowCache();
  }
});

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

@Override
  public void buttonClick(Button.ClickEvent clickEvent) {
    RowDef rowDef = (RowDef) rowsTable.getValue();
    if (rowDef != null) {
      rowsTable.unselect(rowDef);
      rows.removeItem(rowDef);
    }
    rowsTable.refreshRowCache();
  }
});

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

@Override
public void removeColumn(Table.Column column) {
  if (column == null) {
    return;
  }
  component.removeContainerProperty(column.getId());
  columns.remove(column.getId());
  columnsOrder.remove(column);
  // vaadin8 it seems that it is not required
  if (!(component.getContainerDataSource() instanceof com.vaadin.v7.data.Container.ItemSetChangeNotifier)) {
    component.refreshRowCache();
  }
  column.setOwner(null);
}

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

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

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

void refreshTable() {
    if (m_table != null) {
      m_beanItemContainer = WallboardProvider.getInstance().getBeanContainer();
      m_table.setContainerDataSource(m_beanItemContainer);
      m_table.setVisibleColumns(new Object[]{"title", "Edit", "Remove", "Preview", "Default"});
      m_table.setColumnHeader("title", "Title");
      m_table.sort();
      m_table.refreshRowCache();
    }
  }
}

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

/**
 * Notifies this listener that the Property's value has changed.
 *
 * Also listens changes in rendered items to refresh content area.
 *
 * @see Property.ValueChangeListener#valueChange(Property.ValueChangeEvent)
 */
@Override
public void valueChange(Property.ValueChangeEvent event) {
  if (equals(event.getProperty())
      || event.getProperty() == getPropertyDataSource()) {
    super.valueChange(event);
  } else {
    refreshRowCache();
    containerChangeToBeRendered = true;
  }
  markAsDirty();
}

相关文章

微信公众号

最新文章

更多

Table类方法