@Test public void testOnFilterChangedEvent() { final FilterChangedEvent event = mock(FilterChangedEvent.class); final DataSetFilter filter = mock(DataSetFilter.class); when(event.getContext()).thenReturn(filterEditor); when(event.getFilter()).thenReturn(filter); presenter.dataSetDef = this.dataSetDef; mockPreviewTableCall(); final Command afterPreviewCommand = mock(Command.class); presenter.afterPreviewCommand = afterPreviewCommand; presenter.onFilterChangedEvent(event); verify(dataSetDef, times(1)).setDataSetFilter(filter); verify(loadingBox, times(1)).show(); verify(loadingBox, times(1)).hide(); verify(view, times(1)).clearErrorNotification(); verify(filterEditor, times(0)).init(any(DataSetMetadata.class)); verify(afterPreviewCommand, times(1)).execute(); verify(view, times(0)).init(any(DataSetEditor.class)); verify(view, times(0)).initWidgets( any(DataSetDefBasicAttributesEditor.View.class), any(IsWidget.class), any(DataSetDefColumnsFilterEditor.View.class), any(DataSetDefPreviewTable.View.class), any(DataSetDefCacheAttributesEditorView.class), any(DataSetDefCacheAttributesEditorView.class), any(DataSetDefRefreshAttributesEditor.View.class) ); verify(view, times(0)).addConfigurationTabItemClickHandler(any(Command.class)); verify(view, times(0)).addPreviewTabItemClickHandler(any(Command.class)); verify(view, times(0)).addAdvancedTabItemClickHandler(any(Command.class)); verify(view, times(0)).showConfigurationTab(); verify(view, times(0)).showPreviewTab(); verify(view, times(0)).showAdvancedTab(); verify(view, times(0)).openColumnsFilterPanel(anyString()); verify(view, times(0)).closeColumnsFilterPanel(anyString()); verify(view, times(0)).showErrorNotification(any(SafeHtml.class)); }
void onFilterChangedEvent(@Observes FilterChangedEvent filterChangedEvent) { checkNotNull("filterChangedEvent", filterChangedEvent); if (filterChangedEvent.getContext().equals(columnsAndFilterEditor.dataSetFilter())) { final DataSetFilter f = filterChangedEvent.getFilter(); dataSetDef.setDataSetFilter(f); doPreview(false); } }
DataSetEditor implements IsWidget,
                                                                     DataSetDefEditor<T> { void onFilterChangedEvent(@Observes FilterChangedEvent filterChangedEvent) { checkNotNull("filterChangedEvent", filterChangedEvent); if (filterChangedEvent.getContext().equals(columnsAndFilterEditor.dataSetFilter())) { final DataSetFilter f = filterChangedEvent.getFilter(); dataSetDef.setDataSetFilter(f); doPreview(false); } } }
DataSetEditor implements IsWidget,
                                                                     DataSetDefEditor<T> { void onFilterChangedEvent(@Observes FilterChangedEvent filterChangedEvent) { checkNotNull("filterChangedEvent", filterChangedEvent); if (filterChangedEvent.getContext().equals(columnsAndFilterEditor.dataSetFilter())) { final DataSetFilter f = filterChangedEvent.getFilter(); dataSetDef.setDataSetFilter(f); doPreview(false); } } @Inject  DataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,
                         final IsWidget providerAttributesEditorView,
                         final DataSetDefColumnsFilterEditor columnsAndFilterEditor,
                         final DataSetDefPreviewTable previewTable,
                         final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,
                         final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,
                         final DataSetDefRefreshAttributesEditor refreshEditor,
                         final DataSetClientServices clientServices,
                         final LoadingBox loadingBox,
                         final Event<ErrorEvent> errorEvent,
                         final Event<TabChangedEvent> tabChangedEvent,
                         final View view); }
