Search in sources :

Example 61 with PositionCoordinate

use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.

the class SearchGridCommandHandlerTest method shouldFindRegexInGrid.

@Test
public void shouldFindRegexInGrid() {
    this.isForward = true;
    this.isWrapSearch = false;
    this.isCaseSensitive = false;
    this.isWholeWord = false;
    this.isIncremental = false;
    this.isRegex = true;
    this.isIncludeCollapsed = false;
    this.isColumnFirst = true;
    this.searchText = ".2.4.";
    this.expected = new PositionCoordinate(null, 2, 4);
    doTest();
}
Also used : PositionCoordinate(org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate) Test(org.junit.Test)

Example 62 with PositionCoordinate

use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.

the class SearchGridCommandHandlerTest method shouldFindRegexInRowFirst.

@Test
public void shouldFindRegexInRowFirst() {
    this.isForward = true;
    this.isWrapSearch = false;
    this.isCaseSensitive = false;
    this.isWholeWord = false;
    this.isIncremental = false;
    this.isRegex = true;
    this.isIncludeCollapsed = false;
    this.isColumnFirst = false;
    this.searchText = ".[23].[23].";
    this.expected = new PositionCoordinate(null, 3, 2);
    doTest();
}
Also used : PositionCoordinate(org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate) Test(org.junit.Test)

Example 63 with PositionCoordinate

use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.

the class SearchGridCommandHandlerTest method shouldFindRegexInColumnFirst.

@Test
public void shouldFindRegexInColumnFirst() {
    this.isForward = true;
    this.isWrapSearch = false;
    this.isCaseSensitive = false;
    this.isWholeWord = false;
    this.isIncremental = false;
    this.isRegex = true;
    this.isIncludeCollapsed = false;
    this.isColumnFirst = true;
    this.searchText = ".[23].[23].";
    this.expected = new PositionCoordinate(null, 2, 3);
    doTest();
}
Also used : PositionCoordinate(org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate) Test(org.junit.Test)

Example 64 with PositionCoordinate

use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.

the class GridSearchStrategyTest method searchShouldWrapAroundRow.

@Test
public void searchShouldWrapAroundRow() {
    // Select search starting point in composite coordinates
    this.gridLayer.doCommand(new SelectCellCommand(this.gridLayer, 3, 4, false, false));
    GridSearchStrategy gridStrategy = new GridSearchStrategy(this.configRegistry, false, true);
    gridStrategy.setComparator(new CellValueAsStringComparator<>());
    // If we don't specify to wrap the search, it will not find it.
    gridStrategy.setContextLayer(this.selectionLayer);
    PositionCoordinate searchResult = gridStrategy.executeSearch("[1,3]");
    assertNull(searchResult);
    // Should find it when wrap search is enabled.
    gridStrategy.setWrapSearch(true);
    searchResult = gridStrategy.executeSearch("[1,3]");
    assertNotNull(searchResult);
    assertEquals(1, searchResult.columnPosition);
    assertEquals(3, searchResult.rowPosition);
}
Also used : SelectCellCommand(org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand) PositionCoordinate(org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate) Test(org.junit.Test)

Example 65 with PositionCoordinate

use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.

the class GridSearchStrategyTest method searchShouldNotFindWithSkipSearchLabel.

@Test
public void searchShouldNotFindWithSkipSearchLabel() {
    GridSearchStrategy gridStrategy = new GridSearchStrategy(this.configRegistry, false, true);
    // If we don't specify to wrap the search, it will not find it.
    gridStrategy.setContextLayer(this.selectionLayer);
    gridStrategy.setCaseSensitive(true);
    gridStrategy.setComparator(new CellValueAsStringComparator<>());
    PositionCoordinate searchResult = gridStrategy.executeSearch("body");
    assertNotNull(searchResult);
    assertEquals(2, searchResult.columnPosition);
    assertEquals(2, searchResult.rowPosition);
    // clear the selection
    this.selectionLayer.clear();
    // configure skip search label
    ColumnOverrideLabelAccumulator accumulator = new ColumnOverrideLabelAccumulator(this.selectionLayer);
    accumulator.registerColumnOverrides(2, ISearchStrategy.SKIP_SEARCH_RESULT_LABEL);
    this.selectionLayer.setConfigLabelAccumulator(accumulator);
    searchResult = gridStrategy.executeSearch("body");
    assertNull(searchResult);
}
Also used : PositionCoordinate(org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate) ColumnOverrideLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator) Test(org.junit.Test)

Aggregations

PositionCoordinate (org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate)97 Test (org.junit.Test)55 SelectCellCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand)15 ILayerCell (org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell)10 Rectangle (org.eclipse.swt.graphics.Rectangle)9 SelectRegionCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectRegionCommand)7 ArrayList (java.util.ArrayList)5 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)5 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)5 Range (org.eclipse.nebula.widgets.nattable.coordinate.Range)4 ViewportSelectColumnGroupCommand (org.eclipse.nebula.widgets.nattable.group.command.ViewportSelectColumnGroupCommand)4 SearchEvent (org.eclipse.nebula.widgets.nattable.search.event.SearchEvent)4 SelectAllCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectAllCommand)4 ILayerListener (org.eclipse.nebula.widgets.nattable.layer.ILayerListener)3 HashSet (java.util.HashSet)2 Pattern (java.util.regex.Pattern)2 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)2 ColumnPositionCoordinate (org.eclipse.nebula.widgets.nattable.coordinate.ColumnPositionCoordinate)2 RowPositionCoordinate (org.eclipse.nebula.widgets.nattable.coordinate.RowPositionCoordinate)2 UpdateDataCommand (org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand)2