本文整理汇总了Python中pyjamas.DOM.getFirstChild方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.getFirstChild方法的具体用法?Python DOM.getFirstChild怎么用?Python DOM.getFirstChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.getFirstChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: computeKey
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def computeKey(self, row, column):
element = self.cellFormatter.getRawElement(row, column)
child = DOM.getFirstChild(element)
if child is None:
return None
return self.computeKeyForElement(child)
示例2: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def __init__(self, **kwargs):
self.body = None
self.visibleStack = -1
self.indices = {}
if kwargs.has_key('Element'):
table = kwargs.pop('Element')
fc = DOM.getFirstChild(table)
if fc:
self.body = fc
else:
self.body = DOM.createTBody()
DOM.appendChild(table, self.body)
else:
table = DOM.createTable()
self.body = DOM.createTBody()
DOM.appendChild(table, self.body)
self.setElement(table)
if not kwargs.has_key('Spacing'): kwargs['Spacing'] = 0
if not kwargs.has_key('Padding'): kwargs['Padding'] = 0
if not kwargs.has_key('StyleName'): kwargs['StyleName'] = "gwt-StackPanel"
DOM.sinkEvents(table, Event.ONCLICK)
ComplexPanel.__init__(self, **kwargs)
示例3: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def __init__(self, vertical=False, **kwargs):
if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-MenuBar"
self.body = None
self.items = []
self.parentMenu = None
self.popup = None
self.selectedItem = None
self.shownChildMenu = None
self.vertical = False
self.autoOpen = False
if kwargs.has_key('Element'):
table = kwargs.pop('Element')
fc = DOM.getFirstChild(table)
if fc:
self.body = fc
else:
self.body = DOM.createTBody()
DOM.appendChild(table, self.body)
else:
table = DOM.createTable()
self.body = DOM.createTBody()
DOM.appendChild(table, self.body)
if not vertical:
tr = DOM.createTR()
DOM.appendChild(self.body, tr)
self.vertical = vertical
outer = DOM.createDiv()
DOM.appendChild(outer, table)
self.setElement(outer)
Widget.__init__(self, **kwargs)
示例4: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def __init__(self, **kwargs):
if not kwargs.has_key('CellFormatter'):
kwargs['CellFormatter'] = CellFormatter(self)
if not kwargs.has_key('RowFormatter'):
kwargs['RowFormatter'] = RowFormatter(self)
self.tableListeners = []
self.dbltableListeners = []
self.widgetMap = {}
if kwargs.has_key('Element'):
self.tableElem = kwargs.pop('Element')
fc = DOM.getFirstChild(self.tableElem)
if fc:
self.bodyElem = fc
else:
self.bodyElem = DOM.createTBody()
DOM.appendChild(self.tableElem, self.bodyElem)
else:
self.tableElem = DOM.createTable()
self.bodyElem = DOM.createTBody()
DOM.appendChild(self.tableElem, self.bodyElem)
self.setElement(self.tableElem)
self.sinkEvents(Event.ONCLICK | Event.ONDBLCLICK)
Panel.__init__(self, **kwargs)
示例5: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def __init__(self, vertical=False, **kwargs):
self.setVertical(kwargs.pop('Vertical', vertical))
if 'StyleName' not in kwargs or kwargs['StyleName'] == 'gwt-MenuBar':
kwargs['StyleName'] = self.getDefaultStyleName()
self.body = None
self.items = []
self.parentMenu = None
self.popup = None
self.selectedItem = None
self.shownChildMenu = None
self.autoOpen = False
if kwargs.has_key('Element'):
table = kwargs.pop('Element')
fc = DOM.getFirstChild(table)
if fc:
self.body = fc
else:
self.body = DOM.createTBody()
DOM.appendChild(table, self.body)
else:
table = DOM.createTable()
self.body = DOM.createTBody()
DOM.appendChild(table, self.body)
outer = DOM.createDiv()
DOM.appendChild(outer, table)
self.setElement(outer)
Widget.__init__(self, **kwargs)
示例6: remove
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def remove(self, child, index=None):
if index is None:
if isinstance(child, int):
index = child
child = self.getWidget(child)
else:
index = self.getWidgetIndex(child)
if child.getParent() != self:
return False
if self.visibleStack == index:
self.visibleStack = -1
elif self.visibleStack > index:
self.visibleStack -= 1
rowIndex = 2 * index
tr = DOM.getChild(self.body, rowIndex)
DOM.removeChild(self.body, tr)
tr = DOM.getChild(self.body, rowIndex)
DOM.removeChild(self.body, tr)
CellPanel.remove(self, child)
rows = self.getWidgetCount() * 2
#for (int i = rowIndex; i < rows; i = i + 2) {
for i in range(rowIndex, rows, 2):
childTR = DOM.getChild(self.body, i)
td = DOM.getFirstChild(childTR)
curIndex = self._getIndex(td)
self._setIndex(td, index)
index += 1
return True
示例7: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def __init__(self, img, **kwargs):
self.mouseListeners = []
if not kwargs.has_key('StyleName'):
kwargs['StyleName'] = 'gwt-HyperlinkImage'
Hyperlink.__init__(self, **kwargs)
DOM.appendChild(DOM.getFirstChild(self.getElement()), img.getElement())
img.unsinkEvents(Event.ONCLICK | Event.MOUSEEVENTS)
self.sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS)
示例8: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def __init__(self, name, **kwargs):
if kwargs.has_key('Element'):
div = kwargs.pop('Element')
else:
div = DOM.createDiv()
DOM.setInnerHTML(div, "<iframe name='" + name + "'>")
iframe = DOM.getFirstChild(div)
Frame.__init__(self, None, iframe, **kwargs)
示例9: getCellElement
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def getCellElement(self, row, cell) :
""" Get a specific Element from the panel.
@param row the row index
@param cell the cell index
@return the Element at the given row and cell
"""
tr = DOM.getChild(self.tbody, row)
td = DOM.getChild(tr, cell)
return DOM.getFirstChild(td)
示例10: setStackVisible
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def setStackVisible(self, index, visible):
tr = DOM.getChild(self.body, (index * 2))
if tr is None:
return
td = DOM.getFirstChild(tr)
self.setStyleName(td, "gwt-StackPanelItem-selected", visible)
tr = DOM.getChild(self.body, (index * 2) + 1)
self.setVisible(tr, visible)
self.getWidget(index).setVisible(visible)
示例11: internalClearCell
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def internalClearCell(self, td):
maybeChild = DOM.getFirstChild(td)
widget = None
if maybeChild is not None:
widget = self.getWidget(maybeChild)
if widget is not None:
self.removeWidget(widget)
return True
DOM.setInnerHTML(td, "")
return False
示例12: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def __init__(self, rowStyles=None, containerIndex=1, **kwargs):
""" Creates a new panel using the specified style names to
apply to each row. Each row will contain three cells
(Left, Center, and Right). The Center cell in the
containerIndex row will contain the {@link Widget}.
@param rowStyles an array of style names to apply to each row
@param containerIndex the index of the container row
"""
if rowStyles is None:
rowStyles = self.DEFAULT_ROW_STYLENAMES
if kwargs.has_key('Element'):
self.table = kwargs.pop('Element')
fc = DOM.getFirstChild(self.table)
if fc:
self.tbody = fc
else:
self.tbody = DOM.createTBody()
DOM.appendChild(self.table, self.tbody)
else:
# Add a tbody
self.table = DOM.createTable()
self.tbody = DOM.createTBody()
DOM.appendChild(self.table, self.tbody)
DOM.setAttribute(self.table, "cellSpacing", "0")
DOM.setAttribute(self.table, "cellPadding", "0")
if not kwargs.has_key('StyleName'): kwargs['StyleName']=self.DEFAULT_STYLENAME
SimplePanel.__init__(self, self.table, **kwargs)
# Add each row
for i in range(len(rowStyles)):
row = self.createTR(rowStyles[i])
DOM.appendChild(self.tbody, row)
if i == containerIndex:
self.containerElem = DOM.getFirstChild(DOM.getChild(row, 1))
示例13: getAdjacentTextElement
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def getAdjacentTextElement(current, topMostNode, forward=None, traversingUp=False):
if forward is None:
forward = topMostNode
topMostNode = None
res = None
#print "getAdjacentTextElement", current, topMostNode, forward, traversingUp
# If traversingUp, then the children have already been processed
if not traversingUp:
if DOM.getChildCount(current) > 0:
if forward:
node = DOM.getFirstChild(current)
else:
node = DOM.getLastChild(current)
if DOM.getNodeType(node) == DOM.TEXT_NODE:
res = node
else:
# Depth first traversal, the recursive call deals with
# siblings
res = getAdjacentTextElement(node, topMostNode,
forward, False)
if res is None:
if forward:
node = current.nextSibling
else:
node = current.previousSibling
# Traverse siblings
if node is not None:
if DOM.getNodeType(node) == DOM.TEXT_NODE:
res = node
else:
#print node, DOM.getNodeType(node), node.innerHTML
# Depth first traversal, the recursive call deals with
# siblings
res = getAdjacentTextElement(node, topMostNode,
forward, False)
# Go up and over if still not found
if (res is None) and (not DOM.compare(current, topMostNode)):
node = current.parentNode
# Stop at document (technically could stop at "html" tag)
if (node is not None) and \
(DOM.getNodeType(node) != DOM.DOCUMENT_NODE):
res = getAdjacentTextElement(node, topMostNode,
forward, True)
return res
示例14: getElementById
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def getElementById(element, id):
try:
element_id = DOM.getAttribute(element, "id")
except:
element_id = None
if element_id is not None and element_id == id:
return element
child = DOM.getFirstChild(element)
while child is not None:
ret = getElementById(child, id)
if ret is not None:
return ret
child = DOM.getNextSibling(child)
return None
示例15: getElementsByTagName
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getFirstChild [as 别名]
def getElementsByTagName(element, tagname):
try:
element_tagname = element.nodeName # DOM.getAttribute(element, "nodeName")
element_tagname = str(element_tagname).lower()
except:
element_tagname = None
if element_tagname is not None and element_tagname == tagname:
return [element]
res = []
child = DOM.getFirstChild(element)
while child is not None:
for el in getElementsByTagName(child, tagname):
res.append(el)
child = DOM.getNextSibling(child)
return res