Ejemplo n.º 1
0
    def draw(self):
        if self.classIcon != "":
            self.icon = Element(Element=DOM.createElement("i"),
                                StyleName=self.classIcon)
            self.add(self.icon)

        if self.rootPanel is None:
            self.popup = PopupPanel(autoHide=True,
                                    modal=False,
                                    rootpanel=self,
                                    StyleName='dropdown_btn')
            DOM.setStyleAttribute(self.popup.element, "position", "static")
        else:  #o poup nao esta fechando!
            self.popup = PopupPanel(autoHide=True,
                                    modal=False,
                                    rootpanel=self.rootPanel,
                                    StyleName='dropdown_btn')

        self.dropdown_arrow = Element(Element=DOM.createElement('div'),
                                      StyleName='dropdown_arrow')
        self.title = Element(Element=DOM.createSpan(), StyleName='title')
        DOM.setInnerHTML(self.title.getElement(), self.text)
        self.add(self.title)
        self.add(Widget(Element=DOM.createDiv(), StyleName='r'))
        self.add(Widget(Element=DOM.createDiv(), StyleName='coverup'))
        self.popup.add(self.dropdown_arrow)
Ejemplo n.º 2
0
 def addRows(self, table, numRows, columns):
     td = DOM.createElement("td")
     DOM.setInnerHTML(td, " ")
     row = DOM.createElement("tr")
     for cellNum in range(columns):
         cell = td.cloneNode(True)
         row.appendChild(cell)
     for rowNum in range(numRows):
         table.appendChild(row.cloneNode(True))
Ejemplo n.º 3
0
 def addRows(self, table, numRows, columns):
     td = DOM.createElement("td")
     DOM.setInnerHTML(td, " ")
     row = DOM.createElement("tr")
     for cellNum in range(columns):
         cell = td.cloneNode(True)
         row.appendChild(cell)
     for rowNum in range(numRows):
         table.appendChild(row.cloneNode(True))
 def draw(self):
     self.title = Element(Element=DOM.createSpan(), StyleName='title')
     DOM.setInnerHTML(self.title.getElement(), self.text)
     self.add(self.title)
     self.tip = PopupPanel(Element=DOM.createElement('code'), autoHide=True, modal=False, rootpanel=self)
     div = Element(Element=DOM.createElement('div'), StyleName='joyride-tip-guide')
     div.add(Widget(Element=DOM.createSpan(), StyleName='joyride-nub left'))
     self.tipItens = Element(Element=DOM.createElement('div'), StyleName='tip-itens')
     div.add(self.tipItens)
     self.tip.add(div)
Ejemplo n.º 5
0
 def __init__(self, caption, widget=None, **kwargs):
     if kwargs.has_key('Element'):
         element = kwargs.pop('Element')
     else:
         element = DOM.createElement("fieldset")
     self.legend = DOM.createElement("legend")
     DOM.appendChild(element, self.legend)
     kwargs['Caption'] = caption
     if widget is not None:
         kwargs['Widget'] = widget
     SimplePanel.__init__(self, element, **kwargs)
Ejemplo n.º 6
0
 def __init__(self, caption, widget=None, **kwargs):
     if kwargs.has_key('Element'):
         element = kwargs.pop('Element')
     else:
         element = DOM.createElement("fieldset")
     self.legend = DOM.createElement("legend")
     DOM.appendChild(element, self.legend)
     kwargs['Caption'] = caption
     if widget is not None:
         kwargs['Widget'] = widget
     SimplePanel.__init__(self, element, **kwargs)
Ejemplo n.º 7
0
    def testDivText(self):
        e = DOM.getElementById('tests')
        div = DOM.createElement('div')
        DOM.appendChild(e, div)
        div2 = DOM.createElement('div')
        DOM.appendChild(div, div2)
        DOM.setInnerText(div2, 'hello world\n')
        self.write_test_output('addDiv')

        DOM.removeChild(e, div)
        self.write_test_output('removeDiv')
