Class ColumnChooserDialog

java.lang.Object
org.eclipse.jface.window.Window
org.eclipse.jface.dialogs.Dialog
org.eclipse.nebula.widgets.nattable.columnChooser.gui.AbstractColumnChooserDialog
org.eclipse.nebula.widgets.nattable.columnChooser.gui.ColumnChooserDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider

public class ColumnChooserDialog extends AbstractColumnChooserDialog
Dialog that contains two Trees to support hide/show and reordering of columns.
  • Constructor Details

    • ColumnChooserDialog

      public ColumnChooserDialog(org.eclipse.swt.widgets.Shell parentShell, String availableLabel, String selectedLabel)
      Parameters:
      parentShell - the parent shell, or null to create a top-level shell
      availableLabel - The label to be shown for the available tree.
      selectedLabel - The label to be shown for the selected tree.
  • Method Details

    • populateDialogArea

      public void populateDialogArea(org.eclipse.swt.widgets.Composite parent)
      Specified by:
      populateDialogArea in class AbstractColumnChooserDialog
    • addListener

      public void addListener(ISelectionTreeListener listener)
      Add a ISelectionTreeListener that is triggered for modifications in the selected tree.
      Parameters:
      listener - the listener to add.
      Since:
      2.0
    • removeListener

      public void removeListener(ISelectionTreeListener listener)
      Remove a ISelectionTreeListener that is triggered for modifications in the selected tree.
      Parameters:
      listener - the listener to remove.
      Since:
      2.0
    • fireItemsSelected

      protected final void fireItemsSelected(List<ColumnEntry> addedItems)
    • fireItemsRemoved

      protected final void fireItemsRemoved(List<ColumnEntry> removedItems)
    • fireItemsMoved

      protected final void fireItemsMoved(SelectionLayer.MoveDirectionEnum direction, List<ColumnGroupEntry> selectedColumnGroupEntries, List<ColumnEntry> selectedColumnEntries, List<List<Integer>> fromPositions, List<Integer> toPositions)
    • populateAvailableTree

      public void populateAvailableTree(List<ColumnEntry> columnEntries, ColumnGroupModel columnGroupModel)
      Populates the available item tree with the given column entries for the given ColumnGroupModel.
      Parameters:
      columnEntries - The column entries to add as available items.
      columnGroupModel - The ColumnGroupModel needed to inspect the column groups, can be null if no column grouping is supported in the underlying table composition.
    • populateAvailableTree

      public void populateAvailableTree(List<ColumnEntry> columnEntries, ColumnGroupModel columnGroupModel, boolean sort)
      Populates the available item tree with the given column entries for the given ColumnGroupModel.
      Parameters:
      columnEntries - The column entries to add as available items.
      columnGroupModel - The ColumnGroupModel needed to inspect the column groups, can be null if no column grouping is supported in the underlying table composition.
      sort - Whether the tree should be sorted or not.
      Since:
      2.0
    • populateSelectedTree

      public void populateSelectedTree(List<ColumnEntry> columnEntries, ColumnGroupModel columnGroupModel)
      Populates the selected item tree with the given column entries for the given ColumnGroupModel.
      Parameters:
      columnEntries - The column entries to add as selected items.
      columnGroupModel - The ColumnGroupModel needed to inspect the column groups, can be null if no column grouping is supported in the underlying table composition.
    • populateAvailableTree

      public void populateAvailableTree(List<ColumnEntry> columnEntries, ColumnGroupHeaderLayer columnGroupHeaderLayer)
      Populates the available item tree with the given column entries for the new performance ColumnGroupHeaderLayer.
      Parameters:
      columnEntries - The column entries to add as available items.
      columnGroupHeaderLayer - The new performance ColumnGroupHeaderLayer needed to inspect the column groups, can be null if no column grouping is supported in the underlying table composition.
      Since:
      1.6
    • populateAvailableTree

      public void populateAvailableTree(List<ColumnEntry> columnEntries, ColumnGroupHeaderLayer columnGroupHeaderLayer, boolean sort)
      Populates the available item tree with the given column entries for the new performance ColumnGroupHeaderLayer.
      Parameters:
      columnEntries - The column entries to add as available items.
      columnGroupHeaderLayer - The new performance ColumnGroupHeaderLayer needed to inspect the column groups, can be null if no column grouping is supported in the underlying table composition.
      sort - Whether the tree should be sorted or not.
      Since:
      2.0
    • populateSelectedTree

      public void populateSelectedTree(List<ColumnEntry> columnEntries, ColumnGroupHeaderLayer columnGroupHeaderLayer)
      Populates the selected item tree with the given column entries for the new performance ColumnGroupHeaderLayer.
      Parameters:
      columnEntries - The column entries to add as selected items.
      columnGroupHeaderLayer - The new performance ColumnGroupHeaderLayer needed to inspect the column groups, can be null if no column grouping is supported in the underlying table composition.
      Since:
      1.6
    • moveSelectedUp

      protected void moveSelectedUp()
      Move selected items in the selected tree up (left).
    • moveSelectedDown

      protected void moveSelectedDown()
      Move selected items in the selected tree down (right).
    • getIndexesOfSelectedLeaves

      protected List<Integer> getIndexesOfSelectedLeaves(org.eclipse.swt.widgets.Tree tree)
      Return the indexes of the selected leaves in the tree.
      Parameters:
      tree - The Tree to inspect.
      Returns:
      The indexes of the selected leaves.
    • expandAllLeaves

      public void expandAllLeaves()
      Expands all leaves.
    • removeAllLeaves

      public void removeAllLeaves()
      Removes all items from the available and the selected tree.
    • setSelectionIncludingNested

      public void setSelectionIncludingNested(List<Integer> indexes)
    • setSelection

      protected void setSelection(org.eclipse.swt.widgets.Tree tree, List<Integer> indexes)
      Marks the leaves in the tree as selected
      Parameters:
      tree - containing the leaves
      indexes - index of the leaf in the tree
    • getSelectedTree

      protected org.eclipse.swt.widgets.Tree getSelectedTree()
    • setPreventHidingAllColumns

      public void setPreventHidingAllColumns(boolean preventHidingAllColumns)
      With this option, the dialog can be configure to either allow removing all columns from the set of visible columns or prevent such a state by disabling the "remove from selection" button if the selection contains all remaining visible columns.
      Parameters:
      preventHidingAllColumns - if true, the dialog will prevent that the user selects no column at all, by disabling the "remove from selection" button appropriately.