I’ve boiled down my application to the following:
[code]
package com.accesspoint.vaadin4;
import com.vaadin.annotations.Theme;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
@Theme(“valo”)
public class HLTest extends UI
{
@Override
protected void init(VaadinRequest request)
{
final VerticalLayout pageLayout = new VerticalLayout();
final CheckBox showCostCheckBox = new CheckBox("Xx");
final CheckBox showNrcCheckBox = new CheckBox("Yy");
showNrcCheckBox.addValueChangeListener
(
new ValueChangeListener()
{ @Override public void valueChange(Property.ValueChangeEvent event)
{
System.out.println("boo");
}
}
);
pageLayout.setMargin(true);
pageLayout.setSpacing(true);
pageLayout.addComponents(showCostCheckBox, showNrcCheckBox);
setContent(pageLayout);
}
}
[/code]I’ve done this with and without the change listener and the setting of margin and spacing; they have their expected effects, but make no difference to the basic problem: On this system, (Windows 7, NetBeans, TomCat, Chrome), the two checkboxes appear as already checked, and clicking on them does not change their state.
Clicking on one does activate the listener when I have one. I even tried setting the state to false at that point, and though it recursed once, it didn’t change the display.
I (and someone else) ran this code on another machine, and it runs as expected there. So my question is: What could cause this on my machine? I deleted all files in all Vaadin projects in NetBeans, then uninstalled and reinstalled the Vaadin plugin for NetBeans, and rebooted the machine. I created a new source file to contain the text, and pasted in just the text in the above Java file (i.e., I did NOT copy over all the supporting files, but am using the ones generated by the “new project” and just put text into new classes in it).
I did break out the servlet code from the “MyUI” into its own class, and changed it to invoke the above class instead of MyUI; hopefully that doesn’t break checkboxes.
So what else can I check? I just can’t imagine what could be causing the checkboxes to fail so miserably when I haven’t done much beyond the demo application.