All Table values not automatically updating during commit

I’m working on a prototype with Vaadin that has a split panel. There’s a readonly table on the left and a form on the right. Both the table and form share the same BeanItemContainer implementation.

The problem I’m seeing is that when commit() is called on the form, only some of the display columns in the table are automatically refreshed. I’m wondering if this is a bug, or if I need to do something more to force the repaint.

As an example, one of the columns not auto-updating with the saved values in the table after commit is a status column. By contrast, name DOES automatically update the display. One thing that is different about the status column is that the form uses a Field Factory to return an Option Group for it:


public Field createField(Item item, Object propertyId, Component uiContext){
			
		String pid = (String)propertyId;
[indent]

if ("name".equals(pid)){
			Field nameField = super.createField(item, propertyId, uiContext);
			nameField.setRequired(true);
			nameField.setRequiredError("Name is required");
			return nameField;
}
else if ("status".equals(pid)){
			OptionGroup radioGroup = new OptionGroup("Status");
			Character active = new Character('A');
			radioGroup.addItem(active);
			radioGroup.setItemCaption(active, "Active");
			Character inactive = new Character('I');
			radioGroup.addItem(inactive);
			radioGroup.setItemCaption(inactive, "Inactive");
			return radioGroup;
}

[/indent]
}

Another difference is that the table uses a wrapper method in the POJO for the status. The table uses ‘displayStatus’ while the form uses ‘status’.

So the POJO has:


private char status;

public void setStatus(char st) { this.status = st; }

public char getStatus() {return this.status;}

public Character getDisplayStatus() {return new Character(this.getStatus());}

and the setup is:


// Visible properties for the form
form.setVisibleItemProperties( new Object[] {"name", "description", "status", .......} );

// Visible columns for the table
setVisibleColumns(new Object[] {"name", "displayStatus"});

From the debugging code in my form as below, I can see that the underlying Item and its properties in the container really has been updated appropriately after the commit, it’s just that the display is not updating.


// The status output really is the updated status.  Why doesn't the status data in the table refresh???
commit();// Pushes updates to the container
System.out.println("Status in container: "+this.getItemDataSource().getItemProperty("status"));
System.out.println("DisplayStatus in container: "+this.getItemDataSource().getItemProperty("displayStatus"));

If I subsequently perform a user-initiated action on the table, like sort a column or click a row, at that time the status display updates.

Has anyone seen this before? Know of a workaround?

As I understand it, the reason the table displayStatus was not auto-updating is because the form element was mapped to a different Property - status. It seems that having a simple wrapper as below is not enough to trigger the table to be repainted:


public Character getDisplayStatus() {return new Character(this.getStatus());}

As a workaround, I used displayStatus for both the form and the table display, and wrapped it around the char status, which is used elsewhere in the app for database activities.


public void setDisplayStatus(Character c){
    	this.displayStatus = c;
    	this.setStatus(c.charValue());
    }
    
    
    public Character getDisplayStatus() {        
    	return Character.valueOf(this.getStatus());
    }