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

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

Introduction

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

Prototype

@Override
    public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Boolean> handler) 

Source Link

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);// w  ww .  j av  a  2s .co  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.PatientForm.java

License:Open Source License

public PatientForm() {
    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setWidth("100%");
    initWidget(verticalPanel);// w  w w  .j  av a2 s . co  m

    final CheckBox tabView = new CheckBox(_("Tab View"));
    tabView.setValue(true);

    verticalPanel.add(tabView);

    final TabPanel tabPanel = new TabPanel();
    tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            // TODO Auto-generated method stub
            if (event.getSelectedItem() == 0)
                title.setFocus(true);
            if (event.getSelectedItem() == 2)
                preferredContact.setFocus(true);
            if (event.getSelectedItem() == 3)
                martialStatus.setFocus(true);
            if (event.getSelectedItem() == 4)
                primaryFacility.setFocus(true);
        }
    });
    verticalPanel.add(tabPanel);

    final VerticalPanel nonTabViewContainer = new VerticalPanel();
    nonTabViewContainer.setWidth("100%");
    nonTabViewContainer.setVisible(false);
    verticalPanel.add(nonTabViewContainer);

    final FlexTable demographicsTable = new FlexTable();
    demographicsTable.setWidth("100%");
    tabPanel.add(demographicsTable, _("Demographics"));

    final Label titleLabel = new Label(_("Title"));
    demographicsTable.setWidget(0, 0, titleLabel);

    /*
    wTitle = new CustomListBox();
    demographicsTable.setWidget(0, 1, wTitle);
    wTitle.addItem("[Choose title]", "");
    wTitle.addItem("Mr");
    wTitle.addItem("Mrs");
    wTitle.addItem("Ms");
    wTitle.addItem("Dr");
    wTitle.addItem("Fr");
    wTitle.setVisibleItemCount(1);
    */
    title = new CustomRadioButtonGroup("title");
    title.setWidth("30%");
    demographicsTable.setWidget(0, 1, title);
    title.addItem("Mr");
    title.addItem("Mrs");
    title.addItem("Ms");
    title.addItem("Dr");
    title.addItem("Fr");

    final Label lastNameLabel = new Label(_("Last Name"));
    demographicsTable.setWidget(1, 0, lastNameLabel);

    wLastName = new TextBox();
    demographicsTable.setWidget(1, 1, wLastName);
    wLastName.setTabIndex(1);
    wLastName.setFocus(true);
    wLastName.setWidth("100%");
    wLastName.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent arg0) {
            generatePracticeId();
        }

    });

    final Label firstNameLabel = new Label(_("First Name"));
    demographicsTable.setWidget(2, 0, firstNameLabel);

    wFirstName = new TextBox();
    demographicsTable.setWidget(2, 1, wFirstName);
    wFirstName.setTabIndex(2);
    wFirstName.setWidth("100%");
    wFirstName.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent arg0) {
            generatePracticeId();
        }

    });

    final Label middleNameLabel = new Label(_("Middle Name"));
    demographicsTable.setWidget(3, 0, middleNameLabel);

    wMiddleName = new TextBox();
    demographicsTable.setWidget(3, 1, wMiddleName);
    wMiddleName.setTabIndex(3);
    wMiddleName.setWidth("100%");
    wMiddleName.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent arg0) {
            generatePracticeId();
        }

    });

    final Label suffixLabel = new Label(_("Suffix"));
    demographicsTable.setWidget(4, 0, suffixLabel);

    /*
    wSuffix = new CustomListBox();
    demographicsTable.setWidget(4, 1, wSuffix);
    wSuffix.setTabIndex(4);
    wSuffix.addItem("[No Suffix]", "");
    wSuffix.addItem("Sr");
    wSuffix.addItem("Jr");
    wSuffix.addItem("II");
    wSuffix.addItem("III");
    wSuffix.addItem("IV");
    wSuffix.setVisibleItemCount(1);
    */

    suffix = new CustomRadioButtonGroup("suffix");
    suffix.setWidth("30%");
    demographicsTable.setWidget(4, 1, suffix);
    suffix.addItem("Sr");
    suffix.addItem("Jr");
    suffix.addItem("II");
    suffix.addItem("III");
    suffix.addItem("IV");

    final Label genderLabel = new Label(_("Gender"));
    demographicsTable.setWidget(5, 0, genderLabel);

    /*
    wGender = new CustomListBox();
    demographicsTable.setWidget(5, 1, wGender);
    wGender.setTabIndex(5);
    wGender.addItem("[Choose Value]", "");
    wGender.addItem("Male", "m");
    wGender.addItem("Female", "f");
    wGender.addItem("Transgendered", "t");
    wGender.setVisibleItemCount(1);
    */

    gender = new CustomRadioButtonGroup("gender");
    gender.setWidth("30%");
    demographicsTable.setWidget(5, 1, gender);
    gender.addItem(_("Male"), "m");
    gender.addItem(_("Female"), "f");
    gender.addItem(_("Transgendered"), "t");

    final Label dateOfBirthLabel = new Label(_("Date of Birth"));
    demographicsTable.setWidget(6, 0, dateOfBirthLabel);

    wDob = new CustomDatePicker();
    demographicsTable.setWidget(6, 1, wDob);
    // wDob.setTabIndex(6);

    addressContainer = new PatientAddresses();
    addressContainer.setWidth("100%");
    tabPanel.add(addressContainer, _("Address"));

    final FlexTable contactTable = new FlexTable();
    contactTable.setWidth("100%");
    tabPanel.add(contactTable, _("Contact"));

    final Label preferredContactLabel = new Label(_("Preferred Contact"));
    contactTable.setWidget(0, 0, preferredContactLabel);

    preferredContact = new CustomListBox();
    preferredContact.addItem(_("Home"), "home");
    preferredContact.addItem(_("Work"), "work");
    preferredContact.addItem(_("Mobile"), "mobile");
    preferredContact.addItem(_("Email"), "email");
    preferredContact.setVisibleItemCount(1);
    contactTable.setWidget(0, 1, preferredContact);

    final Label homePhoneLabel = new Label(_("Home Phone"));
    contactTable.setWidget(1, 0, homePhoneLabel);

    final Label workPhoneLabel = new Label(_("Work Phone"));
    contactTable.setWidget(2, 0, workPhoneLabel);

    final Label faxPhoneLabel = new Label(_("Fax Phone"));
    contactTable.setWidget(3, 0, faxPhoneLabel);

    final Label mobilePhoneLabel = new Label(_("Mobile Phone"));
    contactTable.setWidget(4, 0, mobilePhoneLabel);

    final Label emailAddressLabel = new Label(_("Email Address"));
    contactTable.setWidget(5, 0, emailAddressLabel);

    phoneHome = new TextBox();
    contactTable.setWidget(1, 1, phoneHome);
    phoneHome.setWidth("100%");

    phoneWork = new TextBox();
    contactTable.setWidget(2, 1, phoneWork);
    phoneWork.setWidth("100%");

    phoneFax = new TextBox();
    contactTable.setWidget(3, 1, phoneFax);
    phoneFax.setWidth("100%");

    phoneMobile = new TextBox();
    contactTable.setWidget(4, 1, phoneMobile);
    phoneMobile.setWidth("100%");

    emailAddress = new TextBox();
    contactTable.setWidget(5, 1, emailAddress);
    emailAddress.setWidth("100%");

    //creating personal tab
    final FlexTable personalTable = new FlexTable();
    personalTable.setWidth("100%");
    tabPanel.add(personalTable, _("Personal"));

    final Label martialStatusLabel = new Label(_("Marital Status"));
    personalTable.setWidget(0, 0, martialStatusLabel);

    martialStatus = new CustomRadioButtonGroup("martialStatus");
    martialStatus.addItem(_("Single"), "single");
    martialStatus.addItem(_("Married"), "married");
    martialStatus.addItem(_("Divorced"), "divorced");
    martialStatus.addItem(_("Separated"), "separated");
    martialStatus.addItem(_("Widowed"), "widowed");
    //      martialStatus.setVisibleItemCount(1);
    personalTable.setWidget(0, 1, martialStatus);

    final Label employmentStatusLabel = new Label(_("Employment Status"));
    personalTable.setWidget(1, 0, employmentStatusLabel);

    employmentStatus = new CustomListBox();
    employmentStatus.addItem(_("Yes"), "y");
    employmentStatus.addItem(_("No"), "n");
    employmentStatus.addItem(_("Part Time"), "p");
    employmentStatus.addItem(_("Self"), "s");
    employmentStatus.addItem(_("Retired"), "r");
    employmentStatus.addItem(_("Military"), "m");
    employmentStatus.addItem(_("Unknown"), "u");
    employmentStatus.setVisibleItemCount(1);
    personalTable.setWidget(1, 1, employmentStatus);

    final Label patientStatusLabel = new Label(_("Patient Status"));
    personalTable.setWidget(2, 0, patientStatusLabel);

    final Label patientStatusValueLabel = new Label(_("None"));
    personalTable.setWidget(2, 1, patientStatusValueLabel);

    final Label socialSecurityNumberLabel = new Label(_("Social Security Number"));
    personalTable.setWidget(3, 0, socialSecurityNumberLabel);

    socialSecurityNumber = new TextBox();
    personalTable.setWidget(3, 1, socialSecurityNumber);
    socialSecurityNumber.setWidth("100%");
    socialSecurityNumber.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent arg0) {
            generatePracticeId();
        }

    });

    final Label raceLabel = new Label(_("Race"));
    personalTable.setWidget(4, 0, raceLabel);

    race = new CustomListBox();
    race.addItem(_("Unknown race"), "7");
    race.addItem(_("Hispanic, white"), "1");
    race.addItem(_("Hispanic, black"), "2");
    race.addItem(_("American Indian or Alaska Native"), "3");
    race.addItem(_("Black, not of Hispanic origin"), "4");
    race.addItem(_("Asian or Pacific Islander"), "5");
    race.addItem(_("White, not of Hispanic origin"), "6");
    race.setVisibleItemCount(1);
    personalTable.setWidget(4, 1, race);

    final Label religionLabel = new Label(_("Religion"));
    personalTable.setWidget(5, 0, religionLabel);

    religion = new CustomListBox();
    religion.addItem(_("Unknown/No preference"), "29");
    religion.addItem(_("Catholic"), "0");
    religion.addItem(_("Jewish"), "1");
    religion.addItem(_("Eastern Orthodox"), "2");
    religion.addItem(_("Baptist"), "3");
    religion.addItem(_("Methodist"), "4");
    religion.addItem(_("Lutheran"), "5");
    religion.addItem(_("Presbyterian"), "6");
    religion.addItem(_("United Church of God"), "7");
    religion.addItem(_("Episcopalian"), "8");
    religion.addItem(_("Adventist"), "9");
    religion.addItem(_("Assembly of God"), "10");
    religion.addItem(_("Brethren"), "11");
    religion.addItem(_("Christian Scientist"), "12");
    religion.addItem(_("Church of Christ"), "13");
    religion.addItem(_("Church of God"), "14");
    religion.addItem(_("Disciples of Christ"), "15");
    religion.addItem(_("Evangelical Covenant"), "16");
    religion.addItem(_("Friends"), "17");
    religion.addItem(_("Jehovah's Witness"), "18");
    religion.addItem(_("Latter-Day Saints"), "19");
    religion.addItem(_("Islam"), "20");
    religion.addItem(_("Nazarene"), "21");
    religion.addItem(_("Other"), "22");
    religion.addItem(_("Pentecostal"), "23");
    religion.addItem(_("Protestant, Other"), "24");
    religion.addItem(_("Protestant, No Denomination"), "25");
    religion.addItem(_("Reformed"), "26");
    religion.addItem(_("Salvation Army"), "27");
    religion.addItem(_("Unitarian; Universalist"), "28");
    religion.addItem(_("Native American"), "30");
    religion.addItem(_("Buddhist"), "31");
    religion.setVisibleItemCount(1);
    personalTable.setWidget(5, 1, religion);

    final Label languageLabel = new Label(_("Language"));
    personalTable.setWidget(6, 0, languageLabel);
    languages = new CustomListBox();
    personalTable.setWidget(6, 1, languages);
    loadLanguages();

    final Label driverLicenceLabel = new Label(_("Driver's License (No State)"));
    personalTable.setWidget(7, 0, driverLicenceLabel);

    driverLicence = new TextBox();
    personalTable.setWidget(7, 1, driverLicence);
    driverLicence.setWidth("100%");

    final Label typeofBillingLabel = new Label(_("Type of Billing"));
    personalTable.setWidget(8, 0, typeofBillingLabel);

    typeofBilling = new CustomListBox();
    typeofBilling.addItem(_("NONE SELECTED"), "");
    typeofBilling.addItem(_("Monthly Billing On Account"), "mon");
    typeofBilling.addItem(_("Statement Billing"), "sta");
    typeofBilling.addItem(_("Charge Card Billing"), "chg");
    typeofBilling.setVisibleItemCount(1);
    personalTable.setWidget(8, 1, typeofBilling);

    final Label monthlyBudgetAmountLabel = new Label(_("Monthly Budget Amount"));
    personalTable.setWidget(9, 0, monthlyBudgetAmountLabel);

    monthlyBudgetAmount = new TextBox();
    personalTable.setWidget(9, 1, monthlyBudgetAmount);
    monthlyBudgetAmount.setWidth("100%");

    final Label patientPracticeIdLabel = new Label(_("Patient Practice ID"));
    personalTable.setWidget(10, 0, patientPracticeIdLabel);

    patientPracticeID = new TextBox();
    personalTable.setWidget(10, 1, patientPracticeID);
    patientPracticeID.setTabIndex(7);
    patientPracticeID.setWidth("100%");

    //creating Medical tab
    final FlexTable medicalTable = new FlexTable();
    medicalTable.setWidth("100%");
    tabPanel.add(medicalTable, _("Medical"));

    //      final Label bloodTypeLabel = new Label("Blood Type");
    //      medicalTable.setWidget(0, 0, bloodTypeLabel);
    //
    //      bloodType = new CustomListBox();
    //      bloodType.addItem("-","");
    //      bloodType.addItem("O","O");
    //      bloodType.addItem("O+","O+");
    //      bloodType.addItem("O-","O-");
    //      bloodType.addItem("A","A");
    //      bloodType.addItem("A+","A+");
    //      bloodType.addItem("A-","A-");
    //      bloodType.addItem("B","B");
    //      bloodType.addItem("B+","B+");
    //      bloodType.addItem("B-","B-");
    //      bloodType.addItem("AB","AB");
    //      bloodType.addItem("AB+","AB+");
    //      bloodType.addItem("AB-","AB-");
    //      bloodType.setVisibleItemCount(1);
    //      medicalTable.setWidget(0, 1, bloodType);

    final Label primaryFacilityLabel = new Label(_("Primary Facility"));
    medicalTable.setWidget(0, 0, primaryFacilityLabel);

    primaryFacility = new SupportModuleWidget("FacilityModule");
    medicalTable.setWidget(0, 1, primaryFacility);
    primaryFacility.setWidth("100%");

    final Label preferredPharmacyLabel = new Label(_("Preferred Pharmacy"));
    medicalTable.setWidget(1, 0, preferredPharmacyLabel);

    preferredPharmacy = new SupportModuleWidget("Pharmacy");
    medicalTable.setWidget(1, 1, preferredPharmacy);
    preferredPharmacy.setWidth("100%");

    final Label inHouseDoctorLabel = new Label(_("In House Doctor"));
    medicalTable.setWidget(2, 0, inHouseDoctorLabel);

    inHouseDoctor = new ProviderWidget();

    medicalTable.setWidget(2, 1, inHouseDoctor);
    inHouseDoctor.setWidth("100%");

    final Label referringDoctorLabel = new Label(_("Referring Doctor"));
    medicalTable.setWidget(3, 0, referringDoctorLabel);

    referringDoctor = new ProviderWidget();
    medicalTable.setWidget(3, 1, referringDoctor);
    referringDoctor.setWidth("100%");

    final Label primaryCarePhysicianLabel = new Label(_("Primary Care Physician"));
    medicalTable.setWidget(4, 0, primaryCarePhysicianLabel);

    primaryCarePhysician = new ProviderWidget();
    medicalTable.setWidget(4, 1, primaryCarePhysician);
    primaryCarePhysician.setWidth("100%");

    final Label numberofOtherPhysiciansLabel = new Label(_("Number of Other Physicians"));
    medicalTable.setWidget(5, 0, numberofOtherPhysiciansLabel);

    numberofOtherPhysicians = new CustomListBox();
    numberofOtherPhysicians.addItem("0", "0");
    numberofOtherPhysicians.addItem("1", "1");
    numberofOtherPhysicians.addItem("2", "2");
    numberofOtherPhysicians.addItem("3", "3");
    numberofOtherPhysicians.addItem("4", "4");
    numberofOtherPhysicians.setVisibleItemCount(1);
    medicalTable.setWidget(5, 1, numberofOtherPhysicians);

    numberofOtherPhysicians.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent arg0) {
            // TODO Auto-generated method stub
            int selectedCount = Integer
                    .parseInt(numberofOtherPhysicians.getValue(numberofOtherPhysicians.getSelectedIndex()));
            updateOtherPhysiciansBoxes(selectedCount);
        }

    });

    otherPhysician1Label = new Label(_("Physician 1"));
    medicalTable.setWidget(6, 0, otherPhysician1Label);
    otherPhysician1 = new ProviderWidget();
    medicalTable.setWidget(6, 1, otherPhysician1);

    otherPhysician2Label = new Label(_("Physician 2"));
    medicalTable.setWidget(7, 0, otherPhysician2Label);
    otherPhysician2 = new ProviderWidget();
    medicalTable.setWidget(7, 1, otherPhysician2);

    otherPhysician3Label = new Label(_("Physician 3"));
    medicalTable.setWidget(8, 0, otherPhysician3Label);
    otherPhysician3 = new ProviderWidget();
    medicalTable.setWidget(8, 1, otherPhysician3);

    otherPhysician4Label = new Label(_("Physician 4"));
    medicalTable.setWidget(9, 0, otherPhysician4Label);
    otherPhysician4 = new ProviderWidget();
    medicalTable.setWidget(9, 1, otherPhysician4);

    updateOtherPhysiciansBoxes(0);

    // Select first tab "demographics" as active tag
    tabPanel.selectTab(0);

    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    verticalPanel.add(horizontalPanel);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);
    //      horizontalPanel.setWidth("100%");

    submitButton = new CustomButton(_("Commit"), AppConstants.ICON_ADD);
    horizontalPanel.add(submitButton);
    submitButton.addClickHandler(new ClickHandler() {
        @SuppressWarnings({ "rawtypes", "unchecked" })
        @Override
        public void onClick(ClickEvent evt) {
            //            submitButton.setEnabled(false);
            if (validateForm()) {
                if (patientId == null || patientId == 0) {
                    List params = new ArrayList();
                    HashMap<String, String> criteria = new HashMap<String, String>();
                    criteria.put("ptlname", (String) wLastName.getText());
                    criteria.put("ptfname", (String) wFirstName.getText());
                    criteria.put("ptdob", (String) wDob.getStoredValue());
                    params.add(criteria);

                    Util.callApiMethod("PatientInterface", "GetDuplicatePatients", params,
                            new CustomRequestCallback() {

                                @Override
                                public void onError() {
                                    //                     submitButton.setEnabled(true);
                                }

                                @Override
                                public void jsonifiedData(Object data) {
                                    HashMap<String, String> result = (HashMap<String, String>) data;
                                    if (result == null || result.size() == 0)
                                        commitChanges();
                                    else {
                                        String msg = _(
                                                "This patient is already in the system. Do you want to continue adding?");
                                        Util.confirm(msg, new Command() {

                                            @Override
                                            public void execute() {
                                                commitChanges();
                                            }
                                        }, null);
                                    }
                                }
                            }, "HashMap<String,String>");

                } else
                    commitChanges();
            }
        }
    });

    CustomButton cancelButton = new CustomButton(_("Cancel"), AppConstants.ICON_CANCEL);
    cancelButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            // TODO Auto-generated method stub
            try {
                closeScreen();
            } catch (Exception e) {
            }

            if (patientId != 0)
                spawnPatientScreen(patientId);
        }
    });
    horizontalPanel.add(cancelButton);

    if (CurrentState.isActionAllowed(CoveragesModuleName, AppConstants.SHOW)) {
        patientCoverages = new PatientCoverages();
        patientCoverages.setWidth("100%");
        tabPanel.add(patientCoverages, _("Coverages"));
    }
    if (CurrentState.isActionAllowed(AuthorizationsModuleName, AppConstants.SHOW)) {
        patientAuthorizations = new PatientAuthorizations();
        patientAuthorizations.setWidth("100%");
        tabPanel.add(patientAuthorizations, _("Authorizations"));
    }

    tabView.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> arg0) {
            if (arg0.getValue()) {
                tabPanel.clear();
                //Adding Demographics
                tabPanel.add(demographicsTable, _("Demographics"));
                //Adding Address
                tabPanel.add(addressContainer, _("Address"));
                //Adding Contact
                tabPanel.add(contactTable, _("Contact"));
                //Adding Personal
                tabPanel.add(personalTable, _("Personal"));
                //Adding Medical
                tabPanel.add(medicalTable, _("Medical"));
                //Adding Coverages
                tabPanel.add(patientCoverages, _("Coverages"));
                //Adding Authorizations
                tabPanel.add(patientAuthorizations, _("Authorizations"));

                nonTabViewContainer.setVisible(false);
                tabPanel.setVisible(true);
                tabPanel.selectTab(0);
            } else {
                nonTabViewContainer.clear();
                //Adding Demographics
                Label label = new Label(_("Demographics"));
                label.setStyleName(AppConstants.STYLE_LABEL_HEADER_MEDIUM);
                nonTabViewContainer.add(label);
                nonTabViewContainer.add(demographicsTable);
                demographicsTable.setWidth("100%");

                //Adding Address
                label = new Label(_("Address"));
                label.setStyleName(AppConstants.STYLE_LABEL_HEADER_MEDIUM);
                nonTabViewContainer.add(label);
                nonTabViewContainer.add(addressContainer);
                addressContainer.setWidth("100%");

                //Adding Contact
                label = new Label(_("Contact"));
                label.setStyleName(AppConstants.STYLE_LABEL_HEADER_MEDIUM);
                nonTabViewContainer.add(label);
                nonTabViewContainer.add(contactTable);
                contactTable.setWidth("100%");

                //Adding Personal
                label = new Label(_("Personal"));
                label.setStyleName(AppConstants.STYLE_LABEL_HEADER_MEDIUM);
                nonTabViewContainer.add(label);
                nonTabViewContainer.add(personalTable);
                personalTable.setWidth("100%");

                //Adding Medical
                label = new Label(_("Medical"));
                label.setStyleName(AppConstants.STYLE_LABEL_HEADER_MEDIUM);
                nonTabViewContainer.add(label);
                nonTabViewContainer.add(medicalTable);
                medicalTable.setWidth("100%");

                //Adding Coverages
                label = new Label(_("Coverages"));
                label.setStyleName(AppConstants.STYLE_LABEL_HEADER_MEDIUM);
                nonTabViewContainer.add(label);
                nonTabViewContainer.add(patientCoverages);
                patientCoverages.setWidth("100%");

                //Adding Authorizations
                label = new Label("Authorizations");
                label.setStyleName(AppConstants.STYLE_LABEL_HEADER_MEDIUM);
                nonTabViewContainer.add(label);
                nonTabViewContainer.add(patientAuthorizations);
                patientAuthorizations.setWidth("100%");

                tabPanel.setVisible(false);
                nonTabViewContainer.setVisible(true);
            }

        }

    });

    Util.setFocus(title);
}

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);/*from   w w  w . ja v  a  2 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.freemedsoftware.gwt.client.screen.UserManagementScreen.java

License:Open Source License

public void addACLGroup(final String[][] data) {
    int row = 0, col = 0;
    for (int i = 0; i < data.length; i++) {
        final String groupName = data[i][0];
        final Integer groupId = Integer.parseInt(data[i][1]);
        final CheckBox checkBox = new CheckBox(groupName);
        checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            HashMap<String, List> thisGroupMap = null;

            @Override/* w  w w . ja v a2s.c o m*/
            public void onValueChange(ValueChangeEvent<Boolean> arg0) {
                if (checkBox.getValue()) {
                    if (!aclSelectedGroupsIdsList.contains(groupId))
                        aclSelectedGroupsIdsList.add(groupId);
                    if (thisGroupMap == null) {
                        Util.callModuleMethod("ACL", "GetGroupPermissions", groupId,
                                new CustomRequestCallback() {
                                    @Override
                                    public void onError() {
                                    }

                                    @Override
                                    public void jsonifiedData(Object data) {
                                        thisGroupMap = (HashMap<String, List>) data;
                                        setCheckBoxesValue(thisGroupMap, true, false);
                                        setCheckBoxesValue(blockedPermissionsMap, false, true);
                                        setCheckBoxesValue(allowedPermissionsMap, true, true);
                                    }
                                }, "HashMap<String,List>");
                    } else {
                        setCheckBoxesValue(thisGroupMap, true, false);
                        setCheckBoxesValue(blockedPermissionsMap, false, true);
                        setCheckBoxesValue(allowedPermissionsMap, true, true);
                    }
                } else {
                    aclSelectedGroupsIdsList.remove(groupId);
                    setCheckBoxesValue(thisGroupMap, false, false);
                }

            }

        });

        aclGroupsTable.setWidget(row, col, checkBox);
        aclGroupsCheckBoxesMap.put(groupId, checkBox);
        if ((i + 1) % 3 == 0) {
            row++;
            col = 0;
        } else
            col++;
    }
}

