We need a solution for one of the scenario where we have to pass more than one parameter on button click.
eg:
on clicking of
employee instead of passing only
emp_id
now we need to pass
emp_id,emp_name,emp_joindate,emp_salary
Normally we use
event.getButton().getCaption() to fetch emp_id if it is just one parameter but in our case we are looking for a way to pass more than one parameter.
[quote]
event.getButton().getCaption() to fetch emp_id
[/quote] seems like a very bad way.
You could do something like this:
public class MyButtonListener implements Clicklistener{
private final Employee employee;
public MyButtonListener( Employee employee){
this.employee = employee;
}
.....
button.addListener(new MyClickListener(currentEmployee));
or if the employee is based on the current value in a table just to a Employee e = (Employee)table.getValue();
… remembering that the value of the table is an item identifier and needs to be mapped to the Employee if not using a BeanItemContainer where the ID is the bean itself.