' % (self.cssclass)
+ if self.title:
+ html += u'
%s
' % (self.title_cssclass, self.title)
+ html += u'
%s
' % (self.value_cssclass, self.html)
+ html += u'
'
+
+ self.html = html
+
+class DisplayHTMLBlockTable(DisplayHTMLBlock):
+
+ def __init__(self, iwla, title, cols):
+ super(DisplayHTMLBlockTable, self).__init__(iwla=iwla, title=title)
+ self.cols = listToStr(cols)
+ self.rows = []
+ self.cols_cssclasses = [u''] * len(cols)
+ self.rows_cssclasses = []
+ self.table_css = u'iwla_table'
+
+ def appendRow(self, row):
+ self.rows.append(listToStr(row))
+ self.rows_cssclasses.append([u''] * len(row))
+
+ def getNbRows(self):
+ return len(self.rows)
+
+ def getNbCols(self):
+ return len(self.cols)
+
+ def getCellValue(self, row, col):
+ if row < 0 or col < 0 or\
+ row >= len(self.rows) or col >= len(self.cols):
+ raise ValueError('Invalid indices %d,%d' % (row, col))
+
+ return self.rows[row][col]
+
+ def setCellValue(self, row, col, value):
+ if row < 0 or col < 0 or\
+ row >= len(self.rows) or col >= len(self.cols):
+ raise ValueError('Invalid indices %d,%d' % (row, col))
+
+ self.rows[row][col] = unicode(value)
+
+ def setCellCSSClass(self, row, col, value):
+ if row < 0 or col < 0 or\
+ row >= len(self.rows) or col >= len(self.cols):
+ raise ValueError('Invalid indices %d,%d' % (row, col))
+
+ self.rows_cssclasses[row][col] = unicode(value)
+
+ def getCellCSSClass(self, row, col):
+ if row < 0 or col < 0 or\
+ row >= len(self.rows) or col >= len(self.cols):
+ raise ValueError('Invalid indices %d,%d' % (row, col))
+
+ return self.rows_cssclasses[row][col]
+
+ def getColCSSClass(self, col):
+ if col < 0 or col >= len(self.cols):
+ raise ValueError('Invalid indice %d' % (col))
+
+ return self.cols_cssclasses[col]
+
+ def setRowCSSClass(self, row, value):
+ if row < 0 or row >= len(self.rows):
+ raise ValueError('Invalid indice %d' % (row))
+
+ self.rows_cssclasses[row] = [unicode(value)] * len(self.rows_cssclasses[row])
+
+ def setColCSSClass(self, col, value):
+ if col < 0 or col >= len(self.cols):
+ raise ValueError('Invalid indice %d' % (col))
+
+ self.cols_cssclasses[col] = unicode(value)
+
+ def setColsCSSClass(self, values):
+ if len(values) != len(self.cols):
+ raise ValueError('Invalid values size')
+
+ self.cols_cssclasses = listToStr(values)
+
+ def _buildHTML(self):
+ style = u''
+ if self.table_css: style = u' class="%s"' % (self.table_css)
+ html = u'