Problems with UI events not emerging

For some reason, on both CheckBoxes and PopupDateFields, I can’t seem to register any events at all. I don’t know why, and frankly, it’s making me lose hope with Vaadin. I’m using version 6.7.9. Any assistance or guidance would be greater appreciated.



  mainLayout = new AbsoluteLayout();

  private CheckBox checkbox1 = new CheckBox();
  private CheckBox checkbox2 = new CheckBox();
  private CheckBox checkbox3 = new CheckBox();
  private CheckBox checkbox4 = new CheckBox();
  private CheckBox checkbox5 = new CheckBox();

  addListenerCheckBoxField(checkbox1);
  addListenerCheckBoxField(checkbox2);
  addListenerCheckBoxField(checkbox3);
  addListenerCheckBoxField(checkbox4);
  addListenerCheckBoxField(checkbox5);

  mainLayout.addComponent(checkbox1, "top:40.0px;left:500.0px;");
  mainLayout.addComponent(checkbox2, "top:60.0px;left:500.0px;");
  mainLayout.addComponent(checkbox3, "top:80.0px;left:500.0px;");
  mainLayout.addComponent(checkbox4, "top:100.0px;left:500.0px;");
  mainLayout.addComponent(checkbox5, "top:120.0px;left:500.0px;");

  private void addListenerCheckBoxField(final CheckBox cb) {
    System.out.println("Inside CheckBox listener");
    cb.addListener(new Button.ClickListener() {

      public void buttonClick(final Button.ClickEvent event) {
        System.out.println(event.toString() + " matches  " + cb.getCaption());
        getMainWindow().showNotification(event + " matches button " + cb.getCaption());
      }
    });
    cb.addListener(new Property.ValueChangeListener() {

      public void valueChange(ValueChangeEvent event) {
        System.out.println(event.toString() + "  matches " + cb.getCaption());
        getMainWindow().showNotification(event + " matches " + cb.getCaption());
      }
    });

  }

Hi, you need to call setImmediate(true) for your checkboxes. By default, Vaadin tries to optimize communication by queuing non-immediate events until an immediate one is sent. This is mostly a backwards compatibility feature. Click events should typically always be immediate, but CheckBox click events aren’t really well-supported and are there only because CheckBox extends Button in Vaadin 6.

BTW, 6.7.9 is awfully old; the newest release in the Vaadin 6 series is 6.8.10. And then there’s Vaadin 7 which is very much recommended for non-legacy projects.

Thank you. That was the issue. When I started the project 6.7.9 was the newest version. When I get to a point where release is done, I’ll be looking into upgrading the Vaadin number. As far as I can tell, it’s mostly bug fixes, but none of the bugs were the cause of the issues I was having.