Directory

← Back

Jefferson

Declarative UIs in pure Java

Author

Rating

Popularity

<100

Like Thomas Jefferson advocated a "wall of separation between church and state," the Jefferson add-on helps you create a clean separation between presentation and content in your Vaadin app.

Benefits/Advantages:

  • Style your content without touching your application logic.
  • Core API of only 4 classes.
    • Convenience classes included for common use cases.
  • Makes your content structure more discoverable, readable and understandable.
  • Encapsulates your views, making your code more modular and easier to change or reuse.
  • Plays nicely with MVC and MVP.
  • NEW in 1.3: Now includes a time-saving SmartPresentation that automatically lays out your content with minimal input required, letting you do rapid prototyping.

Jefferson lets you define your content structure separately from your app's data and behavior, and then lets you render this content with any presentation you like. Your content defines only the semantic structure of your app on screen, while your presentation gets to decide exactly what Components to render them with and how to style them. Once these two have been put together, all that is left is to implement the logic that injects the data and defines your app's behavior, which you can do as you would in any other Vaadin app.

For best practices, see the demo project to the right and the code examples below.

Sample code

public class SimpleAddressBook extends SimpleComposite {
    …
    private ContactEditor contactEditor = new ContactEditor();
    private ContactList contactList = new ContactList();
    private ButtonControl contactAdd = new ButtonControl(
            ADD_CONTACT, new ContactAddHandler());
    private ContactRemoveControl contactRemoveControl = new ContactRemoveControl(
            contactList);
    private SimpleComposite nav = new SimpleComposite(NAVIGATION);
    private SimpleComposite toolbar = new SimpleComposite(TOOLBAR);

    public SimpleAddressBookView() {
        super("Content root");

        setChildren(
                nav.setChildren(
                        contactList,
                        toolbar.setChildren(
                                contactAdd,
                                contactRemoveControl,
                                new FilterControl(
                                        Contact.LAST_NAME, contactList),
                                new FilterControl(
                                        Contact.FIRST_NAME, contactList),
                                new FilterControl(
                                        Contact.COMPANY, contactList))),
                contactEditor);
        …
    }
    …
}
public class SimpleAddressBookDemo extends Application {

    @Override
    public void init() {
        setMainWindow(new Window("Address Book",
                new SmartPresentation(Orientation.HORIZONTAL).visit(
                        new SimpleAddressBookView())));
    }
}

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

Vaadin 7 compatibility

Released
2012-04-13
Maturity
EXPERIMENTAL
License
GNU Affero General Public License v3.0

Compatibility

Framework
Vaadin 7.0+
Vaadin 6.5+ in 1.3.0
Browser
Browser Independent

Jefferson - Vaadin Add-on Directory

Declarative UIs in pure Java Jefferson - Vaadin Add-on Directory
Like Thomas Jefferson advocated a "wall of separation between church and state," the Jefferson add-on helps you create a clean separation between presentation and content in your Vaadin app. Benefits/Advantages: * Style your content without touching your application logic. * Core API of only 4 classes. - Convenience classes included for common use cases. * Makes your content structure more discoverable, readable and understandable. * Encapsulates your views, making your code more modular and easier to change or reuse. * Plays nicely with MVC and MVP. * NEW in 1.3: Now includes a time-saving SmartPresentation that automatically lays out your content with minimal input required, letting you do rapid prototyping. Jefferson lets you define your content structure separately from your app's data and behavior, and then lets you render this content with any presentation you like. Your content defines only the semantic structure of your app on screen, while your presentation gets to decide exactly what Components to render them with and how to style them. Once these two have been put together, all that is left is to implement the logic that injects the data and defines your app's behavior, which you can do as you would in any other Vaadin app. For best practices, see the demo project to the right and the code examples below.
Online