gwt - Custom ClickHandler class -


is there way use clickhandler interface in gwt build custom subclass ? need clickhandlers should react on every second click. achieving behavior not problem implemented clickhandler, great if don't have add code snippet each single listbox element:

 boolean ingoreclick;  lastselection =  -1 ;  listbox.addclickhandler(new clickhandler() {      @override     public void onclick(clickevent event) {          if (!ignoreclick) {             lastselection = listbox.getselectedindex();         }         ignoreclick = !ignoreclick;          } }); 

and imagine there listbox1, listbox2 , on.

well, quite simple, answer manolo solves it, need improve little bit:

public abstract class evenclickhandler implements clickhandler {     private boolean eventclick= true;      public void onclick(clickevent event) {         if (eventclick = !eventclick) {           onevenclick(event);         }     }       protected abstract void onevenclick(clickevent e);  }  ...  listbox.addclickhandler(new evenclickhandler (){     protected void onevenclick(clickevent e){       lastselection = listbox.getselectedindex();    }  }); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -