Multiple Context Menus for Multiselect Tables

Hi there,

right now I’m trying to make a table that gives me different context menu options when different ammounts of rows are selected. I already found out how this problem was solved back in vaadin 6. Just add a requestRepaint in a valuechangelistener and the Action Handler would update with new Actions, if specified. Unfortunately this doesn’t seem to work anymore.

Just for checking, my Action handler code:


public Action[] getActions(Object target, Object sender) {
//				return actions;
				Set<String> test = new HashSet<String>((Collection) table.getValue());
				if(test.size() < 1){
					logger.info("Nothing Selected");
					return nullselect_actions;
				}else if(test.size() == 1){
					logger.info("Single Select");
					return actions;
				}else if(test.size() > 1){
					logger.info("Multi Select");
					return multi_actions;
				}
				return multi_actions;
			}

Intrestingly enough my logger spits out the comments for the different cases whenever I select something new. But The contents of the context menu are not changed.

Table is set to immediate, multiselect. Anything I’ve overlooked?

Also, I think the ContextMenu Addon could solve my problem. But I have my problems with getting it to work.
Follow this link if you are interested in helping :wink: