Table - setupTableFieldFactory not giving the itemIds

Hi team,

I have one table that is editable, i have created container and added items to the container everything is fine, but when i wanted to display some basic validatons to my table fileds i am struglling a lot,i am not getting the item Ids for all( i am getting few item ids such that i cant able to proceed in setupTableField factory, i am new bie to vaadin kindly help me.

here is the code for your refrence.

/**
* adds one row to the bottom of the table, by filling the bottom table will also fetech the top table data reason is to pre fill few of the
* columns data.
*/
public void addNewRow() {
Container container = new IndexedContainer();
container = buildContainer(newRowUnbalanceErrorType);
this.setContainerDataSource(container);
componentEvents();
}

private IndexedContainer buildContainer(UnbalanceErrorType newUnbalanceErrorType) {
container.addContainerProperty(ErrorManagementEnum.SALES_MARKET.getText(), String.class, null);
container.addContainerProperty(ErrorManagementEnum.TRANSACTON_DATE.getText(), Date.class, null);
container.addContainerProperty(ErrorManagementEnum.CATEGORY_DESCRIPTION, ComboBox.class, null);
container.addContainerProperty(ErrorManagementEnum.TYPE.getText(), ComboBox.class, null);
container.addContainerProperty(ErrorManagementEnum.TAX.getText(), ComboBox.class, null);
container.addContainerProperty(ErrorManagementEnum.REGION.getText(), String.class, null);
container.addContainerProperty(ErrorManagementEnum.DEBITCREDIT.getText(), TextField.class, null);
container.addContainerProperty(ErrorManagementEnum.ACCOUNT_ID.getText(), ComboBox.class, null);
container.addContainerProperty(ErrorManagementEnum.COSTCENTER.getText(), ComboBox.class, null);
container.addContainerProperty(ErrorManagementEnum.AMOUNT.getText(), TextField.class, null);
container.addContainerProperty(ErrorManagementEnum.CURRENCY.getText(), ComboBox.class, null);
container.addContainerProperty(ErrorManagementEnum.CUSTOMER_ID.getText(), Long.class, null);
container.addContainerProperty(ErrorManagementEnum.ORDER_DATE.getText(), Date.class, null);
container.addContainerProperty(ErrorManagementEnum.ORDER_ID.getText(), String.class, null);
container.addContainerProperty(ErrorManagementEnum.SPEC_NO.getText(), DateField.class, null);
container.addContainerProperty(ErrorManagementEnum.USER_ID.getText(), String.class, null);
container.addContainerProperty(ErrorManagementEnum.VER_NO_SERIES.getText(), Integer.class, null);
addItem(container, newUnbalanceErrorType);
return container;
}

[size=1]
/**
* One row will be added to the UnbalanceErrorCreateNewTable object.
*
* @param container
* @param unbalanceErrorType
*/
private void addItem(IndexedContainer container, UnbalanceErrorType unbalanceErrorType) {
itemId = container.addItem();

    loadCategoryAndCurrencyComboBoxesAndSpecField(unbalanceErrorType);

    container.getItem(itemId).getItemProperty(ErrorManagementEnum.SALES_MARKET.getText()).setValue(unbalanceErrorType.getSalesMarket());
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.TRANSACTON_DATE.getText()).setValue(unbalanceErrorType.getTransactionDate());
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.CATEGORY_DESCRIPTION).setValue(categoriesAndCategoryDescriptionComboBox);
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.TYPE.getText()).setValue(transactionIdsAndDescriptionComboBox);
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.TAX.getText()).setValue(taxComboBox);
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.REGION.getText()).setValue(unbalanceErrorType.getRegion());
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.DEBITCREDIT.getText()).setValue(debitCreditTextField);
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.ACCOUNT_ID.getText()).setValue(accountIdsComboBox);
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.COSTCENTER.getText()).setValue(costCenterCodesComboBox);
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.AMOUNT.getText()).setValue(amountTextField);
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.CURRENCY.getText()).setValue(currencyComboBox);
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.CUSTOMER_ID.getText()).setValue(unbalanceErrorType.getCustomerId());
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.ORDER_DATE.getText()).setValue(unbalanceErrorType.getOrderDate());
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.ORDER_ID.getText()).setValue(unbalanceErrorType.getOrderId());
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.SPEC_NO.getText()).setValue(specNoField);
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.USER_ID.getText()).setValue(unbalanceErrorType.getUserId());
    container.getItem(itemId).getItemProperty(ErrorManagementEnum.VER_NO_SERIES.getText()).setValue(unbalanceErrorType.getVerNoSeries());
}

