Example usage for com.google.gwt.user.client.ui CheckBox setValue

List of usage examples for com.google.gwt.user.client.ui CheckBox setValue

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui CheckBox setValue.

Prototype

@Override
public void setValue(Boolean value, boolean fireEvents) 

Source Link

Document

Checks or unchecks the check box, firing ValueChangeEvent if appropriate.

Usage

From source file:org.freemedsoftware.gwt.client.screen.ClaimsManager.java

License:Open Source License

public ClaimsManager() {
    super(moduleName);
    // Intializing all labels.
    lblAging = new Label(_("Aging"));
    lblFacility = new Label(_("Facility"));
    lblProvider = new Label(_("Provider"));
    lblPayer = new Label(_("Payer"));
    lblPlanName = new Label(_("Plan Name"));
    lblName = new Label(_("Name (Last, First)"));
    lblBillingStatus = new Label(_("Billing Status"));
    lblDateOfService = new Label(_("Date of Service"));
    lbPatientWidget = new Label(_("Patient Full Name"));
    lbTagSearch = new Label(_("Tag Search") + ": ");
    // TextBoxs for FirsName and LastName
    txtFirstName = new TextBox();
    txtFirstName.setWidth("200px");
    txtLastName = new TextBox();
    txtLastName.setWidth("200px");
    facilityWidget = new SupportModuleWidget("FacilityModule");

    patientWidget = new PatientWidget();
    // date for service's date and its simple format i;e without time.
    dateBox = new DateBox();
    dateBox.setFormat(new DefaultFormat(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT)));
    cbShowZeroBalance = new CheckBox(_("Include Zero Balances"));
    cbWholeWeek = new CheckBox(_("Select Week"));
    // Buttons for
    btnSearchClaim = new CustomButton(_("Search Claim"), AppConstants.ICON_SEARCH);
    popupVPanel = new VerticalPanel();
    popupVPanel.setSize("100%", "100%");
    popupVPanel.setSpacing(5);//from   w  w  w.  ja va 2s .  c  o  m
    ledgerStep1HPanel = new HorizontalPanel();
    ledgerStep1HPanel.setSpacing(10);
    Label actionType = new Label(_("Action"));
    // actionType.setStyleName(AppConstants.STYLE_LABEL_LARGE_BOLD);
    ledgerStep1HPanel.add(actionType);
    // ledgerStep1HPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    actionsList = new ListBox();
    actionsList.addItem(_("NONE SELECTED"));
    actionsList.addItem(_("Rebill"));
    actionsList.addItem(_("Payment"));
    // actionsList.addItem("Copay");
    actionsList.addItem(_("Adjustment"));
    // actionsList.addItem("Deductable");
    actionsList.addItem(_("Withhold"));
    actionsList.addItem(_("Transfer"));
    actionsList.addItem(_("Allowed Amount"));
    actionsList.addItem(_("Denial"));
    actionsList.addItem(_("Writeoff"));
    actionsList.addItem(_("Refund"));
    // actionsList.addItem("Mistake");
    actionsList.addItem(_("Ledger"));
    ledgerStep1HPanel.add(actionsList);

    CustomButton selectLineItemBtn = new CustomButton(_("Proceed"), AppConstants.ICON_NEXT);
    ledgerStep1HPanel.add(selectLineItemBtn);
    selectLineItemBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (actionsList.getSelectedIndex() != 0) {
                LedgerWidget pw = null;
                CustomRequestCallback cb = new CustomRequestCallback() {
                    @Override
                    public void onError() {

                    }

                    @Override
                    public void jsonifiedData(Object data) {
                        tabPanel.selectTab(0);
                        if (data.toString().equals("update")) {
                            ledgerPopup.clear();
                            ledgerPopup.hide();
                            refreshSearch();
                            openPopup();
                        } else if (data.toString().equals("close")) {
                            refreshSearch();
                        }
                    }
                };
                boolean hasUI = true;
                if (actionsList.getSelectedIndex() == 1) {
                    hasUI = false;
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.REBILLED,
                            cb);
                } else if (actionsList.getSelectedIndex() == 2) {
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.PAYMENT, cb);
                } else if (actionsList.getSelectedIndex() == 3) {
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.ADJUSTMENT,
                            cb);
                } else if (actionsList.getSelectedIndex() == 4) {
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.WITHHOLD,
                            cb);
                } else if (actionsList.getSelectedIndex() == 5) {
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.TRANSFER,
                            cb);
                } else if (actionsList.getSelectedIndex() == 6) {
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc,
                            PayCategory.ALLOWEDAMOUNT, cb);
                } else if (actionsList.getSelectedIndex() == 7) {
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.DENIAL, cb);
                } else if (actionsList.getSelectedIndex() == 8) {
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.WRITEOFF,
                            cb);
                } else if (actionsList.getSelectedIndex() == 9) {
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.REFUND, cb);
                }
                //               else if (actionsList.getSelectedIndex() == 12) {
                //                  hasUI = false;
                //                  pw = new LedgerWidget(currentProcId, currentPatientId,
                //                        procCovSrc, PayCategory.MISTAKE, cb);
                //               } 
                else if (actionsList.getSelectedIndex() == 10) {
                    pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.LEDGER, cb);
                }

                if (pw != null) {
                    if (hasUI) {
                        ledgerPopup.clear();
                        ledgerPopup.hide();
                        tabPanel.add(pw, currentPatientName);
                        tabPanel.selectTab(tabPanel.getWidgetCount() - 1);
                    }
                }
            } else {
                Window.alert(_("Please select the action type"));
            }
        }

    });

    actionsList.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {

        }

    });

    btnSearchClaim.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (Util.getProgramMode() == ProgramMode.JSONRPC) {
                refreshSearch();
            } else {
                Window.alert("You are on STUB Mod !");
            }
        }

    });
    btnClear = new CustomButton(_("Clear"), AppConstants.ICON_CLEAR);
    btnClear.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            clearSearch();
        }

    });

    btnAgingSummary = new CustomButton(_("Aging Summary"), AppConstants.ICON_VIEW);
    btnAgingSummary.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            CustomRequestCallback cb = new CustomRequestCallback() {
                @Override
                public void onError() {

                }

                @Override
                public void jsonifiedData(Object data) {
                    tabPanel.selectTab(0);
                    if (data instanceof HashMap) {
                        @SuppressWarnings("unchecked")
                        HashMap<String, String> map = (HashMap<String, String>) data;
                        if (map.get("payer") != null) {
                            payerWidget.setValue(Integer.parseInt(map.get("payer")));
                            payerWidget.setText(map.get("payer_name"));
                        }
                        if (map.get("aging") != null) {
                            if (map.get("aging").equals("0-30")) {
                                rb0To30.setValue(true);
                            } else if (map.get("aging").equals("31-60")) {
                                rb31To60.setValue(true);
                            } else if (map.get("aging").equals("61-90")) {
                                rb61To90.setValue(true);
                            } else if (map.get("aging").equals("91-120")) {
                                rb91To120.setValue(true);
                            } else if (map.get("aging").equals("120+")) {
                                rb120Plus.setValue(true);
                            }
                        }
                        refreshSearch();
                    }
                    if (data instanceof String) {
                        if (data.toString().equals("cancel")) {
                            tabPanel.selectTab(0);
                        }
                    }

                }
            };
            AgingSummaryWidget asw = new AgingSummaryWidget(cb);
            tabPanel.add(asw, "Aging Summary");
            tabPanel.selectTab(tabPanel.getWidgetCount() - 1);
        }

    });
    parentSearchTable = new FlexTable();
    parentSearchTable.setSize("100%", "100%");
    parentSearchTable.setBorderWidth(1);
    parentSearchTable.getElement().getStyle().setProperty("borderCollapse", "collapse");
    searchCriteriaVPanel = new VerticalPanel();
    searchCriteriaVPanel.setWidth("100%");
    searchCriteriaVPanel.setSpacing(5);
    Label lbSearch = new Label(_("Claims Criteria"));
    lbSearch.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    lbSearch.getElement().getStyle().setProperty("fontSize", "15px");
    lbSearch.getElement().getStyle().setProperty("textDecoration", "underline");
    lbSearch.getElement().getStyle().setProperty("fontWeight", "bold");
    searchCriteriaTable = new FlexTable();
    searchCriteriaVPanel.add(lbSearch);
    searchCriteriaVPanel.add(searchCriteriaTable);

    currentCriteriaPanel = new VerticalPanel();
    currentCriteriaPanel.setWidth("100%");
    currentCriteriaPanel.setSpacing(5);
    Label lbExistingCri = new Label(_("Current Criteria"));
    lbExistingCri.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    lbExistingCri.getElement().getStyle().setProperty("fontSize", "15px");
    lbExistingCri.getElement().getStyle().setProperty("textDecoration", "underline");
    lbExistingCri.getElement().getStyle().setProperty("fontWeight", "bold");
    existingCriteriaTable = new FlexTable();
    currentCriteriaPanel.add(lbExistingCri);
    currentCriteriaPanel.add(existingCriteriaTable);

    parentSearchTable.setWidget(0, 0, searchCriteriaVPanel);
    parentSearchTable.setWidget(0, 1, currentCriteriaPanel);
    parentSearchTable.getFlexCellFormatter().getElement(0, 0).setAttribute("width", "50%");
    parentSearchTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);

    tagWidget = new PatientTagWidget();

    tabPanel = new TabPanel();
    initWidget(tabPanel);

    final HorizontalPanel searchHorizontalPanel = new HorizontalPanel();
    tabPanel.add(searchHorizontalPanel, _("Search"));
    tabPanel.selectTab(0);
    searchHorizontalPanel.setSize("100%", "100%");

    verticalPanel = new VerticalPanel();
    searchHorizontalPanel.add(verticalPanel);
    verticalPanel.setSize("100%", "100%");

    // Adding all labels to the fexTable
    searchCriteriaTable.setWidget(0, 0, lblAging);
    searchCriteriaTable.setWidget(1, 0, lblFacility);
    searchCriteriaTable.setWidget(2, 0, lblProvider);
    searchCriteriaTable.setWidget(3, 0, lblPayer);
    searchCriteriaTable.setWidget(4, 0, lblPlanName);
    searchCriteriaTable.setWidget(5, 0, lblName);
    searchCriteriaTable.setWidget(6, 0, lbPatientWidget);
    searchCriteriaTable.setWidget(7, 0, lbTagSearch);
    searchCriteriaTable.setWidget(8, 0, lblBillingStatus);
    searchCriteriaTable.setWidget(9, 0, lblDateOfService);
    panelAging = new HorizontalPanel();
    panelAging.setSpacing(9);
    // panelAging.setSize("10","2"); //FIXME
    rb120Plus = new RadioButton("aging", "120+");
    rb91To120 = new RadioButton("aging", "91-120");
    rb61To90 = new RadioButton("aging", "61-90");
    rb31To60 = new RadioButton("aging", "31-60");
    rb0To30 = new RadioButton("aging", "0-30");
    rbNoSearch = new RadioButton("aging", "No Search");
    panelAging.add(rb120Plus);
    panelAging.add(rb91To120);
    panelAging.add(rb61To90);
    panelAging.add(rb31To60);
    panelAging.add(rb0To30);
    panelAging.add(rbNoSearch);
    searchCriteriaTable.setWidget(0, 1, panelAging);
    searchCriteriaTable.getFlexCellFormatter().setColSpan(0, 1, 2);
    // //////////////////////
    searchCriteriaTable.setWidget(1, 1, facilityWidget);
    provWidget = new SupportModuleWidget("ProviderModule");
    searchCriteriaTable.setWidget(2, 1, provWidget);
    provWidget.addValueChangeHandler(new ValueChangeHandler<Integer>() {

        @Override
        public void onValueChange(ValueChangeEvent<Integer> arg0) {
            refreshSearch();

        }

    });
    facilityWidget.addValueChangeHandler(new ValueChangeHandler<Integer>() {

        @Override
        public void onValueChange(ValueChangeEvent<Integer> arg0) {
            refreshSearch();

        }

    });
    // ////////////////////
    /* set column span so that it takes up the whole row. */

    searchCriteriaTable.getFlexCellFormatter().setColSpan(10, 1, 20); /*
                                                                      * col
                                                                      * span
                                                                      * for
                                                                      * Buttons
                                                                      */
    payerWidget = new CustomModuleWidget("api.ClaimLog.RebillDistinctPayers");
    searchCriteriaTable.setWidget(3, 1, payerWidget);
    payerWidget.addValueChangeHandler(new ValueChangeHandler<Integer>() {

        @Override
        public void onValueChange(ValueChangeEvent<Integer> arg0) {
            refreshSearch();

        }

    });
    // /////////////////////////////
    planWidget = new CustomModuleWidget();
    searchCriteriaTable.setWidget(4, 1, planWidget);
    planWidget.addValueChangeHandler(new ValueChangeHandler<Integer>() {

        @Override
        public void onValueChange(ValueChangeEvent<Integer> arg0) {
            refreshSearch();

        }

    });
    // ////////////////////////////
    FlowPanel panelName = new FlowPanel();
    panelName.add(txtLastName);
    panelName.add(txtFirstName);
    searchCriteriaTable.setWidget(5, 1, panelName);
    searchCriteriaTable.getFlexCellFormatter().setColSpan(5, 1, 2);
    searchCriteriaTable.setWidget(6, 0, lbPatientWidget);
    searchCriteriaTable.setWidget(6, 1, patientWidget);
    searchCriteriaTable.setWidget(6, 2, cbShowZeroBalance);
    patientWidget.addValueChangeHandler(new ValueChangeHandler<Integer>() {

        @Override
        public void onValueChange(ValueChangeEvent<Integer> arg0) {
            refreshSearch();

        }

    });
    tagWidget.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> arg0) {
            refreshSearch();
        }

    });
    searchCriteriaTable.setWidget(7, 1, tagWidget);
    // ///////////////////////////
    rbQueued = new RadioButton("status", _("Queued"));
    rbQueued.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            refreshSearch();
        }

    });
    rbBilled = new RadioButton("status", _("Billed"));
    rbBilled.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            refreshSearch();
        }

    });
    statusHp = new HorizontalPanel();
    statusHp.add(rbQueued);
    statusHp.add(rbBilled);

    searchCriteriaTable.setWidget(8, 1, statusHp);
    // ////////////////////////////
    searchCriteriaTable.setWidget(9, 1, dateBox);
    searchCriteriaTable.setWidget(9, 2, cbWholeWeek);

    dateBox.addValueChangeHandler(new ValueChangeHandler<Date>() {

        @Override
        public void onValueChange(ValueChangeEvent<Date> arg0) {
            refreshSearch();
        }

    });
    cbShowZeroBalance.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> arg0) {
            refreshSearch();

        }

    });
    cbWholeWeek.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> arg0) {
            refreshSearch();

        }

    });
    // ////////////////////
    HorizontalPanel panelButtons = new HorizontalPanel();

    panelButtons.setSpacing(5);
    panelButtons.add(btnSearchClaim);
    panelButtons.add(btnClear);
    panelButtons.add(btnAgingSummary);
    searchCriteriaTable.setWidget(10, 1, panelButtons);
    searchCriteriaTable.getFlexCellFormatter().setColSpan(10, 1, 2);
    procDetailsHPanel = new HorizontalPanel();
    // procDetailsHPanel.setSize("100%", "100%");
    procDetailFlexTable = new FlexTable();
    procDetailFlexTable.setStyleName(AppConstants.STYLE_TABLE);
    procDetailFlexTable.setWidth("100%");
    viewLedgerDetails = new HTML(
            "<a href=\"javascript:undefined;\" style='color:blue'>" + _("View Details") + "</a>");
    viewLedgerDetails.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {

            CustomRequestCallback cb = new CustomRequestCallback() {
                @Override
                public void onError() {

                }

                @Override
                public void jsonifiedData(Object data) {
                    tabPanel.selectTab(0);
                    if (data.toString().equals("update"))
                        refreshSearch();

                }
            };
            LedgerWidget pw = new LedgerWidget(currentProcId, currentPatientId, procCovSrc, PayCategory.LEDGER,
                    cb);
            ledgerPopup.clear();
            ledgerPopup.hide();
            tabPanel.add(pw, currentPatientName);
            tabPanel.selectTab(tabPanel.getWidgetCount() - 1);
        }

    });
    procDetailsHPanel.add(procDetailFlexTable);
    // procDetailFlexTable.setSize("100%", "100%");
    // / Preparing Columns for ClaimManager Table
    claimsManagerTable = new CustomTable();
    claimsManagerTable.setAllowSelection(false);
    claimsManagerTable.setSize("100%", "100%");
    claimsManagerTable.setIndexName("Id");
    claimsManagerTable.addColumn("S", "selected");
    claimsManagerTable.addColumn(_("DOS"), "date_of");
    claimsManagerTable.addColumn(_("Facility"), "posname");
    claimsManagerTable.addColumn(_("Patient"), "patient");
    claimsManagerTable.addColumn(_("Provider"), "provider_name");
    claimsManagerTable.addColumn(_("Payer"), "payer");
    claimsManagerTable.addColumn(_("Paid"), "paid");
    claimsManagerTable.addColumn(_("Balance"), "balance");
    claimsManagerTable.addColumn(_("Status"), "status");
    claimsManagerTable.addColumn(_("Claim"), "claim");
    claimsManagerTable.addColumn(_("Action"), "action");
    claimsManagerTable.getFlexTable().getFlexCellFormatter().setWidth(0, 0, "5px");
    checkBoxesList = new ArrayList<CheckBox>();
    // final HashMap<String, String> selectedPatientsWithClaims= new
    // HashMap<String, String>();
    claimsManagerTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {
        @Override
        public Widget setColumn(String columnName, final HashMap<String, String> data) {
            if (columnName.compareTo("action") == 0) {

                HorizontalPanel actionPanel = new HorizontalPanel();
                actionPanel.setSpacing(5);
                HTML htmlLedger = new HTML(
                        "<a href=\"javascript:undefined;\" style='color:blue'>" + _("Ledger") + "</a>");

                htmlLedger.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent arg0) {
                        currentProcId = data.get("Id");
                        currentPatientName = data.get("patient");
                        currentPatientId = data.get("patient_id");
                        procCovSrc = data.get("proc_cov_type");
                        openPopup();
                    }

                });

                HTML htmlEMR = new HTML(
                        "<a href=\"javascript:undefined;\" style='color:blue'>" + _("EMR") + "</a>");

                htmlEMR.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent arg0) {

                        Integer ptID = Integer.parseInt(data.get("patient_id"));
                        PatientScreen p = new PatientScreen();
                        p.setPatient(ptID);
                        Util.spawnTab(data.get("patient"), p);

                    }

                });

                HTML htmlBill = null;
                if (data.get("billed") == null || data.get("billed").equals("")
                        || data.get("billed").equals("0")) {
                    htmlBill = new HTML(
                            "<a href=\"javascript:undefined;\" style='color:blue'>" + _("Bill") + "</a>");

                    htmlBill.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent arg0) {
                            selectedProcs.clear();
                            selectedProcs.add(data.get("Id"));
                            CustomRequestCallback cb = new CustomRequestCallback() {
                                @Override
                                public void onError() {

                                }

                                @Override
                                public void jsonifiedData(Object data) {
                                    tabPanel.selectTab(0);
                                    if (data.toString().equals("update"))
                                        refreshSearch();

                                }
                            };
                            RemittBillingWidget billClaimsWidget = new RemittBillingWidget(selectedProcs, cb,
                                    BillingType.BILL);
                            tabPanel.add(billClaimsWidget, "Billing Queue");
                            tabPanel.selectTab(tabPanel.getWidgetCount() - 1);
                        }

                    });
                } else {
                    htmlBill = new HTML(
                            "<a href=\"javascript:undefined;\" style='color:blue'>" + _("Rebill") + "</a>");

                    htmlBill.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent arg0) {
                            if (data.get("billkey") != null && !data.get("billkey").equals("")) {
                                selectedBillKeys.clear();
                                selectedBillKeys.add(data.get("billkey"));
                                CustomRequestCallback cb = new CustomRequestCallback() {
                                    @Override
                                    public void onError() {

                                    }

                                    @Override
                                    public void jsonifiedData(Object data) {
                                        tabPanel.selectTab(0);
                                        if (data.toString().equals("update"))
                                            refreshSearch();

                                    }
                                };
                                RemittBillingWidget billClaimsWidget = new RemittBillingWidget(selectedBillKeys,
                                        cb, BillingType.REBILL);
                                tabPanel.add(billClaimsWidget, _("Re-Bill Claims"));
                                tabPanel.selectTab(tabPanel.getWidgetCount() - 1);
                            } else {
                                Window.alert(_("The selected claim was not submitted before"));
                            }
                        }

                    });
                }
                actionPanel.add(htmlEMR);
                actionPanel.add(htmlBill);
                actionPanel.add(htmlLedger);
                return actionPanel;
            } else if (columnName.compareTo("selected") == 0) {
                int actionRow = claimsManagerTable.getActionRow();
                claimsManagerTable.getFlexTable().getFlexCellFormatter().setWidth(actionRow, 0, "5px");
                CheckBox c = new CheckBox();
                checkBoxesList.add(c);
                c.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
                    @Override
                    public void onValueChange(ValueChangeEvent<Boolean> arg0) {
                        if (arg0.getValue()) {
                            selectedProcs.add(data.get("Id"));
                            if (data.get("billkey") != null && !data.get("billkey").equals(""))
                                selectedBillKeys.add(data.get("billkey"));
                        } else {
                            selectedProcs.remove(data.get("Id"));
                            selectedBillKeys.remove(data.get("billkey"));
                        }
                        // selectedPatientsWithClaims.put(data.get("patient_id"),
                        // data.get("claims"));
                        // else
                        // selectedPatientsWithClaims.remove(data.get("patient_id"));
                    }
                });
                return c;
            } else if (columnName.compareTo("status") == 0) {
                Float balance = Float.parseFloat(data.get("balance"));
                Label label = new Label();
                if (data.get("billed").equals("0")) {
                    label.setText(_("Queued"));
                    if (balance == 0)
                        label.getElement().getStyle().setColor("#5B5B3B");
                    else if (balance < 0)
                        label.getElement().getStyle().setColor("#FF0000");
                } else {
                    label.setText(_("Billed"));
                    label.getElement().getStyle().setColor("#6000A0");
                }

                return label;
            } else if (data.get("balance") != null) {
                Float balance = Float.parseFloat(data.get("balance"));
                Label label = new Label(data.get(columnName));
                if (data.get("billed").equals("1"))
                    label.getElement().getStyle().setColor("#6000A0");
                else if (balance == 0)
                    label.getElement().getStyle().setColor("#5B5B3B");
                else if (balance < 0)
                    label.getElement().getStyle().setColor("#FF0000");
                return label;

            } else {
                return (Widget) null;
            }
        }

    });

    claimsManagerTable.setTableRowClickHandler(new TableRowClickHandler() {
        @Override
        public void handleRowClick(HashMap<String, String> data, int col) {
            try {
                if (col == 1) {
                    dateBox.setValue(Util.getSQLDate(data.get("date_of")));
                    refreshSearch();
                }
                if (col == 2) {
                    CustomRequestCallback cb = new CustomRequestCallback() {
                        @Override
                        public void onError() {

                        }

                        @Override
                        public void jsonifiedData(Object data) {
                            if (data.toString().equals("done"))
                                refreshSearch();
                        }
                    };
                    facilityWidget.setAfterSetValueCallBack(cb);
                    facilityWidget.setValue(Integer.parseInt(data.get("pos")));
                }
                if (col == 3) {
                    CustomRequestCallback cb = new CustomRequestCallback() {
                        @Override
                        public void onError() {

                        }

                        @Override
                        public void jsonifiedData(Object data) {
                            if (data.toString().equals("done"))
                                refreshSearch();
                        }
                    };
                    patientWidget.setAfterSetValueCallBack(cb);
                    patientWidget.setValue(Integer.parseInt(data.get("patient_id")));

                }
                if (col == 4) {
                    CustomRequestCallback cb = new CustomRequestCallback() {
                        @Override
                        public void onError() {

                        }

                        @Override
                        public void jsonifiedData(Object data) {
                            if (data.toString().equals("done"))
                                refreshSearch();
                        }
                    };
                    provWidget.setAfterSetValueCallBack(cb);
                    provWidget.setValue(Integer.parseInt(data.get("provider_id")));

                }
                if (col == 5) {
                    payerWidget.setValue(Integer.parseInt(data.get("payer_id")));
                    payerWidget.setText(data.get("payer"));
                    refreshSearch();
                }
                if (col == 8) {
                    if (data.get("billed").equals("0"))
                        rbQueued.setValue(true);
                    else
                        rbBilled.setValue(false);
                    refreshSearch();
                }

                if (col == 9) {
                    CustomRequestCallback cb = new CustomRequestCallback() {
                        @Override
                        public void onError() {

                        }

                        @Override
                        public void jsonifiedData(Object data) {
                            tabPanel.selectTab(0);
                            if (data.toString().equals("update"))
                                refreshSearch();
                            if (data.toString().equals("new"))
                                clearSearch();

                        }
                    };
                    ClaimDetailsWidget claimDetail = new ClaimDetailsWidget(Integer.parseInt(data.get("claim")),
                            Integer.parseInt(data.get("patient_id")), data.get("patient"), cb);
                    tabPanel.add(claimDetail, _("Claim Details") + ": " + data.get("claim"));
                    tabPanel.selectTab(tabPanel.getWidgetCount() - 1);
                }

            } catch (Exception e) {
                JsonUtil.debug("ClaimManager.java: Caught exception: " + e.toString());
            }
        }
    });
    final HorizontalPanel buttonsHPanel = new HorizontalPanel();
    buttonsHPanel.setWidth("100%");
    HorizontalPanel buttonsHPanelLeft = new HorizontalPanel();
    buttonsHPanel.add(buttonsHPanelLeft);
    HorizontalPanel buttonsHPanelRight = new HorizontalPanel();
    buttonsHPanel.add(buttonsHPanelRight);
    buttonsHPanel.setCellHorizontalAlignment(buttonsHPanelRight, HorizontalPanel.ALIGN_RIGHT);
    final CustomButton selectAllBtn = new CustomButton(_("Select All"), AppConstants.ICON_SELECT_ALL);
    buttonsHPanelLeft.add(selectAllBtn);
    selectAllBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            Iterator<CheckBox> itr = checkBoxesList.iterator();
            while (itr.hasNext()) {
                CheckBox checkBox = (CheckBox) itr.next();
                checkBox.setValue(true, true);
            }
        }
    });

    final CustomButton selectNoneBtn = new CustomButton(_("Select None"), AppConstants.ICON_SELECT_NONE);
    buttonsHPanelLeft.add(selectNoneBtn);
    selectNoneBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            Iterator<CheckBox> itr = checkBoxesList.iterator();
            while (itr.hasNext()) {
                CheckBox checkBox = (CheckBox) itr.next();
                checkBox.setValue(false, true);
            }
        }
    });

    final CustomButton postCheckBtn = new CustomButton(_("Post Check"), AppConstants.ICON_SEND);
    buttonsHPanelLeft.add(postCheckBtn);
    postCheckBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            CustomRequestCallback cb = new CustomRequestCallback() {
                @Override
                public void onError() {

                }

                @Override
                public void jsonifiedData(Object data) {
                    tabPanel.selectTab(0);
                    if (data.toString().equals("update"))
                        refreshSearch();

                }
            };
            PostCheckWidget postCheckWidget = new PostCheckWidget(selectedProcs, cb);
            tabPanel.add(postCheckWidget, _("Post Check"));
            tabPanel.selectTab(tabPanel.getWidgetCount() - 1);
        }
    });

    final CustomButton billClaimsBtn = new CustomButton(_("Bill Claims"));
    buttonsHPanelRight.add(billClaimsBtn);
    billClaimsBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            CustomRequestCallback cb = new CustomRequestCallback() {
                @Override
                public void onError() {

                }

                @Override
                public void jsonifiedData(Object data) {
                    tabPanel.selectTab(0);
                    if (data.toString().equals("update"))
                        refreshSearch();

                }
            };
            RemittBillingWidget billClaimsWidget = new RemittBillingWidget(selectedProcs, cb, BillingType.BILL);
            tabPanel.add(billClaimsWidget, _("Billing Queue"));
            tabPanel.selectTab(tabPanel.getWidgetCount() - 1);
        }
    });

    final CustomButton markBilledBtn = new CustomButton(_("Mark Billed"), AppConstants.ICON_SELECT_ALL);
    buttonsHPanelRight.add(markBilledBtn);
    markBilledBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            markAsBilled();
        }
    });

    final CustomButton rebillClaimsBtn = new CustomButton(_("Rebill Claims"));
    buttonsHPanelRight.add(rebillClaimsBtn);
    rebillClaimsBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            CustomRequestCallback cb = new CustomRequestCallback() {
                @Override
                public void onError() {

                }

                @Override
                public void jsonifiedData(Object data) {
                    tabPanel.selectTab(0);
                    if (data.toString().equals("update"))
                        refreshSearch();

                }
            };
            RemittBillingWidget billClaimsWidget = new RemittBillingWidget(selectedBillKeys, cb,
                    BillingType.REBILL);
            tabPanel.add(billClaimsWidget, _("Rebill Claims"));
            tabPanel.selectTab(tabPanel.getWidgetCount() - 1);
        }
    });

    selectedProcs = new HashSet<String>();
    selectedBillKeys = new HashSet<String>();
    // ////////////
    verticalPanel.add(parentSearchTable);
    verticalPanel.add(buttonsHPanel);
    verticalPanel.add(claimsManagerTable);
    currentProcId = "";

    populate();
    Util.setFocus(rbNoSearch);
}