From source file:org.geomajas.gwt2.plugin.tms.example.client.sample.CapabilitiesPanel.java

License:Open Source License

private void getCapabilities() {
    // First clear the panel and the map:
    mapPresenter.getLayersModel().clear();
    layerList.clear();/*ww w .  j a v  a 2  s .  com*/

    TmsClient.getInstance().getTileMapService(/*USE_PROXY +*/ getCapaUrl(),
            new Callback<TileMapServiceInfo, String>() {

                @Override
                public void onSuccess(TileMapServiceInfo result) {
                    for (final ListTileMapInfo tileMap : result.getTileMaps()) {

                        // Only add layers using LatLon:
                        if ("EPSG:4326".equalsIgnoreCase(tileMap.getSrs())) {
                            CheckBox layerBox = new CheckBox(tileMap.getTitle());
                            layerBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

                                @Override
                                public void onValueChange(ValueChangeEvent<Boolean> event) {
                                    if (event.getValue()) {
                                        addLayer(tileMap);
                                    } else {
                                        mapPresenter.getLayersModel().removeLayer(tileMap.getTitle());
                                    }
                                }
                            });

                            layerList.add(layerBox);
                        }

                    }
                }

                @Override
                public void onFailure(String reason) {
                    Window.alert("We're very sorry, but something went wrong: " + reason);
                }
            });
}

