com.vaadin.flow.component.spreadsheet.
Class ContextMenuManager
- java.lang.Object
-
- com.vaadin.flow.component.spreadsheet.ContextMenuManager
-
All Implemented Interfaces:
public class ContextMenuManager extends Object implements 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
Constructors Constructor Description ContextMenuManager(Spreadsheet spreadsheet)
Constructs a new ContextMenuManager and ties it to the given Spreadsheet.
-
Method Summary
All Methods Modifier and Type Method Description void
addActionHandler(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>
createActionsListForSelection()
Gets a list of available actions for the current selection.
boolean
hasActionHandlers()
Determines if there are currently any action handlers attached to the target Spreadsheet.
void
onActionOnColumnHeader(String actionKey)
This method is called when an action has been selected on top of a column header.
void
onActionOnCurrentSelection(String actionKey)
This method is called when an action has been selected on top of the currently selected cell(s).
void
onActionOnRowHeader(String actionKey)
This method is called when an action has been selected on top of a row header.
void
onColumnHeaderContextMenuOpen(int columnIndex)
This method is called when a context menu event has happened on top of a column header.
void
onContextMenuOpenOnSelection(int row, int column)
This method is called when a context menu event has happened on any cell of the target Spreadsheet.
void
onRowHeaderContextMenuOpen(int rowIndex)
This method is called when a context menu event has happened on top of a row header.
void
removeActionHandler(Action.Handler actionHandler)
Removes the given context menu action handler from the target spreadsheet.
-
-
-
Constructor Detail
-
ContextMenuManager
public ContextMenuManager(Spreadsheet spreadsheet)
Constructs a new ContextMenuManager and ties it to the given Spreadsheet.
Parameters:
spreadsheet
- Target Spreadsheet
-
-
Method Detail
-
addActionHandler
public void addActionHandler(Action.Handler actionHandler)
Adds the given context menu action handler to the target spreadsheet.
Parameters:
actionHandler
- Handler to add
-
removeActionHandler
public void removeActionHandler(Action.Handler actionHandler)
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
public void onActionOnCurrentSelection(String actionKey)
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
public void onActionOnRowHeader(String actionKey)
This method is called when an action has been selected on top of a row header.
Parameters:
actionKey
- Key of the selected action
-
onActionOnColumnHeader
public void onActionOnColumnHeader(String actionKey)
This method is called when an action has been selected on top of a column header.
Parameters:
actionKey
- Key of the selected action
-
createActionsListForSelection
protected ArrayList<SpreadsheetActionDetails> createActionsListForSelection()
Gets a list of available actions for the current selection.
Returns:
List of actions
-
createActionsListForColumn
protected ArrayList<SpreadsheetActionDetails> createActionsListForColumn(int columnIndex)
Gets a list of available actions for the column at the given index.
Parameters:
columnIndex
- Index of the target column, 1-basedReturns:
List of actions
-
createActionsListForRow
protected ArrayList<SpreadsheetActionDetails> createActionsListForRow(int rowIndex)
Gets a list of available actions for the row at the given index.
Parameters:
rowIndex
- Index of the target row, 1-basedReturns:
List of actions
-
-