Ejemplo n.º 8
0
    def testDivText(self):
        e = DOM.getElementById('tests')
        div = DOM.createElement('div')
        DOM.appendChild(e, div)
        div2 = DOM.createElement('div')
        DOM.appendChild(div, div2)
        DOM.setInnerText(div2, 'hello world\n')
        self.write_test_output('addDiv')

        DOM.removeChild(e, div)
        self.write_test_output('removeDiv')
Ejemplo n.º 9
0
    def add_tinymce(self):

        # for storing the results when available
        iframe = DOM.createElement("iframe")
        DOM.setElemAttribute(iframe, "id", "__edit_%s" % self.editor_id)
        DOM.setElemAttribute(iframe, "style", "display:none")
        doc().body.appendChild(iframe)

        # activate tinymce
        new_script = DOM.createElement("script")
        new_script.innerHTML = """
tinyMCE.init({
        // General options
        mode : "textareas",
        theme : "simple",

        // Theme options
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,table,removeformat",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_buttons4 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
});
"""

        ih = """
var ed = new tinymce.Editor('%s',{
        mode : "none",
        theme : "advanced",
        plugins : "inlinepopups",
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,table,image,removeformat",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_buttons4 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true
});
ed.render();
ed.load();
tinymce.add(ed);
""" % self.editor_id

        print new_script.innerHTML

        DOM.setElemAttribute(new_script, "type", "text/javascript")
        doc().body.appendChild(new_script)
Ejemplo n.º 10
0
    def add_tinymce(self):

        # for storing the results when available
        iframe = DOM.createElement("iframe")
        DOM.setElemAttribute(iframe, "id", "__edit_%s" % self.editor_id)
        DOM.setElemAttribute(iframe, "style", "display:none")
        doc().body.appendChild(iframe)

        # activate tinymce
        new_script = DOM.createElement("script")
        new_script.innerHTML = """
tinyMCE.init({
        // General options
        mode : "textareas",
        theme : "simple",

        // Theme options
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,table,removeformat",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_buttons4 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
});
"""

        ih = """
var ed = new tinymce.Editor('%s',{
        mode : "none",
        theme : "advanced",
        plugins : "inlinepopups",
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,table,image,removeformat",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_buttons4 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true
});
ed.render();
ed.load();
tinymce.add(ed);
""" % self.editor_id

        print new_script.innerHTML

        DOM.setElemAttribute(new_script, "type", "text/javascript")
        doc().body.appendChild(new_script)
Ejemplo n.º 11
0
    def includeMathJax(self, config):
        html = Window.getDocumentRoot().parentElement
        head = html.getElementsByTagName('head').item(0)

        e = DOM.createElement('script')
        e.setAttribute('type', 'text/javascript')
        e.setAttribute(
            'src', 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=' +
            config)
        head.appendChild(e)

        e = DOM.createElement('script')
        e.setAttribute('type', 'text/javascript')
        e.textContent = 'function Typeset() { MathJax.Hub.Queue(["Typeset",MathJax.Hub]); }'
        head.appendChild(e)
Ejemplo n.º 12
0
 def __init__(self, element=None):
     Widget.__init__(self, Element=DOM.createElement('div'))
     self.children = []
     if element is not None:
         clone = cloneElement(element)
         self.addChild(clone)
     self.setStyleAttribute('position', 'absolute')
Ejemplo n.º 13
0
    def __init__(self, feedBack, value, classIcon, **kw):
        Element.__init__(self, Element=DOM.createElement('li'), **kw)
        ClickHandler.__init__(self)
        self.classIcon = classIcon
        self.value = value

        self.icon = Element(Element=DOM.createElement("i"),
                            StyleName=classIcon)
        self.add(self.icon)
        self.title = Element(Element=DOM.createSpan(), StyleName='title')

        DOM.setInnerHTML(self.title.getElement(), self.value)
        self.add(self.title)

        self.addClickListener(self)
        self.feedBack = feedBack