DataSetEditor implements IsWidget,
                                                                     DataSetDefEditor<T> { void onFilterChangedEvent(@Observes FilterChangedEvent filterChangedEvent) { checkNotNull("filterChangedEvent", filterChangedEvent); if (filterChangedEvent.getContext().equals(columnsAndFilterEditor.dataSetFilter())) { final DataSetFilter f = filterChangedEvent.getFilter(); dataSetDef.setDataSetFilter(f); doPreview(false); } } @Inject  DataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,
                         final IsWidget providerAttributesEditorView,
                         final DataSetDefColumnsFilterEditor columnsAndFilterEditor,
                         final DataSetDefPreviewTable previewTable,
                         final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,
                         final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,
                         final DataSetDefRefreshAttributesEditor refreshEditor,
                         final DataSetClientServices clientServices,
                         final LoadingBox loadingBox,
                         final Event<ErrorEvent> errorEvent,
                         final Event<TabChangedEvent> tabChangedEvent,
                         final View view); void init(); @Override Widget asWidget(); void showConfigurationTab(); void showPreviewTab(); void showAdvancedTab(); @Override void setAcceptableValues(final List<DataColumnDef> acceptableValues); @Override void flush(); @Override void onPropertyChange(final String... paths); @Override void setValue(final T value); @Override void setDelegate(final EditorDelegate<T> delegate); @Override org.dashbuilder.dataset.client.editor.DataSetDefBasicAttributesEditor basicAttributesEditor(); @Override org.dashbuilder.dataset.client.editor.DataSetDefColumnsFilterEditor columnsAndFilterEditor(); @Override DataSetDefBackendCacheAttributesEditor backendCacheEditor(); @Override org.dashbuilder.dataset.client.editor.DataSetDefClientCacheAttributesEditor clientCacheEditor(); @Override org.dashbuilder.dataset.client.editor.DataSetDefRefreshAttributesEditor refreshEditor(); }
DataSetEditor implements IsWidget,
                                                                     DataSetDefEditor<T> { void onFilterChangedEvent(@Observes FilterChangedEvent filterChangedEvent) { checkNotNull("filterChangedEvent", filterChangedEvent); if (filterChangedEvent.getContext().equals(columnsAndFilterEditor.dataSetFilter())) { final DataSetFilter f = filterChangedEvent.getFilter(); dataSetDef.setDataSetFilter(f); doPreview(false); } } @Inject  DataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,
                         final IsWidget providerAttributesEditorView,
                         final DataSetDefColumnsFilterEditor columnsAndFilterEditor,
                         final DataSetDefPreviewTable previewTable,
                         final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,
                         final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,
                         final DataSetDefRefreshAttributesEditor refreshEditor,
                         final DataSetClientServices clientServices,
                         final LoadingBox loadingBox,
                         final Event<ErrorEvent> errorEvent,
                         final Event<TabChangedEvent> tabChangedEvent,
                         final View view); void init(); @Override Widget asWidget(); void showConfigurationTab(); void showPreviewTab(); void showAdvancedTab(); @Override void setAcceptableValues(final List<DataColumnDef> acceptableValues); @Override void flush(); @Override void onPropertyChange(final String... paths); @Override void setValue(final T value); @Override void setDelegate(final EditorDelegate<T> delegate); @Override org.dashbuilder.dataset.client.editor.DataSetDefBasicAttributesEditor basicAttributesEditor(); @Override org.dashbuilder.dataset.client.editor.DataSetDefColumnsFilterEditor columnsAndFilterEditor(); @Override DataSetDefBackendCacheAttributesEditor backendCacheEditor(); @Override org.dashbuilder.dataset.client.editor.DataSetDefClientCacheAttributesEditor clientCacheEditor(); @Override org.dashbuilder.dataset.client.editor.DataSetDefRefreshAttributesEditor refreshEditor(); static final String TAB_CONFIGURATION; static final String TAB_PREVIEW; static final String TAB_ADVANCED; public View view; }