@Override protected void dispatch(ChangeHandler handler) { handler.onChange(this); }
public void onChange(ChosenChangeEvent event) { handler.onChange(null); } });
public void onChange(ChosenChangeEvent event) { handler.onChange(null); } });
private void fireChangeEvents() { for (ChangeHandler ch : changeHandlerList) { ch.onChange(null); } }
@Override public void onClick( ClickEvent event ) { handler.onChange( null ); } } );
@Override public void onClick( ClickEvent event ) { handler.onChange( null ); } } );
public void onChange(ChosenChangeEvent event) { handler.onChange(null); } });
@Override protected void dispatch(ChangeHandler handler) { handler.onChange(this); }
@Override protected void dispatch(ChangeHandler handler) { handler.onChange(this); }
private void fireAllCellChangeHandlers(WSCell cell, Object newValue) { for (ChangeHandler c : cellChangeHandlers) c.onChange(new CellChangeEvent(cell, newValue)); }
@Override public HandlerRegistration addChangeHandler(final ChangeHandler handler) { return valueBoxBase.addChangeHandler(event -> { if (isEnabled()) { handler.onChange(event); } }); }
@Override public HandlerRegistration addChangeHandler(final ChangeHandler handler) { return valueBoxBase.addChangeHandler(event -> { if (isEnabled()) { handler.onChange(event); } }); }
private void fireAllAfterCellChangeHandlers(WSCell cell) { for (ChangeHandler c : afterCellChangeHandlers) c.onChange(new CellChangeEvent(cell, cell.getCellFormat().getValue())); }
private void testFileName(String fileInput, String expected) { when(file.getValue()).thenReturn(fileInput); fileUpload.getFileChangeHandler().onChange(mock(ChangeEvent.class)); verify(fileText).setValue(expected); } }
@Test public void testChangeAllowedRules() throws Exception { when(configurationType.getSelectedIndex()).thenReturn(ConfigWidget.ALLOWED_INDEX); when(configurationType.getValue(ConfigWidget.ALLOWED_INDEX)).thenReturn("inc"); configWidget.init(scenarioParentWidget, path, scenario); configWidget.setupHandlers(); verify(configurationType).addChangeHandler(changeHandlerCaptor.capture()); changeHandlerCaptor.getValue().onChange(null); verify(scenario).setInclusive(true); verify(addButton).setVisible(true); verify(removeButton).setVisible(true); verify(configuredRules).setVisible(true); }
@Test public void testChangePreventedRules() throws Exception { when(configurationType.getSelectedIndex()).thenReturn(ConfigWidget.PREVENTED_INDEX); when(configurationType.getValue(ConfigWidget.PREVENTED_INDEX)).thenReturn("exc"); configWidget.init(scenarioParentWidget, path, scenario); configWidget.setupHandlers(); verify(configurationType).addChangeHandler(changeHandlerCaptor.capture()); changeHandlerCaptor.getValue().onChange(null); verify(scenario).setInclusive(false); verify(addButton).setVisible(true); verify(removeButton).setVisible(true); verify(configuredRules).setVisible(true); }
@Test public void testChangeAllowedRules() throws Exception { when(configurationType.getSelectedIndex()).thenReturn(ConfigWidget.ALLOWED_INDEX); when(configurationType.getValue(ConfigWidget.ALLOWED_INDEX)).thenReturn("inc"); configWidget.init(scenarioParentWidget, path, scenario); configWidget.setupHandlers(); verify(configurationType).addChangeHandler(changeHandlerCaptor.capture()); changeHandlerCaptor.getValue().onChange(null); verify(scenario).setInclusive(true); verify(addButton).setVisible(true); verify(removeButton).setVisible(true); verify(configuredRules).setVisible(true); }
@Test public void testChangePreventedRules() throws Exception { when(configurationType.getSelectedIndex()).thenReturn(ConfigWidget.PREVENTED_INDEX); when(configurationType.getValue(ConfigWidget.PREVENTED_INDEX)).thenReturn("exc"); configWidget.init(scenarioParentWidget, path, scenario); configWidget.setupHandlers(); verify(configurationType).addChangeHandler(changeHandlerCaptor.capture()); changeHandlerCaptor.getValue().onChange(null); verify(scenario).setInclusive(false); verify(addButton).setVisible(true); verify(removeButton).setVisible(true); verify(configuredRules).setVisible(true); }
@Test public void testChangeAllowAllRules() throws Exception { final List<String> rules = new ArrayList<String>() {{ add("rule 1"); }}; when(scenario.getRules()).thenReturn(rules); when(configurationType.getSelectedIndex()).thenReturn(ConfigWidget.ALL_ALLOWED_INDEX); when(configurationType.getValue(ConfigWidget.ALL_ALLOWED_INDEX)).thenReturn("all"); configWidget.init(scenarioParentWidget, path, scenario); configWidget.setupHandlers(); verify(configurationType).addChangeHandler(changeHandlerCaptor.capture()); changeHandlerCaptor.getValue().onChange(null); Assertions.assertThat(rules).isEmpty(); verify(addButton).setVisible(false); verify(removeButton).setVisible(false); verify(configuredRules).setVisible(false); verify(configuredRules).clear(); } }
@Test public void testChangeAllowAllRules() throws Exception { final List<String> rules = new ArrayList<String>() {{ add("rule 1"); }}; when(scenario.getRules()).thenReturn(rules); when(configurationType.getSelectedIndex()).thenReturn(ConfigWidget.ALL_ALLOWED_INDEX); when(configurationType.getValue(ConfigWidget.ALL_ALLOWED_INDEX)).thenReturn("all"); configWidget.init(scenarioParentWidget, path, scenario); configWidget.setupHandlers(); verify(configurationType).addChangeHandler(changeHandlerCaptor.capture()); changeHandlerCaptor.getValue().onChange(null); Assertions.assertThat(rules).isEmpty(); verify(addButton).setVisible(false); verify(removeButton).setVisible(false); verify(configuredRules).setVisible(false); verify(configuredRules).clear(); } }