#NEWLINE# def onBrowserEvent( self , event ) : #NEWLINE# #INDENT# etype = DOM . eventGetType ( event ) #NEWLINE# if ( etype == 'click' ) : #NEWLINE# #INDENT# e = DOM . eventGetTarget ( event ) #NEWLINE# if ( ( not self . shouldTreeDelegateFocusToElement ( e ) ) and ( self . curSelection is not None ) ) : #NEWLINE# #INDENT# self . setFocus ( True ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( etype in MouseListener . MOUSE_EVENTS ) : #NEWLINE# #INDENT# if ( etype == 'mousedown' ) : #NEWLINE# #INDENT# self . elementClicked ( self . root , DOM . eventGetTarget ( event ) ) #NEWLINE# #UNINDENT# MouseListener . fireMouseEvent ( self . mouseListeners , self , event ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( etype == 'blur' ) or ( etype == 'focus' ) ) : #NEWLINE# #INDENT# FocusListener . fireFocusEvent ( self . focusListeners , self , event ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( etype == 'keydown' ) : #NEWLINE# #INDENT# if ( self . curSelection is None ) : #NEWLINE# #INDENT# if ( self . root . getChildCount ( ) > 0 ) : #NEWLINE# #INDENT# self . onSelection ( self . root . getChild ( 0 ) , True ) #NEWLINE# #UNINDENT# Widget . onBrowserEvent ( self , event ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( self . lastEventType == 'keydown' ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# keycode = DOM . eventGetKeyCode ( event ) #NEWLINE# if ( keycode == KeyboardListener . KEY_UP ) : #NEWLINE# #INDENT# self . moveSelectionUp ( self . curSelection , True ) #NEWLINE# DOM . eventPreventDefault ( event ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == KeyboardListener . KEY_DOWN ) : #NEWLINE# #INDENT# self . moveSelectionDown ( self . curSelection , True ) #NEWLINE# DOM . eventPreventDefault ( event ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == KeyboardListener . KEY_LEFT ) : #NEWLINE# #INDENT# if self . curSelection . getState ( ) : #NEWLINE# #INDENT# self . curSelection . setState ( False ) #NEWLINE# #UNINDENT# DOM . eventPreventDefault ( event ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == KeyboardListener . KEY_RIGHT ) : #NEWLINE# #INDENT# if ( not self . curSelection . getState ( ) ) : #NEWLINE# #INDENT# self . curSelection . setState ( True ) #NEWLINE# #UNINDENT# DOM . eventPreventDefault ( event ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( etype == 'keyup' ) : #NEWLINE# #INDENT# if ( DOM . eventGetKeyCode ( event ) == KeyboardListener . KEY_TAB ) : #NEWLINE# #INDENT# chain = [ ] #NEWLINE# self . collectElementChain ( chain , self . getElement ( ) , DOM . eventGetTarget ( event ) ) #NEWLINE# item = self . findItemByChain ( chain , 0 , self . root ) #NEWLINE# if ( item != self . getSelectedItem ( ) ) : #NEWLINE# #INDENT# self . setSelectedItem ( item , True ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( etype == 'keypress' ) : #NEWLINE# #INDENT# KeyboardListener . fireKeyboardEvent ( self . keyboardListeners , self , event ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# Widget . onBrowserEvent ( self , event ) #NEWLINE# self . lastEventType = etype