From source file:org.geomajas.gwt2.plugin.tms.example.client.sample.ProfilesPanel.java

License:Open Source License

private void getCapabilities() {
    // First clear the panel and the map:
    mapPresenter.getLayersModel().clear();
    layerList.clear();//  w w  w.j  ava  2s . c o  m

    TmsClient.getInstance().getTileMapService(/* USE_PROXY + */getCapaUrl(),
            new Callback<TileMapServiceInfo, String>() {

                @Override
                public void onSuccess(TileMapServiceInfo result) {
                    boolean first = true;
                    for (final ListTileMapInfo tileMap : result.getTileMaps()) {
                        // Only add layers with correct profile:
                        if (mapPresenter.getConfiguration().getHintValue(TmsClient.PROFILE).getProfile()
                                .equalsIgnoreCase(tileMap.getProfile())) {
                            CheckBox layerBox = new CheckBox(tileMap.getTitle());
                            layerBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

                                @Override
                                public void onValueChange(ValueChangeEvent<Boolean> event) {
                                    if (event.getValue()) {
                                        addLayer(tileMap);
                                    } else {
                                        mapPresenter.getLayersModel().removeLayer(tileMap.getTitle());
                                    }
                                }
                            });
                            if (first) {
                                addLayer(tileMap);
                                layerBox.setValue(true);
                                first = false;
                            }
                            layerList.add(layerBox);
                        }

                    }
                }

                @Override
                public void onFailure(String reason) {
                    Window.alert("We're very sorry, but something went wrong: " + reason);
                }
            });
}

From source file:org.geomajas.gwt2.plugin.wms.example.client.sample.CapabilitiesPanel.java

License:Open Source License

private void getCapabilities() {
    // First clear the panel and the map:
    mapPresenter.getLayersModel().clear();
    layerList.clear();/*from  w w w.  j av a  2  s . c o m*/
    requestList.clear();

    WmsClient.getInstance().getWmsService().getCapabilities(WMS_BASE_URL, getWmsVersion(),
            new Callback<WmsGetCapabilitiesInfo, String>() {

                @Override
                public void onSuccess(WmsGetCapabilitiesInfo result) {
                    if (result.getLayers() != null) {
                        for (WmsLayerInfo layerInfo : result.getLayers()) {
                            TileConfiguration tileConfig = WmsClient.getInstance().createTileConfig(layerInfo,
                                    mapPresenter.getViewPort(), 256, 256);
                            WmsLayerConfiguration layerConfig = WmsClient.getInstance()
                                    .createLayerConfig(layerInfo, WMS_BASE_URL, getWmsVersion());
                            final WmsLayer layer = WmsClient.getInstance().createLayer(layerInfo.getTitle(),
                                    mapPresenter.getViewPort().getCrs(), tileConfig, layerConfig, layerInfo);

                            CheckBox layerBox = new CheckBox(layer.getTitle());
                            layerBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

                                @Override
                                public void onValueChange(ValueChangeEvent<Boolean> event) {
                                    if (event.getValue()) {
                                        mapPresenter.getLayersModel().addLayer(layer);
                                        mapPresenter.getLayersModelRenderer().setAnimated(layer, true);
                                    } else {
                                        mapPresenter.getLayersModel().removeLayer(layer.getId());
                                    }
                                }
                            });

                            layerList.add(layerBox);
                        }
                    }
                    if (result.getRequests() != null) {
                        for (WmsRequestInfo requestInfo : result.getRequests()) {
                            requestList.add(new Label(requestInfo.getRequestType().toString()));
                        }
                    }
                }

                @Override
                public void onFailure(String reason) {
                    Window.alert("We're very sorry, but something went wrong: " + reason);
                }
            });
}

