Hey!
I have learn about implement mouse events.
Now I will open a action menu on right mouse click.
But It does not work!
I write on a panel component:
import com.vaadin.event.Action;
import com.vaadin.event.MouseEvents;
import com.vaadin.event.MouseEvents.ClickEvent;
import com.vaadin.event.MouseEvents.ClickListener;
import com.vaadin.ui.Panel;
public class MyPanel extends Panel implements ClickListener, Action.Handler{
private static final Action ADDNEWGROUP = new Action("New Group");
private static final Action ADDNEWCLASS = new Action("New Class");
private static final Action[] actionsgroup = new Action[]
{ ADDNEWGROUP, ADDNEWCLASS };
public MyPanel (){
addListener((ClickListener)this);
addActionHandler(this);
}
public void click(ClickEvent event) {
if(MouseEvents.ClickEvent.BUTTON_RIGHT == event.getButton()){
System.out.println("Right mouse button clicked");
//How must I call the actionsgroup ?
}
}
public Action[] getActions(Object target, Object sender) {
return actionsmain;
}
public void handleAction(Action action, Object sender, Object target) {
if (action == ADDNEWCLASS) {
System.out.println("ADDNEWCLASS clicked");
}
if (action == ADDNEWGROUP){
System.out.println("ADDNEWGROUP clicked");
}
}