Ejemplo n.º 14
0
    def __init__(self, width=0, height=0):
        Widget.__init__(self)
        self.context = None
        
        self.setElement(DOM.createDiv())
        canvas = DOM.createElement("canvas")
        self.setWidth(width)
        self.setHeight(height)
        
        canvas.width=width
        canvas.height=height
        
        DOM.appendChild(self.getElement(), canvas)
        self.setStyleName("gwt-Canvas")
        
        self.init()
        
        self.context.fillStyle = "black"
        self.context.strokeStyle = "black"

        self.focusable = None
        self.focusable = Focus.createFocusable()
        
        self.focusListeners = []
        self.clickListeners = []
        self.mouseListeners = []
        self.keyboardListeners = []
        
        DOM.appendChild(self.getElement(), self.focusable)
        DOM.sinkEvents(canvas, Event.ONCLICK | Event.MOUSEEVENTS | DOM.getEventsSunk(canvas))
        DOM.sinkEvents(self.focusable, Event.FOCUSEVENTS | Event.KEYEVENTS)
Ejemplo n.º 15
0
Archivo: dynamic.py Proyecto: Afey/pyjs
    def onreadystatechange():
        if xhtoj.readyState == 4:
            jsnode = 0
            if xhtoj.status == 200:
                txt = xhtoj.responseText

                jsnode = None

                if idname:
                    jsnode = DOM.getElementById(idname)

                if jsnode is None:
                    jsnode = DOM.createElement('script')

                #tst = DOM.createElement('html')
                #tst.innerHTML = str

                activate_javascript(txt)
                if not on_load_fn is None:
                    wnd().alert(on_load_fn)
                    # eval(on_load_fn)
                    test_fn()

                return 1
            else:
                jsnode = DOM.getElementById(idname)

                if not jsnode is None:
                    jsnode.innerHTML = xhtoj.status
Ejemplo n.º 16
0
 def addMessage(self, text):
     d = datetime.now().strftime("%x %X")
     li = DOM.createElement('li')
     DOM.setInnerHTML(li,
                      '<dt class="time">%s</dt><dd class="txt">%s</dd>' % (
                      d, text))
     DOM.insertChild(self.element, li, 0)
Ejemplo n.º 17
0
    def onreadystatechange():
        if xhtoj.readyState == 4:
            jsnode = 0
            if xhtoj.status == 200:
                txt = xhtoj.responseText

                jsnode = None

                if idname:
                    jsnode = DOM.getElementById(idname)

                if jsnode is None:
                    jsnode = DOM.createElement('script')

                #tst = DOM.createElement('html')
                #tst.innerHTML = str

                activate_javascript(txt)
                if not on_load_fn is None:
                    wnd().alert(on_load_fn)
                    # eval(on_load_fn)
                    test_fn()

                return 1
            else:
                jsnode = DOM.getElementById(idname)

                if not jsnode is None:
                    jsnode.innerHTML = xhtoj.status
Ejemplo n.º 18
0
 def addDropWidget(self):
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setID('effectdrop' + str(s))
     w.setStyleName('drophere')
     w.setText('Drop %s (%s)' % (s, self.data[s]))
     self.append(w)
Ejemplo n.º 19
0
 def addDropWidget(self):
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setID('effectdrop' + str(s))
     w.setStyleName('drophere')
     w.setText('Drop %s (%s)' % (s, self.data[s]))
     self.append(w)
