Displaying and setting Singleton object in user form.

I am a new user and so far am very impressed with Vaadin. One example I see missing, and it is the problem that I have while working with Vaadin is displaying and setting singelton (or enum) object inside the model.

For example: I have the following model:
public class Model {
private Singleton sValue;
private int iValue;
getters/ setters;

public Singleton {
public static final Singleton ONE = new Singleton(1, “one”);
public static final Singleton TWO = new Singleton(2, “two”);
public static final Singleton allValues = {ONE, TWO};
private final String name;
private final int id;
private Singleton(int id, String name) { …}
getters/ no setters
//don’t use to String!!

Now, I want to display an editable form for Model, with text box for iValue, and with combo box displaying Singleton.name, with default of the value being passed in the Model instance, and combo box having all possible singleton names. Once user selects a name, the singleton value is looked up and Model instance is saved.

Is it possible to do with Vaadin? Is there an example code?

Thank you,


Hi Henry,

I had a similar problem. You will have add a custom field factory to your form that creates a combo box with the enum values as its items.


Could you please post a pseudo code or link to an example on how to do that. I think the problem I am describing is very basic and it would be beneficial to have a sample of how should work with Vaadin.

Thank you,