<s> from pyjamas import DOM <EOL> from pyjamas . ui import Event <EOL> DROP_EVENTS = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> def fireDropEvent ( listeners , event ) : <EOL> etype = DOM . eventGetType ( event ) <EOL> if etype == "<STR_LIT>" : <EOL> for listener in listeners : <EOL> listener . onDragEnter ( event ) <EOL> return True <EOL> elif etype == "<STR_LIT>" : <EOL> for listener in listeners : <EOL> listener . onDragOver ( event ) <EOL> return True <EOL> elif etype == "<STR_LIT>" : <EOL> for listener in listeners : <EOL> listener . onDragLeave ( event ) <EOL> return True <EOL> elif etype == "<STR_LIT>" : <EOL> for listener in listeners : <EOL> listener . onDrop ( event ) <EOL> return True <EOL> return False <EOL> class DropHandler ( object ) : <EOL> def __init__ ( self ) : <EOL> self . _dropListeners = [ ] <EOL> self . sinkEvents ( Event . DROPEVENTS ) <EOL> def onBrowserEvent ( self , event ) : <EOL> event_type = DOM . eventGetType ( event ) <EOL> if event_type in DROP_EVENTS : <EOL> return fireDropEvent ( self . _dropListeners , event ) <EOL> return False <EOL> def addDropListener ( self , listener ) : <EOL> self . _dropListeners . append ( listener ) <EOL> def removeDropListener ( self , listener ) : <EOL> self . _dropListeners . remove ( listener ) <EOL> def onDragEnter ( self , event ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def onDragOver ( self , event ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def onDragLeave ( self , event ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def onDrop ( self , event ) : <EOL> """<STR_LIT>""" <EOL> pass </s>
