Java Code Examples for com.vaadin.ui.VerticalLayout#setHeightUndefined()

The following examples show how to use com.vaadin.ui.VerticalLayout#setHeightUndefined() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DashboardMenu.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private VerticalLayout buildLinksAndVersion() {
    final VerticalLayout links = new VerticalLayout();
    links.setSpacing(true);
    links.addStyleName("links");
    final String linkStyle = "v-link";

    if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
        final Link docuLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_DOCUMENTATION,
                i18n.getMessage("link.documentation.name"), uiProperties.getLinks().getDocumentation().getRoot(),
                FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle);
        docuLink.setSizeFull();
        links.addComponent(docuLink);
        links.setComponentAlignment(docuLink, Alignment.BOTTOM_CENTER);
    }

    if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
        final Link userManagementLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_USERMANAGEMENT,
                i18n.getMessage("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
                FontAwesome.USERS, "_blank", linkStyle);
        links.addComponent(userManagementLink);
        userManagementLink.setSizeFull();
        links.setComponentAlignment(userManagementLink, Alignment.BOTTOM_CENTER);
    }

    if (!uiProperties.getLinks().getSupport().isEmpty()) {
        final Link supportLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_SUPPORT,
                i18n.getMessage("link.support.name"), uiProperties.getLinks().getSupport(), FontAwesome.ENVELOPE_O,
                "", linkStyle);
        supportLink.setSizeFull();
        links.addComponent(supportLink);
        links.setComponentAlignment(supportLink, Alignment.BOTTOM_CENTER);

    }

    final Component buildVersionInfo = buildVersionInfo();
    links.addComponent(buildVersionInfo);
    links.setComponentAlignment(buildVersionInfo, Alignment.BOTTOM_CENTER);
    links.setSizeFull();
    links.setHeightUndefined();
    return links;
}
 
Example 2
Source File: DemoContentLayout.java    From GridExtensionPack with Apache License 2.0 4 votes vote down vote up
public DemoContentLayout() {
	final SelectGrid<TestObject> grid = new SelectGrid<>();
	grid.addColumn(TestObject::getFoo).setCaption("Foo");
	grid.addColumn(TestObject::getBar, new NumberRenderer()).setCaption("Bar");
	grid.addColumn(TestObject::getKm, new NumberRenderer()).setCaption("KM");
	grid.setHeightByRows(10);
	grid.setHeightMode(HeightMode.ROW);

	// Show it in the middle of the screen
	setStyleName("demoContentLayout");
	setSizeFull();
	addComponent(grid);
	setComponentAlignment(grid, Alignment.MIDDLE_CENTER);

	final TableSelectionModel<TestObject> tableSelect = new TableSelectionModel<>();
	grid.setSelectionModel(tableSelect);
	tableSelect.setMode(TableSelectionMode.CTRL);

	HorizontalLayout tableSelectionControls = new HorizontalLayout();
	tableSelectionControls.setCaption("Table Selection Controls");

	// Controls for testing different TableSelectionModes
	for (final TableSelectionMode t : TableSelectionMode.values()) {
		tableSelectionControls.addComponent(new Button(t.toString(), e -> tableSelect.setMode(t)));
	}

	addComponent(tableSelectionControls);

	// TODO: PagingDataProvider

	PagedDataProvider<TestObject, SerializablePredicate<TestObject>> dataProvider = new PagedDataProvider<>(
			DataProvider.ofCollection(TestObject.generateTestData(995)));
	grid.setDataProvider(dataProvider);
	PagingControls pagingControls = dataProvider.getPagingControls();

	HorizontalLayout pages = new HorizontalLayout();
	pages.setCaption("Paging controls");
	pages.addComponent(new Button("First", e -> pagingControls.setPageNumber(0)));
	pages.addComponent(new Button("Previous", e -> pagingControls.previousPage()));
	pages.addComponent(new Button("Next", e -> pagingControls.nextPage()));
	pages.addComponent(new Button("Last", e -> pagingControls.setPageNumber(pagingControls.getPageCount() - 1)));
	VerticalLayout controls = new VerticalLayout();
	controls.addComponents(tableSelectionControls, pages);
	controls.setWidth("100%");
	controls.setHeightUndefined();
	controls.setComponentAlignment(tableSelectionControls, Alignment.MIDDLE_CENTER);
	controls.setComponentAlignment(pages, Alignment.BOTTOM_CENTER);
	addComponent(controls);
	setComponentAlignment(controls, Alignment.MIDDLE_CENTER);

	grid.getEditor().setEnabled(true);
	for (Column<TestObject, ?> c : grid.getColumns()) {
		c.setHidable(true);
	}
}