@Override public void removeDataSetItem(int index) { dataSetListBox.removeItem(dataSetSelectorHintEnabled ? index + 1 : index); }
@Override public void removeDataSetItem(int index) { dataSetListBox.removeItem(dataSetSelectorHintEnabled ? index + 1 : index); }
@Override public void remove( String fullName ) { for ( int i = 0; i < list.getItemCount(); i++ ) { if ( list.getItemText( i ).equals( fullName ) ) { list.removeItem( i ); break; } } }
@Override public void setFunctionSelected(String function) { filterListBox.insertItem(function, 0); filterListBox.setTitle(function); if (functionSelected) { filterListBox.removeItem(1); } functionSelected = true; }
@Override public void setFunctionSelected(String function) { filterListBox.insertItem(function, 0); filterListBox.setTitle(function); if (functionSelected) { filterListBox.removeItem(1); } functionSelected = true; }
private void removeReservedAttributes() { for ( final String reservedAttribute : getReservedAttributes() ) { for ( int iItem = 0; iItem < list.getItemCount(); iItem++ ) { if ( list.getItemText( iItem ).equals( reservedAttribute ) ) { list.removeItem( iItem ); break; } } } }
private void removeReservedAttributes() { for ( final String reservedAttribute : getReservedAttributes() ) { for ( int iItem = 0; iItem < list.getItemCount(); iItem++ ) { if ( list.getItemText( iItem ).equals( reservedAttribute ) ) { list.removeItem( iItem ); break; } } } }
@Test public void alreadyUsedAttributesRemoved() { verify(popup).getAttributes(); verify(popup).getReservedAttributes(); verify(popup.list, times(4)).addItem(anyString()); verify(popup.list, times(2)).removeItem(1); }
@Test public void alreadyUsedAttributesRemoved() { verify(popup).getAttributes(); verify(popup).getReservedAttributes(); verify(popup.list, times(4)).addItem(anyString()); verify(popup.list, times(2)).removeItem(1); }
@Test public void testRemoveButtonHandler() throws Exception { final List<String> rules = new ArrayList<String>() {{ add("rule 1"); }}; when(scenario.getRules()).thenReturn(rules); when(configuredRules.getSelectedIndex()).thenReturn(0); when(configuredRules.getItemText(0)).thenReturn("rule 1"); configWidget.init(scenarioParentWidget, path, scenario); configWidget.setupHandlers(); verify(removeButton).addClickHandler(clickCaptor.capture()); clickCaptor.getValue().onClick(null); Assertions.assertThat(rules).isEmpty(); verify(configuredRules).removeItem(0); }
@Test public void testRemoveButtonHandler() throws Exception { final List<String> rules = new ArrayList<String>() {{ add("rule 1"); }}; when(scenario.getRules()).thenReturn(rules); when(configuredRules.getSelectedIndex()).thenReturn(0); when(configuredRules.getItemText(0)).thenReturn("rule 1"); configWidget.init(scenarioParentWidget, path, scenario); configWidget.setupHandlers(); verify(removeButton).addClickHandler(clickCaptor.capture()); clickCaptor.getValue().onClick(null); Assertions.assertThat(rules).isEmpty(); verify(configuredRules).removeItem(0); }
@Before public void setUp() { listMockAttributes = new ArrayList<>(); popup = spy(new MockAttributeSelectorPopup()); when(boxMock.getElement()).thenReturn(mock(Element.class)); when(boxMock.getText()).thenReturn(metadataName); when(listMock.getItemCount()).thenAnswer( (InvocationOnMock invocation) -> listMockAttributes.size() ); when(listMock.getItemText(anyInt())).thenAnswer( (InvocationOnMock invocation) -> listMockAttributes.get((int) invocation.getArguments()[0]) ); doAnswer((Answer<Void>) (InvocationOnMock invocation) -> { listMockAttributes.add((String) invocation.getArguments()[0]); return null; } ).when(listMock).addItem(anyString()); doAnswer((Answer<Void>) (InvocationOnMock invocation) -> { listMockAttributes.remove((int) invocation.getArguments()[0]); return null; } ).when(listMock).removeItem(anyInt()); popup.initialize(boxMock, listMock); }
@Before public void setUp() { listMockAttributes = new ArrayList<>(); popup = spy(new MockAttributeSelectorPopup()); when(boxMock.getElement()).thenReturn(mock(Element.class)); when(boxMock.getText()).thenReturn(metadataName); when(listMock.getItemCount()).thenAnswer( (InvocationOnMock invocation) -> listMockAttributes.size() ); when(listMock.getItemText(anyInt())).thenAnswer( (InvocationOnMock invocation) -> listMockAttributes.get((int) invocation.getArguments()[0]) ); doAnswer((Answer<Void>) (InvocationOnMock invocation) -> { listMockAttributes.add((String) invocation.getArguments()[0]); return null; } ).when(listMock).addItem(anyString()); doAnswer((Answer<Void>) (InvocationOnMock invocation) -> { listMockAttributes.remove((int) invocation.getArguments()[0]); return null; } ).when(listMock).removeItem(anyInt()); popup.initialize(boxMock, listMock); }
final String rule = configuredRules.getItemText(configuredRules.getSelectedIndex()); scenario.getRules().remove(rule); configuredRules.removeItem(configuredRules.getSelectedIndex());