Directory

← Back

FlexLayout Add-on

Java API for CSS Flexbox

Author

Rating

Popularity

100+

FlexLayout is a UI component add-on for Vaadin 8. This add-on brings the configuration of CSS Flexbox to Java.

There's a handy builder style API for creating FlexLayout for all needs, for example you can make a vertical layout that wraps into columns with the following example code:

FlexLayout.create().vertical().wrap().alignItems().center().build();

The items in the columns will be horizontally in the middle if the column.

This add-on is implemented without the need for widgetset changes. It can be imported to a project without the need for client-side compilation.

Sample code

String[] testLabels = { "Test ", "Test String ", "Foo ", "Bar " };

FlexLayout columnLayout = FlexLayout.create().vertical().wrap()
        .alignItems().baseline().build();
columnLayout.setSizeFull();

IntStream.range(0, 100).boxed().map(i -> testLabels[i % 4] + i)
        .map(Label::new).forEach(columnLayout::addComponent);
FlexLayout tagLayout = new FlexLayout();
tagLayout.setFlexDirection(FlexDirection.Row);
tagLayout.setFlexWrap(FlexWrap.Wrap);
tagLayout.setAlignContent(AlignContent.FlexStart);

tagLayout.setWidth("400px");
tagLayout.setHeight("100%");

Stream.of("HTML", "CSS", "JavaScript", "Java", "Vaadin", "Undertow",
        "Internet Explorer", "Chrome", "Firefox", "Safari")
        .map(caption -> {
            Button button = new Button(caption);
            button.addStyleName(ValoTheme.BUTTON_LINK);
            button.addClickListener(
                    e -> tagLayout.removeComponent(button));
            return button;
        }).forEach(tagLayout::addComponent);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Released
2018-01-26
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.0+
Browser
Firefox
Safari
Google Chrome
Android Browser
Internet Explorer
Microsoft Edge

CDI Utils - Vaadin Add-on Directory

Utilities for CDI/Vaadin applications CDI Utils - Vaadin Add-on Directory
-------------------------------------------------- PROJECT DISCONTINUED! Replaced by the official Vaadin CDI plugin and CDI Properties & CDI MVP add-ons -------------------------------------------------- CDI is a JavaEE standard that consists of two fundamental parts: It allows you to bind bean instances to contexts with well-defined life-cycles and inject instances to beans in a type-safe way. CDI Utils add-on provides some utilities for CDI/Vaadin applications: -Custom CDI Context for Vaadin -Lightweight MVP framework -Producers for declaratively defined Vaadin components (@Preconfigured -annotation) -Built in i18n of @Preconfigured components Quick start (CDI Utils 2): 1. Add empty beans.xml -file (CDI marker file) to your project under WEB-INF dir 2. Add cdi-utils*.jar to your project 3. Annotate your UI with @UIScoped 4. Give the Vaadin servlet an init parameter "UIProvider" with the value "org.vaadin.virkki.cdiutils.application.CdiUIProvider" 5. Deploy to JavaEE/Web profile -compatible container Quick start (CDI Utils 1): 1. Add empty beans.xml -file (CDI marker file) to your project under WEB-INF dir 2. Add cdiutils*.jar to your project 3. Create your Application class by extending AbstractCdiApplication 4. Use CdiApplicationServlet instead of the normal ApplicationServlet 5. Deploy to JavaEE/Web profile -compatible container (CDI apps can also be run on servlet containers etc. but some further configuration is required) See the example projects at: CDI Utils 2: https://github.com/tomivirkki/cdiutils-addressbook/tree/vaadin7 CDI Utils 1: https://github.com/tomivirkki/cdiutils-addressbook
Source Code (CDI Utils 2)
CenterDevice project
Embedded Jetty, Vaadin and Weld
Source Code (CDI Utils 1)
Example project (CDI Utils 2)
Example project (CDI Utils 1)
Discussion Forum

CDI Utils version 0.9.9
VaadinContext and lots of other updates

CDI Utils version 1.0.0
null

CDI Utils version 1.1.0
Some bugfixes and improvements

CDI Utils version 2.0.1
Version for Vaadin 7 (beta 11)

CDI Utils version 1.2.0
Built in i18n of @Preconfigured Components

CDI Utils version 2.1.0
Version for Vaadin 7 rc 2

CDI Utils version 1.2.1
null

CDI Utils version 2.1.1
null

Online