Adding custom menu items to spreadsheet

I was able to successfully add custom menu context to the spreadsheet but i did notice some issues.

  1. SpreadsheetDefaultActionHandler is added as a spreadsheet handler by default and there is no way to remove it unless you have a reference to the action handle which you don’t. Only other way is to lock the sheet so that all the menu items are rendered invisble.
  2. I added a custom ActionHandler to the spreadsheet and added custom SpreadsheetAction classes to my action handler.
    But It ended up calling my executeActionOnSelection on the SpreadsheetAction class twice.
    The reason i believe is a bug in SpreadsheetDefaultActionHandler.handleAction class implementation. It calls my custom SpreadsheetAction.executeActionOnSelection method even though it is not part of the default action handler. It does not check if the action is in its list or not. It just checks if instance is a base class implementation. Also my custom implementation calls it again. The work around i implement for now is to have a empty implementation for handleAction method in my custom class and let the default handle call my action.

I would request a solution to the following

  1. Ability to remove the SpreadsheetDefaultActionHandler. Not really important to me because I can get the same effect by locking the sheet which i still think it is a workaround.
  2. Fix the SpreadsheetDefaultActionHandler.handleAction method so that it checks if the Action class comes from its list of actions and then only call the executeActionOnSelection method or else skip it.

Hi Srinivasan,

  1. See Spreadsheet.removeDefaultActionHandler()
  2. should be solved by the above, if I understood correctly


Thank you very much. My scenario works.

But I still think the default action handler should first check if the spreadsheetaction instance is coming from its own list before invoking its method. Someone else need of a custom action along with default action might not work as expected.

That’s true. I filed a ticket for that:



  1. Book of Vaadin sais; SpreadsheetDefaultActionHandler is NOT added by default. It is.
  2. The issue with SpreadsheetDefaultActionHandler as I see it is that defaultActions is private and there is solid way to alter the behaviour of the default actions, by replacing them. Only way is to override constructor, not call super() and add the actions you need and optionally add override those you need to override. For example, for InsertNewRowAction I want to put stuff in the new row.
    This might seem fine but short sighted. If new actions are added in SpreadsheetDefaultActionHandler they will be lost unless you scan this file for every update.

BTW, Vaadin Spreadsheet is really nice but has the potential to kick butt. Awesome possibilities.


Thanks for your feedback, Ola! I’ve added a redesign of the default action handler class to the backlog.