def __init__(self): super(TreeMultiSelectExample, self).__init__() self.setSpacing(True) # Create new Tree object using a hierarchical container from # ExampleUtil class self._tree = Tree('Hardware Inventory', ExampleUtil.getHardwareContainer()) # Set multiselect mode self._tree.setMultiSelect(True) self._tree.setImmediate(True) self._tree.addListener(TreeListener(self), IValueChangeListener) # Add Actionhandler self._tree.addActionHandler(self) # Set tree to show the 'name' property as caption for items self._tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) self._tree.setItemCaptionMode( AbstractSelect.ITEM_CAPTION_MODE_PROPERTY) # Expand whole tree for idd in self._tree.rootItemIds(): self._tree.expandItemsRecursively(idd) # Create the 'delete button', inline click-listener self._deleteButton = Button('Delete', DeleteListener(self)) self._deleteButton.setEnabled(False) self.addComponent(self._deleteButton) self.addComponent(self._tree)
def __init__(self): super(TreeMultiSelectExample, self).__init__() self.setSpacing(True) # Create new Tree object using a hierarchical container from # ExampleUtil class self._tree = Tree('Hardware Inventory', ExampleUtil.getHardwareContainer()) # Set multiselect mode self._tree.setMultiSelect(True) self._tree.setImmediate(True) self._tree.addListener(TreeListener(self), IValueChangeListener) # Add Actionhandler self._tree.addActionHandler(self) # Set tree to show the 'name' property as caption for items self._tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) self._tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY) # Expand whole tree for idd in self._tree.rootItemIds(): self._tree.expandItemsRecursively(idd) # Create the 'delete button', inline click-listener self._deleteButton = Button('Delete', DeleteListener(self)) self._deleteButton.setEnabled(False) self.addComponent(self._deleteButton) self.addComponent(self._tree)
def __init__(self): super(TreeMouseEventsExample, self).__init__() self.setSpacing(True) # Create new Tree object using a hierarchical container from # ExampleUtil class self._t = Tree('Hardware Inventory', ExampleUtil.getHardwareContainer()) # Add ItemClickListener to the tree self._t.addListener(self, IItemClickListener) self._t.setImmediate(True) # Set tree to show the 'name' property as caption for items self._t.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) self._t.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY) # Starting itemId # for new items self._itemId = len(self._t.getContainerDataSource()) # Expand whole tree for i in range(self._itemId): self._t.expandItemsRecursively(i) # Disallow selecting items from the tree self._t.setSelectable(False) self.addComponent(self._t)
def __init__(self): super(WebLayoutWindow, self).__init__() # Our main layout is a horizontal layout main = HorizontalLayout() main.setMargin(True) main.setSpacing(True) self.setContent(main) # Tree to the left tree = Tree() tree.setContainerDataSource(ExampleUtil.getHardwareContainer()) tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) for idd in tree.rootItemIds(): tree.expandItemsRecursively(idd) self.addComponent(tree) # vertically divide the right area left = VerticalLayout() left.setSpacing(True) self.addComponent(left) # table on top tbl = Table() tbl.setWidth('500px') tbl.setContainerDataSource(ExampleUtil.getISO3166Container()) tbl.setSortDisabled(True) tbl.setPageLength(7) left.addComponent(tbl) # Label on bottom text = Label(ExampleUtil.lorem, Label.CONTENT_XHTML) text.setWidth('500px') # some limit is good for text left.addComponent(text)
def __init__(self): super(DragDropTreeSortingExample, self).__init__() self.setSpacing(True) tree = Tree('Tree sortable using drag\'n\'drop') # Populate the tree container = ExampleUtil.getHardwareContainer() tree.setContainerDataSource(container) tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) tree.setItemIconPropertyId(ExampleUtil.hw_PROPERTY_ICON) # Allow all nodes to have children for itemId in tree.getItemIds(): tree.setChildrenAllowed(itemId, True) # Expand all nodes for idd in tree.rootItemIds(): tree.expandItemsRecursively(idd) tree.setDragMode(TreeDragMode.NODE) tree.setDropHandler(TreeSortDropHandler(tree, container)) self.addComponent(tree)
def __init__(self): super(WebLayoutWindow, self).__init__() # Our main layout is a horizontal layout main = HorizontalLayout() main.setMargin(True) main.setSpacing(True) self.setContent(main) # Tree to the left tree = Tree() tree.setContainerDataSource( ExampleUtil.getHardwareContainer() ) tree.setItemCaptionPropertyId( ExampleUtil.hw_PROPERTY_NAME ) for idd in tree.rootItemIds(): tree.expandItemsRecursively(idd) self.addComponent(tree) # vertically divide the right area left = VerticalLayout() left.setSpacing(True) self.addComponent(left) # table on top tbl = Table() tbl.setWidth('500px') tbl.setContainerDataSource( ExampleUtil.getISO3166Container() ) tbl.setSortDisabled(True) tbl.setPageLength(7) left.addComponent(tbl) # Label on bottom text = Label(ExampleUtil.lorem, Label.CONTENT_XHTML) text.setWidth('500px') # some limit is good for text left.addComponent(text)
def initializeTree(self, acceptCriterion): self._tree.setContainerDataSource(ExampleUtil.getHardwareContainer()) self._tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) # Expand all nodes for idd in self._tree.rootItemIds(): self._tree.expandItemsRecursively(idd) self._tree.setDragMode(TreeDragMode.NODE) self._tree.setDropHandler( TreeDropHandler(self) )
def initializeTree(self, acceptCriterion): self._tree.setContainerDataSource(ExampleUtil.getHardwareContainer()) self._tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) # Expand all nodes for idd in self._tree.rootItemIds(): self._tree.expandItemsRecursively(idd) self._tree.setDragMode(TreeDragMode.NODE) self._tree.setDropHandler(TreeDropHandler(self))
def __init__(self): super(ApplicationLayoutWindow, self).__init__() # Our main layout is a horizontal layout main = HorizontalLayout() main.setSizeFull() self.setContent(main) # Tree to the left treePanel = Panel() # for scrollbars treePanel.setStyleName(Reindeer.PANEL_LIGHT) treePanel.setHeight('100%') treePanel.setWidth(None) treePanel.getContent().setSizeUndefined() self.addComponent(treePanel) tree = Tree() tree.setContainerDataSource(ExampleUtil.getHardwareContainer()) tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) for idd in tree.rootItemIds(): tree.expandItemsRecursively(idd) treePanel.addComponent(tree) # vertically divide the right area left = VerticalLayout() left.setSizeFull() self.addComponent(left) main.setExpandRatio(left, 1.0) # use all available space # table on top tbl = Table() tbl.setWidth('100%') tbl.setContainerDataSource(ExampleUtil.getISO3166Container()) tbl.setSortDisabled(True) tbl.setPageLength(7) left.addComponent(tbl) # Label on bottom textPanel = Panel() # for scrollbars textPanel.setStyleName(Reindeer.PANEL_LIGHT) textPanel.setSizeFull() left.addComponent(textPanel) left.setExpandRatio(textPanel, 1.0) # use all available space text = Label(ExampleUtil.lorem, Label.CONTENT_XHTML) text.setWidth('500px') # some limit is good for text textPanel.addComponent(text)
def __init__(self): super(TreeSingleSelectExample, self).__init__() self.setSpacing(True) # Create the Tree,a dd to layout self._tree = Tree('Hardware Inventory') self.addComponent(self._tree) # Contents from a (prefilled example) hierarchical container: self._tree.setContainerDataSource(ExampleUtil.getHardwareContainer()) # Add Valuechangelistener and Actionhandler self._tree.addListener(self, IValueChangeListener) # Add actions (context menu) self._tree.addActionHandler(self) # Cause valueChange immediately when the user selects self._tree.setImmediate(True) # Set tree to show the 'name' property as caption for items self._tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) self._tree.setItemCaptionMode( AbstractSelect.ITEM_CAPTION_MODE_PROPERTY) # Expand whole tree for idd in self._tree.rootItemIds(): self._tree.expandItemsRecursively(idd) # Create the 'editor bar' (textfield and button in a horizontallayout) self._editBar = HorizontalLayout() self._editBar.setMargin(False, False, False, True) self._editBar.setEnabled(False) self.addComponent(self._editBar) # textfield self._editor = TextField('Item name') self._editor.setImmediate(True) self._editBar.addComponent(self._editor) # apply-button self._change = Button('Apply', self) #, 'buttonClick') FIXME: listener self._editBar.addComponent(self._change) self._editBar.setComponentAlignment(self._change, Alignment.BOTTOM_LEFT)
def __init__(self): super(TreeSingleSelectExample, self).__init__() self.setSpacing(True) # Create the Tree,a dd to layout self._tree = Tree('Hardware Inventory') self.addComponent(self._tree) # Contents from a (prefilled example) hierarchical container: self._tree.setContainerDataSource(ExampleUtil.getHardwareContainer()) # Add Valuechangelistener and Actionhandler self._tree.addListener(self, IValueChangeListener) # Add actions (context menu) self._tree.addActionHandler(self) # Cause valueChange immediately when the user selects self._tree.setImmediate(True) # Set tree to show the 'name' property as caption for items self._tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME) self._tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY) # Expand whole tree for idd in self._tree.rootItemIds(): self._tree.expandItemsRecursively(idd) # Create the 'editor bar' (textfield and button in a horizontallayout) self._editBar = HorizontalLayout() self._editBar.setMargin(False, False, False, True) self._editBar.setEnabled(False) self.addComponent(self._editBar) # textfield self._editor = TextField('Item name') self._editor.setImmediate(True) self._editBar.addComponent(self._editor) # apply-button self._change = Button('Apply', self)#, 'buttonClick') FIXME: listener self._editBar.addComponent(self._change) self._editBar.setComponentAlignment(self._change, Alignment.BOTTOM_LEFT)