}
this.columnAlignments = newCA;
- // Assures the visual refresh
- refreshRowCache();
+ // Assures the visual refresh. No need to reset the page buffer before
+ // as the content has not changed, only the alignments.
+ refreshRenderedCells();
}
/**
columnAlignments.put(propertyId, alignment);
}
- // Assures the visual refresh
- refreshRowCache();
+ // Assures the visual refresh. No need to reset the page buffer before
+ // as the content has not changed, only the alignments.
+ refreshRenderedCells();
}
/**
collapsedColumns.clear();
}
- // Assures the visual refresh
- refreshRowCache();
+ // Assures the visual refresh. No need to reset the page buffer before
+ // as the content has not changed, only the alignments.
+ refreshRenderedCells();
}
/**
}
/**
- * Refreshes rendered rows
+ * Refreshes the rows in the internal cache. Only if
+ * {@link #resetPageBuffer()} is called before this then all values are
+ * guaranteed to be recreated.
*/
protected void refreshRenderedCells() {
if (getParent() == null) {
setItemCaptionMode(mode);
}
- // Assure visual refresh
- refreshRowCache();
+ // Assures the visual refresh. No need to reset the page buffer before
+ // as the content has not changed, only the alignments.
+ refreshRenderedCells();
}
/**
// Rows
if (isPartialRowUpdate() && painted && !target.isFullRepaint()) {
paintPartialRowUpdate(target, actionSet);
+ /*
+ * Send the page buffer indexes to ensure that the client side stays
+ * in sync. Otherwise we _might_ have the situation where the client
+ * side discards too few or too many rows, causing out of sync
+ * issues.
+ *
+ * This could probably be done for full repaints also to simplify
+ * the client side.
+ */
+ int pageBufferLastIndex = pageBufferFirstIndex
+ + pageBuffer[CELL_ITEMID].length - 1;
+ target.addAttribute(VScrollTable.ATTRIBUTE_PAGEBUFFER_FIRST,
+ pageBufferFirstIndex);
+ target.addAttribute(VScrollTable.ATTRIBUTE_PAGEBUFFER_LAST,
+ pageBufferLastIndex);
} else if (target.isFullRepaint() || isRowCacheInvalidated()) {
paintRows(target, cells, actionSet);
setRowCacheInvalidated(false);
if (!actionHandlers.contains(actionHandler)) {
actionHandlers.add(actionHandler);
- refreshRowCache();
+ // Assures the visual refresh. No need to reset the page buffer
+ // before as the content has not changed, only the action
+ // handlers.
+ refreshRenderedCells();
}
}
actionMapper = null;
}
- refreshRowCache();
+ // Assures the visual refresh. No need to reset the page buffer
+ // before as the content has not changed, only the action
+ // handlers.
+ refreshRenderedCells();
}
}
public void removeAllActionHandlers() {
actionHandlers = null;
actionMapper = null;
- refreshRowCache();
+ // Assures the visual refresh. No need to reset the page buffer
+ // before as the content has not changed, only the action
+ // handlers.
+ refreshRenderedCells();
}
/* Property value change listening support */
requestRepaint();
}
+ /**
+ * Clears the current page buffer. Call this before
+ * {@link #refreshRenderedCells()} to ensure that all content is updated
+ * from the properties.
+ */
protected void resetPageBuffer() {
firstToBeRenderedInClient = -1;
lastToBeRenderedInClient = -1;
*/
public void setCellStyleGenerator(CellStyleGenerator cellStyleGenerator) {
this.cellStyleGenerator = cellStyleGenerator;
- refreshRowCache();
+ // Assures the visual refresh. No need to reset the page buffer
+ // before as the content has not changed, only the style generators
+ refreshRenderedCells();
+
}
/**
public void setItemDescriptionGenerator(ItemDescriptionGenerator generator) {
if (generator != itemDescriptionGenerator) {
itemDescriptionGenerator = generator;
- refreshRowCache();
+ // Assures the visual refresh. No need to reset the page buffer
+ // before as the content has not changed, only the descriptions
+ refreshRenderedCells();
}
}