@Test public void testAddHeaderButton_HeaderButtonIsAddedBeforeCloseButton() { AbstractSection section = new TestSection("caption", true, Optional.empty()); HorizontalLayout sectionHeader = (HorizontalLayout)section.getComponent(0); assertThat(sectionHeader, is(notNullValue())); assertThat(sectionHeader.getComponentCount(), is(3)); assertThat(sectionHeader.getComponent(1), is(instanceOf(Button.class))); Button closeButton = (Button)sectionHeader.getComponent(1); assertThat(closeButton.getIcon(), is(FontAwesome.ANGLE_DOWN)); Button headerButton1 = ComponentFactory.newButton(); section.addHeaderButton(headerButton1); assertThat(sectionHeader.getComponentCount(), is(4)); assertThat(sectionHeader.getComponent(2), is(closeButton)); Button button1 = (Button)sectionHeader.getComponent(1); assertThat(button1, is(headerButton1)); Button headerButton2 = ComponentFactory.newButton(); section.addHeaderButton(headerButton2); assertThat(sectionHeader.getComponentCount(), is(5)); assertThat(sectionHeader.getComponent(3), is(closeButton)); Button button2 = (Button)sectionHeader.getComponent(2); assertThat(button2, is(headerButton2)); }
private static void addHeaderButton(AbstractOrderedLayout header, Button button) { button.addStyleName(LinkkiTheme.BUTTON_TEXT); header.addComponent(button); }
AbstractSection extends VerticalLayout { private static void addHeaderButton(AbstractOrderedLayout header, Button button) { button.addStyleName(LinkkiTheme.BUTTON_TEXT); header.addComponent(button); } }
AbstractSection extends VerticalLayout { private static void addHeaderButton(AbstractOrderedLayout header, Button button) { button.addStyleName(LinkkiTheme.BUTTON_TEXT); header.addComponent(button); } AbstractSection(String caption);  AbstractSection(String caption, boolean closeable);  AbstractSection(String caption, boolean closeable, Optional<Button> editButton); }
AbstractSection extends VerticalLayout { private static void addHeaderButton(AbstractOrderedLayout header, Button button) { button.addStyleName(LinkkiTheme.BUTTON_TEXT); header.addComponent(button); } AbstractSection(String caption);  AbstractSection(String caption, boolean closeable);  AbstractSection(String caption, boolean closeable, Optional<Button> editButton); boolean isEditButtonAvailable(); void addHeaderButton(Button button); boolean isOpen(); boolean isClosed(); void open(); void close(); }
AbstractSection extends VerticalLayout { private static void addHeaderButton(AbstractOrderedLayout header, Button button) { button.addStyleName(LinkkiTheme.BUTTON_TEXT); header.addComponent(button); } AbstractSection(String caption);  AbstractSection(String caption, boolean closeable);  AbstractSection(String caption, boolean closeable, Optional<Button> editButton); boolean isEditButtonAvailable(); void addHeaderButton(Button button); boolean isOpen(); boolean isClosed(); void open(); void close();  }