本文整理汇总了Python中pyjamas.DOM.insertChild方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.insertChild方法的具体用法?Python DOM.insertChild怎么用?Python DOM.insertChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.insertChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insertRow
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insertRow(self, beforeRow):
if beforeRow != self.getRowCount():
self.checkRowBounds(beforeRow)
tr = DOM.createTR()
DOM.insertChild(self.bodyElem, tr, beforeRow)
return beforeRow
示例2: insertChildBefore
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insertChildBefore(new_elem, elem):
"""
Inserts an element "new_elem" before the element "elem".
"""
parent = DOM.getParent(elem)
id = DOM.getChildIndex(parent, elem)
DOM.insertChild(parent, new_elem, id)
示例3: insert
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insert(self, widget, container, beforeIndex=None):
""" has two modes of operation:
widget, beforeIndex
widget, container, beforeIndex.
if beforeIndex argument is not given, the 1st mode is assumed.
this technique is less costly than using *args.
"""
if widget.getParent() == self:
return
if beforeIndex is None:
beforeIndex = container
container = self.getBody()
widget.removeFromParent()
tr = DOM.createTR()
td = DOM.createTD()
DOM.insertChild(container, tr, beforeIndex)
DOM.appendChild(tr, td)
CellPanel.insert(self, widget, td, beforeIndex)
self.setCellHorizontalAlignment(widget, self.horzAlign)
self.setCellVerticalAlignment(widget, self.vertAlign)
示例4: addMessage
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
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)
示例5: setCaption
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def setCaption(self, caption):
self.caption = caption
if caption is not None and not caption == "":
DOM.setInnerHTML(self.legend, caption)
DOM.insertChild(self.getElement(), self.legend, 0)
elif DOM.getParent(self.legend) is not None:
DOM.removeChild(self.getElement(), self.legend)
示例6: replaceLinks
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def replaceLinks(self, tagname="a"):
""" replaces <tag href="#pagename">sometext</tag> with:
Hyperlink("sometext", "pagename")
"""
tags = self.findTags(tagname)
pageloc = Window.getLocation()
pagehref = pageloc.getPageHref()
for el in tags:
href = el.href
l = href.split("#")
if len(l) != 2:
continue
if l[0] != pagehref:
continue
token = l[1]
if not token:
continue
html = DOM.getInnerHTML(el)
parent = DOM.getParent(el)
index = DOM.getChildIndex(parent, el)
hl = Hyperlink(TargetHistoryToken=token,
HTML=html,
Element=DOM.createSpan())
DOM.insertChild(parent, hl.getElement(), index)
self.children.insert(index, hl)
parent.removeChild(el)
示例7: insert
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insert(self, widget, beforeIndex):
if widget.getParent() == self:
return
widget.removeFromParent()
DOM.insertChild(self.getElement(), widget.getElement(), beforeIndex)
widget.setParent(self)
self.children.insert(beforeIndex, widget)
示例8: adopt
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def adopt(self, widget, container):
if container is not None:
widget.removeFromParent()
if indexBefore:
DOM.insertChild(container, widget.getElement(), indexBefore)
else:
DOM.appendChild(container, widget.getElement())
widget.setParent(self)
示例9: insert
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insert(self, widget, beforeIndex):
widget.removeFromParent()
td = DOM.createTD()
DOM.insertChild(self.tableRow, td, beforeIndex)
CellPanel.insert(self, widget, td, beforeIndex)
self.setCellHorizontalAlignment(widget, self.horzAlign)
self.setCellVerticalAlignment(widget, self.vertAlign)
示例10: insertItem
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insertItem(self, item, index=None):
if isinstance(item, basestring):
item = TreeItem(item)
ret = self.root.addItem(item)
if index is None:
DOM.appendChild(self.getElement(), item.getElement())
else:
DOM.insertChild(self.getElement(), item.getElement(), index)
return ret
示例11: insertItem
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insertItem(self, item, index):
if self.vertical:
tr = DOM.createTR()
DOM.insertChild(self.body, tr, index)
else:
self._checkVerticalContainer()
tr = DOM.getChild(self.body, 0)
DOM.insertChild(tr, item.getElement(), index)
item.setParentMenu(self)
item.setSelectionStyle(False)
self.items.insert(index, item)
示例12: insert
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insert(self, widget, beforeIndex):
widget.removeFromParent()
tr = DOM.createTR()
td = DOM.createTD()
DOM.insertChild(self.getBody(), tr, beforeIndex)
DOM.appendChild(tr, td)
CellPanel.insert(self, widget, td, beforeIndex)
self.setCellHorizontalAlignment(widget, self.horzAlign)
self.setCellVerticalAlignment(widget, self.vertAlign)
示例13: insertItem
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insertItem(self, item, index=None):
if not hasattr(item, "getTree"):
#if not item.getTree:
item = TreeItem(item)
if (item.getParentItem() is not None) or (item.getTree() is not None):
item.remove()
item.setTree(self.tree)
item.setParentItem(self)
if index is None:
self.children.append(item)
else:
self.children.insert(index, item)
DOM.setStyleAttribute(item.getElement(), "marginLeft", "16px")
if index is None:
DOM.appendChild(self.childSpanElem, item.getElement())
else:
DOM.insertChild(self.childSpanElem, item.getElement(), index)
if len(self.children) == 1:
self.updateState()
return item
示例14: insertCells
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insertCells(self, row, column, count):
tr = self.rowFormatter.getRow(self.bodyElem, row)
for i in range(column, column + count):
td = self.createCell()
DOM.insertChild(tr, td, i)
示例15: insertCell
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insertCell(self, row, column):
tr = self.rowFormatter.getRow(self.bodyElem, row)
td = self.createCell()
DOM.insertChild(tr, td, column)