Ejemplo n.º 20
0
 def __init__(self, apiKey):
     self.__init__._super()
     """
     * <p>
     * required
     
     * param event_app_id
     *            string This is the application ID from the application you
     *            just created above. You must specify either the application ID
     *            or the API key.
     * param apikey
     *            string The API key from the application you just created
     *            above. You must specify either the application ID or the API
     *            key.
     
     *            optional
     * param width
     *            int The width of the box in pixels. (Default value is 450
     *            pixels.)
     * param height
     *            int The height of the box in pixels. (Default value is 400
     *            pixels.)
     * param xid
     *            string If you want to have multiple Live Stream Boxes on your
     *            canvas pages, specify a unique XID for each box. Specify
     *            xid=EVENT_NAME, where EVENT_NAME represents the event.
     *            EVENT_NAME can include only numbers, letters, and underscores.
     *            (Default value is default.)
     * </p>
     """
     super(self.__class__,self).setElement(DOM.createElement(u"fb:live-stream"))
     self.addStyleName(u"gwittit-FbLiveStream")
     self.getElement().setAttribute(u"apikey", apiKey)
Ejemplo n.º 21
0
 def __init__(self):
     AddablePanel.__init__(self, Element=DOM.createElement('div'))
     DropWidget.__init__(self)
     DragContainer.__init__(self)
     self.setStyleName('drophere2')
     self.setStyleAttribute('position', 'relative')
     self.setSize('300px', '300px')
Ejemplo n.º 22
0
 def __init__(self, element=None):
     Widget.__init__(self, Element=DOM.createElement('div'))
     self.children = []
     if element is not None:
         clone = cloneElement(element)
         self.addChild(clone)
     self.setStyleAttribute('position', 'absolute')
Ejemplo n.º 23
0
 def __init__(self):
     AddablePanel.__init__(self, Element=DOM.createElement('div'))
     DropWidget.__init__(self)
     DragContainer.__init__(self)
     self.setStyleName('drophere2')
     self.setStyleAttribute('position', 'relative')
     self.setSize('300px', '300px')
Ejemplo n.º 24
0
 def __init__(self,
              subCategoryName='',
              subCategoryClassName='',
              openList=True):
     self.list = VerticalPanel(StyleName='block_list')
     self.list.setStyleAttribute("display", "block")
     VerticalPanel.__init__(self, StyleName='SubCategoryPanel')
     self.subCategoryName = subCategoryName
     if subCategoryName != '':
         self.title = Element(Element=DOM.createElement('dt'),
                              StyleName=subCategoryClassName)
         DOM.setInnerHTML(self.title.getElement(), self.subCategoryName)
         self.collapse = FocusWidget(Element=DOM.createDiv(),
                                     StyleName='collapse close_up')
         self.collapse.addClickListener(self.showHide)
         self.title.add(self.collapse)
         self.add(self.title)
         if openList:
             self.list.setStyleAttribute("display", "block")
             self.collapse.setStyleName('collapse close_up')
         else:
             self.list.setStyleAttribute("display", "none")
             self.collapse.setStyleName('collapse open_down')
     self.add(self.list)
     self.blocks = []
     self.count = 0
Ejemplo n.º 25
0
    def __init__(self, text='', _doc=None):
        self._e = DOM.createElement('style')
        self._e.setAttribute('type', 'text/css')
        setStyleElementText(self._e, text)

        if _doc is None:
            _doc = doc()
        _doc.getElementsByTagName("head").item(0).appendChild(self._e) 
Ejemplo n.º 26
0
 def __init__(self, text, listener, classIcon=""):
     Element.__init__(self, Element=DOM.createElement('li'), StyleName='btn')
     ClickHandler.__init__(self)
     MouseHandler.__init__(self)
     self.text = text
     self.classIcon = classIcon
     self.draw()
     if listener is not None: self.addClickListener(listener)
Ejemplo n.º 27
0
 def draw(self):
     if self.classIcon != "":
         self.icon = Element(Element=DOM.createElement("i"), StyleName=self.classIcon)
         self.add(self.icon)
     self.title = Element(Element=DOM.createSpan(), StyleName='title')
     DOM.setInnerHTML(self.title.getElement(), self.text)
     self.add(self.title)     
     self.add(Widget(Element=DOM.createDiv(), StyleName='r'))
