Directory

← Back

Viritin

What apache-commons and Guava libraries does for Java, Viritin does it for Vaadin

Author

Contributors

Rating

Viritin is a server side enhancement library for Vaadin. It fixes some bad defaults in the core framework and provides more fluent and intelligent API for existing components. It also provides several major enhancements to databinding and provides completely new components made with server side composition (no widgetset is needed).

  • Better typed API for Table, Grid and various select components, easier to get started, better readability, safer refactoring. Endorsing java.util.collections and basic Java beans over proprietary Container-Item-Property.
  • Enhanced developer experience with extended basic layouts
  • Lots of handy Field implementations e.g. for common relation types (@ManyToMany, @OneToMany, @ElementCollection in JPA terminology, but not tied to JPA)
  • AbstractForm - a base class to avoid boilerplate code for basic entity editing
  • Enhancements to core Fields and BeanFieldGroup, better defaults, enhanced end user UX with on the fly validation
  • Setting browser cookies from basic Java code
  • Really scalable "lazy loading" solutions for Vaadin Components (see MTable, LazyComboBox, ListContainer + LazyList)
  • Often needed component compositions: PrimaryButton, ConfirmButton, DisclosurePanel ...
  • Cross-field validation support
  • Improved input fields
    • Support for custom HTML5 input properties (autocomplete, autocorrect...)
    • IntegerField (numeric keyboard on mobile devices, only accepts numbers, type of the field is Integer)
    • DoubleField
    • EmailField (email keyboard on mobile devices)

There is already a huge set of enhancements, couple of them are highlighted below. For a more complete view of what is provided, check out the project page in github for more details listing of examples. There is always room for enhancements and the project is easy to check out for development, so join the effort in github!

Sample code

MTable<Entity> t = new MTable(findBeans())
        .withProperties("property", "another")
        .withColumnHeaders("Property 1", "Second");
t.addMValueChangeListener(new MValueChangeListener<Entity>() {
    @Override
    public void valueChange(MValueChangeEvent<Entity> event) {
        editEntity(event.getValue());
    }
});
// with Viritin
setContent(new MVerticalLayout(new MHorizontalLayout(c, d).withFullWidth())
                .expand(new MHorizontalLayout(menu).expand(mainContent)));

// same without Viritin

  VerticalLayout wrapper = new VerticalLayout();
        wrapper.setMargin(true);
        wrapper.setSpacing(true);
        wrapper.setHeight("100%");
        HorizontalLayout toolbar = new HorizontalLayout(c, d);
        toolbar.setWidth("100%");
        toolbar.setMargin(false);
        toolbar.setSpacing(true);
        HorizontalLayout wrapper2 = new HorizontalLayout();
        wrapper2.addComponent(menu);
        wrapper2.addComponent(mainContent);
        wrapper2.setSizeFull();
        mainContent.setSizeFull();
        wrapper2.setExpandRatio(mainContent, 1);
        wrapper.addComponents(toolbar, wrapper2);
        wrapper.setExpandRatio(wrapper2, 1);
        setContent(wrapper);
MTable<Update> table;

@Inject
GPSRouteService s;

@PostConstruct
void init() {
    add(table = new MTable<>(s::fetchUpdates, s::getEntityCount));
}

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

First alpha release supporting V8. Lot of V8 related support still to be implemented, but "org.viritin.v7" compatibility package should now allow projects to start converting to Vaadin 8. See Vaadin 8 upgrade in wiki for more details.

Released
2017-02-27
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.0+
Vaadin 7.3+ in 1.22
Vaadin 7.6+ in 1.57
Vaadin 8.1+ in 2.1
Vaadin 7.4+ in 1.32
Browser
Browser Independent

Vaadin Add-on Directory

Find open-source widgets, add-ons, themes, and integrations for your Vaadin application. Vaadin Add-on Directory
Online