From source file:org.geomajas.plugin.wms.example.client.sample.CapabilitiesPanel.java

License:Open Source License

private void getCapabilities() {
    // First clear the panel and the map:
    mapPresenter.getLayersModel().clear();
    layerList.clear();//from w  w  w .java 2s  .c  o  m

    WmsClient.getInstance().getWmsService().getCapabilities(WMS_BASE_URL, getWmsVersion(),
            new Callback<WmsGetCapabilitiesInfo, String>() {

                @Override
                public void onSuccess(WmsGetCapabilitiesInfo result) {
                    if (result.getLayers() != null) {
                        for (WmsLayerInfo layerInfo : result.getLayers()) {
                            WmsTileConfiguration tileConfig = WmsClient.getInstance()
                                    .createTileConfig(layerInfo, mapPresenter.getViewPort().getCrs(), 256, 256);
                            WmsLayerConfiguration layerConfig = WmsClient.getInstance()
                                    .createLayerConfig(layerInfo, WMS_BASE_URL, getWmsVersion());
                            final WmsLayer layer = WmsClient.getInstance().createLayer(layerInfo.getTitle(),
                                    tileConfig, layerConfig, layerInfo);

                            CheckBox layerBox = new CheckBox(layer.getTitle());
                            layerBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

                                @Override
                                public void onValueChange(ValueChangeEvent<Boolean> event) {
                                    if (event.getValue()) {
                                        mapPresenter.getLayersModel().addLayer(layer);
                                        mapPresenter.getLayersModelRenderer().setAnimated(layer, true);
                                    } else {
                                        mapPresenter.getLayersModel().removeLayer(layer.getId());
                                    }
                                }
                            });

                            layerList.add(layerBox);
                        }
                    }
                }

                @Override
                public void onFailure(String reason) {
                    Window.alert("We're very sorry, but something went wrong: " + reason);
                }
            });
}

