class TableStylingExample(VerticalLayout): def __init__(self): super(TableStylingExample, self).__init__() self.setSpacing(True) self._table = Table() self._markedRows = dict() self._markedCells = dict() self.addComponent(self._table) # set a style name, so we can style rows and cells self._table.setStyleName('contacts') # size self._table.setWidth('100%') self._table.setPageLength(7) # connect data source self._table.setContainerDataSource(ExampleUtil.getPersonContainer()) # Generate the email-link from firstname & lastname self._table.addGeneratedColumn('Email', TableColumnGenerator(self)) # turn on column reordering and collapsing self._table.setColumnReorderingAllowed(True) self._table.setColumnCollapsingAllowed(True) # Actions (a.k.a context menu) self._table.addActionHandler( TableActionHandler(self) ) # style generator self._table.setCellStyleGenerator( TableStyleGenerator(self) ) # toggle cell 'marked' styling when double-clicked self._table.addListener(TableClickListener(self), IItemClickListener) # Editing # we don't want to update container before pressing 'save': self._table.setWriteThrough(False) # edit button editButton = Button('Edit') self.addComponent(editButton) editButton.addListener(EditListener(self, editButton), button.IClickListener) self.setComponentAlignment(editButton, Alignment.TOP_RIGHT)