@Test public void testConfigureButton() { final Button button = mock(Button.class); final Button otherButton = mock(Button.class); final Runnable runnable = mock(Runnable.class); tested.configureButton(button, "COLUMNS", true, mock(Tooltip.class), "tooltip", otherButton, runnable); verify(button, times(1)).setType(eq(ButtonType.INFO)); ArgumentCaptor<ClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(ClickHandler.class); verify(button, times(1)).addClickHandler(clickHandlerArgumentCaptor.capture()); reset(button); clickHandlerArgumentCaptor.getValue().onClick(mock(ClickEvent.class)); verify(button, times(1)).setType(eq(ButtonType.INFO)); verify(otherButton, times(1)).setType(eq(ButtonType.LINK)); verify(runnable, times(1)).run(); }
void configureButton(final Button button, final String iconType, final boolean selected, final Tooltip tooltip, final String tooltipText, final Button otherButton, final Runnable handler) { button.setSize(ButtonSize.DEFAULT); button.setType(selected ? ButtonType.INFO : ButtonType.LINK); button.setIcon(IconType.valueOf(iconType)); button.setIconFixedWidth(true); button.setIconSize(IconSize.LARGE); button.setIconPosition(IconPosition.LEFT); tooltip.setTitle(tooltipText); tooltip.setContainer("body"); tooltip.setPlacement(Placement.AUTO); button.addClickHandler(event -> { select(button); deselect(otherButton); handler.run(); }); }
SwitchViewControl extends Composite { void configureButton(final Button button, final String iconType, final boolean selected, final Tooltip tooltip, final String tooltipText, final Button otherButton, final Runnable handler) { button.setSize(ButtonSize.DEFAULT); button.setType(selected ? ButtonType.INFO : ButtonType.LINK); button.setIcon(IconType.valueOf(iconType)); button.setIconFixedWidth(true); button.setIconSize(IconSize.LARGE); button.setIconPosition(IconPosition.LEFT); tooltip.setTitle(tooltipText); tooltip.setContainer("body"); tooltip.setPlacement(Placement.AUTO); button.addClickHandler(event -> { select(button); deselect(otherButton); handler.run(); }); } }
SwitchViewControl extends Composite { void configureButton(final Button button, final String iconType, final boolean selected, final Tooltip tooltip, final String tooltipText, final Button otherButton, final Runnable handler) { button.setSize(ButtonSize.DEFAULT); button.setType(selected ? ButtonType.INFO : ButtonType.LINK); button.setIcon(IconType.valueOf(iconType)); button.setIconFixedWidth(true); button.setIconSize(IconSize.LARGE); button.setIconPosition(IconPosition.LEFT); tooltip.setTitle(tooltipText); tooltip.setContainer("body"); tooltip.setPlacement(Placement.AUTO); button.addClickHandler(event -> { select(button); deselect(otherButton); handler.run(); }); } SwitchViewControl(final String caseViewIconType,
                      final String caseViewTooltipText,
                      final Runnable caseViewSwitchHandler,
                      final String processViewIconType,
                      final String processViewTooltipText,
                      final Runnable processViewSwitchHandler); }
SwitchViewControl extends Composite { void configureButton(final Button button, final String iconType, final boolean selected, final Tooltip tooltip, final String tooltipText, final Button otherButton, final Runnable handler) { button.setSize(ButtonSize.DEFAULT); button.setType(selected ? ButtonType.INFO : ButtonType.LINK); button.setIcon(IconType.valueOf(iconType)); button.setIconFixedWidth(true); button.setIconSize(IconSize.LARGE); button.setIconPosition(IconPosition.LEFT); tooltip.setTitle(tooltipText); tooltip.setContainer("body"); tooltip.setPlacement(Placement.AUTO); button.addClickHandler(event -> { select(button); deselect(otherButton); handler.run(); }); } SwitchViewControl(final String caseViewIconType,
                      final String caseViewTooltipText,
                      final Runnable caseViewSwitchHandler,
                      final String processViewIconType,
                      final String processViewTooltipText,
                      final Runnable processViewSwitchHandler);  }
SwitchViewControl extends Composite { void configureButton(final Button button, final String iconType, final boolean selected, final Tooltip tooltip, final String tooltipText, final Button otherButton, final Runnable handler) { button.setSize(ButtonSize.DEFAULT); button.setType(selected ? ButtonType.INFO : ButtonType.LINK); button.setIcon(IconType.valueOf(iconType)); button.setIconFixedWidth(true); button.setIconSize(IconSize.LARGE); button.setIconPosition(IconPosition.LEFT); tooltip.setTitle(tooltipText); tooltip.setContainer("body"); tooltip.setPlacement(Placement.AUTO); button.addClickHandler(event -> { select(button); deselect(otherButton); handler.run(); }); } SwitchViewControl(final String caseViewIconType,
                      final String caseViewTooltipText,
                      final Runnable caseViewSwitchHandler,
                      final String processViewIconType,
                      final String processViewTooltipText,
                      final Runnable processViewSwitchHandler);   }