test_class.declarator: view
test_class.modifier: @Mock
test_class.original_string: @Mock DataSetDefPreviewTable.View view;
test_class.type: DataSetDefPreviewTable.View
test_class.var_name: view
test_class.declarator: dataSetDef
test_class.modifier: @Mock
test_class.original_string: @Mock DataSetDef dataSetDef;
test_class.type: DataSetDef
test_class.var_name: dataSetDef
test_class.declarator: tested
test_class.modifier: private
test_class.original_string: private DataSetDefPreviewTable tested;
test_class.type: DataSetDefPreviewTable
test_class.var_name: tested
test_class.declarator: columnDefList = mock(List.class)
test_class.modifier: final
test_class.original_string: final List<DataColumnDef> columnDefList = mock(List.class);
test_class.type: List<DataColumnDef>
test_class.var_name: columnDefList
test_class.declarator: displayer = mock(Displayer.class)
test_class.modifier: final
test_class.original_string: final Displayer displayer = mock(Displayer.class);
test_class.type: Displayer
test_class.var_name: displayer
test_class.declarator: displayerListener = mock(DisplayerListener.class)
test_class.modifier: final
test_class.original_string: final DisplayerListener displayerListener = mock(DisplayerListener.class);
test_class.type: DisplayerListener
test_class.var_name: displayerListener
test_class.declarator: displayerSettings = mock(DisplayerSettings.class)
test_class.modifier: final
test_class.original_string: final DisplayerSettings displayerSettings = mock(DisplayerSettings.class);
test_class.type: DisplayerSettings
test_class.var_name: displayerSettings
test_class.file: dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefPreviewTableTest.java
test_class.identifier: DataSetDefPreviewTableTest
test_class.superclass: extends AbstractDisplayerTest
test_case.body: @Test
      public void testCSVConfig() throws Exception {
          DataSetDef dataSetDef = DataSetDefFactory.newCSVDataSetDef()
                  .datePattern("dd/MM/yyyy")
                  .numberPattern("#,###")
                  .allColumns(true)
                  .buildDef();
  
          DataSet dataSet = DataSetFactory.newDataSetBuilder()
                  .date("date")
                  .number("number")
                  .row(new Date(), 1d)
                  .buildDataSet();
  
          when(dataSetLookupServices.lookupDataSet(any(), any())).thenReturn(dataSet);
          tested.show(dataSetDef, null, displayerListener);
  
          ArgumentCaptor<Displayer> argumentCaptor = ArgumentCaptor.forClass(Displayer.class);
          verify(displayerListener).onDataLoaded(argumentCaptor.capture());
          Displayer displayer = argumentCaptor.getValue();
          DisplayerSettings settings = displayer.getDisplayerSettings();
          assertEquals(settings.getColumnSettings("date").getValuePattern(), "dd/MM/yyyy");
          assertEquals(settings.getColumnSettings("number").getValuePattern(), "#,###");
      }
test_case.class_method_signature: DataSetDefPreviewTableTest.testCSVConfig()
test_case.full_signature: @Test public void testCSVConfig()
test_case.identifier: testCSVConfig
test_case.invocations: buildDef allColumns numberPattern datePattern newCSVDataSetDef buildDataSet row number date newDataSetBuilder thenReturn when lookupDataSet any any show forClass onDataLoaded verify capture getValue getDisplayerSettings assertEquals getValuePattern getColumnSettings assertEquals getValuePattern getColumnSettings
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCSVConfig()
focal_class.declarator: clientServices
focal_class.original_string: DataSetClientServices clientServices;
focal_class.type: DataSetClientServices
focal_class.var_name: clientServices
focal_class.declarator: displayerLocator
focal_class.original_string: DisplayerLocator displayerLocator;
focal_class.type: DisplayerLocator
focal_class.var_name: displayerLocator
focal_class.declarator: view
focal_class.modifier: public
focal_class.original_string: public View view;
focal_class.type: View
focal_class.var_name: view
focal_class.declarator: tableDisplayer
focal_class.original_string: Displayer tableDisplayer;
focal_class.type: Displayer
focal_class.var_name: tableDisplayer
focal_class.file: dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefPreviewTable.java
focal_class.identifier: DataSetDefPreviewTable
focal_class.interfaces: implements IsWidget
focal_class.class_method_signature: DataSetDefPreviewTable.DataSetDefPreviewTable(final DisplayerLocator displayerLocator,
                                    final DataSetClientServices clientServices,
                                    final View view)
focal_class.full_signature: @Inject public  DataSetDefPreviewTable(final DisplayerLocator displayerLocator,
                                    final DataSetClientServices clientServices,
                                    final View view)
focal_class.identifier: DataSetDefPreviewTable
focal_class.modifiers: @Inject public
focal_class.parameters: (final DisplayerLocator displayerLocator,
                                    final DataSetClientServices clientServices,
                                    final View view)
focal_class.signature:  DataSetDefPreviewTable(final DisplayerLocator displayerLocator,
                                    final DataSetClientServices clientServices,
                                    final View view)
focal_class.class_method_signature: DataSetDefPreviewTable.init()
focal_class.full_signature: @PostConstruct public void init()
focal_class.identifier: init
focal_class.modifiers: @PostConstruct public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: DataSetDefPreviewTable.asWidget()
focal_class.full_signature: @Override public Widget asWidget()
focal_class.identifier: asWidget
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Widget
focal_class.signature: Widget asWidget()
focal_class.class_method_signature: DataSetDefPreviewTable.show(final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
                       final DisplayerListener displayerListener)
focal_class.full_signature: public void show(final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
                       final DisplayerListener displayerListener)
focal_class.identifier: show
focal_class.modifiers: public
focal_class.parameters: (final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
                       final DisplayerListener displayerListener)
focal_class.return: void
focal_class.signature: void show(final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
                       final DisplayerListener displayerListener)
focal_class.class_method_signature: DataSetDefPreviewTable.configureColumnSettings(Displayer displayer, CSVDataSetDef csvDataSetDef)
focal_class.full_signature: protected void configureColumnSettings(Displayer displayer, CSVDataSetDef csvDataSetDef)
focal_class.identifier: configureColumnSettings
focal_class.modifiers: protected
focal_class.parameters: (Displayer displayer, CSVDataSetDef csvDataSetDef)
focal_class.return: void
focal_class.signature: void configureColumnSettings(Displayer displayer, CSVDataSetDef csvDataSetDef)
focal_class.class_method_signature: DataSetDefPreviewTable.draw(final DisplayerListener displayerListener)
focal_class.full_signature:  void draw(final DisplayerListener displayerListener)
focal_class.identifier: draw
focal_class.parameters: (final DisplayerListener displayerListener)
focal_class.return: void
focal_class.signature: void draw(final DisplayerListener displayerListener)
focal_class.class_method_signature: DataSetDefPreviewTable.clear()
focal_class.full_signature: public void clear()
focal_class.identifier: clear
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clear()
focal_method.body: public void show(final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
                       final DisplayerListener displayerListener) {
          clear();
          
          if (dataSetDef != null) {
              
              // Build the table displayer settings.
              final TableDisplayerSettingsBuilder settingsBuilder = DisplayerSettingsFactory.newTableSettings()
                      .dataset(dataSetDef.getUUID())
                      .renderer(DefaultRenderer.UUID)
                      .titleVisible(false)
                      .tablePageSize(6)
                      .tableOrderEnabled(true)
                      .filterOn(true, false, false);
  
              // Make only the specified columns visible (if null then show all)
              if (columns != null && !columns.isEmpty()) {
                  for (final DataColumnDef column : columns) {
                      settingsBuilder.column(column.getId());
                  }
              }
  
              // Disable backend cache for preview.
              DataSetDef editCloneWithoutCacheSettings = dataSetDef.clone();
              editCloneWithoutCacheSettings.setCacheEnabled(false);
  
              // Close the current displayer (if any)
              if (tableDisplayer != null) {
                  tableDisplayer.close();
              }
  
              // Configure the table displayer and the data set handler for edition.
              DisplayerSettings settings = settingsBuilder.buildSettings();
              tableDisplayer = displayerLocator.lookupDisplayer(settings);
              tableDisplayer.setDataSetHandler(new DataSetEditHandler(clientServices, settings.getDataSetLookup(), editCloneWithoutCacheSettings));
  
              // For CSV datasets, make sure dates & numbers are displayed as defined in the CSV configuration
              if (dataSetDef instanceof CSVDataSetDef) {
                  CSVDataSetDef csvDataSetDef = (CSVDataSetDef) dataSetDef;
                  tableDisplayer.addListener(new AbstractDisplayerListener() {
  
                      // The column settings are set right after the data set load, once the dataset columns are known
                      @Override
                      public void onDataLoaded(Displayer displayer) {
                          configureColumnSettings(displayer, csvDataSetDef);
                      }
                  });
              }
  
              // Draw the table
              draw(displayerListener);
          }
      }
focal_method.class_method_signature: DataSetDefPreviewTable.show(final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
                       final DisplayerListener displayerListener)
focal_method.full_signature: public void show(final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
                       final DisplayerListener displayerListener)
focal_method.identifier: show
focal_method.invocations: clear filterOn tableOrderEnabled tablePageSize titleVisible renderer dataset newTableSettings getUUID isEmpty column getId clone setCacheEnabled close buildSettings lookupDisplayer setDataSetHandler getDataSetLookup addListener configureColumnSettings draw
focal_method.modifiers: public
focal_method.parameters: (final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
                       final DisplayerListener displayerListener)
focal_method.return: void
focal_method.signature: void show(final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,
                       final DisplayerListener displayerListener)