protected Grid createMetadataGrid() { final Grid metadataGrid = new Grid(); metadataGrid.addStyleName(SPUIStyleDefinitions.METADATA_GRID); metadataGrid.setImmediate(true); metadataGrid.setHeight("100%"); metadataGrid.setWidth("100%"); metadataGrid.setId(UIComponentIdProvider.METDATA_TABLE_ID); metadataGrid.setSelectionMode(SelectionMode.SINGLE); metadataGrid.setColumnReorderingAllowed(true); metadataGrid.setContainerDataSource(getMetadataContainer()); metadataGrid.getColumn(KEY).setHeaderCaption(i18n.getMessage("header.key")); metadataGrid.getColumn(VALUE).setHeaderCaption(i18n.getMessage("header.value")); metadataGrid.getColumn(VALUE).setHidden(true); metadataGrid.addSelectionListener(this::onRowClick); metadataGrid.getColumn(DELETE_BUTTON).setHeaderCaption(""); metadataGrid.getColumn(DELETE_BUTTON).setRenderer(new HtmlButtonRenderer(this::onDelete)); metadataGrid.getColumn(DELETE_BUTTON).setWidth(50); metadataGrid.getColumn(KEY).setExpandRatio(1); return metadataGrid; }
public ReleasesView() { setSizeFull(); setMargin(false); ButtonBar buttonBar = new ButtonBar(); addButton = buttonBar.addButton("Add", FontAwesome.PLUS, e -> add()); editButton = buttonBar.addButton("Edit", FontAwesome.EDIT, e -> edit()); exportButton = buttonBar.addButton("Export", FontAwesome.DOWNLOAD, e -> export()); archiveButton = buttonBar.addButton("Archive", FontAwesome.ARCHIVE, e -> archive()); // TODO add support for the archive button archiveButton.setVisible(false); finalizeButton = buttonBar.addButton("Finalize", FontAwesome.CUBE, e -> finalize()); addComponent(buttonBar); enableDisableButtonsForSelectionSize(0); grid = new Grid(); grid.setSizeFull(); grid.setSelectionMode(SelectionMode.MULTI); grid.addItemClickListener(e->rowClicked(e)); grid.addSelectionListener((e) -> rowSelected(e)); container = new BeanItemContainer<>(ReleasePackage.class); grid.setContainerDataSource(container); grid.setColumns("name", "versionLabel", "releaseDate", "released"); grid.sort("releaseDate", SortDirection.DESCENDING); addComponent(grid); setExpandRatio(grid, 1); progressBar = new ProgressBar(0.0f); }
protected void buildGrid() { grid = new Grid(); grid.setSelectionMode(SelectionMode.NONE); grid.setSizeFull(); grid.setEditorEnabled(!readOnly); container = new BeanItemContainer<Record>(Record.class); grid.setContainerDataSource(container); grid.setColumnOrder("entityName", "attributeName", "excelMapping"); HeaderRow filterRow = grid.appendHeaderRow(); addColumn("entityName", filterRow); addColumn("attributeName", filterRow); TextField tfExcelMapping = new TextField(); tfExcelMapping.addBlurListener(e->saveExcelMappingSettings()); tfExcelMapping.setWidth(100, Unit.PERCENTAGE); tfExcelMapping.setImmediate(true); grid.getColumn("excelMapping").setEditorField(tfExcelMapping).setExpandRatio(1); addShowPopulatedFilter("excelMapping", filterRow); grid.setEditorBuffered(false); addComponent(grid); setExpandRatio(grid, 1); }
/** * Finds the {@link SelectionMode} associated with the given itemType * through the {@link GridSelectionMode} annotation that may be placed on * ITEM type. * * @param itemType * @return the {@link SelectionMode} configured to given itemType or * {@link SelectionMode#NONE} if no mode annotation is specified. */ public static <ITEM> SelectionMode discoverSelectionMode(Class<ITEM> itemType) { if (itemType == null) { return null; } if (itemType.isAnnotationPresent(GridSelectionMode.class)) { return selectionModeMap.get(itemType.getAnnotation(GridSelectionMode.class).value()); } return SelectionMode.NONE; }
@Test public void test() { Person p1 = new Person(1, "John", LocalDate.of(1990, Month.JANUARY, 2)); Person p2 = new Person(2, "George", LocalDate.of(1991, Month.JUNE, 19)); Person p3 = new Person(3, "Tim", LocalDate.of(1995, Month.APRIL, 7)); StyleGenerator<Person> styleGenerator = person -> "test"; FTreeGrid<Person> tree = new FTreeGrid<Person>(Person.class).withCaption("My Tree", true) .withDescription("description", ContentMode.HTML) .withCollapseListener(event -> System.out.println("collapsed")) .withExpandListener(event -> System.out.println("expanded")) .withItemClickListener(event -> System.out.println("clicked")) .withItems(p1, p2, p3) .withItemCollapseAllowedProvider(person -> person.getId() > 1) .withSelectionMode(SelectionMode.MULTI) .withSelectionListener(event -> System.out.println("selected")) .withRowHeight(14) .withStyleGenerator(styleGenerator) .withHierarchyColumn("name"); assertEquals("My Tree", tree.getCaption()); assertEquals("description", tree.getDescription()); assertEquals(1, tree.getListeners(CollapseEvent.class).size()); assertEquals(1, tree.getListeners(ExpandEvent.class).size()); assertEquals(1, tree.getListeners(ItemClick.class).size()); assertTrue(tree.getSelectionModel() instanceof MultiSelectionModel); assertEquals(styleGenerator, tree.getStyleGenerator()); assertTrue(tree.getDataProvider() instanceof HierarchicalDataProvider); assertEquals("name", tree.getHierarchyColumn().getId()); }
@Override public void enter(ViewChangeEvent event) { leftLayout = new VerticalLayout(); rightLayout = new VerticalLayout(); infoLayout = new VerticalLayout(); infoLayout.setSpacing(false); infoLayout.setMargin(false); attackButton = new Button("Attaquer", VaadinIcons.SWORD); attackButton.addStyleName(ValoTheme.BUTTON_LARGE); attackButton.addStyleName(ValoTheme.BUTTON_PRIMARY); attackButton.setVisible(false); Grid<Monster> monsterGrid = new Grid<>(); monsterGrid.setSelectionMode(SelectionMode.SINGLE); monsterGrid.addColumn(Monster::getChallengeRating).setCaption("DD").setId("challengeRating"); monsterGrid.addColumn(Monster::getName).setCaption("Nom").setId("name"); monsterGrid.setItems(Services.getMonsterService().findAll()); monsterGrid.addSelectionListener(selection -> { showMonsterInfo(selection.getFirstSelectedItem()); }); leftLayout.addComponent(monsterGrid); rightLayout.addComponents(infoLayout, attackButton); addComponents(leftLayout, rightLayout); setWidth(100, Unit.PERCENTAGE); setExpandRatio(leftLayout, 1); setExpandRatio(rightLayout, 1); }
private void initGrid(final Grid grid) { // Add some columns DeleteButtonRenderer deleteButton = new DeleteButtonRenderer(new DeleteRendererClickListener() { @Override public void click(DeleteRendererClickEvent event) { grid.getContainerDataSource().removeItem(event.getItem()); } },FontAwesome.TRASH.getHtml()+" Delete",FontAwesome.CHECK.getHtml()+" Confirm"); deleteButton.setHtmlContentAllowed(true); grid.addColumn("action", Boolean.class); grid.getColumn("action").setEditable(false); grid.getColumn("action").setRenderer(deleteButton); grid.addColumn("col1", String.class); grid.addColumn("col2", String.class); for (int i = 0; i < 5; ++i) { grid.addColumn("col" + (i + 3), Integer.class); } grid.addColumn("col8", Date.class); grid.addColumn("col10", Boolean.class); grid.addColumn("col11", String.class); ComboBox comboBox = new ComboBox(); comboBox.addItems("Soft","Medium","Hard"); grid.getColumn("col11").setEditorField(comboBox); // Make column 2 read only to test statically read only columns grid.getColumn("col2").setEditable(false); Random rand = new Random(); for (int i = 0; i < 100; ++i) { grid.addRow(true,"string 1 " + i, "string 2 " + i, rand.nextInt(i + 10), rand.nextInt(i + 10), rand.nextInt(i + 10), rand.nextInt(i + 10), rand.nextInt(i + 10), new Date(), false, "Medium"); } grid.setSelectionMode(SelectionMode.SINGLE); grid.setSizeFull(); }
private Grid createGrid() { final Grid statusGrid = new Grid(uploads); statusGrid.addStyleName(SPUIStyleDefinitions.UPLOAD_STATUS_GRID); statusGrid.setSelectionMode(SelectionMode.NONE); statusGrid.setHeaderVisible(true); statusGrid.setImmediate(true); statusGrid.setSizeFull(); return statusGrid; }
/** * Init selection mode */ private void initSelectionMode() { final CheckBox checkBox = new CheckBox("Multi Select"); addComponent(checkBox); checkBox.setImmediate(true); checkBox.setValue(false); checkBox.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = -1261311232228188664L; @Override public void valueChange(ValueChangeEvent event) { if (checkBox.getValue()) { grid.setSelectionMode(SelectionMode.MULTI); grid.recalculateColumnWidths(); // Seems to be some bug in Vaadin Grid when expand ration is // not given the column shrinks and this is visible when // selection mode is single for (Column column : grid.getColumns()) { column.setExpandRatio(1); } } else { grid.setSelectionMode(SelectionMode.SINGLE); } } }); }
/** * Sets the default properties of grid */ protected void setDefaultGridProperties() { grid.setSelectionMode(SelectionMode.SINGLE); grid.removeColumn("id"); grid.removeColumn("sales2012.totalSales"); grid.removeColumn("sales2013.totalSales"); grid.removeColumn("sales2014.totalSales"); grid.setImmediate(true); grid.setHeightMode(HeightMode.CSS); for (Column column : grid.getColumns()) { column.setExpandRatio(1); } }
private void initLayout(){ setMargin(true); setSpacing(true); // vaadin table grid = new Grid<Customer>(Customer.class); grid.setDataProvider(mongodbContainer); // set columns grid.setColumnOrder(mongodbContainer.PROPERTIES); grid.setSelectionMode(SelectionMode.SINGLE); grid.setWidth("100%"); grid.setHeight("300px"); // table select listener grid.addSelectionListener(event -> { selectedCustomer = event.getFirstSelectedItem().get(); selectedId = selectedCustomer.getId(); LOG.info("Selected item id {"+ selectedId+"}"); }); // button bar final AbstractLayout buttonBar = initButtonBar(); buttonBar.setWidth("100%"); // edit Form editForm.setVisible(false); addComponent(grid); addComponent(buttonBar); addComponent(editForm); }
protected void buildGrid() { grid = new Grid(); grid.setEditorEnabled(true); grid.setSizeFull(); grid.setSelectionMode(SelectionMode.SINGLE); grid.setColumns("projectName","newDeployName","newDeployVersion", "newDeployType","existingDeployName","existingDeployVersion", "existingDeployType","upgrade"); container = new BeanItemContainer<>(DeploymentLine.class); buildContainer(); grid.setContainerDataSource(container); grid.sort("projectName", SortDirection.DESCENDING); }
protected void buildPanel(String introText) { this.setSpacing(true); this.setSizeFull(); this.addComponent(new Label(introText)); grid.setSizeFull(); grid.setSelectionMode(SelectionMode.MULTI); BeanItemContainer<ReleasePackage> container = new BeanItemContainer<>(ReleasePackage.class); container.addAll(configService.findReleasePackages()); grid.setContainerDataSource(container); grid.setColumns("name", "versionLabel", "releaseDate"); grid.addSelectionListener((e) -> rowSelected()); this.addComponent(grid); this.setExpandRatio(grid, 1); }
protected void buildGrid() { grid = new Grid(); grid.setSelectionMode(SelectionMode.NONE); grid.setSizeFull(); grid.setEditorEnabled(!readOnly); container = new BeanItemContainer<Record>(Record.class); grid.setContainerDataSource(container); grid.setColumns("entityName", "attributeName", "xpath"); HeaderRow filterRow = grid.appendHeaderRow(); addColumn("entityName", filterRow); addColumn("attributeName", filterRow); ComboBox combo = new ComboBox(); combo.addValueChangeListener(e->saveXPathSettings()); combo.setWidth(100, Unit.PERCENTAGE); combo.setImmediate(true); combo.setNewItemsAllowed(true); combo.setInvalidAllowed(true); combo.setTextInputAllowed(true); combo.setScrollToSelectedItem(true); combo.setFilteringMode(FilteringMode.CONTAINS); grid.getColumn("xpath").setEditorField(combo).setExpandRatio(1); addShowPopulatedFilter("xpath", filterRow); grid.setEditorBuffered(false); addComponent(grid); setExpandRatio(grid, 1); }
public ReportParameterTable(String caption, String parameterName, Class<T> tableClass, SingularAttribute<T, String> displayField) { super(caption, parameterName); init(caption, tableClass, displayField); setSelectionMode(SelectionMode.MULTI); }
public ReportParameterTable(String caption, String parameterName, Class<T> tableClass, SingularAttribute<T, String> displayField, Long defaultValue) { super(caption, parameterName); init(caption, tableClass, displayField); this.defaultValue = defaultValue; setSelectionMode(SelectionMode.MULTI); }
void setSelectionMode(final SelectionMode mode) { UI ui = UI.getCurrent(); if (ui != null) { Runnable runner = new Runnable() { @Override public void run() { if (mode == SelectionMode.MULTI) { grid.setSelectionMode(SelectionMode.MULTI); grid.setSelectionModel(new Grid.MultiSelectionModel()); } else if (mode == SelectionMode.SINGLE) { grid.setSelectionMode(SelectionMode.SINGLE); grid.setSelectionModel(new Grid.SingleSelectionModel()); } else { throw new RuntimeException("SelectionMode none not supported"); } } }; UI.getCurrent().accessSynchronously(runner); } else { logger.warn("No vaadin session available, not setting up UI"); } }
@Test public void test() { Person p1 = new Person(1, "John", LocalDate.of(1990, Month.JANUARY, 2)); Person p2 = new Person(1, "George", LocalDate.of(1991, Month.JUNE, 19)); Person p3 = new Person(1, "Tim", LocalDate.of(1995, Month.APRIL, 7)); List<Person> persons = Arrays.asList(p1, p2, p3); ListDataProvider<Person> dataProvider = DataProvider.ofCollection(persons); FGrid<Person> grid = new FGrid<Person>(Person.class).withColumns("name", "birthday") .withSelectionMode(SelectionMode.SINGLE) .withFrozenColumnCount(1) .withHeaderVisible(false) .withFooterVisible(false) .withRowHeight(25) .withColumnReorderingAllowed(false) .withHeightByRows(12) .withDataProvider(dataProvider) .withSort("birthday", SortDirection.DESCENDING); grid.withItemClickListener(event -> grid.setDetailsVisible(event.getItem(), !grid.isDetailsVisible(event.getItem()))) .withDetailsGenerator(person -> new Label(person.getName())) .withSortListener(event -> System.out.println("sort changed")); Column<Person, ?> birthdayColumn = grid.getColumn("birthday"); assertNotNull(grid.getColumn("name")); assertNotNull(birthdayColumn); assertTrue(grid.getSelectionModel() instanceof SingleSelectionModel); assertEquals(1, grid.getFrozenColumnCount()); assertFalse(grid.isHeaderVisible()); assertFalse(grid.isFooterVisible()); assertFalse(grid.isColumnReorderingAllowed()); assertEquals(25, grid.getRowHeight(), 0); assertEquals(12, grid.getHeightByRows(), 0); assertEquals(dataProvider, grid.getDataProvider()); assertEquals(birthdayColumn, grid.getSortOrder().get(0).getSorted()); assertEquals(SortDirection.DESCENDING, grid.getSortOrder().get(0).getDirection()); assertEquals(1, grid.getListeners(ItemClick.class).size()); assertEquals(1, grid.getListeners(SortEvent.class).size()); }
@Test public void test() { Person p1 = new Person(1, "John", LocalDate.of(1990, Month.JANUARY, 2)); Person p2 = new Person(2, "George", LocalDate.of(1991, Month.JUNE, 19)); Person p3 = new Person(3, "Tim", LocalDate.of(1995, Month.APRIL, 7)); List<Person> persons = Arrays.asList(p1, p2, p3); ItemCaptionGenerator<Person> captionGenerator = Person::getName; IconGenerator<Person> iconProvider = person -> VaadinIcons.USER; StyleGenerator<Person> styleGenerator = person -> "test"; FTree<Person> tree = new FTree<Person>().withCaption("My Tree", true) .withContentMode(ContentMode.HTML) .withDescription("description", ContentMode.HTML) .withCollapseListener(event -> System.out.println("collapsed")) .withExpandListener(event -> System.out.println("expanded")) .withAutoRecalculateWidth(false) .withItemCaptionGenerator(captionGenerator) .withItemClickListener(event -> System.out.println("clicked")) .withItemIconGenerator(iconProvider) .withItems(persons) .withItemCollapseAllowedProvider(person -> person.getId() > 1) .withSelectionMode(SelectionMode.MULTI) .withSelectionListener(event -> System.out.println("selected")) .withRowHeight(14) .withStyleGenerator(styleGenerator) .withWidth("50%") .withId("treeId"); assertEquals("My Tree", tree.getCaption()); assertEquals("treeId", tree.getId()); assertEquals("description", tree.getDescription()); assertFalse(tree.isAutoRecalculateWidth()); assertEquals(1, tree.getListeners(CollapseEvent.class).size()); assertEquals(1, tree.getListeners(ExpandEvent.class).size()); assertEquals(1, tree.getListeners(ItemClick.class).size()); assertTrue(tree.getSelectionModel() instanceof MultiSelectionModel); assertEquals(captionGenerator, tree.getItemCaptionGenerator()); assertEquals(iconProvider, tree.getItemIconGenerator()); assertEquals(styleGenerator, tree.getStyleGenerator()); assertEquals(50, tree.getWidth(), 0); assertEquals(Unit.PERCENTAGE, tree.getWidthUnits()); assertTrue(tree.getDataProvider() instanceof HierarchicalDataProvider); }
@SuppressWarnings("unchecked") @Override public void enter(final ViewChangeEvent event) { eventbus.register(this); setSizeFull(); // caption caption.addStyleName("h2"); // toolbar createToolbar(); beanContainer = new BeanContainer<>(AbstractSimulatedDevice.class); beanContainer.setBeanIdProperty(ID_COL); grid.setSizeFull(); grid.setCellStyleGenerator(new CellStyleGenerator() { private static final long serialVersionUID = 1L; @Override public String getStyle(final CellReference cellReference) { return cellReference.getPropertyId().equals(STATUS_COL) ? "centeralign" : null; } }); grid.setSelectionMode(SelectionMode.NONE); grid.setContainerDataSource(beanContainer); grid.appendHeaderRow().getCell(RESPONSE_STATUS_COL).setComponent(responseComboBox); grid.setColumnOrder(ID_COL, STATUS_COL, SWVERSION_COL, PROGRESS_COL, TENANT_COL, PROTOCOL_COL, RESPONSE_STATUS_COL, NEXT_POLL_COUNTER_SEC_COL); // header widths grid.getColumn(STATUS_COL).setMaximumWidth(80); grid.getColumn(PROTOCOL_COL).setMaximumWidth(180); grid.getColumn(RESPONSE_STATUS_COL).setMaximumWidth(240); grid.getColumn(NEXT_POLL_COUNTER_SEC_COL).setMaximumWidth(210); grid.getColumn(NEXT_POLL_COUNTER_SEC_COL).setHeaderCaption("Next Poll in (sec)"); grid.getColumn(SWVERSION_COL).setHeaderCaption("SW Version"); grid.getColumn(RESPONSE_STATUS_COL).setHeaderCaption("Response Update Status"); grid.getColumn(PROGRESS_COL).setRenderer(new ProgressBarRenderer()); grid.getColumn(PROTOCOL_COL).setConverter(createProtocolConverter()); grid.getColumn(STATUS_COL).setRenderer(new HtmlRenderer(), createStatusConverter()); grid.removeColumn(TENANT_COL); // grid combobox responseComboBox.setItemIcon(ResponseStatus.SUCCESSFUL, FontAwesome.CHECK_CIRCLE); responseComboBox.setItemIcon(ResponseStatus.ERROR, FontAwesome.EXCLAMATION_CIRCLE); responseComboBox.setNullSelectionAllowed(false); responseComboBox.setValue(ResponseStatus.SUCCESSFUL); responseComboBox.addValueChangeListener( valueChangeEvent -> beanContainer.getItemIds().forEach(itemId -> beanContainer.getItem(itemId) .getItemProperty(RESPONSE_STATUS_COL).setValue(valueChangeEvent.getProperty().getValue()))); // add all components addComponent(caption); addComponent(toolbar); addComponent(grid); setExpandRatio(grid, 1.0F); // load beans repository.getAll().forEach(beanContainer::addBean); }
public ReqRespTabSheet(String caption, boolean editable) { setCaption(caption); setHeight(15, Unit.EM); setWidth(550, Unit.PIXELS); addStyleName(ValoTheme.TABSHEET_COMPACT_TABBAR); payloadLayout = new VerticalLayout(); payloadLayout.setSizeFull(); payload = new TextArea(); payload.setNullRepresentation(""); payload.setSizeFull(); payloadLayout.addComponent(payload); addTab(payloadLayout, "Payload"); VerticalLayout requestHeadersLayout = new VerticalLayout(); requestHeadersLayout.setSizeFull(); if (editable) { HorizontalLayout requestHeadersButtonLayout = new HorizontalLayout(); Button addButton = new Button("+", (e) -> add()); addButton.addStyleName(ValoTheme.BUTTON_SMALL); Button deleteButton = new Button("-", (e) -> delete()); deleteButton.addStyleName(ValoTheme.BUTTON_SMALL); requestHeadersButtonLayout.addComponent(addButton); requestHeadersButtonLayout.addComponent(deleteButton); requestHeadersLayout.addComponent(requestHeadersButtonLayout); } headersGrid = new Grid(); headersGrid.setEditorEnabled(editable); headersGrid.setEditorSaveCaption("Save"); headersGrid.setEditorCancelCaption("Cancel"); headersGrid.setSelectionMode(SelectionMode.SINGLE); headersGrid.setSizeFull(); headersGrid.addColumn("headerName").setHeaderCaption("Header").setEditable(true) .setExpandRatio(1); headersGrid.addColumn("headerValue").setHeaderCaption("Value").setEditable(true) .setExpandRatio(1); requestHeadersLayout.addComponent(headersGrid); requestHeadersLayout.setExpandRatio(headersGrid, 1); addTab(requestHeadersLayout, "Headers"); }
public SelectionModel setSelectionMode(SelectionMode selectionMode) { return grid.setSelectionMode(selectionMode); }
public ReportParameterTableSingleSelect(String caption, String parameterName, Class<T> tableClass, SingularAttribute<T, String> displayField) { super(caption, parameterName, tableClass, displayField); setSelectionMode(SelectionMode.SINGLE); }
public ReportParameterTableSingleSelect(String caption, String parameterName, Class<T> tableClass, SingularAttribute<T, String> displayField, Long defaultValue) { super(caption, parameterName, tableClass, displayField, defaultValue); setSelectionMode(SelectionMode.SINGLE); }
@Override public <T extends Serializable> void createBasicBeanItemNestedPropertiesGrid(final AbstractOrderedLayout panelContent,final Class<T> dataType, final List<T> datasource, final String caption, final String[] nestedProperties, final String[] columnOrder, final String[] hideColumns, final AbstractPageItemRendererClickListener<?> listener, final String actionId, final ListPropertyConverter[] collectionPropertyConverters) { final Grid<T> grid = new Grid<T>(caption).withPropertySet(BeanPropertySet.get(dataType)); grid.setItems(datasource.stream().filter(Objects::nonNull) .collect(Collectors.toList())); grid.setSelectionMode(SelectionMode.SINGLE); createNestedProperties(grid, nestedProperties); configureColumnOrdersAndHiddenFields(columnOrder, hideColumns, grid); configureListeners(listener, grid); setColumnConverters(collectionPropertyConverters, grid); grid.setSizeFull(); grid.setStyleName("Level2Header"); createGridCellFilter(columnOrder, grid,dataType); grid.setResponsive(true); panelContent.addComponent(grid); panelContent.setExpandRatio(grid, ContentRatio.GRID); }
/** * Sets the tree's selection mode. * <p> * The built-in selection modes are: * <ul> * <li>{@link SelectionMode#SINGLE} <b>the default model</b></li> * <li>{@link SelectionMode#MULTI}</li> * <li>{@link SelectionMode#NONE} preventing selection</li> * </ul> * * @param selectionMode * the selection mode to switch to, not {@code null} * @return this for method chaining * @see Tree#setSelectionMode(Grid.SelectionMode) * * @see SelectionMode */ @SuppressWarnings("unchecked") public default THIS withSelectionMode(SelectionMode selectionMode) { ((Tree<ITEM>) this).setSelectionMode(selectionMode); return (THIS) this; }
/** * Sets the grid's selection mode. * <p> * The built-in selection models are: * <ul> * <li>{@link SelectionMode#SINGLE} -< {@link SingleSelectionModelImpl}, * <b>the default model</b></li> * <li>{@link SelectionMode#MULTI} -< {@link MultiSelectionModelImpl}, with * checkboxes in the first column for selection</li> * <li>{@link SelectionMode#NONE} -< {@link NoSelectionModel}, preventing * selection</li> * </ul> * <p> * To use your custom selection model, you can use * {@link Grid#setSelectionModel(GridSelectionModel)}, see existing selection * model implementations for example. * * @param selectionMode * the selection mode to switch to, not {@code null} * @return this for method chaining * @see Grid#setSelectionMode(SelectionMode) */ @SuppressWarnings("unchecked") public default THIS withSelectionMode(SelectionMode selectionMode) { ((Grid<ITEM>) this).setSelectionMode(selectionMode); return (THIS) this; }