* @return The preferred width of the specified command button under the
* specified display priority.
*/
private int getPreferredWidth(AbstractCommandButton button,
RibbonElementPriority buttonDisplayPriority) {
CommandButtonDisplayState displayState = null;
switch (buttonDisplayPriority) {
case TOP:
displayState = CommandButtonDisplayState.BIG;
break;
case MEDIUM:
displayState = CommandButtonDisplayState.MEDIUM;
break;
case LOW:
displayState = CommandButtonDisplayState.SMALL;
break;
}
return displayState.createLayoutManager(button).getPreferredSize(
button).width;
}