Cannot add new item to ComboBox

I want to use a ComboBox to input time-of-day. The data model in a bean is of type LocalTime from the joda library with getter and setter.
The conversion LocalTime<->String is done by a Converter.
The ComboBox should list some default values (08:00, 08:30, 09:00) but also allow the user to input any valid time (eg. 08:45). The ComboBox has setNewItemsAllowed(true)
When I type in a new value, as soon as the ComboBox loses focus it takes again the last value. The new item handler is not called.

What am I doing wrong?

Full working code showing the problem:

import java.util.Arrays;
import java.util.Locale;

import org.joda.time.LocalTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.vaadin.ui.ComboBox;
import com.vaadin.ui.VerticalLayout;

public class TestTab extends VerticalLayout {
  private static final Logger logger = LoggerFactory.getLogger(TestTab.class);
  private ComboBox startTime = new ComboBox("Begin: ", Arrays.asList("08:00","08:30","09:00"));
  private Converter<Object, LocalTime> converter = new LocalTimeConverter();

  public TestTab() {
    BeanItem<TestBean> item = new BeanItem<TestTab.TestBean>(new TestBean());
    FieldGroup fg = new FieldGroup();

    fg.bind(startTime, "time");
  public static class TestBean {
    private LocalTime time = new LocalTime(8,30);

    public LocalTime getTime() {
      logger.debug("Getting Time " + time);
      return time;

    public void setTime(LocalTime time) {
      logger.debug("Setting Time " + time);
      this.time = time;
  public static class LocalTimeConverter implements Converter<Object, LocalTime> {
    public LocalTime convertToModel(Object value, Class<? extends LocalTime> targetType, Locale locale) throws {
      logger.debug("Converting to model: " + value);
      return LocalTime.parse((String)value);

    public Object convertToPresentation(LocalTime value, Class<? extends Object> targetType, Locale locale) throws {
      logger.debug("Converting to presentation: " + value);
      return ((LocalTime)value).toString("HH:mm");
    public Class getModelType() {
      return LocalTime.class;

    public Class getPresentationType() {
      return String.class;

You say that the NewItemHandler isn’t called, but you haven’t posted the code for it. Here is a snippet I use in a project:

        final ComboBox producer = new ComboBox("Producer");
        producer.setNewItemHandler(new NewItemHandler() {
            public void addNewItem(String newItemCaption) {

I tested with a dummy new item handler with just a log statement in it, and never saw the corresponding log - so concluded that the handler is not called.
Also, as far as I understand, the default new item handle should be just fine for my case (only string value).

Just a thought: is the CB in immediate mode?

Thanks for the suggestion. In my example code, I guess it isn’t. Should it be, to allow adding values?
Will try it out and report back. (but out of office until 1st sept. - so after that)

Thanks! Setting in immediate mode solved the problem - now new items can be added!