GuidedDecisionTableModellerViewImpl extends Composite implements GuidedDecisionTableModellerView { @Override public void removeDecisionTable(final GuidedDecisionTableView gridWidget, final Command afterRemovalCommand) { if (gridWidget == null) { return; } final Command remove = () -> { gridLayer.remove(gridWidget); afterRemovalCommand.execute(); gridLayer.batch(); }; if (gridLayer.isGridPinned()) { final GridPinnedModeManager.PinnedContext context = gridLayer.getPinnedContext(); if (gridWidget.equals(context.getGridWidget())) { gridLayer.exitPinnedMode(remove); } } else { remove.execute(); } } GuidedDecisionTableModellerViewImpl(); @Inject  GuidedDecisionTableModellerViewImpl(final TranslationService translationService); @Override void init(final GuidedDecisionTableModellerView.Presenter presenter); @PostConstruct void setup(); @Override void onResize(); @Override HandlerRegistration addKeyDownHandler(final KeyDownHandler handler); @Override HandlerRegistration addContextMenuHandler(final ContextMenuHandler handler); @Override HandlerRegistration addMouseDownHandler(final MouseDownHandler handler); @Override void clear(); @Override void addDecisionTable(final GuidedDecisionTableView gridWidget); @Override void removeDecisionTable(final GuidedDecisionTableView gridWidget,
                                    final Command afterRemovalCommand); @Override void refreshScrollPosition(); @Override void setZoom(final int zoom); @Override GridLayer getGridLayerView(); @Override GridLienzoPanel getGridPanel(); @Override Bounds getBounds(); @Override void select(final GridWidget selectedGridWidget); @Override void selectLinkedColumn(final GridColumn<?> link); @Override Set<GridWidget> getGridWidgets(); @Override void setPinnedModeIndicatorVisibility(final boolean visibility, final double headerCaptionWidth); @Override void showGenericVetoMessage(); @Override void showUnableToDeleteColumnMessage(final ConditionCol52 column); @Override void showUnableToDeleteColumnMessage(final ActionCol52 column);  }
@Test public void testRemoveDecisionTableWhenPinned() { final Command callback = mock(Command.class); final GridPinnedModeManager.PinnedContext context = mock(GridPinnedModeManager.PinnedContext.class); when(defaultGridLayer.isGridPinned()).thenReturn(true); when(defaultGridLayer.getPinnedContext()).thenReturn(context); when(context.getGridWidget()).thenReturn(dtableView); view.removeDecisionTable(dtableView, callback); verify(defaultGridLayer, times(1)).exitPinnedMode(commandArgumentCaptor.capture()); final Command command = commandArgumentCaptor.getValue(); assertNotNull(command); command.execute(); verify(defaultGridLayer, times(1)).remove(dtableView); verify(callback, times(1)).execute(); verify(defaultGridLayer, times(1)).batch(); }
@Test public void testRemoveDecisionTableWhenNotPinned() { final Command callback = mock(Command.class); view.removeDecisionTable(dtableView, callback); verify(callback, times(1)).execute(); }