Class ContextMenuManager
java.lang.Object
com.vaadin.flow.component.spreadsheet.ContextMenuManager
- All Implemented Interfaces:
Serializable
ContextMenuManager is an utility class for the Spreadsheet component. This
class handles all context menu -related tasks within the Spreadsheet it is
tied to.
- Author:
- Vaadin Ltd.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionContextMenuManager(Spreadsheet spreadsheet) Constructs a new ContextMenuManager and ties it to the given Spreadsheet. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActionHandler(Action.Handler actionHandler) Adds the given context menu action handler to the target spreadsheet.protected ArrayList<SpreadsheetActionDetails>createActionsListForColumn(int columnIndex) Gets a list of available actions for the column at the given index.protected ArrayList<SpreadsheetActionDetails>createActionsListForRow(int rowIndex) Gets a list of available actions for the row at the given index.protected ArrayList<SpreadsheetActionDetails>Gets a list of available actions for the current selection.booleanDetermines if there are currently any action handlers attached to the target Spreadsheet.voidonActionOnColumnHeader(String actionKey) This method is called when an action has been selected on top of a column header.voidonActionOnCurrentSelection(String actionKey) This method is called when an action has been selected on top of the currently selected cell(s).voidonActionOnRowHeader(String actionKey) This method is called when an action has been selected on top of a row header.voidonColumnHeaderContextMenuOpen(int columnIndex) This method is called when a context menu event has happened on top of a column header.voidonContextMenuOpenOnSelection(int row, int column) This method is called when a context menu event has happened on any cell of the target Spreadsheet.voidonRowHeaderContextMenuOpen(int rowIndex) This method is called when a context menu event has happened on top of a row header.voidremoveActionHandler(Action.Handler actionHandler) Removes the given context menu action handler from the target spreadsheet.
-
Constructor Details
-
ContextMenuManager
Constructs a new ContextMenuManager and ties it to the given Spreadsheet.- Parameters:
spreadsheet- Target Spreadsheet
-
-
Method Details
-
addActionHandler
Adds the given context menu action handler to the target spreadsheet.- Parameters:
actionHandler- Handler to add
-
removeActionHandler
Removes the given context menu action handler from the target spreadsheet.- Parameters:
actionHandler- Handler to remove
-
hasActionHandlers
public boolean hasActionHandlers()Determines if there are currently any action handlers attached to the target Spreadsheet.- Returns:
- true if action handlers exist, false otherwise
-
onContextMenuOpenOnSelection
public void onContextMenuOpenOnSelection(int row, int column) This method is called when a context menu event has happened on any cell of the target Spreadsheet.- Parameters:
row- Row index at context menu target, 1-basedcolumn- Column index at context menu target, 1-based
-
onRowHeaderContextMenuOpen
public void onRowHeaderContextMenuOpen(int rowIndex) This method is called when a context menu event has happened on top of a row header.- Parameters:
rowIndex- Index of the target row, 1-based
-
onColumnHeaderContextMenuOpen
public void onColumnHeaderContextMenuOpen(int columnIndex) This method is called when a context menu event has happened on top of a column header.- Parameters:
columnIndex- Index of the target column, 1-based
-
onActionOnCurrentSelection
This method is called when an action has been selected on top of the currently selected cell(s).- Parameters:
actionKey- Key of the selected action
-
onActionOnRowHeader
This method is called when an action has been selected on top of a row header.- Parameters:
actionKey- Key of the selected action
-
onActionOnColumnHeader
This method is called when an action has been selected on top of a column header.- Parameters:
actionKey- Key of the selected action
-
createActionsListForSelection
Gets a list of available actions for the current selection.- Returns:
- List of actions
-
createActionsListForColumn
Gets a list of available actions for the column at the given index.- Parameters:
columnIndex- Index of the target column, 1-based- Returns:
- List of actions
-
createActionsListForRow
Gets a list of available actions for the row at the given index.- Parameters:
rowIndex- Index of the target row, 1-based- Returns:
- List of actions
-