def __init__(self, format='%d-%m-%Y'): DateSelectedHandler.__init__(self) if self.img_base is None: self.img_base = pygwt.getImageBaseURL(True) if self.icon_img is None: self.icon_img = self.img_base + 'icon_calendar.gif' self.format = format self.tbox = TextBox() self.tbox.setVisibleLength(10) # assume valid sep is - / . or nothing if format.find('-') >= 0: self.sep = '-' elif format.find('/') >= 0: self.sep = '/' elif format.find('.') >= 0: self.sep = '.' else: self.sep = '' # self.sep = format[2] # is this too presumptious? self.calendar = Calendar() self.img = Image(self.icon_img) self.img.addStyleName(self.icon_style) self.calendarLink = HyperlinkImage(self.img) self.todayLink = Hyperlink(self.today_text) self.todayLink.addStyleName(self.today_style) # # lay it out # hp = HorizontalPanel() hp.setSpacing(2) vp = VerticalPanel() hp.add(self.tbox) vp.add(self.calendarLink) vp.add(self.todayLink) #vp.add(self.calendar) hp.add(vp) Composite.__init__(self) self.initWidget(hp) # # done with layout, so now set up some listeners # self.tbox.addFocusListener(self) # hook to onLostFocus self.calendar.addSelectedDateListener(getattr(self, "onDateSelected")) self.todayLink.addClickListener(getattr(self, "onTodayClicked")) self.calendarLink.addClickListener(getattr(self, "onShowCalendar")) self.tbox.addChangeListener(getattr(self, "onFieldChanged")) self.tbox.addInputListener(getattr(self, "onFieldChanged")) self._last_date = None
def __init__(self, **ka): ka['StyleName'] = ka.get('StyleName', "gwt-Tree") self.root = None self.childWidgets = Set() self.curSelection = None self.focusable = None self.focusListeners = [] self.mouseListeners = [] self.images = ka.pop('Images', False) self.imageBase = pygwt.getImageBaseURL(self.images) self.keyboardListeners = [] self.listeners = [] self.lastEventType = "" element = ka.pop('Element', None) or DOM.createDiv() self.setElement(element) DOM.setStyleAttribute(self.getElement(), "position", "relative") self.focusable = Focus.createFocusable() # Hide focus outline in Mozilla/Webkit/Opera DOM.setStyleAttribute(self.focusable, "outline", "0px") # Hide focus outline in IE 6/7 DOM.setElemAttribute(self.focusable, "hideFocus", "true") DOM.setStyleAttribute(self.focusable, "fontSize", "0") DOM.setStyleAttribute(self.focusable, "position", "absolute") DOM.setIntStyleAttribute(self.focusable, "zIndex", -1) DOM.appendChild(self.getElement(), self.focusable) self.root = RootTreeItem() self.root.setTree(self) Widget.__init__(self, **ka) self.sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS) DOM.sinkEvents(self.focusable, Event.FOCUSEVENTS)
def __init__(self, **ka): ka['StyleName'] = ka.get('StyleName', "gwt-Tree") self.root = None self.childWidgets = Set() self.curSelection = None self.focusable = None self.focusListeners = [] self.mouseListeners = [] self.images = ka.pop('Images', False) self.imageBase = pygwt.getImageBaseURL(self.images) self.keyboardListeners = [] self.listeners = [] self.lastEventType = "" element = ka.pop('Element', None) or DOM.createDiv() self.setElement(element) DOM.setStyleAttribute(self.getElement(), "position", "relative") self.focusable = Focus.createFocusable() # Hide focus outline in Mozilla/Webkit/Opera DOM.setStyleAttribute(self.focusable, "outline", "0px") # Hide focus outline in IE 6/7 DOM.setElemAttribute(self.focusable, "hideFocus", "true"); DOM.setStyleAttribute(self.focusable, "fontSize", "0") DOM.setStyleAttribute(self.focusable, "position", "absolute") DOM.setIntStyleAttribute(self.focusable, "zIndex", -1) DOM.appendChild(self.getElement(), self.focusable) self.root = RootTreeItem() self.root.setTree(self) Widget.__init__(self, **ka) self.sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS) DOM.sinkEvents(self.focusable, Event.FOCUSEVENTS)
def setImages(self, images): if self.images == images: return self.images = images self.setImageBase(pygwt.getImageBaseURL(self.images))
** The full path to the default GChart blank image ** (specifically, a 1 x 1 pixel transparent GIF) it requires ** to prevent "missing image" icons from appearing in your ** charts. ** <p> ** ** Convenience constant equal to: ** ** <pre> ** pygwt.getModuleBaseURL()+GChart.DEFAULT_BLANK_IMAGE_URL ** </pre> ** ** @see #setBlankImageURL setBlankImageURL ** *""" DEFAULT_BLANK_IMAGE_URL_FULLPATH = pygwt.getImageBaseURL(True) + DEFAULT_BLANK_IMAGE_URL DEFAULT_GRID_HEIGHT = DEFAULT_TICK_THICKNESS DEFAULT_GRID_WIDTH = DEFAULT_TICK_THICKNESS GRID_BORDER_STYLE = "solid" GRID_BORDER_WIDTH = 1 """* The default color used for all axes, gridlines, and ticks. ** ** @see #setGridColor setGridColor ** """ DEFAULT_GRID_COLOR = "black" """* The default thickness (height) of the rectangular region at ** the bottom of the chart allocated for footnotes, per
def setImageBase(self, images): self.imageBase = pygwt.getImageBaseURL(images)
** The full path to the default GChart blank image ** (specifically, a 1 x 1 pixel transparent GIF) it requires ** to prevent "missing image" icons from appearing in your ** charts. ** <p> ** ** Convenience constant equal to: ** ** <pre> ** pygwt.getModuleBaseURL()+GChart.DEFAULT_BLANK_IMAGE_URL ** </pre> ** ** @see #setBlankImageURL setBlankImageURL ** *""" DEFAULT_BLANK_IMAGE_URL_FULLPATH = pygwt.getImageBaseURL( True) + DEFAULT_BLANK_IMAGE_URL DEFAULT_GRID_HEIGHT = DEFAULT_TICK_THICKNESS DEFAULT_GRID_WIDTH = DEFAULT_TICK_THICKNESS GRID_BORDER_STYLE = "solid" GRID_BORDER_WIDTH = 1 """* The default color used for all axes, gridlines, and ticks. ** ** @see #setGridColor setGridColor ** """ DEFAULT_GRID_COLOR = "black" """* The default thickness (height) of the rectangular region at ** the bottom of the chart allocated for footnotes, per ** <tt><br></tt> or <tt><li></tt> delimited HTML line. This ** default is only used when the footnote thickness is set to ** <tt>NAI</tt> (the default).