Refreshing Table ItemIcon

I have a table and a form much like the sample application. In my table i have a ItemIcon column, and “add” column the has a plus sign button and a “minus” column the has a minus sign button. On each of the plus and minus buttons is a click handler. The bean for each row has a few value properties. One of these properties is actually a calculated value as a difference between a value from the database and a “set” value from the user (using the plus and minus buttons). When this difference value drops below 0 i wish to show a warning in the itemIcon…other wise null. This all works EXCEPT the table doesnt repaint when it should. it will display the warning icon on the “next” paint…meaning when the difference value is at -1…clearly one paint behind. Conversly it wont remove until the value changed is 1 (not zero). Your first question of course is the code logic correct…well yes and for two reasons this is confirmed. 1) the associated form is updating correctly as the bean property value is changed…and 2) there is a piece of functionality on the table that allows the user to press a button to just see the items with the warning icon (filtered table). When this is pressed the correct rows display (due to the repaint). even the one that has the right diff value but isnt yet showing the icon…when the filtered view is displayed it then of course shows up…

here is the code for the addition click…basic stuff really the Crisis helper simply calls setItemIcon on the table and item to either the warning icon or null based onthe value “quantityDifference” being <0 or not.

there is another oddity here to. In order for the table to update correctly I actually have to “set” the difference property…even tho it’s read method is calculated. This is a weakness in the model design. I had to put in a lot of code to ensure the value retrieved was actually the calculated value regardless of what was “set” by calling code. Notice the line :[code]
item.getItemProperty(“quantityDifference”).setValue(robot.getQuantityDifference());//quantityDifference needed for UI update

[/code]

How can I get the table to show the warning icon right when the value changes to -1 ??? or conversly set to null (no icon) when value changes to 0 ???

public class AddRobotQuantityHandler  implements ClickListener {

VisitableTable _table;
	
	public AddRobotQuantityHandler(VisitableTable table){
		_table = table;
		
		
	}
	
	@Override
	public void buttonClick(ClickEvent event) {
		final Button source = event.getButton();
		if(source.getData().getClass().isAssignableFrom(Robot.class)){
		
			Robot robot = (Robot)source.getData();
			if(robot != null && _table != null){
				Item item = _table.getItem(robot);
				item.getItemProperty(Constants.Robot_Calculation_Field).setValue(robot.getCalculatedQuantity() + 1);
				item.getItemProperty("quantityDifference").setValue(robot.getQuantityDifference());//quantityDifference needed for UI update

				RobotCrisisHelper.setItemIcon(_table,robot);
				
				
			}
			
		}
		
		
	}

tried hack found at :
http://vaadin.com/forum/-/message_boards/view_message/248323
but that doesnt change icon on correct repaint either.

found the answer…or work around…not sure if this is appropriate but it does seem to work…would appreciate any comments…but after the call to set the icon i added the following two lines…

	_table.detach();
	_table.attach();