Example usage for com.vaadin.ui Button setCaption

List of usage examples for com.vaadin.ui Button setCaption

Introduction

In this page you can find the example usage for com.vaadin.ui Button setCaption.

Prototype

@Override
    public void setCaption(String caption) 

Source Link

Usage

From source file:com.mycollab.mobile.module.crm.view.campaign.CampaignReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/*from   www  . j  a  v  a 2s .  c  o  m*/

    Button relatedAccounts = new Button();
    relatedAccounts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACCOUNT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(AccountI18nEnum.LIST)
            + "</div>");
    relatedAccounts.setHtmlContentAllowed(true);
    relatedAccounts.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateAccounts))));
    toolbarLayout.addComponent(relatedAccounts);

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))));
    toolbarLayout.addComponent(relatedContacts);

    Button relatedLeads = new Button();
    relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(LeadI18nEnum.LIST)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads))));
    toolbarLayout.addComponent(relatedLeads);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.cases.CaseReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    MHorizontalLayout toolbarLayout = new MHorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))));
    toolbarLayout.addComponent(relatedContacts);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.contact.ContactReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    MHorizontalLayout toolbarLayout = new MHorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Button relatedOpportunities = new Button();
    relatedOpportunities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_OPPORTUNITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(OpportunityI18nEnum.LIST) + "</div>");
    relatedOpportunities.setHtmlContentAllowed(true);
    relatedOpportunities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateOpportunityList))));

    toolbarLayout.addComponent(relatedOpportunities);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivityList))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.lead.LeadReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/*from w  ww .  j  ava2  s.co  m*/

    Button relatedCampaigns = new Button();
    relatedCampaigns.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CAMPAIGN
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CampaignI18nEnum.LIST)
            + "</div>");
    relatedCampaigns.setHtmlContentAllowed(true);
    relatedCampaigns
            .addClickListener(clickEvent -> EventBusFactory.getInstance().post(new LeadEvent.GoToRelatedItems(
                    LeadReadViewImpl.this, new CrmRelatedItemsScreenData(associateCampaigns))));
    toolbarLayout.addComponent(relatedCampaigns);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new LeadEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.opportunity.OpportunityReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);//from   w ww  . j av  a2s  .c om

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))));
    toolbarLayout.addComponent(relatedContacts);

    Button relatedLeads = new Button();
    relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(LeadI18nEnum.LIST)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads))));
    toolbarLayout.addComponent(relatedLeads);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.module.project.view.settings.component.InviteUserTokenField.java

License:Open Source License

private Component generateToken(final SimpleUser user) {
    final Button btn = new Button("", FontAwesome.TIMES);
    btn.setCaptionAsHtml(true);//from  w  w w .  ja va2 s.c om
    btn.setCaption((new Img("", StorageFactory.getAvatarPath(user.getAvatarid(), 16))).write() + " "
            + user.getDisplayName());
    btn.addClickListener(clickEvent -> {
        InviteUserTokenField.this.removeComponent(btn);
        inviteEmails.remove(user.getEmail());
    });
    btn.setStyleName("token-field");
    return btn;
}

From source file:com.naoset.framework.frontend.view.window.DialogWindow.java

public void setFooterButtons(DialogButton... buttons) {
    footer.removeAllComponents();/*from   w  w  w. j  ava 2 s . co m*/

    HorizontalLayout innerLayout = new HorizontalLayout();
    innerLayout.setSpacing(true);
    footer.addComponent(innerLayout);
    footer.setComponentAlignment(innerLayout, Alignment.TOP_RIGHT);

    for (DialogButton button : buttons) {
        Button btn = new Button();
        if (button.equals(DialogButton.OK)) {
            btn.setCaption("OK");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonOKClicked();
                }
            });
            okButton = btn;
        }
        if (button.equals(DialogButton.CANCEL)) {
            btn.setCaption("CANCEL");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonCancelClicked();
                }
            });
            cancelButton = btn;
        }
        if (button.equals(DialogButton.YES)) {
            btn.setCaption("YES");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonYesClicked();
                }
            });
            yesButton = btn;
        }
        if (button.equals(DialogButton.NO)) {
            btn.setCaption("NO");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonNoClicked();
                }
            });
            noButton = btn;
        }
        if (button.equals(DialogButton.CLOSE)) {
            btn.setCaption("CLOSE");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonCloseClicked();
                }
            });
            closeButton = btn;
        }
        innerLayout.addComponent(btn);
    }

}

From source file:com.neatresults.mgnltweaks.ui.column.ColumnFormatterUtils.java

License:Open Source License

