Directory

← Back

CommanderGrid Add-on

CommanderGrid

Author

Contributors

Rating

Uses performance of flat Grid (paging) to show hierarchical data by showing only one hierarchy level at time. To be used with a heavy com.vaadin.data.provider.BackEndDataProvider which is not optimised to show all children at once in a com.vaadin.ui.TreeGrid.

Sample code

  HierarchicalFileDataProvider dataProvider = 
    new HierarchicalFileDataProvider(new File("/Users"));

  CommanderGrid<File, FileFilter> grid = 
    new CommanderGrid<>(BeanPropertySet.get(File.class), dataProvider)
      .withFirstColumn("name");
 
  grid.addKeyAction(ShortcutAction.KeyCode.ENTER, 
    ShortcutAction.ModifierKey.SHIFT, 
     () -> grid.asSingleSelect().getSelectedItem().ifPresent(grid::goInto)
   );
   grid.addKeyAction(
     ShortcutAction.KeyCode.BACKSPACE, ShortcutAction.ModifierKey.SHIFT, 
     grid::goToParentFolder
   );

 TextField filterComponent = new TextField();
 filterComponent.addValueChangeListener(event -> 
   dataProvider.setFilter(file -> file.getName().contains(event.getValue()))
 );
 grid.getHeaderRow(0).getCell("name").setComponent(filterComponent);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Released
2022-08-12
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.0+
Browser
N/A

CommanderGrid Add-on - Vaadin Add-on Directory

CommanderGrid CommanderGrid Add-on - Vaadin Add-on Directory
Uses performance of flat Grid (paging) to show hierarchical data by showing only one hierarchy level at time. To be used with a heavy com.vaadin.data.provider.BackEndDataProvider which is not optimised to show all children at once in a com.vaadin.ui.TreeGrid.
Online