use of com.github.bordertech.wcomponents.WTable.TableRepeater in project wcomponents by BorderTech.
the class WTableRenderer method doPaintRows.
/**
* Override paintRow so that we only paint the first-level nodes for tree-tables.
*
* @param table the table to paint the rows for.
* @param renderContext the RenderContext to paint to.
*/
private void doPaintRows(final WTable table, final WebXmlRenderContext renderContext) {
TableRepeater repeater = table.getRepeater();
WComponent row = repeater.getRepeatedComponent();
List<RowIdWrapper> wrappers = repeater.getBeanList();
Set<?> otherSelectedRows = new HashSet<>(table.getSelectedRows());
int index = -1;
for (RowIdWrapper wrapper : wrappers) {
index++;
Object rowKey = wrapper.getRowKey();
if (table.getSelectedRows().contains(rowKey)) {
otherSelectedRows.remove(rowKey);
}
// Child rows handled by the layout, so dont paint the row
if (wrapper.getParent() != null) {
continue;
}
// Each row has its own context. This is why we can reuse the same
// WComponent instance for each row.
UIContext rowContext = repeater.getRowContext(wrapper, index);
UIContextHolder.pushContext(rowContext);
try {
row.paint(renderContext);
} finally {
UIContextHolder.popContext();
}
}
this.selectedOnOther = otherSelectedRows.size();
}
Aggregations