Class PopupMenuBuilder
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder
-
public class PopupMenuBuilder extends Object
This class is used to create a context menu.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
PopupMenuBuilder.PopupContributionItem
Wrapper class to build up aContributionItem
based on a givenIMenuItemProvider
.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PopupMenuBuilder(org.eclipse.jface.action.MenuManager manager)
PopupMenuBuilder(NatTable parent)
CreatesPopupMenuBuilder
that builds up a newMenu
that is only configurable with this instance ofPopupMenuBuilder
.PopupMenuBuilder(NatTable parent, org.eclipse.jface.action.MenuManager manager)
PopupMenuBuilder(NatTable natTable, org.eclipse.swt.widgets.Menu menu)
Creates a popup menu builder based on the given menu.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.swt.widgets.Menu
build()
Builds and returns the createdMenu
.org.eclipse.jface.action.MenuManager
build(NatTable natTable)
Sets the given NatTable to this builder and returns theMenuManager
that is used to create the context menu.PopupMenuBuilder
withAutoResizeSelectedColumnsMenuItem()
Adds the menu item for auto resizing selected columns to the popup menu.PopupMenuBuilder
withAutoResizeSelectedColumnsMenuItem(String menuLabel)
Adds the menu item for auto resizing selected columns to the popup menu.PopupMenuBuilder
withAutoResizeSelectedRowsMenuItem()
PopupMenuBuilder
withAutoResizeSelectedRowsMenuItem(String menuLabel)
PopupMenuBuilder
withCategoriesBasedColumnChooser()
PopupMenuBuilder
withCategoriesBasedColumnChooser(String menuLabel)
PopupMenuBuilder
withClearAllFilters()
PopupMenuBuilder
withClearAllFilters(String menuLabel)
PopupMenuBuilder
withColumnChooserMenuItem()
PopupMenuBuilder
withColumnChooserMenuItem(String menuLabel)
PopupMenuBuilder
withColumnRenameDialog()
PopupMenuBuilder
withColumnRenameDialog(String menuLabel)
PopupMenuBuilder
withColumnStyleEditor()
PopupMenuBuilder
withColumnStyleEditor(String menuLabel)
PopupMenuBuilder
withContributionItem(org.eclipse.jface.action.ContributionItem contributionItem)
Adds the menu item(s) provided by the givenContributionItem
to the popup menu.PopupMenuBuilder
withCreateColumnGroupMenuItem()
Adds the menu item for creating a column group with the new performance ColumnGroupHeaderLayer.PopupMenuBuilder
withCreateColumnGroupMenuItem(String menuLabel)
Adds the menu item for creating a column group with the new performance ColumnGroupHeaderLayer.PopupMenuBuilder
withCreateColumnGroupsMenuItem()
PopupMenuBuilder
withCreateColumnGroupsMenuItem(String menuLabel)
PopupMenuBuilder
withCreateRowGroupMenuItem()
Adds the menu item for creating a row group with the new performance RowGroupHeaderLayer.PopupMenuBuilder
withCreateRowGroupMenuItem(String menuLabel)
Adds the menu item for creating a row group with the new performance RowGroupHeaderLayer.PopupMenuBuilder
withEnabledState(String id, IMenuItemState state)
Associate a enabledIMenuItemState
with the menu item identified by the given id.PopupMenuBuilder
withExportToImageMenuItem()
Add the menu item for exporting to image to the popup menu.PopupMenuBuilder
withExportToImageMenuItem(String menuLabel)
Add the menu item for exporting to image to the popup menu.PopupMenuBuilder
withFreezeColumnMenuItem()
Adds the menu item for for freezing a grid at a given column position.PopupMenuBuilder
withFreezeColumnMenuItem(String menuLabel)
Adds the menu item for for freezing a grid at a given column position.PopupMenuBuilder
withFreezePositionMenuItem(boolean include)
Adds the menu item for freezing a grid at a given cell position.PopupMenuBuilder
withFreezePositionMenuItem(String menuLabel, boolean include)
Adds the menu item for freezing a grid at a given cell position.PopupMenuBuilder
withFreezeRowMenuItem()
Adds the menu item for for freezing a grid at a given row position.PopupMenuBuilder
withFreezeRowMenuItem(String menuLabel)
Adds the menu item for for freezing a grid at a given row position.PopupMenuBuilder
withHideColumnMenuItem()
Adds the menu item for hiding a column to the popup menu.PopupMenuBuilder
withHideColumnMenuItem(String menuLabel)
Adds the menu item for hiding a column to the popup menu.PopupMenuBuilder
withHideRowMenuItem()
Adds the menu item for hiding a row to the popup menu by using theRowHideCommand
.PopupMenuBuilder
withHideRowMenuItem(String menuLabel)
Adds the menu item for hiding a row to the popup menu by using theRowHideCommand
.PopupMenuBuilder
withHideRowPositionMenuItem()
Adds the menu item for hiding a row to the popup menu by using theRowPositionHideCommand
.PopupMenuBuilder
withHideRowPositionMenuItem(String menuLabel)
Adds the menu item for hiding a row to the popup menu by using theRowPositionHideCommand
.PopupMenuBuilder
withInspectLabelsMenuItem()
PopupMenuBuilder
withMenuItemProvider(String id, IMenuItemProvider menuItemProvider)
Adds the menu item provided by the givenIMenuItemProvider
to the popup menu.PopupMenuBuilder
withMenuItemProvider(IMenuItemProvider menuItemProvider)
Adds the menu item provided by the givenIMenuItemProvider
to the popup menu.PopupMenuBuilder
withRemoveColumnGroupMenuItem()
PopupMenuBuilder
withRemoveColumnGroupMenuItem(String menuLabel)
PopupMenuBuilder
withRemoveRowGroupMenuItem()
Adds the menu item for removing a row group.PopupMenuBuilder
withRemoveRowGroupMenuItem(String menuLabel)
Adds the menu item for removing a row group.PopupMenuBuilder
withRenameColumnGroupMenuItem()
PopupMenuBuilder
withRenameColumnGroupMenuItem(String menuLabel)
PopupMenuBuilder
withRenameRowGroupMenuItem()
Adds the menu item for renaming a row group.PopupMenuBuilder
withRenameRowGroupMenuItem(String menuLabel)
Adds the menu item for renaming a row group.PopupMenuBuilder
withSeparator()
Adds a separator to the popup menu.PopupMenuBuilder
withSeparator(String id)
Adds a separator to the popup menu with the given id.PopupMenuBuilder
withShowAllColumnsMenuItem()
Adds the menu item for showing all columns to the popup menu.PopupMenuBuilder
withShowAllColumnsMenuItem(String menuLabel)
Adds the menu item for showing all columns to the popup menu.PopupMenuBuilder
withShowAllRowsMenuItem()
Adds the menu item for showing all rows to the popup menu.PopupMenuBuilder
withShowAllRowsMenuItem(String menuLabel)
Adds the menu item for showing all rows to the popup menu.PopupMenuBuilder
withStateManagerMenuItemProvider()
Adds the menu item for opening the view management dialog to the popup menu.PopupMenuBuilder
withStateManagerMenuItemProvider(String menuLabel)
Adds the menu item for opening the view management dialog to the popup menu.PopupMenuBuilder
withToggleFilterRow()
Adds a menu item for toggling the visibility of the filter row.PopupMenuBuilder
withToggleFilterRow(String menuLabel)
Adds a menu item for toggling the visibility of the filter row.PopupMenuBuilder
withUnfreezeMenuItem()
Adds the menu item for removing a frozen state.PopupMenuBuilder
withUnfreezeMenuItem(String menuLabel)
Adds the menu item for removing a frozen state.PopupMenuBuilder
withUngroupColumnsMenuItem()
PopupMenuBuilder
withUngroupColumnsMenuItem(String menuLabel)
PopupMenuBuilder
withUngroupRowsMenuItem()
Adds the menu item for ungrouping selected rows from an existing row group.PopupMenuBuilder
withUngroupRowsMenuItem(String menuLabel)
Adds the menu item for ungrouping selected rows from an existing row group.PopupMenuBuilder
withVisibleState(String id, IMenuItemState state)
Associate a visibilityIMenuItemState
with the menu item identified by the given id.
-
-
-
Field Detail
-
HIDE_COLUMN_MENU_ITEM_ID
public static final String HIDE_COLUMN_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
SHOW_ALL_COLUMNS_MENU_ITEM_ID
public static final String SHOW_ALL_COLUMNS_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
HIDE_ROW_MENU_ITEM_ID
public static final String HIDE_ROW_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
SHOW_ALL_ROWS_MENU_ITEM_ID
public static final String SHOW_ALL_ROWS_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
AUTO_RESIZE_COLUMN_MENU_ITEM_ID
public static final String AUTO_RESIZE_COLUMN_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
AUTO_RESIZE_ROW_MENU_ITEM_ID
public static final String AUTO_RESIZE_ROW_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
AUTO_RESIZE_ALL_SELECTED_COLUMN_MENU_ITEM_ID
public static final String AUTO_RESIZE_ALL_SELECTED_COLUMN_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
COLUMN_CHOOSER_MENU_ITEM_ID
public static final String COLUMN_CHOOSER_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
COLUMN_STYLE_EDITOR_MENU_ITEM_ID
public static final String COLUMN_STYLE_EDITOR_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
COLUMN_RENAME_MENU_ITEM_ID
public static final String COLUMN_RENAME_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
CREATE_COLUMN_GROUP_MENU_ITEM_ID
public static final String CREATE_COLUMN_GROUP_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
RENAME_COLUMN_GROUP_MENU_ITEM_ID
public static final String RENAME_COLUMN_GROUP_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
REMOVE_COLUMN_GROUP_MENU_ITEM_ID
public static final String REMOVE_COLUMN_GROUP_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
UNGROUP_COLUMNS_MENU_ITEM_ID
public static final String UNGROUP_COLUMNS_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
INSPECT_LABEL_MENU_ITEM_ID
public static final String INSPECT_LABEL_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
CATEGORIES_BASED_COLUMN_CHOOSER_MENU_ITEM_ID
public static final String CATEGORIES_BASED_COLUMN_CHOOSER_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
CLEAR_ALL_FILTERS_MENU_ITEM_ID
public static final String CLEAR_ALL_FILTERS_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
TOGGLE_FILTER_ROW_MENU_ITEM_ID
public static final String TOGGLE_FILTER_ROW_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
STATE_MANAGER_MENU_ITEM_ID
public static final String STATE_MANAGER_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
SEPARATOR_MENU_ITEM_ID
public static final String SEPARATOR_MENU_ITEM_ID
- See Also:
- Constant Field Values
-
EXPORT_IMAGE_MENU_ITEM_ID
public static final String EXPORT_IMAGE_MENU_ITEM_ID
- Since:
- 1.5
- See Also:
- Constant Field Values
-
CREATE_ROW_GROUP_MENU_ITEM_ID
public static final String CREATE_ROW_GROUP_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
- Constant Field Values
-
RENAME_ROW_GROUP_MENU_ITEM_ID
public static final String RENAME_ROW_GROUP_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
- Constant Field Values
-
REMOVE_ROW_GROUP_MENU_ITEM_ID
public static final String REMOVE_ROW_GROUP_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
- Constant Field Values
-
UNGROUP_ROWS_MENU_ITEM_ID
public static final String UNGROUP_ROWS_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
- Constant Field Values
-
FREEZE_COLUMN_MENU_ITEM_ID
public static final String FREEZE_COLUMN_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
- Constant Field Values
-
FREEZE_ROW_MENU_ITEM_ID
public static final String FREEZE_ROW_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
- Constant Field Values
-
FREEZE_POSITION_MENU_ITEM_ID
public static final String FREEZE_POSITION_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
- Constant Field Values
-
UNFREEZE_MENU_ITEM_ID
public static final String UNFREEZE_MENU_ITEM_ID
- Since:
- 1.6
- See Also:
- Constant Field Values
-
natTable
protected NatTable natTable
The active NatTable instance the context menu should be added to. Needed in advance to be able to add custom menu items that need the NatTable instance.
-
popupMenu
protected org.eclipse.swt.widgets.Menu popupMenu
TheMenu
that is created with this popup menu builder.
-
menuManager
protected org.eclipse.jface.action.MenuManager menuManager
TheMenuManager
that is used by this popup menu builder. Can benull
if plain SWT menu mechanisms are used.
-
visibility
protected final MenuItemStateMap visibility
Collection of all registered visibility state checkers for configured id's.
-
enablement
protected final MenuItemStateMap enablement
Collection of all registered enablement state checkers for configured id's.
-
-
Constructor Detail
-
PopupMenuBuilder
public PopupMenuBuilder(NatTable parent)
CreatesPopupMenuBuilder
that builds up a newMenu
that is only configurable with this instance ofPopupMenuBuilder
. Uses aMenuManager
internally to be able to configure visibility and enabled states.- Parameters:
parent
- The active NatTable instance the context menu should be added to.
-
PopupMenuBuilder
public PopupMenuBuilder(org.eclipse.jface.action.MenuManager manager)
Creates aPopupMenuBuilder
that builds up a newMenu
using the givenMenuManager
.Note: If this constructor is used a
Menu
can only be created by usingbuild(NatTable)
, otherwise it will fail with an exception.- Parameters:
manager
- TheMenuManager
that should be used to create theMenu
.- Since:
- 1.6
-
PopupMenuBuilder
public PopupMenuBuilder(NatTable parent, org.eclipse.jface.action.MenuManager manager)
- Parameters:
parent
- The active NatTable instance the context menu should be added to.manager
- TheMenuManager
that should be used to create theMenu
.
-
PopupMenuBuilder
public PopupMenuBuilder(NatTable natTable, org.eclipse.swt.widgets.Menu menu)
Creates a popup menu builder based on the given menu. Using this enables the possibility to use configured context menus from plugin.xml and adding NatTable commands programmatically.As an example you might want to create a PopupMenuBuilder by using a configured menu with the id org.eclipse.nebula.widgets.nattable.example.contextmenu
ISelectionProvider isp = new RowSelectionProvider<?>(selectionLayer, bodyDataProvider, false); MenuManager menuManager = new MenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); getSite().registerContextMenu( "org.eclipse.nebula.widgets.nattable.example.contextmenu", menuManager, isp); PopupMenuBuilder popupMenu = new PopupMenuBuilder(menuManager.createContextMenu(natTable));
For usage with Eclipse 4 you can use the
EMenuService
to register the menu to a NatTable instance. Afterwards get the menu and remove it from the NatTable to avoid the SWT control menu. The generated menu carries aMenuManager
in theWidget.getData()
which will be used within thisPopupMenuBuilder
.menuService.registerContextMenu(natTable, menuId); Menu swtMenu = natTable.getMenu(); natTable.setMenu(null);
- Parameters:
natTable
- The active NatTable instance which might be needed for creation of menu items that need the NatTable instance to work.menu
- The registered context menu.
-
-
Method Detail
-
withMenuItemProvider
public PopupMenuBuilder withMenuItemProvider(IMenuItemProvider menuItemProvider)
Adds the menu item provided by the givenIMenuItemProvider
to the popup menu. You can use this to add your own item to the popup menu.Items added by this method can not be identified by id, so adding visible or enabled state checkers is not possible for these providers.
- Parameters:
menuItemProvider
- TheIMenuItemProvider
that provides the menu item that should be added to the popup menu.- Returns:
- The current
PopupMenuBuilder
with the added item.
-
withMenuItemProvider
public PopupMenuBuilder withMenuItemProvider(String id, IMenuItemProvider menuItemProvider)
Adds the menu item provided by the givenIMenuItemProvider
to the popup menu. You can use this to add your own item to the popup menu.As items added by this method can be identified via the given id it is possible to register visible or enabled state checkers for these providers.
- Parameters:
id
- The id under which the givenIMenuItemProvider
should be identifiable.menuItemProvider
- TheIMenuItemProvider
that provides the menu item that should be added to the popup menu.- Returns:
- The current
PopupMenuBuilder
with the added item.
-
withContributionItem
public PopupMenuBuilder withContributionItem(org.eclipse.jface.action.ContributionItem contributionItem)
Adds the menu item(s) provided by the givenContributionItem
to the popup menu. You can use this to add your own item to the popup menu.This method is only working if the
PopupMenuBuilder
is using aMenuManager
.Using this adds support for visibility and enabled states of menu items.
- Parameters:
contributionItem
- TheContributionItem
that is used to add a menu item to the menu.- Returns:
- The current
PopupMenuBuilder
with the added item. - Throws:
IllegalStateException
- if thisPopupMenuBuilder
does not use aMenuManager
-
withHideColumnMenuItem
public PopupMenuBuilder withHideColumnMenuItem()
Adds the menu item for hiding a column to the popup menu. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilder
with the hide column menu item added. - See Also:
MenuItemProviders.hideColumnMenuItemProvider()
-
withHideColumnMenuItem
public PopupMenuBuilder withHideColumnMenuItem(String menuLabel)
Adds the menu item for hiding a column to the popup menu. Uses the given String as label for the menu item.- Parameters:
menuLabel
- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilder
with the hide column menu item added. - See Also:
MenuItemProviders.hideColumnMenuItemProvider(String)
-
withShowAllColumnsMenuItem
public PopupMenuBuilder withShowAllColumnsMenuItem()
Adds the menu item for showing all columns to the popup menu. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilder
with the show all columns menu item added. - See Also:
MenuItemProviders.showAllColumnsMenuItemProvider()
-
withShowAllColumnsMenuItem
public PopupMenuBuilder withShowAllColumnsMenuItem(String menuLabel)
Adds the menu item for showing all columns to the popup menu. Uses the given String as label for the menu item.- Parameters:
menuLabel
- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilder
with the show all columns menu item added. - See Also:
MenuItemProviders.showAllColumnsMenuItemProvider(String)
-
withExportToImageMenuItem
public PopupMenuBuilder withExportToImageMenuItem()
Add the menu item for exporting to image to the popup menu. Use the default text localized in NatTable core resource bundles.IMPORTANT: the
ImageExporter
needs to be configured for the configuration attributeExportConfigAttributes.TABLE_EXPORTER
to really export to an image. Also theExportTableCommandHandler
needs to be registered on anILayer
in the layer stack, e.g. the GridLayer.- Returns:
- The
PopupMenuBuilder
with the export to image menu item added. - Since:
- 1.5
- See Also:
MenuItemProviders.exportToImageMenuItemProvider()
-
withExportToImageMenuItem
public PopupMenuBuilder withExportToImageMenuItem(String menuLabel)
Add the menu item for exporting to image to the popup menu. Use the given String as label for the menu item.IMPORTANT: the
ImageExporter
needs to be configured for the configuration attributeExportConfigAttributes.TABLE_EXPORTER
to really export to an image. Also theExportTableCommandHandler
needs to be registered on anILayer
in the layer stack, e.g. the GridLayer.- Parameters:
menuLabel
- The label to use for exporting to image in the popup menu.- Returns:
- The
PopupMenuBuilder
with the exporting to image menu item added. - Since:
- 1.5
- See Also:
MenuItemProviders.exportToImageMenuItemProvider(String)
-
withHideRowMenuItem
public PopupMenuBuilder withHideRowMenuItem()
Adds the menu item for hiding a row to the popup menu by using theRowHideCommand
. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilder
with the hide row menu item added. - See Also:
MenuItemProviders.hideRowMenuItemProvider()
-
withHideRowMenuItem
public PopupMenuBuilder withHideRowMenuItem(String menuLabel)
Adds the menu item for hiding a row to the popup menu by using theRowHideCommand
. Uses the given String as label for the menu item.- Parameters:
menuLabel
- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilder
with the hide row menu item added. - See Also:
MenuItemProviders.hideRowMenuItemProvider(String)
-
withHideRowPositionMenuItem
public PopupMenuBuilder withHideRowPositionMenuItem()
Adds the menu item for hiding a row to the popup menu by using theRowPositionHideCommand
. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilder
with the hide row menu item added. - Since:
- 1.6
- See Also:
MenuItemProviders.hideRowPositionMenuItemProvider()
-
withHideRowPositionMenuItem
public PopupMenuBuilder withHideRowPositionMenuItem(String menuLabel)
Adds the menu item for hiding a row to the popup menu by using theRowPositionHideCommand
. Uses the given String as label for the menu item.- Parameters:
menuLabel
- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilder
with the hide row menu item added. - Since:
- 1.6
- See Also:
MenuItemProviders.hideRowPositionMenuItemProvider(String)
-
withShowAllRowsMenuItem
public PopupMenuBuilder withShowAllRowsMenuItem()
Adds the menu item for showing all rows to the popup menu. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilder
with the show all rows menu item added. - See Also:
MenuItemProviders.showAllRowsMenuItemProvider()
-
withShowAllRowsMenuItem
public PopupMenuBuilder withShowAllRowsMenuItem(String menuLabel)
Adds the menu item for showing all rows to the popup menu. Uses the given String as label for the menu item.- Parameters:
menuLabel
- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilder
with the show all rows menu item added. - See Also:
MenuItemProviders.showAllRowsMenuItemProvider(String)
-
withAutoResizeSelectedColumnsMenuItem
public PopupMenuBuilder withAutoResizeSelectedColumnsMenuItem()
Adds the menu item for auto resizing selected columns to the popup menu. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilder
with the resize selected columns menu item added. - See Also:
MenuItemProviders.autoResizeColumnMenuItemProvider()
-
withAutoResizeSelectedColumnsMenuItem
public PopupMenuBuilder withAutoResizeSelectedColumnsMenuItem(String menuLabel)
Adds the menu item for auto resizing selected columns to the popup menu. Uses the given String as label for the menu item.- Returns:
- The
PopupMenuBuilder
with the resize selected columns menu item added. - See Also:
MenuItemProviders.autoResizeColumnMenuItemProvider(String)
-
withAutoResizeSelectedRowsMenuItem
public PopupMenuBuilder withAutoResizeSelectedRowsMenuItem()
-
withAutoResizeSelectedRowsMenuItem
public PopupMenuBuilder withAutoResizeSelectedRowsMenuItem(String menuLabel)
-
withColumnChooserMenuItem
public PopupMenuBuilder withColumnChooserMenuItem()
-
withColumnChooserMenuItem
public PopupMenuBuilder withColumnChooserMenuItem(String menuLabel)
-
withColumnStyleEditor
public PopupMenuBuilder withColumnStyleEditor()
-
withColumnStyleEditor
public PopupMenuBuilder withColumnStyleEditor(String menuLabel)
-
withColumnRenameDialog
public PopupMenuBuilder withColumnRenameDialog()
-
withColumnRenameDialog
public PopupMenuBuilder withColumnRenameDialog(String menuLabel)
-
withCreateColumnGroupsMenuItem
public PopupMenuBuilder withCreateColumnGroupsMenuItem()
-
withCreateColumnGroupsMenuItem
public PopupMenuBuilder withCreateColumnGroupsMenuItem(String menuLabel)
-
withCreateColumnGroupMenuItem
public PopupMenuBuilder withCreateColumnGroupMenuItem()
Adds the menu item for creating a column group with the new performance ColumnGroupHeaderLayer.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withCreateColumnGroupMenuItem
public PopupMenuBuilder withCreateColumnGroupMenuItem(String menuLabel)
Adds the menu item for creating a column group with the new performance ColumnGroupHeaderLayer.- Parameters:
menuLabel
- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUngroupColumnsMenuItem
public PopupMenuBuilder withUngroupColumnsMenuItem()
-
withUngroupColumnsMenuItem
public PopupMenuBuilder withUngroupColumnsMenuItem(String menuLabel)
-
withRenameColumnGroupMenuItem
public PopupMenuBuilder withRenameColumnGroupMenuItem()
-
withRenameColumnGroupMenuItem
public PopupMenuBuilder withRenameColumnGroupMenuItem(String menuLabel)
-
withRemoveColumnGroupMenuItem
public PopupMenuBuilder withRemoveColumnGroupMenuItem()
-
withRemoveColumnGroupMenuItem
public PopupMenuBuilder withRemoveColumnGroupMenuItem(String menuLabel)
-
withCreateRowGroupMenuItem
public PopupMenuBuilder withCreateRowGroupMenuItem()
Adds the menu item for creating a row group with the new performance RowGroupHeaderLayer.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withCreateRowGroupMenuItem
public PopupMenuBuilder withCreateRowGroupMenuItem(String menuLabel)
Adds the menu item for creating a row group with the new performance RowGroupHeaderLayer.- Parameters:
menuLabel
- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUngroupRowsMenuItem
public PopupMenuBuilder withUngroupRowsMenuItem()
Adds the menu item for ungrouping selected rows from an existing row group.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUngroupRowsMenuItem
public PopupMenuBuilder withUngroupRowsMenuItem(String menuLabel)
Adds the menu item for ungrouping selected rows from an existing row group.- Parameters:
menuLabel
- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withRenameRowGroupMenuItem
public PopupMenuBuilder withRenameRowGroupMenuItem()
Adds the menu item for renaming a row group.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withRenameRowGroupMenuItem
public PopupMenuBuilder withRenameRowGroupMenuItem(String menuLabel)
Adds the menu item for renaming a row group.- Parameters:
menuLabel
- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withRemoveRowGroupMenuItem
public PopupMenuBuilder withRemoveRowGroupMenuItem()
Adds the menu item for removing a row group.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withRemoveRowGroupMenuItem
public PopupMenuBuilder withRemoveRowGroupMenuItem(String menuLabel)
Adds the menu item for removing a row group.- Parameters:
menuLabel
- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezeColumnMenuItem
public PopupMenuBuilder withFreezeColumnMenuItem()
Adds the menu item for for freezing a grid at a given column position.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezeColumnMenuItem
public PopupMenuBuilder withFreezeColumnMenuItem(String menuLabel)
Adds the menu item for for freezing a grid at a given column position.- Parameters:
menuLabel
- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezeRowMenuItem
public PopupMenuBuilder withFreezeRowMenuItem()
Adds the menu item for for freezing a grid at a given row position.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezeRowMenuItem
public PopupMenuBuilder withFreezeRowMenuItem(String menuLabel)
Adds the menu item for for freezing a grid at a given row position.- Parameters:
menuLabel
- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezePositionMenuItem
public PopupMenuBuilder withFreezePositionMenuItem(boolean include)
Adds the menu item for freezing a grid at a given cell position. This menu item is intended to be used in a body menu.- Parameters:
include
- whether the selected cell should be included in the freeze region or not. Include means the freeze borders will be to the right and bottom, while exclude means the freeze borders are to the left and top.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withFreezePositionMenuItem
public PopupMenuBuilder withFreezePositionMenuItem(String menuLabel, boolean include)
Adds the menu item for freezing a grid at a given cell position. This menu item is intended to be used in a body menu.- Parameters:
menuLabel
- The label to be used for showing the menu item.include
- whether the selected cell should be included in the freeze region or not. Include means the freeze borders will be to the right and bottom, while exclude means the freeze borders are to the left and top.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUnfreezeMenuItem
public PopupMenuBuilder withUnfreezeMenuItem()
Adds the menu item for removing a frozen state.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withUnfreezeMenuItem
public PopupMenuBuilder withUnfreezeMenuItem(String menuLabel)
Adds the menu item for removing a frozen state.- Parameters:
menuLabel
- The label to be used for showing the menu item.- Returns:
- This PopupMenuBuilder.
- Since:
- 1.6
-
withInspectLabelsMenuItem
public PopupMenuBuilder withInspectLabelsMenuItem()
-
withCategoriesBasedColumnChooser
public PopupMenuBuilder withCategoriesBasedColumnChooser()
-
withCategoriesBasedColumnChooser
public PopupMenuBuilder withCategoriesBasedColumnChooser(String menuLabel)
-
withClearAllFilters
public PopupMenuBuilder withClearAllFilters()
-
withClearAllFilters
public PopupMenuBuilder withClearAllFilters(String menuLabel)
-
withToggleFilterRow
public PopupMenuBuilder withToggleFilterRow()
Adds a menu item for toggling the visibility of the filter row. Uses the default text localized in NatTable core resource bundles.- Returns:
- The
PopupMenuBuilder
with the toggle filter row menu item added. - See Also:
MenuItemProviders.clearToggleFilterRowMenuItemProvider()
-
withToggleFilterRow
public PopupMenuBuilder withToggleFilterRow(String menuLabel)
Adds a menu item for toggling the visibility of the filter row. Uses the given String as label for the menu item.- Parameters:
menuLabel
- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilder
with the toggle filter row menu item added. - See Also:
MenuItemProviders.clearToggleFilterRowMenuItemProvider(String)
-
withStateManagerMenuItemProvider
public PopupMenuBuilder withStateManagerMenuItemProvider()
Adds the menu item for opening the view management dialog to the popup menu. Uses the default text localized in NatTable core resource bundles. Uses the given String as label for the menu item.- Returns:
- The
PopupMenuBuilder
with the menu item added for showing the view management dialog for managing NatTable states. - See Also:
MenuItemProviders.stateManagerMenuItemProvider()
-
withStateManagerMenuItemProvider
public PopupMenuBuilder withStateManagerMenuItemProvider(String menuLabel)
Adds the menu item for opening the view management dialog to the popup menu.- Parameters:
menuLabel
- The label to use for showing the item in the popup menu.- Returns:
- The
PopupMenuBuilder
with the menu item added for showing the view management dialog for managing NatTable states. - See Also:
MenuItemProviders.stateManagerMenuItemProvider(String)
-
withSeparator
public PopupMenuBuilder withSeparator()
Adds a separator to the popup menu.- Returns:
- The
PopupMenuBuilder
with an added separator. - See Also:
MenuItemProviders.separatorMenuItemProvider()
-
withSeparator
public PopupMenuBuilder withSeparator(String id)
Adds a separator to the popup menu with the given id.- Parameters:
id
- The id to identify the separator. Necessary if there should be visibility constraints for specific separators.- Returns:
- The
PopupMenuBuilder
with an added separator. - See Also:
MenuItemProviders.separatorMenuItemProvider()
-
build
public org.eclipse.jface.action.MenuManager build(NatTable natTable)
Sets the given NatTable to this builder and returns theMenuManager
that is used to create the context menu.Note: Calling this method only brings the builder to a working state. The creation of the
Menu
needs to be done using theMenuManager
. In this case the caller is also responsible for theMenu
disposal.- Parameters:
natTable
- The NatTable instance for which theMenu
should be created by using the returnedMenuManager
. Needed to make theIMenuItemProvider
work.- Returns:
- The
MenuManager
that is used by this builder. - Since:
- 1.6
-
build
public org.eclipse.swt.widgets.Menu build()
Builds and returns the createdMenu
.Note: Calling this method will also add a
DisposeListener
to the NatTable instance to ensure the createdMenu
is disposed when the NatTable itself gets disposed.- Returns:
- The
Menu
that is created by this builder.
-
withVisibleState
public PopupMenuBuilder withVisibleState(String id, IMenuItemState state)
Associate a visibilityIMenuItemState
with the menu item identified by the given id.The visibility state is handled by the internal
MenuManager
. If noMenuManager
is used, this method will have not effect.For the item to be visible, all associated
IMenuItemState
must be active OR noIMenuItemState
must be associated with the item.- Parameters:
id
- the registeredIMenuItemState
will affect the menu item identified by the given id.state
- theIMenuItemState
to queried for the visibility state of the menu item with the given id.- Returns:
- This
PopupMenuBuilder
with the visible state checker for the given id.
-
withEnabledState
public PopupMenuBuilder withEnabledState(String id, IMenuItemState state)
Associate a enabledIMenuItemState
with the menu item identified by the given id.The enabled state is handled by the internal
MenuManager
. If noMenuManager
is used, this method will have not effect.For the item to be enabled, all associated
IMenuItemState
must be active OR noIMenuItemState
must be associated with the item.- Parameters:
id
- the registeredIMenuItemState
will affect the menu item identified by the given id.state
- theIMenuItemState
to queried for the enabled state of the menu item with the given id.- Returns:
- This
PopupMenuBuilder
with the enabled state checker for the given id.
-
-