private static Button createButton(final String title, final String appName, final String subAppName,
        final String path, final Object itemId, final String rootPath, EventBus adminEventBus,
        EventBus eventBus, NeatTweaks4DevelopersModule module) {
    Button selectButton = new NativeButton();
    selectButton.addStyleName("neatmagnoliabutton");
    selectButton.setCaption(title);
    selectButton.addClickListener(new ClickListener() {

        @Override//from w ww.j ava  2 s  . c  o m
        public void buttonClick(ClickEvent event) {
            String workPath = path;
            if (StringUtils.isNotBlank(rootPath) && !"/".equals(rootPath)) {
                workPath = StringUtils.removeStart(workPath, rootPath);
            }
            if ("browser".equals(subAppName)) {
                Location location = new BrowserLocation(appName, subAppName, workPath + ":treeview:");
                adminEventBus.fireEvent(new LocationChangedEvent(location));
            } else {
                // open app (subapp)
                Location location = new RerootBrowserLocation(appName, subAppName, workPath,
                        module.isShowSubtreeOnlyInHelper());
                adminEventBus.fireEvent(new LocationChangedEvent(location));
                // expand selected node
                try {
                    ContentChangedEvent cce = new ContentChangedEvent(
                            JcrItemUtil.getItemId(RepositoryConstants.CONFIG, path), true);
                    eventBus.fireEvent(cce);
                } catch (RepositoryException e) {
                    log.error(
                            "Ooops, failed to retrieve node at path {} and open it while trying to open definition with {}",
                            path, e.getMessage(), e);
                }
            }
        }
    });
    return selectButton;
}

From source file:com.openhris.payroll.PayrollAdvancesLedgerUI.java

public PayrollAdvancesLedgerUI(int branchId) {
    this.branchId = branchId;

    setSpacing(false);/* www  .  j  a  v a2s.  c o m*/
    setMargin(false);
    setWidth("100%");
    setHeight("100%");
    setImmediate(true);

    final VerticalSplitPanel vsplit = new VerticalSplitPanel();

    vsplit.setImmediate(true);
    vsplit.setMargin(false);
    vsplit.setSizeFull();
    vsplit.setLocked(true);

    vsplit.setSplitPosition(90, Sizeable.UNITS_PIXELS);

    GridLayout glayout = new GridLayout(2, 1);
    glayout.setWidth("60%");
    glayout.setMargin(true);
    glayout.setSpacing(true);

    employeeComboBox(getBranchId());
    glayout.addComponent(employee, 0, 0);

    Button button = new Button();
    button.setWidth("100%");
    button.setCaption("Generate Ledger");
    button.setEnabled(UserAccessControl.isPayroll());
    button.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            System.out.println("employeeId: " + employee.getValue());
        }
    });

    glayout.addComponent(button, 1, 0);
    glayout.setComponentAlignment(button, Alignment.BOTTOM_LEFT);

    vsplit.setFirstComponent(glayout);
    addComponent(vsplit);

    setExpandRatio(vsplit, 1.0f);
}

From source file:com.openhris.timekeeping.AttendanceTableContainerWindow.java

