Chrome vs Firefox on table.getContainerDataSource()

Hi guys,

Im having problem with mozilla firefox… all is well running in chrome but when I use firefox it does not get the value from the textfield inside my table.

Firefox:

(UI)


(output)


Chrome:

(UI)


(output)


I cant figure out what’s missing in my codes.


                    Collection attendanceTableCollection = table.getContainerDataSource().getItemIds();
                    List<String> attendanceList = new ArrayList<String>();
                    for(int i = 0; i < attendanceTableCollection.size(); i++){
                        String str = table.getItem(i).toString();
                        attendanceList.add(str);
                        System.out.println(attendanceList.get(i));
                    }

doesnt work with IE8 as well… :frowning:

anyone, PLEASE? :frowning:

Hard to say anything with the minimal information you provided - no information on what you do, in which situation the values seem not to be saved (moving focus? clicking a button? something else?), which Vaadin version is used, code for the table and its field factory (if any), how you make the table editable, …

Also, it might be better to wait a little longer before bumping the thread… if you need immediate answers, purchasing support might be a better option for you.

If I would venture a guess here: maybe the editor fields generated (by a FieldFactory?) are not immediate.

Well, you have two problems with this post.

  1. The second image isn’t showing.
  2. There’s no code showing how the table is built, nor an an explanation of what it is you want to actually happen.

I can almost guarantee you that the title to to this post is wrong : table#getContainerDataSource() will work identically on both FireFox & Chrome (and Safari and Opera) - because it has nothing to do with the browser at all - t works on the server, not the browser.

So : try and create a
small, complete self-contained example
(Application + Window) whereby you can reproduce the problem, that shows what you want to happen and what is happening. It would then be easier for us to help you. (I would add that I’ve actually not used editable tables, so I might not be able to help you anyway…)

It’s actually entirely possible that you will actually discover what the problem is yourself : I often find that by trying to illustrate the problem, the process of simplification shows what the problem actually is!

Cheers,

Charles.

Hi Henri,

I only posted a minimal information thinking that it might have to do with the browser only, when I click the button in chrome browser all inputs that was inserted in a textfield are being shown in the output and none in firefox. I already set as immediate but still the same as previous output.

Hi Charles, I still dont get it why in chrome, all data that has been inserted in a textfield shown in the output and not in firefox…

here’s the code that generates my table. I’m using Vaadin 6.8


