I’ve set up an ActionButton with a CallMethodAction, like this:
String actions[]= {"action1", "action2", ..."actionN"}
for (String a : actions) {
CallMethodAction c=new CallMethodAction(a, this, "index");
ActionButton b = new ActionButton(c, new ElementId("big.button"));
}
public void index() {
//which action was actually clicked?
}
So I have a (possibly) long list of buttons, and when index() gets called I need to know “which” button was actually clicked.
(The next problem will be to add some sort of scrolling when there are many of them…)
The last bit makes me wonder if what you really want is a ListBox.
…but CallMethodAction wasn’t really meant for what you are using it for. It’s a convenience for wiring up a method to a single action.
In your case, you might be better off just extending Action directly. Depending on what ‘index()’ is doing, you could then either roll that right into action performed or use a property on the action to figure out what index to use.
I’d be curious to know what “action1”, “action2”, etc. are actually doing, though. It could be that embracing Action’s command pattern more completely fits your use-case.