How to filter multi-line text?

171 Views Asked by At

My filter does not work for multi-line text, not even for ASCII characters. Only single line cells are filtered out correctly.

Example of a row with 4 columns:

[1, WELD FIL.. ... MCW430
(REP.. ..bL), 各溶接.. ..と。(..430NbL), X] 
  • (REP.. ..bL) text is still in the 2-nd column, but in new line
  • X character is in the 4-th column

Creating nattable:

private NatTable createTable(Composite parent, List<TableLine> tLines, String[][] propertyNames,
      PropertyToLabels[] propToLabels, TableParams params, TextMatcherEditor<TableLine>editor, boolean openableParts) {
    
    // another code: bodyLayerStack, bodyDataLayer
    // another code: set row heights, set column widths
    // another code: columnHeaderDataLayer    
    // another code: include table headers

    CompositeLayer composite = null;
    if( propertyNames != null ) {
      ColumnHeaderLayer columnHeaderLayer =
          new ColumnHeaderLayer(
              columnHeaderDataLayer,
              bodyLayerStack,
              (SelectionLayer)null);
      columnHeaderLayer.addConfiguration(NatTableLayerConfigurations.getColumnHeaderLayerConfiguration(false));

      SortHeaderLayer<TableLine> sortHeaderLayer =
          new SortHeaderLayer<TableLine>(
              columnHeaderLayer,
              new GlazedListsSortModel<TableLine>(
                  bodyLayerStack.getSortedList(),
                  getSortingColumnPropAccessor(propertyNames[0]),
                  configRegistry,
                  columnHeaderDataLayer));

      // another code: setChildLayer, add configurations

    natTable.configure();    
    editor.setFilterator(new TextFilterator<TableLine>() {

      @Override
      public void getFilterStrings(List<String> baseList, TableLine element) {
        for( int i = 0; i < element.getLength(); i++ )
          baseList.add("" + element.getObjectByColumn(i));
      }
    });
    editor.setMode(TextMatcherEditor.REGULAR_EXPRESSION);
    bodyLayerStack.getFilterList().setMatcherEditor(editor);

    NatTableContentProvider.addNatTableData(natTable, bodyLayerStack.getSelectionLayer(), bodyLayerStack.getBodyDataProvider());
    
    return natTable;
  }

I figured out, that in ca.odell.glazedlists.impl.filter.TextMatchers.matches(List<String>, TextFilterator<? super E>, SearchTerm<E>[], TextSearchStrategy[], E) the condition if(filterString != null && textSearchStrategy.indexOf(filterString.toString()) != -1) is missed, when filtering w character. It is clear, the string in the 2-nd cell starts with W. See picture.

My search text for filtering w is (?i).*w.*(?-i), case insensitive.

Is there any workaround, or setting for this? Or do I need to transform data before sorting? If transform data - how? Those Glazedlists classes are final, I can not override them

Thanks for any comment!

debugging

0

There are 0 best solutions below