ComponentContainer attendanceTableContainer(final Window subWindow, final Table table, final List dates, final String paydayPeriod, final String salaryDate){
        //subWindow = new Window("ATTENDANCE TABLE for "+employeesName.getValue());
        subWindow.setWidth("90%");
        
        table.removeAllItems();
        table.setEnabled(true);
        table.setWidth("100%");
        table.setImmediate(true);
                
        table.addContainerProperty("date", String.class, null);
        table.addContainerProperty("policy", ComboBox.class, null);
        table.addContainerProperty("holidays", ComboBox.class, null); 
        table.addContainerProperty("lp", CheckBox.class, null); 
        table.addContainerProperty("lates", TextField.class, null);    
        table.addContainerProperty("up", CheckBox.class, null);
        table.addContainerProperty("undertime", TextField.class, null); 
        table.addContainerProperty("op", CheckBox.class, null);
        table.addContainerProperty("overtime", TextField.class, null);        
        table.addContainerProperty("night differential", TextField.class, null);  
        table.addContainerProperty("l/min", String.class, null); 
        table.addContainerProperty("u/min", String.class, null); 
        table.addContainerProperty("o/min", String.class, null);
        table.addContainerProperty("nd/min", String.class, null);
        table.addContainerProperty("lholiday", String.class, null);
        table.addContainerProperty("sholiday", String.class, null);
        table.addContainerProperty("wdo", String.class, null);
        
        table.setColumnAlignment("date", Table.ALIGN_CENTER);
        table.setColumnAlignment("policy", Table.ALIGN_CENTER);
        table.setColumnAlignment("lp", Table.ALIGN_CENTER);
        table.setColumnAlignment("lates", Table.ALIGN_CENTER);
        table.setColumnAlignment("up", Table.ALIGN_CENTER);
        table.setColumnAlignment("undertime", Table.ALIGN_CENTER);
        table.setColumnAlignment("op", Table.ALIGN_CENTER);
        table.setColumnAlignment("overtime", Table.ALIGN_CENTER);
        table.setColumnAlignment("night differential", Table.ALIGN_CENTER);
        table.setColumnAlignment("l/min", Table.ALIGN_RIGHT);
        table.setColumnAlignment("u/min", Table.ALIGN_RIGHT);
        table.setColumnAlignment("o/min", Table.ALIGN_RIGHT);
        table.setColumnAlignment("nd/min", Table.ALIGN_RIGHT);
        table.setColumnAlignment("lholiday", Table.ALIGN_RIGHT);
        table.setColumnAlignment("sholiday", Table.ALIGN_RIGHT);
        table.setColumnAlignment("wdo", Table.ALIGN_RIGHT);
        
        for(int i = 0; i < dates.size(); i++){
            Object itemId = new Integer(i);
            final AttendanceProcess attendanceProcess = new AttendanceProcess();            
            
            final ComboBox holidays = new ComboBox();
            holidays.setEnabled(false);
            holidays.setWidth("120px");
            holidays.setNullSelectionAllowed(true);
            holidays.setImmediate(true);
            holidays.addItem("legalHoliday");
            holidays.addItem("specialHoliday");
            holidays.setData(itemId);
            
            final CheckBox lp = new CheckBox();
            lp.setData(itemId);
            lp.setImmediate(true);
            
            final TextField lates = new TextField();
            lates.setWidth("50px");
            lates.setData(itemId);
            lates.setImmediate(true);
            
            final CheckBox up = new CheckBox();
            up.setData(itemId);
            up.setImmediate(true);
            
            final TextField undertime = new TextField();
            undertime.setWidth("50px");
            undertime.setData(itemId);
            undertime.setImmediate(true);
            
            final CheckBox op = new CheckBox();
            op.setData(itemId);
            op.setImmediate(true);
            
            final TextField overtime = new TextField();
            overtime.setWidth("50px");
            overtime.setData(itemId);
            overtime.setImmediate(true);
            
            final TextField nightDifferential = new TextField();
            nightDifferential.setWidth("50px");
            nightDifferential.setData(itemId);
            nightDifferential.setImmediate(true);
            
            final ComboBox policy = new ComboBox();
            policy.setWidth("120px");
            policy.setNullSelectionAllowed(true);
            policy.setImmediate(true);
            policy.addItem("absent");
            policy.addItem("dayOff");
            policy.addItem("workingDayOff");
            policy.addItem("paternityLeave");
            policy.addItem("serviceIncentiveLeave");
            policy.addItem("holiday");
            policy.addItem("workingHoliday");
            policy.addItem("paidVacationLeave");
            policy.addItem("paidSickLeave");
            policy.addItem("unpaidVacationLeave");
            policy.addItem("unpaidSickLeave");
            policy.addItem("suspended");
            policy.addItem("resigned");
            policy.setData(itemId);       
            policy.addListener(new Property.ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {  
                    Object itemId = policy.getData();
                    Item item = table.getItem(itemId);
                    String str = (String) event.getProperty().getValue();
                    //Double debt = Double.parseDouble(str);
                    if(str == null){                                                
                        holidays.setEnabled(false);
                        lp.setEnabled(true);
                        lates.setEnabled(true);
                        up.setEnabled(true);
                        undertime.setEnabled(true);
                        op.setEnabled(true);
                        overtime.setEnabled(true);
                        nightDifferential.setEnabled(true);
                        item.getItemProperty("wdo").setValue(null);
                    }else if(str.equals("workingHoliday")){
                        holidays.setEnabled(true);
                        lp.setEnabled(true);
                        lates.setEnabled(true);
                        up.setEnabled(true);
                        undertime.setEnabled(true);
                        op.setEnabled(true);
                        overtime.setEnabled(true);
                        nightDifferential.setEnabled(true);
                        item.getItemProperty("wdo").setValue(null);
                    }else if(str.equals("workingDayOff")){
                        holidays.setEnabled(false);
                        lp.setEnabled(true);
                        lates.setEnabled(true);
                        up.setEnabled(true);
                        undertime.setEnabled(true);
                        op.setEnabled(true);
                        overtime.setEnabled(true);
                        nightDifferential.setEnabled(true);
                                                
                        double additionalWorkingDayOffRate = attendanceProcess.processAdditionalWorkingDayOff(wage);
                        item.getItemProperty("wdo").setValue(new Double(df.format(additionalWorkingDayOffRate)));
                    }else{
                        holidays.setEnabled(false);
                        lp.setEnabled(false);
                        lates.setEnabled(false);
                        up.setEnabled(false);
                        undertime.setEnabled(false);
                        op.setEnabled(false);
                        overtime.setEnabled(false);
                        nightDifferential.setEnabled(false);
                        item.getItemProperty("wdo").setValue(null);
                    }                    
                }

            });            
            
            holidays.addListener(new Property.ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    Object itemId = holidays.getData();
                    Item item = table.getItem(itemId);
                    double additionalHolidayRate;
                    String str = (String) event.getProperty().getValue();
                    
                    if(str == null){
                        item.getItemProperty("sholiday").setValue(null);
                        item.getItemProperty("lholiday").setValue(null);
                    }else if(str.equals("legalHoliday")){
                        additionalHolidayRate = attendanceProcess.processAdditionalHolidayRate(event.getProperty().getValue().toString(), wage);
                        item.getItemProperty("lholiday").setValue(new Double(df.format(additionalHolidayRate)));
                        item.getItemProperty("sholiday").setValue(null);
                    }else{
                        additionalHolidayRate = attendanceProcess.processAdditionalHolidayRate(event.getProperty().getValue().toString(), wage);
                        item.getItemProperty("sholiday").setValue(new Double(df.format(additionalHolidayRate)));
                        item.getItemProperty("lholiday").setValue(null);
                    }
                    
                }
                
            });
            
            lp.addListener(new Property.ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    Object itemId = lp.getData();
                    Item item = table.getItem(itemId);
                    
                    boolean value = (Boolean) event.getProperty().getValue();
                    if(value == true){
                        latesPremiumRate = 0.1; 
                    }else{
                        latesPremiumRate = 0.0;
                    }
                    
                    String policies = null, holiday = null;                    
                     
                    if(policy.getValue() != null){
                        policies = policy.getValue().toString();
                    }
                    
                    if(holidays.getValue() != null){
                        holiday = holidays.getValue().toString();
                    }
                    
                    if(!lates.getValue().toString().trim().isEmpty()){
                        latePerMinute = Double.parseDouble(lates.getValue().toString().trim());
                        lateDeduction = attendanceProcess.processEmployeesLates(policies, holiday, latePerMinute, wage);
                        item.getItemProperty("l/min").setValue(lateDeduction);
                    }else{
                        item.getItemProperty("l/min").setValue(null);
                    }
                    
                    if(!undertime.getValue().toString().trim().isEmpty()){
                        latePerMinute = Double.valueOf(undertime.getValue().toString().trim()).doubleValue();
                        undertimeDeduction = attendanceProcess.processEmployeesLates(policies, holiday, latePerMinute, wage);
                    }                   
                    
                    if(!lates.getValue().toString().trim().isEmpty()){
                        if(!undertime.getValue().toString().trim().isEmpty()){                            
                            deduction = lateDeduction + undertimeDeduction + 
                                    (lateDeduction * latesPremiumRate) + (undertimeDeduction * undertimePremiumRate);
                            item.getItemProperty("l/min").setValue(new Double(df.format(lateDeduction + (lateDeduction * latesPremiumRate))));
                        }else{
                            deduction = lateDeduction + (lateDeduction * latesPremiumRate);
                            item.getItemProperty("l/min").setValue(new Double(df.format(deduction)));
                        }                      
                    }else{
                        item.getItemProperty("l/min").setValue(null);
                        if(!undertime.getValue().toString().trim().isEmpty()){
                            deduction = undertimeDeduction + (undertimeDeduction * undertimePremiumRate);
                        }else{
                            deduction = null;
                        }
                    }
                    if(deduction != null){
                        deduction = new Double(df.format(deduction));
                    }                    
                    //item.getItemProperty("deduction").setValue(deduction);
                    
                }
                
            });
            
            lates.addListener(new FieldEvents.TextChangeListener() {
                
                @Override
                public void textChange(TextChangeEvent event) {
                    Object itemId = lates.getData();
                    Item item = table.getItem(itemId);                    
                                       
                    String policies = null, holiday = null;                    
                     
                    if(policy.getValue() != null){
                        policies = policy.getValue().toString();
                    }
                    
                    if(holidays.getValue() != null){
                        holiday = holidays.getValue().toString();
                    }
                    
                    if(!event.getText().isEmpty()){
                        latePerMinute = Double.parseDouble(event.getText().trim());
                        lateDeduction = attendanceProcess.processEmployeesLates(policies, holiday, latePerMinute, wage);
                        item.getItemProperty("l/min").setValue(lateDeduction);
                    }else{
                        item.getItemProperty("l/min").setValue(null);
                    }
                    
                    if(!undertime.getValue().toString().trim().isEmpty()){
                        latePerMinute = Double.valueOf(undertime.getValue().toString().trim()).doubleValue();
                        undertimeDeduction = attendanceProcess.processEmployeesLates(policies, holiday, latePerMinute, wage);
                    }                   
                    
                    if(!event.getText().trim().isEmpty()){
                        if(!undertime.getValue().toString().trim().isEmpty()){                            
                            deduction = lateDeduction + undertimeDeduction + 
                                    (lateDeduction * latesPremiumRate) + (undertimeDeduction * undertimePremiumRate);
                            item.getItemProperty("l/min").setValue(new Double(df.format(lateDeduction + (lateDeduction * latesPremiumRate))));
                        }else{
                            deduction = lateDeduction + (lateDeduction * latesPremiumRate);
                            item.getItemProperty("l/min").setValue(new Double(df.format(deduction)));
                        }
                                               
                    }else{
                        item.getItemProperty("l/min").setValue(null);
                        if(!undertime.getValue().toString().trim().isEmpty()){
                            deduction = undertimeDeduction + (undertimeDeduction * undertimePremiumRate);
                        }else{
                            deduction = null;
                        }                        
                    }
                    if(deduction != null){
                        deduction = new Double(df.format(deduction));
                    }                    
                    //item.getItemProperty("deduction").setValue(deduction);
                }
                
            });            
            
            up.addListener(new Property.ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    Object itemId = lp.getData();
                    Item item = table.getItem(itemId);
                    
                    boolean value = (Boolean) event.getProperty().getValue();
                    if(value == true){
                        undertimePremiumRate = 0.1; 
                    }else{
                        undertimePremiumRate = 0.0;
                    }
                    
                    String policies = null, holiday = null;
                    
                    if(policy.getValue() != null){
                        policies = policy.getValue().toString();
                    } 
                    
                    if(holidays.getValue() != null){
                        holiday = holidays.getValue().toString();
                    }
                    
                    if(!lates.getValue().toString().trim().isEmpty()){
                        latePerMinute = Double.valueOf(lates.getValue().toString().trim()).doubleValue();
                        lateDeduction = attendanceProcess.processEmployeesLates(policies, holiday, latePerMinute, wage);
                    }
                    
                    if(!undertime.getValue().toString().trim().isEmpty()){
                        latePerMinute = Double.parseDouble(undertime.getValue().toString().trim());
                        undertimeDeduction = attendanceProcess.processEmployeesLates(policies, holiday, latePerMinute, wage);
                        item.getItemProperty("u/min").setValue(undertimeDeduction);
                    }else{
                        item.getItemProperty("u/min").setValue(null);
                    }
                    
                    if(!undertime.getValue().toString().trim().isEmpty()){
                        if(!lates.getValue().toString().trim().isEmpty()){                            
                            deduction = lateDeduction + undertimeDeduction + 
                                    (undertimeDeduction * undertimePremiumRate) + (lateDeduction * latesPremiumRate);
                            item.getItemProperty("u/min").setValue(new Double(df.format(undertimeDeduction + (undertimeDeduction * undertimePremiumRate))));
                        }else{
                            deduction = undertimeDeduction + (undertimeDeduction * undertimePremiumRate);
                            item.getItemProperty("u/min").setValue(new Double(df.format(deduction)));
                        }
                                               
                    }else{
                        item.getItemProperty("u/min").setValue(null);
                        if(!lates.getValue().toString().trim().isEmpty()){
                            deduction = lateDeduction + (lateDeduction * latesPremiumRate);
                        }else{
                            deduction = null;
                        }                        
                    }
                    if(deduction != null){
                        deduction = new Double(df.format(deduction));
                    }                    
                    //item.getItemProperty("deduction").setValue(deduction);
                    
                }
                
            });
            
            undertime.addListener(new FieldEvents.TextChangeListener() {

                @Override
                public void textChange(TextChangeEvent event) {
                    Object itemId = lates.getData();
                    Item item = table.getItem(itemId);
                                        
                    String policies = null, holiday = null;
                    
                    if(policy.getValue() != null){
                        policies = policy.getValue().toString();
                    } 
                    
                    if(holidays.getValue() != null){
                        holiday = holidays.getValue().toString();
                    }
                    
                    if(!lates.getValue().toString().trim().isEmpty()){
                        latePerMinute = Double.valueOf(lates.getValue().toString().trim()).doubleValue();
                        lateDeduction = attendanceProcess.processEmployeesLates(policies, holiday, latePerMinute, wage);
                    }
                    
                    if(!event.getText().isEmpty()){
                        latePerMinute = Double.parseDouble(event.getText().trim());
                        undertimeDeduction = attendanceProcess.processEmployeesLates(policies, holiday, latePerMinute, wage);
                        item.getItemProperty("u/min").setValue(undertimeDeduction);
                    }else{
                        item.getItemProperty("u/min").setValue(null);
                    }
                    
                    if(!event.getText().trim().isEmpty()){
                        if(!lates.getValue().toString().trim().isEmpty()){                            
                            deduction = lateDeduction + undertimeDeduction + 
                                    (undertimeDeduction * undertimePremiumRate) + + (lateDeduction * latesPremiumRate);
                            item.getItemProperty("u/min").setValue(new Double(df.format(undertimeDeduction + (undertimeDeduction * undertimePremiumRate))));
                        }else{
                            deduction = undertimeDeduction + (undertimeDeduction * undertimePremiumRate);
                            item.getItemProperty("u/min").setValue(new Double(df.format(deduction)));
                        }
                                               
                    }else{
                        item.getItemProperty("u/min").setValue(null);
                        if(!lates.getValue().toString().trim().isEmpty()){
                            deduction = lateDeduction + (lateDeduction * latesPremiumRate);
                        }else{
                            deduction = null;
                        }                        
                    }
                    if(deduction != null){
                        deduction = new Double(df.format(deduction));
                    }                    
                    //item.getItemProperty("deduction").setValue(deduction);
                }
                
            });
            
            op.addListener(new Property.ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    Object itemId = lp.getData();
                    Item item = table.getItem(itemId);
                    
                    boolean value = (Boolean) event.getProperty().getValue();
                    if(value == true){
                        overtimePremiumRate = 0.1; 
                    }else{
                        overtimePremiumRate = 0.0;
                    }
                    
                    String policies = null, holiday = null;
                    
                    if(policy.getValue() != null){
                        policies = policy.getValue().toString();
                    }
                    
                    if(holidays.getValue() != null){
                        holiday = holidays.getValue().toString();
                    }
                    
                    if(!overtime.getValue().toString().trim().isEmpty()){
                        overtimePerMinute = Double.parseDouble(overtime.getValue().toString().trim());
                        overtimeAddition = attendanceProcess.processEmployeesOvertime(policies, holiday, overtimePerMinute, wage);
                        item.getItemProperty("o/min").setValue(overtimeAddition);
                    }else{
                        item.getItemProperty("o/min").setValue(null);
                    }
                    
                    if(!nightDifferential.getValue().toString().trim().isEmpty()){
                        nightDifferentialPerMinute = Double.valueOf(nightDifferential.getValue().toString().trim()).doubleValue();
                        nightDifferentialAddition = attendanceProcess.processEmployeesNightDifferential(policies, holiday, nightDifferentialPerMinute, wage);
                    }
                    
                    if(!overtime.getValue().toString().trim().isEmpty()){
                        if(!nightDifferential.getValue().toString().trim().isEmpty()){
                            addition = overtimeAddition + nightDifferentialAddition + (overtimeAddition * overtimePremiumRate);
                            item.getItemProperty("o/min").setValue(new Double(df.format(overtimeAddition + (overtimeAddition * overtimePremiumRate))));
                        }else{
                            addition = overtimeAddition + (overtimeAddition * overtimePremiumRate);
                            item.getItemProperty("o/min").setValue(new Double(df.format(addition)));
                        }
                    }else{
                        item.getItemProperty("o/min").setValue(null);
                        if(!nightDifferential.getValue().toString().trim().isEmpty()){
                            addition = nightDifferentialAddition;
                        }else{
                            addition = null;
                        }
                    }
                    if(addition != null){
                        addition = new Double(df.format(addition));
                    }                    
                    //item.getItemProperty("addition").setValue(addition);
                }
                
            });
            
            overtime.addListener(new FieldEvents.TextChangeListener() {

                @Override
                public void textChange(TextChangeEvent event) {
                    Object itemId = lates.getData();
                    Item item = table.getItem(itemId);
                                       
                    String policies = null, holiday = null;
                    double hAmount = 0;
                    
                    if(policy.getValue() != null){
                        policies = policy.getValue().toString();
                    }
                    
                    if(holidays.getValue() != null){
                        holiday = holidays.getValue().toString();
                        if(holiday.equals("legalHoliday")){
                            hAmount = Double.parseDouble(item.getItemProperty("lholiday").getValue().toString());
                        }else{
                            hAmount = Double.parseDouble(item.getItemProperty("sholiday").getValue().toString());
                        }
                    }
                    
                    if(!event.getText().trim().isEmpty()){
                        overtimePerMinute = Double.parseDouble(event.getText().trim());
                        overtimeAddition = attendanceProcess.processEmployeesOvertime(policies, holiday, overtimePerMinute, wage);
                        item.getItemProperty("o/min").setValue(overtimeAddition);
                    }else{
                        item.getItemProperty("o/min").setValue(null);
                    }
                    
                    if(!nightDifferential.getValue().toString().trim().isEmpty()){
                        nightDifferentialPerMinute = Double.valueOf(nightDifferential.getValue().toString().trim()).doubleValue();
                        nightDifferentialAddition = attendanceProcess.processEmployeesNightDifferential(policies, holiday, nightDifferentialPerMinute, wage);
                    }
                    
                    if(!event.getText().trim().isEmpty()){
                        if(!nightDifferential.getValue().toString().trim().isEmpty()){
                            addition = overtimeAddition + nightDifferentialAddition + (overtimeAddition * overtimePremiumRate);
                            item.getItemProperty("o/min").setValue(new Double(df.format(overtimeAddition + (overtimeAddition * overtimePremiumRate))));
                        }else{
                            addition = overtimeAddition + (overtimeAddition * overtimePremiumRate);
                            item.getItemProperty("o/min").setValue(new Double(df.format(addition)));
                        }
                    }else{
                        item.getItemProperty("o/min").setValue(null);
                        if(!nightDifferential.getValue().toString().trim().isEmpty()){
                            addition = nightDifferentialAddition;
                        }else{
                            addition = null;
                        }
                    }
                    if(addition != null){
                        addition = new Double(df.format(addition));
                    }                    
                    //item.getItemProperty("addition").setValue(addition);
                }
            });
            
            nightDifferential.addListener(new FieldEvents.TextChangeListener() {

                @Override
                public void textChange(TextChangeEvent event) {
                    Object itemId = lates.getData();
                    Item item = table.getItem(itemId);                    
                                        
                    String policies = null, holiday = null;
                    double hAmount = 0;
                    
                    if(policy.getValue() != null){
                        policies = policy.getValue().toString();
                    }
                    
                    if(holidays.getValue() != null){
                        holiday = holidays.getValue().toString();
                        if(holiday.equals("legalHoliday")){
                            hAmount = Double.parseDouble(item.getItemProperty("lholiday").getValue().toString());
                        }else{
                            hAmount = Double.parseDouble(item.getItemProperty("sholiday").getValue().toString());
                        }                        
                    }
                    
                    if(!overtime.getValue().toString().trim().isEmpty()){
                        overtimePerMinute = Double.valueOf(overtime.getValue().toString().trim()).doubleValue();
                        overtimeAddition = attendanceProcess.processEmployeesOvertime(policies, holiday, overtimePerMinute, wage);                        
                    }
                    
                    if(!event.getText().trim().isEmpty()){
                        nightDifferentialPerMinute = Double.parseDouble(event.getText().trim());
                        nightDifferentialAddition = attendanceProcess.processEmployeesNightDifferential(policies, holiday, nightDifferentialPerMinute, wage);
                        item.getItemProperty("nd/min").setValue(nightDifferentialAddition);
                    }else{
                        item.getItemProperty("nd/min").setValue(null);
                    }
                    
                    if(!event.getText().trim().isEmpty()){
                        if(!overtime.getValue().toString().trim().isEmpty()){
                            addition = overtimeAddition + nightDifferentialAddition + (overtimeAddition * overtimePremiumRate);
                            item.getItemProperty("nd/min").setValue(new Double(df.format(nightDifferentialAddition)));
                        }else{
                            addition = nightDifferentialAddition;
                            item.getItemProperty("nd/min").setValue(new Double(df.format(addition)));
                        }
                    }else{
                        item.getItemProperty("nd/min").setValue(null);
                        if(!overtime.getValue().toString().trim().isEmpty()){
                            addition = overtimeAddition + hAmount;
                        }else{
                            addition = null;
                        }
                    }
                    if(addition != null){
                        addition = new Double(df.format(addition));
                    }                    
                    //item.getItemProperty("addition").setValue(addition);
                }
                
            });
            
            table.addItem(new Object[]{convertDateFormat(dates.get(i).toString()), policy, holidays, lp, lates, up, undertime,
                op, overtime, nightDifferential, null, null, null, null, null, null, null}, new Integer(i));            
        }                
        table.setPageLength(table.size());
        
        subWindow.addComponent(table); 
        
        final Button button = new Button();
        button.setCaption("Save Attendance Data");
        for(Object listener : button.getListeners(ClickListener.class)){
            button.removeListener(ClickListener.class, listener);
        }
        button.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {                
                try{                                       
                    Collection attendanceTableCollection = table.getContainerDataSource().getItemIds();
                    List<String> attendanceList = new ArrayList<String>();
                    for(int i = 0; i < attendanceTableCollection.size(); i++){
                        String str = table.getItem(i).toString();
                        attendanceList.add(str);
                        System.out.println(attendanceList.get(i));
                    }
                    /*
                    boolean result = salaryComputation.saveAttendanceData(attendanceList, employeeId, attendanceDateFrom, 
                            attendanceDateTo, paydayPeriod, salaryDate);
                            
                    for(Object listener : button.getListeners(ClickEvent.class)){
                        button.removeListener(ClickEvent.class, listener);
                    } 
                    
                    if(result == true){
                        employeeSalaryTable();
                        (subWindow.getParent()).removeWindow(subWindow);
                    }*/
                                         
                }catch(Exception e){
                    e.getMessage();
                }
            }
            
        });
        
        subWindow.addComponent(button);
        
        return subWindow;
    }