From source file:org.freemedsoftware.gwt.client.screen.RemittBilling.java

License:Open Source License

public VerticalPanel getPerformBillingUI() {
    final VerticalPanel performBillingVPanel = new VerticalPanel();
    performBillingVPanel.setWidth("100%");

    final HorizontalPanel buttonsHPanel = new HorizontalPanel();
    performBillingVPanel.add(buttonsHPanel);

    final CustomButton selectAllBtn = new CustomButton(_("Select All"), AppConstants.ICON_SELECT_ALL);
    buttonsHPanel.add(selectAllBtn);/* ww w  .  ja  va2  s  .  c o m*/
    selectAllBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
        }
    });

    final CustomButton selectNoneBtn = new CustomButton(_("Select None"), AppConstants.ICON_SELECT_NONE);
    buttonsHPanel.add(selectNoneBtn);
    selectNoneBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
        }
    });

    final CustomButton submitClaimsBtn = new CustomButton(_("Submit Claims"), AppConstants.ICON_ADD);
    buttonsHPanel.add(submitClaimsBtn);
    submitClaimsBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
        }
    });

    final CustomTable topSelectionTable = new CustomTable();
    topSelectionTable.setWidth("100%");
    performBillingVPanel.add(topSelectionTable);
    topSelectionTable.getFlexTable().setWidget(0, 0, new Label(_("Clearinghouse")));
    topSelectionTable.getFlexTable().setWidget(0, 1, new Label(_("Billing Service")));
    topSelectionTable.getFlexTable().setWidget(0, 2, new Label(_("Billing Contact")));

    final CustomListBox clearingHouseList = new CustomListBox();
    Util.callModuleMethod("BillingClearinghouse", "picklist", (Integer) null, new CustomRequestCallback() {
        @Override
        public void onError() {
        }

        @Override
        public void jsonifiedData(Object data) {
            if (data != null) {
                HashMap<String, String> result = (HashMap<String, String>) data;
                Iterator<String> iterator = result.keySet().iterator();
                while (iterator.hasNext()) {
                    String id = iterator.next();
                    String item = result.get(id);
                    clearingHouseList.addItem(item, id);
                }
            }
        }
    }, "HashMap<String,String>");
    topSelectionTable.getFlexTable().setWidget(1, 0, clearingHouseList);

    final CustomListBox billingServiceList = new CustomListBox();
    Util.callModuleMethod("BillingService", "picklist", (Integer) null, new CustomRequestCallback() {
        @Override
        public void onError() {
        }

        @Override
        public void jsonifiedData(Object data) {
            if (data != null) {
                HashMap<String, String> result = (HashMap<String, String>) data;
                Iterator<String> iterator = result.keySet().iterator();
                while (iterator.hasNext()) {
                    String id = iterator.next();
                    String item = result.get(id);
                    billingServiceList.addItem(item, id);
                }
            }
        }
    }, "HashMap<String,String>");
    topSelectionTable.getFlexTable().setWidget(1, 1, billingServiceList);

    final CustomListBox billingContactList = new CustomListBox();
    Util.callModuleMethod("BillingContact", "picklist", (Integer) null, new CustomRequestCallback() {
        @Override
        public void onError() {
        }

        @Override
        public void jsonifiedData(Object data) {
            if (data != null) {
                HashMap<String, String> result = (HashMap<String, String>) data;
                Iterator<String> iterator = result.keySet().iterator();
                while (iterator.hasNext()) {
                    String id = iterator.next();
                    String item = result.get(id);
                    billingContactList.addItem(item, id);
                }
            }
        }
    }, "HashMap<String,String>");
    topSelectionTable.getFlexTable().setWidget(1, 2, billingContactList);

    final CustomTable claimsSubmissionTable = new CustomTable();
    claimsSubmissionTable.setWidth("100%");
    performBillingVPanel.add(claimsSubmissionTable);
    claimsSubmissionTable.addColumn(_("Selected"), "selected");
    claimsSubmissionTable.addColumn(_("Patient"), "patient");
    claimsSubmissionTable.addColumn(_("Total Claims"), "claim_count");
    claimsSubmissionTable.setIndexName("patient_id");
    claimsSubmissionTable.setMultipleSelection(true);
    claimsSubmissionTable.showloading(true);
    Util.callModuleMethod("RemittBillingTransport", "PatientsToBill", (Integer) null,
            new CustomRequestCallback() {
                @Override
                public void onError() {
                }

                @Override
                public void jsonifiedData(Object data) {
                    if (data != null) {
                        claimsSubmissionTable.loadData((HashMap<String, String>[]) data);
                    } else {
                        claimsSubmissionTable.showloading(false);
                    }
                }
            }, "HashMap<String,String>[]");

    final List<CheckBox> checkBoxesList = new ArrayList<CheckBox>();

    final HashMap<String, String> selectedPatientsWithClaims = new HashMap<String, String>();

    claimsSubmissionTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {
        public Widget setColumn(String columnName, final HashMap<String, String> data) {
            if (columnName.compareTo("selected") == 0) {
                CheckBox c = new CheckBox();
                checkBoxesList.add(c);
                c.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
                    @Override
                    public void onValueChange(ValueChangeEvent<Boolean> arg0) {
                        if (arg0.getValue())
                            selectedPatientsWithClaims.put(data.get("patient_id"), data.get("claims"));
                        else
                            selectedPatientsWithClaims.remove(data.get("patient_id"));
                    }
                });
                return c;
            } else {
                return (Widget) null;
            }
        }
    });

    selectAllBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            Iterator<CheckBox> itr = checkBoxesList.iterator();
            while (itr.hasNext()) {
                CheckBox checkBox = (CheckBox) itr.next();
                checkBox.setValue(true, true);
            }
        }
    });
    selectNoneBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            Iterator<CheckBox> itr = checkBoxesList.iterator();
            while (itr.hasNext()) {
                CheckBox checkBox = (CheckBox) itr.next();
                checkBox.setValue(false, true);
            }
        }
    });
    submitClaimsBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            if (selectedPatientsWithClaims.size() > 0) {
                List<String> patientsList = new ArrayList<String>();
                List<String> claimsList = new ArrayList<String>();

                Iterator<String> iterator = selectedPatientsWithClaims.keySet().iterator();
                while (iterator.hasNext()) {
                    String key = iterator.next();
                    String value = selectedPatientsWithClaims.get(key);
                    List<String> values = csvToClaimsArray(value);
                    patientsList.add(key);
                    for (String v : values) {
                        claimsList.add(v);
                    }
                }

                List paramsList = new ArrayList();
                paramsList.add(patientsList.toArray(new String[0]));
                paramsList.add(claimsList.toArray(new String[0]));
                Util.callModuleMethod("RemittBillingTransport", "ProcessClaims", paramsList,
                        new CustomRequestCallback() {
                            @Override
                            public void onError() {
                            }

                            @Override
                            public void jsonifiedData(Object data) {
                            }
                        }, "");

            } else
                Window.alert("Please select at least one claim!");
        }
    });

    return performBillingVPanel;
}

