Focus lost on addition of new row in Table

Hi,

I’m new to Vaadin and stuck with an issue where focus on cell get lost.
Scenario is on pressing tab blur listener of a cell is called and I’m adding a new row but the cell focus doesn’t move to next cell. Tried many ways to get the focus on the next cell but unable to get it.
Please help. Thanks in advance.

Code Snippet:

/**

  • This method adds an empty row on focus of any cell of last row.
    */
    private void fieldBlurListener(final Object itemId, final BeanItemContainer tableContainer,
    final TextField field) {
    field.addBlurListener(new BlurListener() {

               @Override
               public void blur(BlurEvent event) {
                   if (tableContainer.lastItemId().equals(itemId)) {
                       VaraStaticModel model = new VaraStaticModel();
                       addRow(model);
                   }                       
               }
           });
       }
    
/**
 * This method adds a row in the table and updates the row count.
 */
@Override
public void addRow(VaraStaticModel row) {
    row.getCheckBox().addValueChangeListener(getValueChangeListener());
    container.addBean(row);    
    this.updateRowcount();
}

public void updateRowcount(){
int i = 1;
for(VaraStaticModel model:container.getItemIds()) {
model.setRowCount(i++);
}
}

Hi guys,

This issue got resolved using the following cool link:

http://ramontalaverasuarez.blogspot.co.at/2014/06/vaadin-7-detect-enter-key-in-textfield.html

A big thanks to my friend Gerald.