diff --git a/src/main/java/org/vaadin/addons/taefi/component/ToggleButtonGroup.java b/src/main/java/org/vaadin/addons/taefi/component/ToggleButtonGroup.java index 557d0ac..0c0bc4e 100644 --- a/src/main/java/org/vaadin/addons/taefi/component/ToggleButtonGroup.java +++ b/src/main/java/org/vaadin/addons/taefi/component/ToggleButtonGroup.java @@ -24,7 +24,7 @@ public class ToggleButtonGroup extends CustomField { public enum Orientation { - HORIZONTAL, VERTICAL + HORIZONTAL, VERTICAL, STACKED } private List items; @@ -95,6 +95,10 @@ private void init() { } addButtonsToLayout(buttons); + + if(orientation == Orientation.STACKED) { + setValue(items.get(0), false); + } } protected void addButtonsToLayout(Button[] buttons) { @@ -159,7 +163,15 @@ protected Optional getLastButtonClass() { } private String getOrientationStylePostfix() { - return orientation == Orientation.HORIZONTAL ? "h" : "v"; + switch(orientation) { + case HORIZONTAL: + return "h"; + case STACKED: + return "s"; + case VERTICAL: + return "v"; + default: throw new IllegalArgumentException(); + } } private Comparator getDefaultComparator() { @@ -186,7 +198,13 @@ protected void buttonsActionListener(ClickEvent