final BankHead[] heads = grid.getBankHeads(orientation);
final BankHead[] heads2 = grid.getBankHeads(orientation.other());
// find *
final FactorList factorList = new FactorList();
for (final BankHead head : heads) {
if (head.getToken() instanceof RelativeLayoutToken && head.isRendered()) {
factorList.add(((RelativeLayoutToken) head.getToken()).getFactor());
}
}
if (!factorList.isEmpty()) {
// find rest
final LayoutContainer container = getLayoutContainer();
Measure available = LayoutUtils.getCurrentSize(orientation, container);
if (available != null) {
for (final BankHead head : heads) {
available = available.subtractNotNegative(head.getCurrent());
}
available = available.subtractNotNegative(LayoutUtils.getBorderBegin(orientation, container));
available = available.subtractNotNegative(LayoutUtils.getPaddingBegin(orientation, container));
available = available.subtractNotNegative(getMarginBegin(orientation));
available = available.subtractNotNegative(computeSpacing(orientation, 0, heads.length));
available = available.subtractNotNegative(getMarginEnd(orientation));
available = available.subtractNotNegative(LayoutUtils.getPaddingEnd(orientation, container));
available = available.subtractNotNegative(LayoutUtils.getBorderEnd(orientation, container));
if (grid.isOverflow(orientation.other())) {
final ClientProperties client
= VariableResolverUtils.resolveClientProperties(FacesContext.getCurrentInstance());
final Measure scrollbar = orientation
== Orientation.HORIZONTAL ? client.getVerticalScrollbarWeight() : client.getHorizontalScrollbarWeight();
available = available.subtractNotNegative(scrollbar);
}
final List<Measure> partition = factorList.partition(available);
// write values back into the header
int i = 0; // index of head
int j = 0; // index of partition
for (final BankHead head : heads) {