Ejemplo n.º 28
0
 def __init__(self, fbml):
     self.__init__._super()
     """
     Fbml
     @param fbml
     """
     super(self.__class__,self).setElement(DOM.createElement(u"fb:serverFbml"))
     DOM.setInnerHTML(self.getElement(), fbml)
Ejemplo n.º 29
0
    def __init__(self, cssFile=''):
        self._e = DOM.createElement('link')
        self._e.setAttribute('rel', 'stylesheet')
        self._e.setAttribute('type', 'text/css')
        self._e.setAttribute('href', cssFile)

        print "css file", cssFile
        doc().getElementsByTagName("head").item(0).appendChild(self._e)
Ejemplo n.º 30
0
 def setStyleSheet(self, sheet):
     e = DOM.createElement('link')
     e.setAttribute('rel', 'stylesheet')
     e.setAttribute('type', 'text/css')
     e.setAttribute('href', sheet)
     html = Window.getDocumentRoot().parentElement
     head = html.getElementsByTagName('head').item(0)
     head.appendChild(e)
Ejemplo n.º 31
0
Archivo: CSS.py Proyecto: sofianhw/pyjs
    def __init__(self, text='', _doc=None):
        self._e = DOM.createElement('style')
        self._e.setAttribute('type', 'text/css')
        setStyleElementText(self._e, text)

        if _doc is None:
            _doc = doc()
        _doc.getElementsByTagName("head").item(0).appendChild(self._e)
Ejemplo n.º 32
0
 def __init__(self, Name, **kwargs):
     kwargs['Name'] = Name
     if kwargs.has_key('Element'):
         element = kwargs.pop('Element')
     else:
         element = DOM.createElement("map")
     self.setElement(element)
     ComplexPanel.__init__(self, **kwargs)
    def __init__(self, cssFile=''):
        self._e = DOM.createElement('link')
        self._e.setAttribute('rel', 'stylesheet')
        self._e.setAttribute('type', 'text/css')
        self._e.setAttribute('href', cssFile);

        print "css file", cssFile
        doc().getElementsByTagName("head").item(0).appendChild(self._e) 
Ejemplo n.º 34
0
 def __init__(self, Name, **kwargs):
     kwargs['Name'] = Name
     if kwargs.has_key('Element'):
         element = kwargs.pop('Element')
     else:
         element = DOM.createElement("map")
     self.setElement(element)
     ComplexPanel.__init__(self, **kwargs)
Ejemplo n.º 35
0
 def addDragWidget(self):
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setID('effectdrag' + str(s))
     w.setStyleName('dragme')
     w.setText('Drag %s (%s)' % (s, self.data[s]))
     self.add(w)
     makeDraggable(w)
Ejemplo n.º 36
0
 def addDragWidget(self):
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setID('effectdrag' + str(s))
     w.setStyleName('dragme')
     w.setText('Drag %s (%s)' % (s, self.data[s]))
     self.add(w)
     makeDraggable(w)
Ejemplo n.º 37
0
 def __init__(self, eid):
     self.__init__._super()
     """
     * Params
     * @param eid  	 Event ID for the event whose name and link you want to retrieve.
     """
     super(self.__class__,self).setElement(DOM.createElement(u"fb:eventlink"))
     self.getElement().setAttribute(u"eid", java.str(eid) + u"")
     super(self.__class__,self).addStyleName(u"gwittit-FbEventLink")
Ejemplo n.º 38
0
    def __init__(self, feedBack, value, **kw):
        Element.__init__(self, Element=DOM.createElement('li'), **kw)
        ClickHandler.__init__(self)
        self.value = value

        DOM.setInnerHTML(self.getElement(), _(value).replace(' ', '&nbsp;'))

        self.addClickListener(self)
        self.feedBack = feedBack
Ejemplo n.º 39
0
 def __init__(self, name, age):
     #Label.__init__(self, Element=DOM.createElement('div'))
     #self.dragHandler = DragHandler()
     #self.dragHandler.addDragListener(self)
     Label.__init__(self, Element=DOM.createElement('li'))
     self.student_name = name
     self.age = int(age)
     self.setText("%s (%s)" % (self.student_name, self.age))
     self.setStyleName('dragme')
