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 twoTree
s to support hide/show and reordering of columns.
-
-
Field Summary
-
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
-
-
Constructor Summary
Constructors Constructor Description ColumnChooserDialog(org.eclipse.swt.widgets.Shell parentShell, String availableLabel, String selectedLabel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(ISelectionTreeListener listener)
Add aISelectionTreeListener
that is triggered for modifications in the selected tree.void
expandAllLeaves()
Expands all leaves.protected void
fireItemsMoved(SelectionLayer.MoveDirectionEnum direction, List<ColumnGroupEntry> selectedColumnGroupEntries, List<ColumnEntry> selectedColumnEntries, List<List<Integer>> fromPositions, List<Integer> toPositions)
protected void
fireItemsRemoved(List<ColumnEntry> removedItems)
protected void
fireItemsSelected(List<ColumnEntry> addedItems)
protected List<Integer>
getIndexesOfSelectedLeaves(org.eclipse.swt.widgets.Tree tree)
Return the indexes of the selected leaves in the tree.protected org.eclipse.swt.widgets.Tree
getSelectedTree()
protected void
moveSelectedDown()
Move selected items in the selected tree down (right).protected void
moveSelectedUp()
Move selected items in the selected tree up (left).void
populateAvailableTree(List<ColumnEntry> columnEntries, ColumnGroupModel columnGroupModel)
Populates the available item tree with the given column entries for the givenColumnGroupModel
.void
populateAvailableTree(List<ColumnEntry> columnEntries, ColumnGroupModel columnGroupModel, boolean sort)
Populates the available item tree with the given column entries for the givenColumnGroupModel
.void
populateAvailableTree(List<ColumnEntry> columnEntries, ColumnGroupHeaderLayer columnGroupHeaderLayer)
Populates the available item tree with the given column entries for the new performanceColumnGroupHeaderLayer
.void
populateAvailableTree(List<ColumnEntry> columnEntries, ColumnGroupHeaderLayer columnGroupHeaderLayer, boolean sort)
Populates the available item tree with the given column entries for the new performanceColumnGroupHeaderLayer
.void
populateDialogArea(org.eclipse.swt.widgets.Composite parent)
void
populateSelectedTree(List<ColumnEntry> columnEntries, ColumnGroupModel columnGroupModel)
Populates the selected item tree with the given column entries for the givenColumnGroupModel
.void
populateSelectedTree(List<ColumnEntry> columnEntries, ColumnGroupHeaderLayer columnGroupHeaderLayer)
Populates the selected item tree with the given column entries for the new performanceColumnGroupHeaderLayer
.void
removeAllLeaves()
Removes all items from the available and the selected tree.void
removeListener(ISelectionTreeListener listener)
Remove aISelectionTreeListener
that is triggered for modifications in the selected tree.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.protected void
setSelection(org.eclipse.swt.widgets.Tree tree, List<Integer> indexes)
Marks the leaves in the tree as selectedvoid
setSelectionIncludingNested(List<Integer> indexes)
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.columnChooser.gui.AbstractColumnChooserDialog
createButtonsForButtonBar, createDialogArea, createLabels, getDialogBoundsSettings, getInitialSize, setDialogSettings
-
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsStrategy, getImage, getInitialLocation, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
-
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, configureShell, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
-
-
-
-
Constructor Detail
-
ColumnChooserDialog
public ColumnChooserDialog(org.eclipse.swt.widgets.Shell parentShell, String availableLabel, String selectedLabel)
- Parameters:
parentShell
- the parent shell, ornull
to create a top-level shellavailableLabel
- The label to be shown for the available tree.selectedLabel
- The label to be shown for the selected tree.
-
-
Method Detail
-
populateDialogArea
public void populateDialogArea(org.eclipse.swt.widgets.Composite parent)
- Specified by:
populateDialogArea
in classAbstractColumnChooserDialog
-
addListener
public void addListener(ISelectionTreeListener listener)
Add aISelectionTreeListener
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 aISelectionTreeListener
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 givenColumnGroupModel
.- Parameters:
columnEntries
- The column entries to add as available items.columnGroupModel
- TheColumnGroupModel
needed to inspect the column groups, can benull
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 givenColumnGroupModel
.- Parameters:
columnEntries
- The column entries to add as available items.columnGroupModel
- TheColumnGroupModel
needed to inspect the column groups, can benull
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 givenColumnGroupModel
.- Parameters:
columnEntries
- The column entries to add as selected items.columnGroupModel
- TheColumnGroupModel
needed to inspect the column groups, can benull
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 performanceColumnGroupHeaderLayer
.- Parameters:
columnEntries
- The column entries to add as available items.columnGroupHeaderLayer
- The new performanceColumnGroupHeaderLayer
needed to inspect the column groups, can benull
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 performanceColumnGroupHeaderLayer
.- Parameters:
columnEntries
- The column entries to add as available items.columnGroupHeaderLayer
- The new performanceColumnGroupHeaderLayer
needed to inspect the column groups, can benull
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 performanceColumnGroupHeaderLayer
.- Parameters:
columnEntries
- The column entries to add as selected items.columnGroupHeaderLayer
- The new performanceColumnGroupHeaderLayer
needed to inspect the column groups, can benull
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
- TheTree
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.
-
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 leavesindexes
- 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.
-
-