本文整理汇总了Python中pyjamas.ui.FlexTable.FlexTable.setStyleName方法的典型用法代码示例。如果您正苦于以下问题:Python FlexTable.setStyleName方法的具体用法?Python FlexTable.setStyleName怎么用?Python FlexTable.setStyleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.FlexTable.FlexTable
的用法示例。
在下文中一共展示了FlexTable.setStyleName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onModuleLoad
# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setStyleName [as 别名]
class RegexTextBoxDemo:
def onModuleLoad(self):
_example_descr=HTML("""This example shows how to validate text using
a TextBox. A new class called RegexTextBox, which inherits from TextBox
validates text, when focus is removed (ie, onblur event).<br>
In the table below, TextBoxes in the 'Valid Text' column contain text
strings that match that rows regular expression. TextBoxes in the 'Invalid Text'
column contain strings that violates the same regular expressions. Feel free
to modify the text to test different values to see if they are valid or not.
<p>""")
self._table=FlexTable(BorderWidth=0)
self._table.setStyleName("gwt-table")
self._setHeaders()
self._row=1
for _descr, _regex, _correct, _wrong in self._get_data():
self._rowHelper(_descr, _regex, _correct, _wrong)
self._row+=1
_panel=VerticalPanel()
_panel.add(_example_descr)
_panel.add(self._table)
RootPanel().add(_panel)
def _setHeaders(self):
self._table.setHTML(0,0, "<b>Description</b>")
self._table.setHTML(0,1, "<b>Regex</b>")
self._table.setHTML(0,2, "<b>Valid Text</b>")
self._table.setHTML(0,3, "<b>Invalid Text</b>")
def _rowHelper(self, text, regex, value1, value2):
self._table.setHTML(self._row, 0, text)
self._table.setHTML(self._row, 1, regex)
_rtb=RegexTextBox()
_rtb.setRegex(regex)
_rtb.setText(value1)
_rtb.appendValidListener(display_ok)
_rtb.appendInvalidListener(display_error)
_rtb.validate(None)
self._table.setWidget(self._row, 2, _rtb)
_rtb1=RegexTextBox()
_rtb1.setRegex(regex)
_rtb1.setText(value2)
_rtb1.appendValidListener(display_ok)
_rtb1.appendInvalidListener(display_error)
_rtb1.validate(None)
self._table.setWidget(self._row, 3, _rtb1)
def _get_data(self):
return [['Positive Unsigned Integer', r'^\d+$', '123', '1a2'],
['Signed Integer', r'^[+-]?\d+$', '+321', '321-'],
['No whitespace', r'^\S+$', 'pyjamas', '1 3'],
['Date in (MM/DD/YYYY) format', r'^\d\d/\d\d/\d{4}$',
'12/21/2012', '12-21-2012'],
['Non digits', r'^\D+$', 'pyjamas', '1 3'],
]
示例2: CodeSwitchingSentence
# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setStyleName [as 别名]
class CodeSwitchingSentence(VerticalPanel):
def __init__(self, sentence):
VerticalPanel.__init__(self)
self.sentence = sentence
self.tokens = sentence.split()
self.table = FlexTable()
self.table.setStyleName("codeswitchtable")
self.radiobuttons = []
for i, token in enumerate(self.tokens):
self.radiobuttons.append(RadioButton(""))
tmp = HTML(token)
tmp.setStyleName("codeswitchtable")
self.table.setWidget(0, i, tmp)
self.table.setWidget(1, i, self.radiobuttons[i])
self.add(self.table)
示例3: PopupPagina
# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setStyleName [as 别名]
#.........这里部分代码省略.........
"<b>(</b><input type='text' class='gwt-TextBox' id='n2' style='width: 25px; height:20px;' maxLength='1'><b>)</b>"
),
)
gridinterativa.setWidget(
2,
2,
HTML(
"<b>= </b> <input type='text' class='gwt-TextBox' id='solucao' style='width: 25px; height:20px;' maxLength='1'>"
),
)
ftInterativo.setHTML(0, 0, "</br>")
ftInterativo.setHTML(1, 0, "<b><h3>Painel Interativo<h3></b>")
# ftInterativo.setWidget(2, 0, self.btnInterativo)
ftInterativo.setWidget(3, 0, gridinterativa)
ftInterativo.setWidget(4, 0, self.btnTestarResposta)
ftInterativo.setHTML(5, 0, "</br>")
ftInterativo.setHTML(6, 0, "Use a tecla tab para agilizar.")
ftInterativo.getCellFormatter().setAlignment(
4, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_TOP
)
ftInterativo.getCellFormatter().setAlignment(
1, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_TOP
)
# painelhorizontal.add(ftInterativo)
self.panel.setWidget(2, 0, painelhorizontal)
self.panel.setWidget(3, 0, self.lblStatus)
self.panel.setStyleName("dialogContent")
PopupPanel.setWidget(self, self.panel)
self.setStyleName("gwt-DialogBox")
self.caption.setStyleName("Caption")
self.caption.addMouseListener(self)
# self.txtlm1.setFocus(True);
def onFecharPopup(self, event):
self.hide()
PararAnimacao()
def onIniciarAnimacaoPassoAPasso(self, event):
self.btnFazer.setEnabled(True)
self.btnDesfazer.setEnabled(True)
if self.validarParametrosMatriz():
IniciarAnimacaoPassoAPasso()
def onIniciarAnimacaoAutomatica(self, event):
if self.validarParametrosMatriz():
IniciarAnimacaoAutomatica()
def onTestarSolucao(self, event):
pass
# if self.validarParametrosMatriz():
# def onCloseDialog(self, event):
# self.dbProxInstrucao.hide()