@Override
protected CaptionArea getDefaultButtonsArea(ComponentWithCaption component) {
CaptionArea area = super.getDefaultButtonsArea(component);
FoldingPanel foldingPanel = (FoldingPanel) component;
FoldingDirection foldingDirection = foldingPanel.getFoldingDirection();
boolean horizontalFoldingDirection =
FoldingDirection.LEFT.equals(foldingDirection) || FoldingDirection.RIGHT.equals(foldingDirection);
boolean buttonsOnTheLeft = horizontalFoldingDirection && FoldingDirection.RIGHT.equals(foldingDirection);
area.setAlignment(buttonsOnTheLeft ? Side.LEFT : Side.RIGHT);
return area;