From source file:org.nsesa.editor.gwt.amendment.client.ui.amendment.share.SharePanelController.java

License:EUPL

/**
 * Sets the parent amendment controller, and registers the event listeners.
 *
 * @param amendmentController the parent amendment controller
 *///ww w. j a v  a  2s  .  co  m
public void setAmendmentController(final AmendmentController amendmentController) {
    this.amendmentController = amendmentController;

    final ClientContext clientContext = amendmentController.getDocumentController().getClientFactory()
            .getClientContext();
    PersonDTO person = clientContext.getLoggedInPerson();
    view.getMainPanel().clear();
    for (final GroupDTO group : person.getGroups()) {
        final CheckBox checkBox = new CheckBox(group.getName());
        if (amendmentController.getModel().getGroups() != null)
            checkBox.setValue(amendmentController.getModel().getGroups().contains(group), false);

        checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            @Override
            public void onValueChange(final ValueChangeEvent<Boolean> event) {
                // TODO register this
                amendmentController.getDocumentController().getServiceFactory().getGwtAmendmentService()
                        .shareAmendmentContainer(clientContext,
                                amendmentController.getModel().getAmendmentContainerID(), group.getGroupID(),
                                event.getValue(), new AsyncCallback<AmendmentContainerDTO>() {
                                    @Override
                                    public void onFailure(Throwable caught) {
                                        amendmentController.getDocumentController().getClientFactory()
                                                .getEventBus().fireEvent(new CriticalErrorEvent(
                                                        "Could not share amendment with group.", caught));
                                    }

                                    @Override
                                    public void onSuccess(AmendmentContainerDTO result) {
                                        EventBus eventBus = amendmentController.getDocumentController()
                                                .getClientFactory().getEventBus();
                                        // merge our updated result
                                        amendmentController.setModel(result);
                                        eventBus.fireEvent(new AmendmentContainerMergeEvent(result));
                                        // re-diff
                                        amendmentController.getDocumentController().getDocumentEventBus()
                                                .fireEvent(
                                                        new AmendmentContainerSavedEvent(amendmentController));
                                        String message = (event.getValue()
                                                ? "Successfully shared amendment with group "
                                                : "Successfully stopped sharing amendment with group ")
                                                + group.getName();
                                        eventBus.fireEvent(new NotificationEvent(message));
                                    }
                                });
            }
        });
        addWidget(checkBox);
    }
}