Ejemplo n.º 40
0
    def __init__(self, cssFile='', _doc=None):
        self._e = DOM.createElement('link')
        self._e.setAttribute('rel', 'stylesheet')
        self._e.setAttribute('type', 'text/css')
        self._e.setAttribute('href', cssFile)

        if _doc is None:
            _doc = doc()
        _doc.getElementsByTagName("head").item(0).appendChild(self._e)
Ejemplo n.º 41
0
 def __init__(self, **kwargs):
     if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-FileUpload"
     if kwargs.has_key('Element'):
         element = kwargs.pop('Element')
     else:
         element = DOM.createElement("input")
     DOM.setAttribute(element, "type", "file")
     self.setElement(element)
     Widget.__init__(self, **kwargs)
Ejemplo n.º 42
0
 def addDropWidget(self):
     self.remove(self.button)
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setID('drop' + str(s))
     w.setStyleName('drophere')
     w.setText('Drop ' + str(s))
     self.append(w)
     self.append(self.button)
Ejemplo n.º 43
0
 def onLoad(self):
     button = self.makeButton()
     button.addClickListener(self)
     li = AddablePanel(Element=DOM.createElement('li'))
     li.add(button)
     self.button = li
     self.add(self.button)
     for k in range(3):
         self.addDropWidget()
Ejemplo n.º 44
0
    def __init__(self, width=0, height=0):
        """ Standard initialiser.

            'width' and 'height' are the dimensions to use for this whitespace,
            in pixels.
        """
        Widget.__init__(self)
        self.setElement(DOM.createElement('div'))
        self.setPixelSize(width, height)
Ejemplo n.º 45
0
Archivo: CSS.py Proyecto: Afey/pyjs
    def __init__(self, cssFile='', _doc=None):
        self._e = DOM.createElement('link')
        self._e.setAttribute('rel', 'stylesheet')
        self._e.setAttribute('type', 'text/css')
        self._e.setAttribute('href', cssFile);

        if _doc is None:
            _doc = doc()
        _doc.getElementsByTagName("head").item(0).appendChild(self._e)
Ejemplo n.º 46
0
 def __init__(self, gid):
     self.__init__._super()
     """
     * Create group link.
     * @param gid Group ID for the group whose name and link you want to retrieve.
     """
     super(self.__class__,self).setElement(DOM.createElement(u"fb:grouplink"))
     self.getElement().setAttribute(u"gid", java.str(gid) + u"")
     self.addStyleName(u"gwittit-FbGroupLink")
Ejemplo n.º 47
0
 def __init__(self):
     AddablePanel.__init__(self, Element=DOM.createElement('div'))
     self.setID(self.id)
     self.h2 = HTML('<h2>%s</h2>' % self.title)
     self.append(self.h2)
     demo_div = AddablePanel(Element=DOM.createElement('div'))
     demo_div.setStyleName('demo')
     top_frame = HorizontalPanel()
     g = self.drag_widget
     if g is not None:
         top_frame.add(g)
     p = self.drop_widget
     if p is not None:
         top_frame.add(p)
     demo_div.add(top_frame)
     self.messages = Messages()
     demo_div.append(self.messages)
     self.add(demo_div)
Ejemplo n.º 48
0
 def __init__(self, uid):
     self.__init__._super()
     super(self.__class__,self).setElement(DOM.createElement(u"fb:name"))
     if uid == None or u"".equals(uid.trim()):
         raise IllegalArgumentException(u"uid null")
     else:
         super(self.__class__,self).addStyleName(u"FbName")
         self.set(u"uid", uid)
         self.addStyleName(u"gwittit-FbName")
Ejemplo n.º 49
0
    def __init__(self, width=0, height=0):
        """ Standard initialiser.

            'width' and 'height' are the dimensions to use for this whitespace,
            in pixels.
        """
        Widget.__init__(self)
        self.setElement(DOM.createElement('div'))
        self.setPixelSize(width, height)
