public PersonTableView(final IViewContext context, final IBeanTableModel<IPerson> model) { final IContainer container = context.getContainer(); container.setLayout(MigLayoutFactory.growingInnerCellLayout()); final ICapApiBluePrintFactory cbpf = CapUiToolkit.bluePrintFactory(); final IBeanTable<IPerson> table = container.add(cbpf.beanTable(model), MigLayoutFactory.GROWING_CELL_CONSTRAINTS); table.getCellPopMenu().addAction(PersonLongLastingActionFactory.create(model)); }
public UserTableView( final IViewContext context, final IBeanTableModel<IUser> tableModel, final ValueHolder<Integer> parameter) { this.beanTableModel = tableModel; this.parameter = parameter; final IContainer container = context.getContainer(); container.setLayout(MigLayoutFactory.growingInnerCellLayout()); this.table = container.add( CapUiToolkit.bluePrintFactory().beanTable(beanTableModel), MigLayoutFactory.GROWING_CELL_CONSTRAINTS); final IToolBarModel toolBar = context.getToolBar(); toolBar.addContainer(createDelayFieldCreator()); toolBar.addAction(createClearAction()); toolBar.addAction(createPackAction()); table.getCellPopMenu().addAction(new ChangeGenderAction(tableModel)); table.getCellPopMenu().addAction(new ChangeBirthdayAction(tableModel)); table.getCellPopMenu().addAction(new LongLastingAction(tableModel)); table.getCellPopMenu().addAction(new CreateTransientUserAction(table)); table.getCellPopMenu().addSeparator(); // example for dynamic menu final Random random = new Random(); final IMenuModel dynamicMenuModel = createDynamicMenuModelStub(); table.getCellPopMenu().addItem(dynamicMenuModel); table.addCellMenuListener( new IPopupMenuListener<ITableCellPopupEvent>() { @Override public void beforeMenuShow(final ITableCellPopupEvent event) { fillDynamicMenuModel(dynamicMenuModel, random, event); } }); beanTableModel.load(); }