From source file:org.gwtaf.visibility.rule.ShowIfChecked.java

License:Apache License

/**
 * Create a new <code>ShowIfChecked</code> with the given CheckBox.
 * /*  w w w  .j a  v  a 2  s.c  o m*/
 * @param parent
 *            the parent CheckBox.
 */
public ShowIfChecked(CheckBox parent) {
    super(parent);

    parent.addValueChangeHandler(new ShowIfCheckedHandler());
}

From source file:org.jboss.errai.bus.client.util.BusErrorDialog.java

License:Apache License

public BusErrorDialog(final ClientMessageBusImpl clientMessageBus) {
    hide();//from w w  w.j a  va2s  .co  m
    setModal(false);

    final VerticalPanel panel = new VerticalPanel();

    final HorizontalPanel titleBar = new HorizontalPanel();
    titleBar.getElement().getStyle().setProperty("backgroundColor", "#A9A9A9");
    titleBar.getElement().getStyle().setWidth(100, Style.Unit.PCT);
    titleBar.getElement().getStyle().setProperty("borderBottom", "1px solid black");
    titleBar.getElement().getStyle().setProperty("marginBottom", "5px");

    final Label titleBarLabel = new Label("An Error Occurred in the Bus");
    titleBarLabel.getElement().getStyle().setFontSize(10, Style.Unit.PT);
    titleBarLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLDER);
    titleBarLabel.getElement().getStyle().setColor("white");

    titleBar.add(titleBarLabel);
    titleBar.setCellVerticalAlignment(titleBarLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    final HorizontalPanel buttonPanel = new HorizontalPanel();

    final CheckBox showFurtherErrors = new CheckBox();
    showFurtherErrors.setValue(showErrors);
    showFurtherErrors.setText("Show further errors");
    showFurtherErrors.getElement().getStyle().setFontSize(10, Style.Unit.PT);
    showFurtherErrors.getElement().getStyle().setColor("white");

    showFurtherErrors.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(final ValueChangeEvent<Boolean> booleanValueChangeEvent) {
            showErrors = booleanValueChangeEvent.getValue();
        }
    });

    final Button disconnectFromServer = new Button("Disconnect Bus");
    disconnectFromServer.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            if (Window.confirm(
                    "Are you sure you want to disconnect and de-federate the local bus from the server bus? "
                            + "This will permanently kill your session. You will need to refresh to reconnect. OK will proceed. Click "
                            + "Cancel to abort this operation")) {
                clientMessageBus.stop(true);
            }
        }
    });

    final Button clearErrors = new Button("Clear Log");
    clearErrors.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            contentPanel.clear();
        }
    });

    final Button closeButton = new Button("Dismiss Error");
    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            BusErrorDialog.this.hide();
        }
    });

    buttonPanel.add(showFurtherErrors);
    buttonPanel.add(disconnectFromServer);
    buttonPanel.add(clearErrors);
    buttonPanel.add(closeButton);

    buttonPanel.setCellVerticalAlignment(showFurtherErrors, HasVerticalAlignment.ALIGN_MIDDLE);

    titleBar.add(buttonPanel);
    titleBar.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    panel.add(titleBar);

    final Style s = panel.getElement().getStyle();

    s.setProperty("border", "1px");
    s.setProperty("borderStyle", "solid");
    s.setProperty("borderColor", "black");
    s.setProperty("backgroundColor", "#ede0c3");

    resize();

    panel.add(contentPanel);
    add(panel);

    getElement().getStyle().setZIndex(16777271);
}