// sort the actions to preserve the displaying order
List<ProcessStateAction> actionList = new ArrayList<ProcessStateAction>(stateConfiguration.getActions());
Collections.sort(actionList, new ActionPriorityComparator());
AligningHorizontalLayout buttonLayout = new AligningHorizontalLayout(Alignment.MIDDLE_RIGHT);
buttonLayout.setMargin(new MarginInfo(false, true, false, true));
buttonLayout.setWidth(100, Sizeable.UNITS_PERCENTAGE);
for (final ProcessStateAction a : actionList) {
final ProcessToolActionButton actionButton = makeButton(a);
actionButton.setEnabled(isOwner);
actionButton.loadData(task);
actionButton.setActionCallback(actionCallback);
if (actionButton instanceof ProcessToolVaadinRenderable) {
buttonLayout.addComponent(((ProcessToolVaadinRenderable) actionButton).render());
}
}
buttonLayout.addComponentAsFirst(new Label() {{
setWidth(100, Sizeable.UNITS_PERCENTAGE);
}});
buttonLayout.recalculateExpandRatios();
return buttonLayout;
}