Search in sources :

Example 6 with SearchCommand

use of org.eclipse.nebula.widgets.nattable.search.command.SearchCommand in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testUnhideOnSearchWithoutLevelHeader.

@Test
public void testUnhideOnSearchWithoutLevelHeader() {
    this.treeLayer.setShowTreeLevelHeader(false);
    this.treeLayer.setExpandOnSearch(false);
    this.treeLayer.doCommand(new TreeExpandCollapseCommand(9, 2));
    assertEquals(10, this.treeLayer.getRowCount());
    assertEquals(1, this.treeLayer.collapsedNodes.size());
    HierarchicalTreeNode node = this.treeLayer.collapsedNodes.iterator().next();
    assertEquals(2, node.columnIndex);
    assertEquals(9, node.rowIndex);
    assertNotNull(node.rowObject);
    assertEquals(10, this.treeLayer.getHiddenRowIndexes().iterator().next().intValue());
    // search for the collapsed row
    ConfigRegistry configRegistry = new ConfigRegistry();
    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDisplayConverter());
    GridSearchStrategy gridSearchStrategy = new GridSearchStrategy(configRegistry, false, true);
    SearchCommand searchCommand = new SearchCommand("sing", this.selectionLayer, gridSearchStrategy, ISearchDirection.SEARCH_FORWARD, false, false, false, false, false, false, new CellValueAsStringComparator<>());
    this.treeLayer.doCommand(searchCommand);
    assertEquals(11, this.treeLayer.getRowCount());
    assertEquals(1, this.treeLayer.collapsedNodes.size());
    node = this.treeLayer.collapsedNodes.iterator().next();
    assertEquals(2, node.columnIndex);
    assertEquals(9, node.rowIndex);
    assertNotNull(node.rowObject);
    assertEquals(0, this.treeLayer.getHiddenRowIndexes().size());
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) HierarchicalTreeNode(org.eclipse.nebula.widgets.nattable.hierarchical.HierarchicalTreeLayer.HierarchicalTreeNode) GridSearchStrategy(org.eclipse.nebula.widgets.nattable.search.strategy.GridSearchStrategy) TreeExpandCollapseCommand(org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseCommand) DefaultDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultDisplayConverter) SearchCommand(org.eclipse.nebula.widgets.nattable.search.command.SearchCommand) Test(org.junit.Test)

Example 7 with SearchCommand

use of org.eclipse.nebula.widgets.nattable.search.command.SearchCommand in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testExpandAllLevelsOnSearch.

@Test
public void testExpandAllLevelsOnSearch() {
    this.treeLayer.doCommand(new TreeExpandCollapseCommand(9, 2));
    this.treeLayer.doCommand(new TreeExpandCollapseCommand(6, 0));
    assertEquals(7, this.treeLayer.getRowCount());
    assertEquals(2, this.treeLayer.collapsedNodes.size());
    assertEquals(4, this.treeLayer.getHiddenRowIndexes().size());
    // search for the collapsed row
    ConfigRegistry configRegistry = new ConfigRegistry();
    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDisplayConverter());
    GridSearchStrategy gridSearchStrategy = new GridSearchStrategy(configRegistry, false, true);
    SearchCommand searchCommand = new SearchCommand("sing", this.selectionLayer, gridSearchStrategy, ISearchDirection.SEARCH_FORWARD, false, false, false, false, false, false, new CellValueAsStringComparator<>());
    this.treeLayer.doCommand(searchCommand);
    assertEquals(11, this.treeLayer.getRowCount());
    assertEquals(0, this.treeLayer.collapsedNodes.size());
    assertEquals(0, this.treeLayer.getHiddenRowIndexes().size());
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) GridSearchStrategy(org.eclipse.nebula.widgets.nattable.search.strategy.GridSearchStrategy) TreeExpandCollapseCommand(org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseCommand) DefaultDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultDisplayConverter) SearchCommand(org.eclipse.nebula.widgets.nattable.search.command.SearchCommand) Test(org.junit.Test)

Example 8 with SearchCommand

use of org.eclipse.nebula.widgets.nattable.search.command.SearchCommand in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testExpandOnSearchWithoutLevelHeader.

@Test
public void testExpandOnSearchWithoutLevelHeader() {
    this.treeLayer.setShowTreeLevelHeader(false);
    this.treeLayer.doCommand(new TreeExpandCollapseCommand(9, 2));
    assertEquals(10, this.treeLayer.getRowCount());
    assertEquals(1, this.treeLayer.collapsedNodes.size());
    HierarchicalTreeNode node = this.treeLayer.collapsedNodes.iterator().next();
    assertEquals(2, node.columnIndex);
    assertEquals(9, node.rowIndex);
    assertNotNull(node.rowObject);
    assertEquals(10, this.treeLayer.getHiddenRowIndexes().iterator().next().intValue());
    // search for the collapsed row
    ConfigRegistry configRegistry = new ConfigRegistry();
    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDisplayConverter());
    GridSearchStrategy gridSearchStrategy = new GridSearchStrategy(configRegistry, false, true);
    SearchCommand searchCommand = new SearchCommand("sing", this.selectionLayer, gridSearchStrategy, ISearchDirection.SEARCH_FORWARD, false, false, false, false, false, false, new CellValueAsStringComparator<>());
    this.treeLayer.doCommand(searchCommand);
    assertEquals(11, this.treeLayer.getRowCount());
    assertEquals(0, this.treeLayer.collapsedNodes.size());
    assertEquals(0, this.treeLayer.getHiddenRowIndexes().size());
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) HierarchicalTreeNode(org.eclipse.nebula.widgets.nattable.hierarchical.HierarchicalTreeLayer.HierarchicalTreeNode) GridSearchStrategy(org.eclipse.nebula.widgets.nattable.search.strategy.GridSearchStrategy) TreeExpandCollapseCommand(org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseCommand) DefaultDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultDisplayConverter) SearchCommand(org.eclipse.nebula.widgets.nattable.search.command.SearchCommand) Test(org.junit.Test)

Aggregations

SearchCommand (org.eclipse.nebula.widgets.nattable.search.command.SearchCommand)8 GridSearchStrategy (org.eclipse.nebula.widgets.nattable.search.strategy.GridSearchStrategy)7 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)6 DefaultDisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.DefaultDisplayConverter)6 TreeExpandCollapseCommand (org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseCommand)6 Test (org.junit.Test)6 HierarchicalTreeNode (org.eclipse.nebula.widgets.nattable.hierarchical.HierarchicalTreeLayer.HierarchicalTreeNode)4 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 PositionCoordinate (org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate)1 ISearchStrategy (org.eclipse.nebula.widgets.nattable.search.strategy.ISearchStrategy)1 SelectionSearchStrategy (org.eclipse.nebula.widgets.nattable.search.strategy.SelectionSearchStrategy)1