def __init__(self, element, **kwargs): self.setElement(element) Widget.__init__(self, **kwargs) FocusHandler.__init__(self) KeyboardHandler.__init__(self) ClickHandler.__init__(self) MouseHandler.__init__(self)
def onBrowserEvent(self, event): # farm out the event to convenience handlers. # detect existence by checking for the listener lists of each # type of handler. there's probably a better way to do this... if hasattr(self, "_clickListeners"): ClickHandler.onBrowserEvent(self, event) if hasattr(self, "_keyboardListeners"): KeyboardHandler.onBrowserEvent(self, event) if hasattr(self, "_mouseListeners"): MouseHandler.onBrowserEvent(self, event) if hasattr(self, "_mouseWheelListeners"): MouseWheelHandler.onBrowserEvent(self, event) if hasattr(self, "_focusListeners"): FocusHandler.onBrowserEvent(self, event) if hasattr(self, "_dragListeners"): DragHandler.onBrowserEvent(self, event) if hasattr(self, "_dropListeners"): DropHandler.onBrowserEvent(self, event) if self.contextMenu is None: return True type = DOM.eventGetType(event) if type == "contextmenu": DOM.eventCancelBubble(event, True) DOM.eventPreventDefault(event) self.contextMenu.onContextMenu(self) return False return True
def onBrowserEvent(self, event): # farm out the event to convenience handlers. # detect existence by checking for the listener lists of each # type of handler. there's probably a better way to do this... if hasattr(self, "_clickListeners"): ClickHandler.onBrowserEvent(self, event) if hasattr(self, "_keyboardListeners"): KeyboardHandler.onBrowserEvent(self, event) if hasattr(self, "_mouseListeners"): MouseHandler.onBrowserEvent(self, event) if hasattr(self, "_mouseWheelListeners"): MouseWheelHandler.onBrowserEvent(self, event) if hasattr(self, "_focusListeners"): FocusHandler.onBrowserEvent(self, event) if hasattr(self, "_dragListeners"): DragHandler.onBrowserEvent(self, event) if hasattr(self, "_changeListeners"): ChangeHandler.onBrowserEvent(self, event) if hasattr(self, "_inputListeners"): InputHandler.onBrowserEvent(self, event) if hasattr(self, "_dropListeners"): DropHandler.onBrowserEvent(self, event) if self.contextMenu is None: return True type = DOM.eventGetType(event) if type == "contextmenu": DOM.eventCancelBubble(event, True) DOM.eventPreventDefault(event) self.contextMenu.onContextMenu(self) return False return True
def __init__(self, **kwargs): """ pass in Widget={the widget} so that Applier will call setWidget. """ SimplePanel.__init__(self, Focus.createFocusable(), **kwargs) FocusHandler.__init__(self) KeyboardHandler.__init__(self) ClickHandler.__init__(self) MouseHandler.__init__(self)
def __init__(self, **kwargs): FlexTable.__init__(self, **kwargs) FocusHandler.__init__(self) self.buttons = {} fmt = self.getFlexCellFormatter() for i, row in enumerate(rows): for j, letter in enumerate(row): if letter == ' ': l = ' ' else: l = letter button = Button(l, self, StyleName="kbdbutton") self.buttons[letter] = button self.setWidget(i, j, button) if letter == ' ': fmt.setColSpan(i, j, 5) button.addStyleName("kbdbuttonspace")