public void parsePortions() {
if (columnsLeft()) {
// 1. count portions
int portions = 0;
for (int i = 0; i < layoutTokens.getSize(); i++) {
LayoutToken token = layoutTokens.get(i);
if (isFree(i) && token instanceof RelativeLayoutToken) {
portions += ((RelativeLayoutToken) token).getFactor();
}
}
// 2. calc and set portion
if (portions > 0) {
int widthForPortions = getSpaceLeft();
for (int i = 0; i < layoutTokens.getSize(); i++) {
LayoutToken token = layoutTokens.get(i);
if (isFree(i) && token instanceof RelativeLayoutToken) {
int portion = ((RelativeLayoutToken) token).getFactor();
float w = (float) widthForPortions / portions * portion;
if (w < 0) {
update(0, i);