// three-somes.
while (((mapped.get(RibbonElementPriority.MEDIUM)
.size() % 3) != 0)
&& (mapped.get(RibbonElementPriority.LOW)
.size() > 0)) {
AbstractCommandButton low = mapped.get(
RibbonElementPriority.LOW).get(0);
mapped.get(RibbonElementPriority.LOW).remove(low);
mapped.get(RibbonElementPriority.MEDIUM).add(low);
}
}
for (AbstractCommandButton medium : mapped
.get(RibbonElementPriority.MEDIUM)) {
medium
.setDisplayState(CommandButtonDisplayState.MEDIUM);
}
// finally - low priority
for (AbstractCommandButton low : mapped
.get(RibbonElementPriority.LOW)) {
low.setDisplayState(CommandButtonDisplayState.SMALL);
}
}
}
}