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));
}

Links

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 release after rename from Maddon to Viritin. Contains lots of new helper for editing collection fields.

Released
2015-01-09
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.3+
Vaadin 7.6+ in 1.57
Vaadin 8.1+ in 2.1
Vaadin 7.4+ in 1.32
Vaadin 8.0+ in 2.0.alpha1
Browser
Browser Independent
Online