def initElement(self, element, **ka): self.inputElem = element self.labelElem = DOM.createLabel() element = ka.pop('Element', None) or DOM.createSpan() ButtonBase.__init__(self, element, **ka) self.sinkEvents(Event.FOCUSEVENTS | Event.ONCLICK) DOM.appendChild(self.getElement(), self.inputElem) DOM.appendChild(self.getElement(), self.labelElem) uid = "check%d" % self.getUniqueID() DOM.setAttribute(self.inputElem, "id", uid) DOM.setAttribute(self.labelElem, "htmlFor", uid)
def __init__(self, html=None, listener=None, **kwargs): """ Create a new button widget. @param html: Html content (e.g. the button label); see setHTML() @param listener: A new click listener; see addClickListener() """ if not kwargs.has_key('StyleName'): kwargs['StyleName'] = "gwt-Button" if html: kwargs['HTML'] = html if kwargs.has_key('Element'): element = kwargs.pop('Element') else: element = DOM.createButton() ButtonBase.__init__(self, element, **kwargs) self.adjustType(self.getElement()) if listener is not None: self.addClickListener(listener)
def __init__(self, html=None, listener=None, **kwargs): """ Create a new button widget. @param html: Html content (e.g. the button label); see setHTML() @param listener: A new click listener; see addClickListener() """ if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-Button" if html: kwargs['HTML'] = html if kwargs.has_key('Element'): element = kwargs.pop('Element') else: element = DOM.createButton() ButtonBase.__init__(self, element, **kwargs) self.adjustType(self.getElement()) if listener is not None: self.addClickListener(listener)
def _getProps(self): return ButtonBase._getProps() + self._props
def onDetach(self): self.setChecked(self.isChecked()) ButtonBase.onDetach(self)