VerticalLayout generateAttendanceTable() {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSizeFull();//from   w  w  w.j  a va 2s.c o m
    vlayout.setSpacing(true);

    final Table table = new Table();
    table.removeAllItems();
    table.setEnabled(true);
    table.setSizeFull();
    table.setImmediate(true);
    table.setColumnCollapsingAllowed(true);

    table.addContainerProperty("date", String.class, null);
    table.addContainerProperty("policy", ComboBox.class, null);
    table.addContainerProperty("holidays", ComboBox.class, null);
    table.addContainerProperty("premium", CheckBox.class, null);
    table.addContainerProperty("lates", TextField.class, null);
    table.addContainerProperty("undertime", TextField.class, null);
    table.addContainerProperty("overtime", TextField.class, null);
    table.addContainerProperty("night differential", TextField.class, null);
    table.addContainerProperty("duty manager", TextField.class, null);
    table.addContainerProperty("l/min", Double.class, null);
    table.addContainerProperty("u/min", Double.class, null);
    table.addContainerProperty("o/min", Double.class, null);
    table.addContainerProperty("nd/min", Double.class, null);
    table.addContainerProperty("dm/min", Double.class, null);
    table.addContainerProperty("lholiday", Double.class, null);
    table.addContainerProperty("sholiday", Double.class, null);
    table.addContainerProperty("wdo", Double.class, null);
    table.addContainerProperty("psday", Double.class, null); //paid non-working holiday
    table.addContainerProperty("latesLH", Double.class, null);
    table.addContainerProperty("latesSH", Double.class, null);
    table.addContainerProperty("latesWO", Double.class, null);
    table.addContainerProperty("undertimeLH", Double.class, null);
    table.addContainerProperty("undertimeSH", Double.class, null);
    table.addContainerProperty("undertimeWO", Double.class, null);

    table.setColumnAlignment("date", Table.ALIGN_CENTER);
    table.setColumnAlignment("policy", Table.ALIGN_CENTER);
    table.setColumnAlignment("premium", Table.ALIGN_CENTER);
    table.setColumnAlignment("lates", Table.ALIGN_CENTER);
    table.setColumnAlignment("undertime", Table.ALIGN_CENTER);
    table.setColumnAlignment("overtime", Table.ALIGN_CENTER);
    table.setColumnAlignment("night differential", Table.ALIGN_CENTER);
    table.setColumnAlignment("duty manager", 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("dm/min", Table.ALIGN_RIGHT);
    table.setColumnAlignment("lholiday", Table.ALIGN_RIGHT);
    table.setColumnAlignment("sholiday", Table.ALIGN_RIGHT);
    table.setColumnAlignment("wdo", Table.ALIGN_RIGHT);
    table.setColumnAlignment("psday", Table.ALIGN_RIGHT);
    table.setColumnAlignment("latesLH", Table.ALIGN_RIGHT);
    table.setColumnAlignment("latesSH", Table.ALIGN_RIGHT);
    table.setColumnAlignment("latesWO", Table.ALIGN_RIGHT);
    table.setColumnAlignment("undertimeLH", Table.ALIGN_RIGHT);
    table.setColumnAlignment("undertimeSH", Table.ALIGN_RIGHT);
    table.setColumnAlignment("undertimeWO", Table.ALIGN_RIGHT);

    table.setColumnWidth("date", 70);
    table.setColumnWidth("policy", 125);
    table.setColumnWidth("holidays", 125);
    table.setColumnWidth("premium", 60);
    table.setColumnWidth("lates", 50);
    table.setColumnWidth("undertime", 60);
    table.setColumnWidth("overtime", 50);
    table.setColumnWidth("night differential", 110);
    table.setColumnWidth("duty manager", 80);
    table.setColumnWidth("l/min", 40);
    table.setColumnWidth("u/min", 40);
    table.setColumnWidth("o/min", 40);
    table.setColumnWidth("nd/min", 50);

    table.setColumnCollapsed("latesLH", true);
    table.setColumnCollapsed("latesSH", true);
    table.setColumnCollapsed("latesWO", true);
    table.setColumnCollapsed("undertimeLH", true);
    table.setColumnCollapsed("undertimeSH", true);
    table.setColumnCollapsed("undertimeWO", true);

    final String[] holidayList = { "legal-holiday", "special-holiday" };
    if (getEmploymentWageEntry().equals("monthly")) {
        employmentWage = utilities.roundOffToTwoDecimalPlaces((employmentWage * 12) / 314);
    }

    for (int i = 0; i < dateList.size(); i++) {
        Object itemId = new Integer(i);
        final ComboBox holidays = dropDown.populateAttendanceHolidayDropDownList(new ComboBox());
        holidays.setEnabled(false);
        holidays.setWidth("120px");
        holidays.setNullSelectionAllowed(false);
        holidays.setData(itemId);

        final CheckBox premium = new CheckBox();
        premium.setData(itemId);
        premium.setImmediate(true);

        final TextField lates = new TextField();
        lates.setWidth("100%");
        lates.setValue("0");
        lates.addStyleName("numerical");
        lates.setEnabled(true);
        lates.setData(itemId);
        lates.setImmediate(true);

        final TextField undertime = new TextField();
        undertime.setWidth("100%");
        undertime.setValue("0");
        undertime.addStyleName("numerical");
        undertime.setEnabled(true);
        undertime.setData(itemId);
        undertime.setImmediate(true);

        final TextField overtime = new TextField();
        overtime.setWidth("100%");
        overtime.setValue("0");
        overtime.addStyleName("numerical");
        overtime.setEnabled(true);
        overtime.setData(itemId);
        overtime.setImmediate(true);

        final TextField nightDifferential = new TextField();
        nightDifferential.setWidth("70%");
        nightDifferential.setValue("0");
        nightDifferential.addStyleName("numerical");
        nightDifferential.setEnabled(true);
        nightDifferential.setData(itemId);
        nightDifferential.setImmediate(true);

        final TextField dutyManager = new TextField();
        dutyManager.setWidth("80%");
        dutyManager.setValue("0");
        dutyManager.addStyleName("numerical");
        dutyManager.setEnabled(true);
        dutyManager.setData(itemId);
        dutyManager.setImmediate(true);

        final ComboBox policy = dropDown.populateAttendancePolicyDropDownList(new ComboBox());
        policy.setWidth("120px");
        policy.setNullSelectionAllowed(true);
        policy.setData(itemId);
        policy.addListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                Object itemId = policy.getData();
                Item item = table.getItem(itemId);
                double additionalWorkingDayOffPay = 0;

                holidays.removeAllItems();
                for (String temp : holidayList) {
                    holidays.addItem(temp);
                }

                premium.setValue(false);
                lates.setValue("0");
                undertime.setValue("0");
                overtime.setValue("0");
                nightDifferential.setValue("0");
                item.getItemProperty("l/min").setValue(0.0);
                item.getItemProperty("u/min").setValue(0.0);
                item.getItemProperty("o/min").setValue(0.0);
                item.getItemProperty("nd/min").setValue(0.0);
                item.getItemProperty("dm/min").setValue(0.0);
                item.getItemProperty("sholiday").setValue(0.0);
                item.getItemProperty("lholiday").setValue(0.0);
                item.getItemProperty("wdo").setValue(0.0);
                item.getItemProperty("psday").setValue(0.0);
                item.getItemProperty("psday").setValue(0.0);
                item.getItemProperty("latesLH").setValue(0.0);
                item.getItemProperty("latesSH").setValue(0.0);
                item.getItemProperty("latesWO").setValue(0.0);
                item.getItemProperty("undertimeLH").setValue(0.0);
                item.getItemProperty("undertimeSH").setValue(0.0);
                item.getItemProperty("undertimeWO").setValue(0.0);

                if (event.getProperty().getValue() == null) {
                    holidays.setEnabled(false);
                    lates.setEnabled(true);
                    undertime.setEnabled(true);
                    overtime.setEnabled(true);
                    nightDifferential.setEnabled(true);
                    dutyManager.setEnabled(true);
                } else if (event.getProperty().getValue().equals("holiday")) {
                    holidays.setEnabled(true);
                    lates.setEnabled(false);
                    undertime.setEnabled(false);
                    overtime.setEnabled(false);
                    nightDifferential.setEnabled(false);
                    dutyManager.setEnabled(false);
                } else if (event.getProperty().getValue().equals("working-holiday")) {
                    holidays.setEnabled(true);
                    lates.setEnabled(true);
                    undertime.setEnabled(true);
                    overtime.setEnabled(true);
                    nightDifferential.setEnabled(true);
                    dutyManager.setEnabled(true);
                } else if (event.getProperty().getValue().equals("working-day-off")) {
                    holidays.setEnabled(true);
                    lates.setEnabled(true);
                    undertime.setEnabled(true);
                    overtime.setEnabled(true);
                    nightDifferential.setEnabled(true);
                    dutyManager.setEnabled(true);

                    additionalWorkingDayOffPay = computation.processAdditionalWorkingDayOff(getEmploymentWage(),
                            getEmploymentWageEntry());
                    System.out.println("wdo: " + additionalWorkingDayOffPay);
                    if (getBranch().equals("on-call and trainees")) {
                        item.getItemProperty("wdo")
                                .setValue(utilities.roundOffToTwoDecimalPlaces(getEmploymentWage()));
                    } else {
                        item.getItemProperty("wdo")
                                .setValue(utilities.roundOffToTwoDecimalPlaces(additionalWorkingDayOffPay));
                    }
                } else {
                    holidays.setEnabled(false);
                    lates.setEnabled(false);
                    undertime.setEnabled(false);
                    overtime.setEnabled(false);
                    nightDifferential.setEnabled(false);
                    dutyManager.setEnabled(false);
                }
            }
        });
        policy.setImmediate(true);

        holidays.addListener(new ComboBox.ValueChangeListener() {

            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                Object itemId = holidays.getData();
                Item item = table.getItem(itemId);

                String policyStr = item.getItemProperty("policy").toString();
                double additionalHolidayPay = 0;
                double multiplePremiumPay = 0;
                double additionalWorkingDayOffPay = 0;

                premium.setValue(false);
                lates.setValue("0");
                undertime.setValue("0");
                overtime.setValue("0");
                nightDifferential.setValue("0");
                item.getItemProperty("sholiday").setValue(0.0);
                item.getItemProperty("lholiday").setValue(0.0);
                item.getItemProperty("latesLH").setValue(0.0);
                item.getItemProperty("latesSH").setValue(0.0);
                item.getItemProperty("latesWO").setValue(0.0);
                item.getItemProperty("undertimeLH").setValue(0.0);
                item.getItemProperty("undertimeSH").setValue(0.0);
                item.getItemProperty("undertimeWO").setValue(0.0);

                if (policyStr == null) {
                } else {
                    if (policyStr.equals("working-holiday")) {
                        if (event.getProperty().getValue().equals("legal-holiday")) {
                            additionalHolidayPay = computation.processAdditionalHolidayPay(
                                    event.getProperty().getValue().toString(), getEmploymentWage());
                            item.getItemProperty("lholiday")
                                    .setValue(utilities.roundOffToTwoDecimalPlaces(additionalHolidayPay));
                            item.getItemProperty("sholiday").setValue(0.0);
                        } else {
                            additionalHolidayPay = computation.processAdditionalHolidayPay(
                                    event.getProperty().getValue().toString(), getEmploymentWage());
                            item.getItemProperty("sholiday")
                                    .setValue(utilities.roundOffToTwoDecimalPlaces(additionalHolidayPay));
                            item.getItemProperty("lholiday").setValue(0.0);
                        }
                    } else if (policyStr.equals("holiday")) {
                        if (event.getProperty().getValue().equals("legal-holiday")) {
                            if (getEmploymentWageEntry().equals("daily")) {
                                additionalHolidayPay = computation.processAdditionalHolidayPay(
                                        event.getProperty().getValue().toString(), getEmploymentWage());
                                item.getItemProperty("psday")
                                        .setValue(utilities.roundOffToTwoDecimalPlaces(additionalHolidayPay));
                            } else {
                                item.getItemProperty("psday").setValue(0.0);
                            }
                        } else {
                            item.getItemProperty("psday").setValue(0.0);
                        }
                    } else if (policyStr.equals("working-day-off")) {
                        if (event.getProperty().getValue() == null) {
                            item.getItemProperty("psday").setValue(0.0);
                        } else if (event.getProperty().getValue().equals("legal-holiday")) {
                            additionalWorkingDayOffPay = computation.processAdditionalWorkingDayOff(
                                    getEmploymentWage(), getEmploymentWageEntry());
                            item.getItemProperty("wdo")
                                    .setValue(utilities.roundOffToTwoDecimalPlaces(additionalWorkingDayOffPay));
                            multiplePremiumPay = computation.processMultiplePremiumPay(
                                    event.getProperty().getValue().toString(), getEmploymentWage());
                            item.getItemProperty("lholiday").setValue(multiplePremiumPay);
                            item.getItemProperty("sholiday").setValue(0.0);
                        } else {
                            additionalWorkingDayOffPay = computation.processAdditionalWorkingDayOff(
                                    getEmploymentWage(), getEmploymentWageEntry());
                            item.getItemProperty("wdo")
                                    .setValue(utilities.roundOffToTwoDecimalPlaces(additionalWorkingDayOffPay));
                            multiplePremiumPay = computation.processMultiplePremiumPay(
                                    event.getProperty().getValue().toString(), getEmploymentWage());
                            item.getItemProperty("sholiday").setValue(multiplePremiumPay);
                            item.getItemProperty("lholiday").setValue(0.0);
                        }
                    }
                }
            }
        });
        holidays.setImmediate(true);

        premium.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                Object itemId = lates.getData();
                Item item = table.getItem(itemId);

                lates.setValue("0");
                undertime.setValue("0");
                overtime.setValue("0");
                nightDifferential.setValue("0");
                dutyManager.setValue("0");

                item.getItemProperty("l/min").setValue(0.0);
                item.getItemProperty("u/min").setValue(0.0);
                item.getItemProperty("o/min").setValue(0.0);
                item.getItemProperty("nd/min").setValue(0.0);
                item.getItemProperty("dm/min").setValue(0.0);

                if (event.getButton().booleanValue() == true) {
                    premiumRate = 0.1;
                } else {
                    premiumRate = 0.0;
                }

                item.getItemProperty("wdo")
                        .setValue(utilities.roundOffToTwoDecimalPlaces(
                                Double.parseDouble(item.getItemProperty("wdo").getValue().toString())
                                        + (Double.parseDouble(item.getItemProperty("wdo").getValue().toString())
                                                * premiumRate)));

                item.getItemProperty("lholiday")
                        .setValue(utilities.roundOffToTwoDecimalPlaces(Double
                                .parseDouble(item.getItemProperty("lholiday").getValue().toString())
                                + (Double.parseDouble(item.getItemProperty("lholiday").getValue().toString())
                                        * premiumRate)));

                item.getItemProperty("sholiday")
                        .setValue(utilities.roundOffToTwoDecimalPlaces(Double
                                .parseDouble(item.getItemProperty("sholiday").getValue().toString())
                                + (Double.parseDouble(item.getItemProperty("sholiday").getValue().toString())
                                        * premiumRate)));
            }
        });

        lates.addListener(new FieldEvents.TextChangeListener() {

            @Override
            public void textChange(FieldEvents.TextChangeEvent event) {
                Object itemId = lates.getData();
                Item item = table.getItem(itemId);
                String policyStr = item.getItemProperty("policy").toString();
                String holidayStr = item.getItemProperty("holidays").toString();
                double lateDeduction;

                boolean checkIfInputIsInteger = utilities.checkInputIfInteger(event.getText().trim());
                if (!checkIfInputIsInteger) {
                    getWindow().showNotification("Enter numeric format for lates!",
                            Window.Notification.TYPE_WARNING_MESSAGE);
                    return;
                }

                if (!event.getText().isEmpty()) {
                    if (getBranch().equals("on-call and trainees")) {
                        lateDeduction = computation.processEmployeesLatesForOnCall(policyStr, holidayStr,
                                utilities.convertStringToInteger(event.getText().trim()), getEmploymentWage());
                        item.getItemProperty("l/min")
                                .setValue(utilities.roundOffToTwoDecimalPlaces(lateDeduction));
                    } else {
                        if (utilities.convertStringToInteger(event.getText().trim()) > 5) {
                            lateDeduction = computation.processEmployeesLates(policyStr, holidayStr,
                                    utilities.convertStringToInteger(event.getText().trim()),
                                    getEmploymentWage());
                            if (policyStr == null || policyStr.isEmpty()) {
                                item.getItemProperty("l/min")
                                        .setValue(utilities.roundOffToTwoDecimalPlaces(lateDeduction));
                            } else if (policyStr.equals("working-holiday")
                                    && holidayStr.equals("legal-holiday")) {
                                item.getItemProperty("latesLH")
                                        .setValue(utilities.roundOffToTwoDecimalPlaces(lateDeduction));
                                item.getItemProperty("latesSH").setValue(0.0);
                                item.getItemProperty("latesWO").setValue(0.0);
                                item.getItemProperty("l/min").setValue(0.0);
                            } else if (policyStr.equals("working-holiday")
                                    && holidayStr.equals("special-holiday")) {
                                item.getItemProperty("latesLH").setValue(0.0);
                                item.getItemProperty("latesSH")
                                        .setValue(utilities.roundOffToTwoDecimalPlaces(lateDeduction * 0.3));
                                item.getItemProperty("latesWO").setValue(0.0);
                                if (getEmploymentWageEntry().equals("daily")) {
                                    item.getItemProperty("l/min").setValue(lateDeduction);
                                } else {
                                    item.getItemProperty("l/min").setValue(0.0);
                                }
                            } else if (policyStr.equals("working-day-off")) {
                                item.getItemProperty("latesLH").setValue(0.0);
                                item.getItemProperty("latesSH").setValue(0.0);

                                if (getEmploymentWageEntry().equals("daily")) {
                                    item.getItemProperty("latesWO")
                                            .setValue(utilities.roundOffToTwoDecimalPlaces(lateDeduction * .3));
                                    item.getItemProperty("l/min").setValue(lateDeduction);
                                } else {
                                    item.getItemProperty("latesWO")
                                            .setValue(utilities.roundOffToTwoDecimalPlaces(lateDeduction * .3));
                                    item.getItemProperty("l/min").setValue(0.0);
                                }
                            }
                        } else {
                            item.getItemProperty("l/min").setValue(0.0);
                        }
                    }

                } else {
                    item.getItemProperty("l/min").setValue(0.0);
                }

            }
        });

        undertime.addListener(new FieldEvents.TextChangeListener() {

            @Override
            public void textChange(FieldEvents.TextChangeEvent event) {
                Object itemId = lates.getData();
                Item item = table.getItem(itemId);
                String policyStr = item.getItemProperty("policy").toString();
                String holidayStr = item.getItemProperty("holidays").toString();
                double undertimeDeduction;

                boolean checkIfInputIsInteger = utilities.checkInputIfInteger(event.getText().trim());
                if (!checkIfInputIsInteger) {
                    getWindow().showNotification("Enter numeric format for undertime!",
                            Window.Notification.TYPE_WARNING_MESSAGE);
                    return;
                }

                if (!event.getText().isEmpty()) {
                    if (getBranch().equals("on-call and trainees")) {
                        undertimeDeduction = computation.processEmployeesUndertimeForOnCall(policyStr,
                                holidayStr, utilities.convertStringToInteger(event.getText().trim()),
                                getEmploymentWage());
                        item.getItemProperty("u/min")
                                .setValue(utilities.roundOffToTwoDecimalPlaces(undertimeDeduction));
                    } else {
                        undertimeDeduction = computation.processEmployeesUndertime(policyStr, holidayStr,
                                utilities.convertStringToInteger(event.getText().trim()), getEmploymentWage());
                        if (policyStr == null || policyStr.isEmpty()) {
                            item.getItemProperty("u/min")
                                    .setValue(utilities.roundOffToTwoDecimalPlaces(undertimeDeduction));
                        } else if (policyStr.equals("working-holiday") && holidayStr.equals("legal-holiday")) {
                            item.getItemProperty("undertimeLH")
                                    .setValue(utilities.roundOffToTwoDecimalPlaces(undertimeDeduction));
                            item.getItemProperty("undertimeSH").setValue(0.0);
                            item.getItemProperty("undertimeWO").setValue(0.0);
                            item.getItemProperty("u/min").setValue(0.0);
                        } else if (policyStr.equals("working-holiday")
                                && holidayStr.equals("special-holiday")) {
                            item.getItemProperty("undertimeLH").setValue(0.0);
                            item.getItemProperty("undertimeSH")
                                    .setValue(utilities.roundOffToTwoDecimalPlaces(undertimeDeduction * 0.3));
                            item.getItemProperty("undertimeWO").setValue(0.0);
                            if (getEmploymentWageEntry().equals("daily")) {
                                item.getItemProperty("u/min").setValue(undertimeDeduction);
                            } else {
                                item.getItemProperty("u/min").setValue(0.0);
                            }

                        } else if (policyStr.equals("working-day-off")) {
                            item.getItemProperty("undertimeLH").setValue(0.0);
                            item.getItemProperty("undertimeSH").setValue(0.0);
                            item.getItemProperty("undertimeWO")
                                    .setValue(utilities.roundOffToTwoDecimalPlaces(undertimeDeduction));
                            item.getItemProperty("u/min").setValue(0.0);
                            if (getEmploymentWageEntry().equals("daily")) {
                                item.getItemProperty("undertimeWO").setValue(
                                        utilities.roundOffToTwoDecimalPlaces(undertimeDeduction * .3));
                                item.getItemProperty("u/min").setValue(undertimeDeduction);
                            } else {
                                item.getItemProperty("undertimeWO").setValue(
                                        utilities.roundOffToTwoDecimalPlaces(undertimeDeduction * .3));
                                item.getItemProperty("u/min").setValue(0.0);
                            }
                        }
                    }

                } else {
                    item.getItemProperty("u/min").setValue(0.0);
                }
            }
        });

        overtime.addListener(new FieldEvents.TextChangeListener() {

            @Override
            public void textChange(FieldEvents.TextChangeEvent event) {
                Object itemId = lates.getData();
                Item item = table.getItem(itemId);
                String policyStr = item.getItemProperty("policy").toString();
                String holidayStr = item.getItemProperty("holidays").toString();
                double overtimeAddition;

                boolean checkIfInputIsInteger = utilities.checkInputIfInteger(event.getText().trim());
                if (!checkIfInputIsInteger) {
                    getWindow().showNotification("Enter numeric format for undertime!",
                            Window.Notification.TYPE_WARNING_MESSAGE);
                    return;
                }

                if (!event.getText().isEmpty()) {
                    String branch = getBranch().replaceAll("\\(.*?\\)", "");
                    if (branch.trim().equals("on-call and trainees")) {
                        overtimeAddition = computation.processEmployeesOvertimeForOnCall(policyStr, holidayStr,
                                utilities.convertStringToInteger(event.getText().trim()), getEmploymentWage());
                        item.getItemProperty("o/min")
                                .setValue(utilities.roundOffToTwoDecimalPlaces(overtimeAddition));
                    } else {
                        overtimeAddition = computation.processEmployeesOvertime(policyStr, holidayStr,
                                utilities.convertStringToInteger(event.getText().trim()), getEmploymentWage());
                        item.getItemProperty("o/min").setValue(utilities.roundOffToTwoDecimalPlaces(
                                overtimeAddition + (overtimeAddition * premiumRate)));
                    }

                } else {
                    item.getItemProperty("o/min").setValue(0.0);
                }
            }
        });

        nightDifferential.addListener(new FieldEvents.TextChangeListener() {

            @Override
            public void textChange(FieldEvents.TextChangeEvent event) {
                Object itemId = lates.getData();
                Item item = table.getItem(itemId);
                String policyStr = item.getItemProperty("policy").toString();
                String holidayStr = item.getItemProperty("holidays").toString();
                double nightDifferentialAddition;

                boolean checkIfInputIsInteger = utilities.checkInputIfInteger(event.getText().trim());
                if (!checkIfInputIsInteger) {
                    getWindow().showNotification("Enter numeric format for undertime!",
                            Window.Notification.TYPE_WARNING_MESSAGE);
                    return;
                }

                if (!event.getText().isEmpty()) {
                    if (getBranch().equals("on-call and trainees")) {
                        nightDifferentialAddition = computation.processEmployeesNightDifferentialForOnCall(
                                policyStr, holidayStr, utilities.convertStringToInteger(event.getText().trim()),
                                getEmploymentWage());
                        item.getItemProperty("nd/min").setValue(utilities.roundOffToTwoDecimalPlaces(
                                nightDifferentialAddition + (nightDifferentialAddition * premiumRate)));
                    } else {
                        nightDifferentialAddition = computation.processEmployeesNightDifferential(policyStr,
                                holidayStr, utilities.convertStringToInteger(event.getText().trim()),
                                getEmploymentWage());
                        item.getItemProperty("nd/min").setValue(utilities.roundOffToTwoDecimalPlaces(
                                nightDifferentialAddition + (nightDifferentialAddition * premiumRate)));
                    }

                } else {
                    item.getItemProperty("nd/min").setValue(0.0);
                }
            }
        });

        dutyManager.addListener(new FieldEvents.TextChangeListener() {

            @Override
            public void textChange(FieldEvents.TextChangeEvent event) {
                Object itemId = lates.getData();
                Item item = table.getItem(itemId);
                String policyStr = item.getItemProperty("policy").toString();
                String holidayStr = item.getItemProperty("holidays").toString();
                double dutyManagerAddition;

                boolean checkIfInputIsInteger = utilities.checkInputIfInteger(event.getText().trim());
                if (!checkIfInputIsInteger) {
                    getWindow().showNotification("Enter numeric format for Duty Manager!",
                            Window.Notification.TYPE_WARNING_MESSAGE);
                    return;
                }

                if (!event.getText().isEmpty()) {
                    if (getBranch().equals("on-call and trainees")) {
                        dutyManagerAddition = computation.processEmployeeDutyManagerForOnCall(policyStr,
                                holidayStr, utilities.convertStringToInteger(event.getText().trim()),
                                getEmploymentWage());
                        item.getItemProperty("dm/min")
                                .setValue(utilities.roundOffToTwoDecimalPlaces(dutyManagerAddition));
                    } else {
                        dutyManagerAddition = computation.processEmployeeDutyManager(policyStr, holidayStr,
                                utilities.convertStringToInteger(event.getText().trim()), getEmploymentWage());
                        item.getItemProperty("dm/min")
                                .setValue(utilities.roundOffToTwoDecimalPlaces(dutyManagerAddition));
                    }

                } else {
                    item.getItemProperty("dm/min").setValue(0.0);
                }
            }
        });

        table.addItem(new Object[] { utilities.convertDateFormat(dateList.get(i).toString()), policy, holidays,
                premium, lates, undertime, overtime, nightDifferential, dutyManager, 0.0, 0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, //lates from legal & special holiday 
                0.0, 0.0, 0.0 //undertime from legal & special holiday
        }, i);
    }
    table.setPageLength(table.size());

    vlayout.addComponent(table);

    final Button button = new Button();
    button.setCaption("Save Attendance Data");
    vlayout.addComponent(button);

    for (Object listener : button.getListeners(Button.ClickListener.class)) {
        button.removeListener(Button.ClickListener.class, listener);
    }

    button.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                Collection attendanceTableCollection = table.getContainerDataSource().getItemIds();
                List<Timekeeping> attendanceList = new ArrayList<Timekeeping>();
                for (int i = 0; i < attendanceTableCollection.size(); i++) {
                    String str = table.getItem(i).toString();
                    String[] attStr = str.split(" ");
                    List<String> tkeepList = new ArrayList<String>(Arrays.asList(attStr));

                    Timekeeping t = new Timekeeping();
                    t.setAttendanceDate(utilities.parsingDate(tkeepList.get(0)));
                    t.setPolicy(tkeepList.get(1));
                    t.setHoliday(tkeepList.get(2));
                    t.setPremium(utilities.convertStringToBoolean(tkeepList.get(3)));
                    t.setLates(utilities.convertStringToDouble(tkeepList.get(4)));
                    t.setUndertime(utilities.convertStringToDouble(tkeepList.get(5)));
                    t.setOvertime(utilities.convertStringToDouble(tkeepList.get(6)));
                    t.setNightDifferential(utilities.convertStringToDouble(tkeepList.get(7)));
                    t.setDutyManager(utilities.convertStringToDouble(tkeepList.get(8)));
                    t.setLateDeduction(utilities.convertStringToDouble(tkeepList.get(9)));
                    t.setUndertimeDeduction(utilities.convertStringToDouble(tkeepList.get(10)));
                    t.setOvertimePaid(utilities.convertStringToDouble(tkeepList.get(11)));
                    t.setNightDifferentialPaid(utilities.convertStringToDouble(tkeepList.get(12)));
                    t.setDutyManagerPaid(utilities.convertStringToDouble(tkeepList.get(13)));
                    t.setLegalHolidayPaid(utilities.convertStringToDouble(tkeepList.get(14)));
                    t.setSpecialHolidayPaid(utilities.convertStringToDouble(tkeepList.get(15)));
                    t.setWorkingDayOffPaid(utilities.convertStringToDouble(tkeepList.get(16)));
                    t.setNonWorkingHolidayPaid(utilities.convertStringToDouble(tkeepList.get(17)));
                    t.setLatesLegalHolidayDeduction(utilities.convertStringToDouble(tkeepList.get(18)));
                    t.setLatesSpecialHolidayDeduction(utilities.convertStringToDouble(tkeepList.get(19)));
                    t.setLatesWorkingDayOffDeduction(utilities.convertStringToDouble(tkeepList.get(20)));
                    t.setUndertimeLegalHolidayDeduction(utilities.convertStringToDouble(tkeepList.get(21)));
                    t.setUndertimeSpecialHolidayDeduction(utilities.convertStringToDouble(tkeepList.get(22)));
                    t.setUndertimeWorkingDayOffDeduction(utilities.convertStringToDouble(tkeepList.get(23)));
                    attendanceList.add(t);
                }

                ProcessPayrollComputation processPayroll = new ProcessPayrollComputation(employeeId,
                        getBranchId());
                processPayroll.initVariables();
                processPayroll.initVariablesForComputation(attendanceList);
                boolean result = processPayroll.processPayrollComputation(payrollDate, payrollPeriod,
                        attendancePeriodFrom, attendancePeriodTo, 0);
                if (result) {
                    close();
                } else {
                    getWindow().showNotification("SQL ERROR");
                }
            } catch (Exception e) {
                e.getMessage();
            }
        }

    });

    return vlayout;
}