Ejemplo n.º 50
0
 def __init__(self, name, age):
     #Label.__init__(self, Element=DOM.createElement('div'))
     #self.dragHandler = DragHandler()
     #self.dragHandler.addDragListener(self)
     Label.__init__(self, Element=DOM.createElement('li'))
     self.student_name = name
     self.age = int(age)
     self.setText("%s (%s)" % (self.student_name, self.age))
     self.setStyleName('dragme')
 def __init__(self, text, group, groupLabel, block):
     Element.__init__(self, Element=DOM.createElement('code'), StyleName='group_operation')
     ClickHandler.__init__(self)
     self.addClickListener(self)
     self.text = text
     self.group = group
     self.groupLabel = groupLabel
     self.block = block
     self.draw()
Ejemplo n.º 52
0
 def addDragWidget(self):
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setID('datadrag' + str(s))
     w.setStyleName('dragme')
     texts = ['Text', 'Text / HTML / URI', 'Disallowed']
     w.setText(texts[s])
     self.append(w)
     makeDraggable(w)
Ejemplo n.º 53
0
 def addDragWidget(self):
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setStyleName('dragme')
     w.setID('imgdrag' + str(s))
     texts = ['Default', 'Element', 'Image', 'Canvas']
     w.setText(texts[s])
     self.add(w)
     makeDraggable(w)
Ejemplo n.º 54
0
 def addDropWidget(self):
     self.remove(self.button)
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setID('drop' + str(s))
     w.setStyleName('drophere')
     w.setText('Drop ' + str(s))
     self.append(w)
     self.append(self.button)
Ejemplo n.º 55
0
 def onLoad(self):
     button = self.makeButton()
     button.addClickListener(self)
     li = AddablePanel(Element=DOM.createElement('li'))
     li.add(button)
     self.button = li
     self.add(self.button)
     for k in range(3):
         self.addDropWidget()
Ejemplo n.º 56
0
 def __init__(self):
     AddablePanel.__init__(self, Element=DOM.createElement('div'))
     self.setID(self.id)
     self.h2 = HTML('<h2>%s</h2>' % self.title)
     self.append(self.h2)
     demo_div = AddablePanel(Element=DOM.createElement('div'))
     demo_div.setStyleName('demo')
     top_frame = HorizontalPanel()
     g = self.drag_widget
     if g is not None:
         top_frame.add(g)
     p = self.drop_widget
     if p is not None:
         top_frame.add(p)
     demo_div.add(top_frame)
     self.messages = Messages()
     demo_div.append(self.messages)
     self.add(demo_div)
Ejemplo n.º 57
0
def init(is_native=None):
    global DropWidget
    if is_native is None:
        html5_dnd = hasattr(DOM.createElement('span'), 'draggable')
    else:
        html5_dnd = is_native
    if html5_dnd:
        DropWidget = Html5DropWidget
    else:
        DropWidget = EmulatedDropWidget
Ejemplo n.º 58
0
    def onLoad(self):
        link = self.makeLink()
        link.addClickListener(self)
        li = AddablePanel(Element=DOM.createElement('li'))
        li.add(link)
        self.button = li
        self.add(self.button)

        for k in range(3):
            self.addDragWidget()
Ejemplo n.º 59
0
 def addDragWidget(self):
     self.remove(self.button)
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setID('drag' + str(s))
     w.setStyleName('dragme')
     w.setText('Drag ' + str(s))
     self.add(w)
     makeDraggable(w)
     self.add(self.button)
Ejemplo n.º 60
0
def getHtmlText(rng):
    """
    Get the complete html fragment enclosed by this range.  Ensures that all
    opening and closing tags are included.

    @param range js range to get the html of
    @return an html string of the range
    """
    parent = DOM.createElement("span")
    copyContents(rng, parent)
    return DOM.getInnerHTML(parent)