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)
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)
def __init__(self): super(DragDropServerValidationExample, self).__init__() self.setSpacing(True) # First create the components to be able to refer to them as allowed # drag sources self._table = Table('Drag persons onto their relatives') self._table.setWidth('100%') self._container = ExampleUtil.getPersonContainer() self._table.setContainerDataSource(self._container) # Drag and drop support self._table.setDragMode(TableDragMode.ROW) self._table.setDropHandler(TableDropHandler(self)) self.addComponent(self._table)
def __init__(self): super(DragDropServerValidationExample, self).__init__() self.setSpacing(True) # First create the components to be able to refer to them as allowed # drag sources self._table = Table('Drag persons onto their relatives') self._table.setWidth('100%') self._container = ExampleUtil.getPersonContainer() self._table.setContainerDataSource(self._container) # Drag and drop support self._table.setDragMode(TableDragMode.ROW) self._table.setDropHandler( TableDropHandler(self) ) self.addComponent(self._table)