From source file:org.rstudio.core.client.widget.CheckboxLabel.java

License:Open Source License

public CheckboxLabel(final CheckBox checkbox, String label) {
    label_ = new Label(label);

    label_.getElement().getStyle().setCursor(Cursor.DEFAULT);
    label_.addClickHandler(new ClickHandler() {
        @Override/*from   ww  w .j  a  va 2 s .c  o m*/
        public void onClick(ClickEvent event) {
            event.preventDefault();

            checkbox.setValue(!checkbox.getValue(), true);
        }
    });
}

From source file:org.talend.mdm.webapp.stagingarea.control.client.view.FilterDialog.java

License:Open Source License

private FilterDialog(final ConceptRelationshipModel relation, final FilterListener listener) {
    this.setClosable(false);
    this.setLayout(new FitLayout());
    this.setModal(true);

    container.setHeaderVisible(false);//from  www. j  av  a 2 s .  c  om
    container.setBodyBorder(false);
    container.setScrollMode(Scroll.AUTOY);

    entitySet = new EntitySet(relation);
    entitySet.setSize(600, 260);
    FieldSet conceptSet = new FieldSet();
    conceptSet.setHeading(MessagesFactory.getMessages().entity_filter());
    conceptSet.add(new HTML("<b>" + MessagesFactory.getMessages().entity_filter_title() + "</b>"), //$NON-NLS-1$//$NON-NLS-2$
            new RowData(1, -1, new Margins(0, 10, 0, 10)));
    conceptSet.add(entitySet, new RowData(1, -1, new Margins(0, 0, 0, 0)));
    Button reset = new Button(MessagesFactory.getMessages().reset_concept());
    conceptSet.add(reset, new RowData(1, 1, new Margins(0, 10, 0, 10)));

    container.add(conceptSet, new RowData(1, -1, new Margins(0, 10, 0, 10)));
    container.add(statusSet, new RowData(1, -1, new Margins(0, 10, 0, 10)));
    container.add(timeSet, new RowData(1, 1, new Margins(0, 10, 0, 10)));

    Button ok = new Button(MessagesFactory.getMessages().ok());
    ok.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            hide();
            FilterModel filter = new FilterModel();
            List<String> concepts = entitySet.getSelectedConcepts();
            filter.setConcepts(concepts);
            filter.setStatusCodes(statusSet.getStatuses());
            filter.setStartDate(timeSet.getStartDate());
            filter.setEndDate(timeSet.getEndDate());
            listener.onFilter(filter);
        }
    });
    Button cancel = new Button(MessagesFactory.getMessages().cancel());
    cancel.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            hide();
        }
    });
    this.addButton(ok);
    this.addButton(cancel);
    this.setButtonAlign(HorizontalAlignment.RIGHT);

    this.add(container);
    reset.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            for (CheckBox box : entitySet.boxes) {
                box.setValue(false, true);
            }
        }
    });
    setSize(660, 570);
}