本文整理汇总了Python中pyjamas.DOM.createTD方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.createTD方法的具体用法?Python DOM.createTD怎么用?Python DOM.createTD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.createTD方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [as 别名]
def __init__(self, text, disclosurePanel):
Widget.__init__(self)
self.disclosurePanel = disclosurePanel
self.imageBase = pygwt.getModuleBaseURL()
self.root = DOM.createTable()
self.tbody = DOM.createTBody()
self.tr = DOM.createTR()
self.imageTD = DOM.createTD()
self.labelTD = DOM.createTD()
self.imgElem = DOM.createImg()
self.updateState()
self.setElement(self.root)
DOM.appendChild(self.root, self.tbody)
DOM.appendChild(self.tbody, self.tr)
DOM.appendChild(self.tr, self.imageTD)
DOM.appendChild(self.tr, self.labelTD)
DOM.appendChild(self.imageTD, self.imgElem)
self.setText(text)
disclosurePanel.addEventHandler(self)
self.updateState()
示例2: add
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [as 别名]
def add(self, widget, stackText="", asHTML=False):
widget.removeFromParent()
index = self.getWidgetCount()
tr = DOM.createTR()
td = DOM.createTD()
DOM.appendChild(self.body, tr)
DOM.appendChild(tr, td)
self.setStyleName(td, "gwt-StackPanelItem", True)
self._setIndex(td, index)
DOM.setAttribute(td, "height", "1px")
tr = DOM.createTR()
td = DOM.createTD()
DOM.appendChild(self.body, tr)
DOM.appendChild(tr, td)
DOM.setAttribute(td, "height", "100%")
DOM.setAttribute(td, "vAlign", "top")
CellPanel.add(self, widget, td)
self.setStackVisible(index, False)
if self.visibleStack == -1:
self.showStack(0)
if stackText != "":
self.setStackText(self.getWidgetCount() - 1, stackText, asHTML)
示例3: insert
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [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: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [as 别名]
def __init__(self, text):
Widget.__init__(self)
self.imageBase = pygwt.getModuleBaseURL()
self.root = DOM.createTable()
self.tbody = DOM.createTBody()
self.tr = DOM.createTR()
self.imageTD = DOM.createTD()
self.labelTD = DOM.createTD()
self.imgElem = DOM.createImg()
self.setElement(self.root)
DOM.appendChild(self.root, self.tbody)
DOM.appendChild(self.tbody, self.tr)
DOM.appendChild(self.tr, self.imageTD)
DOM.appendChild(self.tr, self.labelTD)
DOM.appendChild(self.imageTD, self.imgElem)
self.setText(text)
示例5: insert
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [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)
示例6: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [as 别名]
def __init__(self, text, images=True):
Widget.__init__(self)
self.setImageBase(images)
self.root = DOM.createTable()
self.tbody = DOM.createTBody()
self.tr = DOM.createTR()
self.imageTD = DOM.createTD()
self.labelTD = DOM.createTD()
self.imgElem = DOM.createImg()
self.setElement(self.root)
DOM.appendChild(self.root, self.tbody)
DOM.appendChild(self.tbody, self.tr)
DOM.appendChild(self.tr, self.imageTD)
DOM.appendChild(self.tr, self.labelTD)
DOM.appendChild(self.imageTD, self.imgElem)
self.setText(text)
示例7: createTD
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [as 别名]
def createTD(self, styleName) :
""" Create a new table cell with a specific style name.
@param styleName the style name
@return the new cell {@link Element}
"""
tdElem = DOM.createTD()
inner = DOM.createDiv()
DOM.appendChild(tdElem, inner)
self.setStyleName(tdElem, styleName)
self.setStyleName(inner, styleName + "Inner")
return tdElem
示例8: insert
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [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)
示例9: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [as 别名]
def __init__(self, text, asHTML, subMenu=None, **kwargs):
cmd = None
if subMenu is None:
if hasattr(asHTML, "execute"): # text, cmd
cmd = asHTML
asHTML = False
elif hasattr(asHTML, "onShow"): # text, subMenu
subMenu = asHTML
asHTML = False
# else: text, asHTML
elif hasattr(subMenu, "execute"): # text, asHTML, cmd
cmd = subMenu
subMenu = None
# else: text, asHTML, subMenu
self.command = None
self.parentMenu = None
self.subMenu = None
if kwargs.has_key('Element'):
element = kwargs.pop('Element')
else:
element = DOM.createTD()
self.setElement(element)
kwargs['SelectionStyle'] = False
if asHTML:
kwargs['HTML'] = text
else:
kwargs['Text'] = text
if cmd:
kwargs['Command'] = cmd
if subMenu:
kwargs['SubMenu'] = subMenu
if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-MenuItem"
UIObject.__init__(self, **kwargs)
self.sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT)
示例10: createCell
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [as 别名]
def createCell(self):
return DOM.createTD()
示例11: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [as 别名]
def __init__(self, html=None, **ka):
self.children = []
self.attached = False
self.contentPanel = None
self.itemTable = None
self.contentElem = None
self.imgElem = None
self.childSpanElem = None
self.open = False
self.parent = None
self.selected = False
self.tree = None
self.userObject = None
element = ka.pop('Element', None) or DOM.createDiv()
self.setElement(element)
self.itemTable = DOM.createTable()
self.contentElem = DOM.createSpan()
self.childSpanElem = DOM.createSpan()
self.imgElem = DOM.createImg()
tbody = DOM.createTBody()
tr = DOM.createTR()
tdImg = DOM.createTD()
tdContent = DOM.createTD()
DOM.appendChild(self.itemTable, tbody)
DOM.appendChild(tbody, tr)
DOM.appendChild(tr, tdImg)
DOM.appendChild(tr, tdContent)
DOM.setStyleAttribute(tdImg, "verticalAlign", "middle")
DOM.setStyleAttribute(tdContent, "verticalAlign", "middle")
DOM.setStyleAttribute(self.getElement(), "cursor", "pointer")
DOM.appendChild(self.getElement(), self.itemTable)
DOM.appendChild(self.getElement(), self.childSpanElem)
DOM.appendChild(tdImg, self.imgElem)
DOM.appendChild(tdContent, self.contentElem)
# XXX - can't set pos relative on a div node,
# or white_space on an HTML Table..
try:
DOM.setAttribute(self.getElement(), "position", "relative")
except:
pass
DOM.setStyleAttribute(self.contentElem, "display", "inline")
DOM.setStyleAttribute(self.getElement(), "whiteSpace", "nowrap")
try:
DOM.setAttribute(self.itemTable, "whiteSpace", "nowrap")
except:
pass
DOM.setStyleAttribute(self.childSpanElem, "whiteSpace", "nowrap")
self.setStyleName(self.contentElem, "gwt-TreeItem", True)
#if not ka.has_key('StyleName'): ka['StyleName']="gwt-TreeItem"
if html is not None:
try:
# messy. pyjd can do unicode, pyjs can't
if isinstance(html, unicode):
ka['HTML'] = html
elif isinstance(html, basestring):
ka['HTML'] = html
else:
ka['Widget'] = html
except:
if isinstance(html, basestring):
ka['HTML'] = html
else:
ka['Widget'] = html
UIObject.__init__(self, **ka)
示例12: realizeTable
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createTD [as 别名]
def realizeTable(self, beingAdded):
bodyElement = self.getBody()
while DOM.getChildCount(bodyElement) > 0:
DOM.removeChild(bodyElement, DOM.getChild(bodyElement, 0))
rowCount = 1
colCount = 1
for child in self.dock_children:
dir = child.getLayoutData().direction
if dir == self.NORTH or dir == self.SOUTH:
rowCount += 1
elif dir == self.EAST or dir == self.WEST:
colCount += 1
rows = []
for i in range(rowCount):
rows.append(DockPanelTmpRow())
rows[i].tr = DOM.createTR()
DOM.appendChild(bodyElement, rows[i].tr)
westCol = 0
eastCol = colCount - 1
northRow = 0
southRow = rowCount - 1
centerTd = None
for child in self.dock_children:
layout = child.getLayoutData()
td = DOM.createTD()
layout.td = td
DOM.setAttribute(layout.td, "align", layout.hAlign)
DOM.setStyleAttribute(layout.td, "verticalAlign", layout.vAlign)
DOM.setAttribute(layout.td, "width", layout.width)
DOM.setAttribute(layout.td, "height", layout.height)
if layout.direction == self.NORTH:
DOM.insertChild(rows[northRow].tr, td, rows[northRow].center)
self.appendAndMaybeAdopt(td, child.getElement(), beingAdded)
DOM.setIntAttribute(td, "colSpan", eastCol - westCol + 1)
northRow += 1
elif layout.direction == self.SOUTH:
DOM.insertChild(rows[southRow].tr, td, rows[southRow].center)
self.appendAndMaybeAdopt(td, child.getElement(), beingAdded)
DOM.setIntAttribute(td, "colSpan", eastCol - westCol + 1)
southRow -= 1
elif layout.direction == self.WEST:
row = rows[northRow]
DOM.insertChild(row.tr, td, row.center)
row.center += 1
self.appendAndMaybeAdopt(td, child.getElement(), beingAdded)
DOM.setIntAttribute(td, "rowSpan", southRow - northRow + 1)
westCol += 1
elif layout.direction == self.EAST:
row = rows[northRow]
DOM.insertChild(row.tr, td, row.center)
self.appendAndMaybeAdopt(td, child.getElement(), beingAdded)
DOM.setIntAttribute(td, "rowSpan", southRow - northRow + 1)
eastCol -= 1
elif layout.direction == self.CENTER:
centerTd = td
if self.center is not None:
row = rows[northRow]
DOM.insertChild(row.tr, centerTd, row.center)
self.appendAndMaybeAdopt(centerTd, self.center.getElement(), beingAdded)