[/size]

now comming my table field factory.

private void setupTableFieldFactory() {
this.setTableFieldFactory(new DefaultFieldFactory() {
private static final long serialVersionUID = 1L;
@Override
public Field<?> createField(Container container, Object itemId, Object propertyId, com.vaadin.ui.Component uiContext) {

            [color=#FF0000]

[b]
System.out.println(" ITEM ID ------- >>>> " + container.getItem(itemId));

            System.out.println(" Property ID  ------- >>>> " + propertyId);

[/b]
[/color]

            TextField tField = null;
            DateField dField = null;
            if (container.getContainerProperty(itemId, propertyId).getType() == Date.class) {
                dField = (DateField) super.createField(container, itemId, propertyId, uiContext);
                dField.setDateFormat("yyyyMMdd");
                dField.setBuffered(true);
                Entry<Object, Object> tableCell = new SimpleImmutableEntry<Object, Object>(propertyId, itemId);
                dField.setData(tableCell);
                addFieldListeners(dField);
            }if (container.getContainerProperty(itemId, propertyId).getType() == ComboBox.class) {
                
                System.out.println("Combob box also called ...........................");
                
            }  
            if (container.getContainerProperty(itemId, propertyId).getType() == TextField.class) { 
                tField = (TextField) super.createField(container, itemId, propertyId, uiContext);
                Entry<Object, Object> tableCell = new SimpleImmutableEntry<Object, Object>(propertyId, itemId);
                tField.setData(tableCell);
                tField.setBuffered(true);
                addFieldListeners(tField);
            }
            if (propertyId.equals(ErrorManagementEnum.SPEC_NO.getText())) {
                dField.setWidth("7em");
                dField.setRequired(true);
                dField.setRequiredError(MESSAGE_FIELD_REQUIRED);
                //tField.addValidator(verificationNoValidator);
                TextFieldValidatingWrapper<TextField> wField = new GeneralTextFieldValidatingWrapper(tField, "");
                return wField;
            }
            if (propertyId.equals(ErrorManagementEnum.VER_NO_SERIES.getText())) {
                tField = (TextField) super.createField(container, itemId, propertyId, uiContext);
                Entry<Object, Object> tableCell = new SimpleImmutableEntry<Object, Object>(propertyId, itemId);
                tField.setData(tableCell);
                tField.setBuffered(true);
                addFieldListeners(tField);
            
                tField.setWidth("7em");
                tField.setRequired(true);
                tField.setNullRepresentation("");
                tField.setRequiredError(MESSAGE_FIELD_REQUIRED);
                tField.addValidator(verificationNoValidator);
                TextFieldValidatingWrapper<TextField> wField = new GeneralTextFieldValidatingWrapper(tField, "");
                return wField;
            }
             else {
                return null;
            }
        }
    });
    
    this.setEditable(true);
}

above i am not getting the all item Ids from the container i am getting few of them.


ITEM ID ------- >>>> DE 2014-03-20 null null null – null null null 107494338 2014-03-20 030304 Wed Apr 09 00:00:00 CEST 2014 HWW8351 2

please find the screen shot of the UI.
what i am doing wrong,


My requirement is just show asterstic on each mandatory filed and minimal validation

13545.png