Example usage for com.google.gwt.user.client.ui Label setText

List of usage examples for com.google.gwt.user.client.ui Label setText

Introduction

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

Prototype

public void setText(String text) 

Source Link

Document

Sets the label's content to the given text.

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 . j a va 2 s. 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.DashboardScreenNew.java

License:Open Source License

protected HorizontalPanel createHeaderPanel() {
    final HorizontalPanel headerHPanel = new HorizontalPanel();
    headerHPanel.setWidth("100%");
    //Adding quick text on top left corner

    final HorizontalPanel refreshDashBoardHPanel = new HorizontalPanel();
    refreshDashBoardHPanel.setWidth("100%");
    headerHPanel.add(refreshDashBoardHPanel);

    final HorizontalPanel refreshDashBoardSubHPanel = new HorizontalPanel();
    refreshDashBoardHPanel.add(refreshDashBoardSubHPanel);

    final Label lastUpdateLabel = new Label("Last updated on " + Util.getTodayDate());
    refreshDashBoardSubHPanel.add(lastUpdateLabel);
    refreshDashBoardSubHPanel.setCellVerticalAlignment(lastUpdateLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    final CustomButton refreshDashBoardBtn = new CustomButton("Refresh", AppConstants.ICON_REFRESH);
    refreshDashBoardBtn.getElement().setAttribute("style", "float:right");
    refreshDashBoardSubHPanel.add(refreshDashBoardBtn);
    refreshDashBoardHPanel.setCellHorizontalAlignment(refreshDashBoardSubHPanel,
            HasHorizontalAlignment.ALIGN_RIGHT);

    refreshDashBoardBtn.addClickHandler(new ClickHandler() {

        @Override/*from www.j ava2  s  . c  o  m*/
        public void onClick(ClickEvent arg0) {
            // TODO Auto-generated method stub
            lastUpdateLabel.setText("Last updated on " + Util.getTodayDate());
            clearView();
            loadWidgets();
            reloadDashboard();
        }

    });

    return headerHPanel;
}

From source file:org.freemedsoftware.gwt.client.widget.ClaimDetailsWidget.java

License:Open Source License

public void createClaimDetailsPanel() {
    newClaimEventPanel.clear();// ww w  .j  a  v a 2 s.c o m
    claimDetailsPanel.clear();
    newClaimEventPanel.setVisible(false);
    claimDetailsPanel.setVisible(true);
    FlexTable claimsInfoParentTable = new FlexTable();
    claimsInfoParentTable.setBorderWidth(1);
    claimsInfoParentTable.getElement().getStyle().setProperty("borderCollapse", "collapse");
    claimDetailsPanel.setWidth("100%");
    claimDetailsPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    claimDetailsPanel.setSpacing(5);
    claimsInfoParentTable.setWidth("100%");
    claimDetailsPanel.add(claimsInfoParentTable);

    Label lbCovInfo = new Label(_("Coverage Information"));
    lbCovInfo.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    lbCovInfo.getElement().getStyle().setProperty("fontSize", "15px");
    lbCovInfo.getElement().getStyle().setProperty("textDecoration", "underline");
    lbCovInfo.getElement().getStyle().setProperty("fontWeight", "bold");

    FlexTable covInfoTable = new FlexTable();
    covInfoTable.setWidth("100%");
    final FlexTable covTypesTable = new FlexTable();
    covTypesTable.setWidth("100%");
    VerticalPanel covInfoVPanel = new VerticalPanel();
    covInfoVPanel.setSpacing(10);
    covInfoVPanel.setWidth("95%");

    covInfoVPanel.add(lbCovInfo);
    covInfoVPanel.add(covInfoTable);
    covInfoVPanel.add(covTypesTable);
    claimsInfoParentTable.setWidget(0, 0, covInfoVPanel);
    claimsInfoParentTable.getFlexCellFormatter().getElement(0, 0).setAttribute("width", "50%");
    claimsInfoParentTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);

    Label lbPatient = new Label(_("Patient") + ":");
    lbPatient.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    lbPatientVal = new Label();
    Label lbdob = new Label(_("Date of Birth") + ":");
    lbdob.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbdobVal = new Label();
    Label lbSSN = new Label(_("SSN") + ":");
    lbSSN.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbSSNVal = new Label();

    covInfoTable.setWidget(0, 0, lbPatient);
    covInfoTable.setWidget(0, 1, lbPatientVal);
    covInfoTable.setWidget(0, 2, lbdob);
    covInfoTable.setWidget(0, 3, lbdobVal);
    covInfoTable.setWidget(0, 4, lbSSN);
    covInfoTable.setWidget(0, 5, lbSSNVal);

    final Label lbRespParty = new Label(_("Resp. Party") + ":");
    lbRespParty.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbRespPartyVal = new Label();
    final Label lbRpDob = new Label(_("Date of Birth") + ":");
    lbRpDob.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbRpDobVal = new Label();
    final Label lbRpSSN = new Label(_("SSN") + ":");
    lbRpSSN.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbRpSSNVal = new Label();

    covInfoTable.setWidget(1, 0, lbRespParty);
    covInfoTable.setWidget(1, 1, lbRespPartyVal);
    covInfoTable.setWidget(1, 2, lbRpDob);
    covInfoTable.setWidget(1, 3, lbRpDobVal);
    covInfoTable.setWidget(1, 4, lbRpSSN);
    covInfoTable.setWidget(1, 5, lbRpSSNVal);

    final Label lbPrimary = new Label(_("Primary Coverage") + "/" + _("Location") + "/" + _("Ins. No.") + "/"
            + _("Copay") + "/" + _("Deductible"));
    lbPrimary.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbPrimaryVal = new Label();

    covTypesTable.setWidget(0, 0, lbPrimary);
    covTypesTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    covTypesTable.setWidget(0, 1, lbPrimaryVal);
    covTypesTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);

    final Label lbSecondary = new Label(_("Secondary Coverage") + "/" + _("Location") + "/" + _("Ins. No.")
            + "/" + _("Copay") + "/" + _("Deductible"));
    lbSecondary.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbSecondaryVal = new Label();

    covTypesTable.setWidget(1, 0, lbSecondary);
    covTypesTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);
    covTypesTable.setWidget(1, 1, lbSecondaryVal);
    covTypesTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);

    final Label lbTertiary = new Label(_("Tertiary Coverage") + "/" + _("Location") + "/" + _("Ins. No.") + "/"
            + _("Copay") + "/" + _("Deductible"));
    lbTertiary.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbTertiaryVal = new Label();

    covTypesTable.setWidget(2, 0, lbTertiary);
    covTypesTable.getFlexCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP);
    covTypesTable.setWidget(2, 1, lbTertiaryVal);
    covTypesTable.getFlexCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP);

    Label lbClaimInfo = new Label(_("Claim Information"));
    lbClaimInfo.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    lbClaimInfo.getElement().getStyle().setProperty("fontSize", "15px");
    lbClaimInfo.getElement().getStyle().setProperty("textDecoration", "underline");
    lbClaimInfo.getElement().getStyle().setProperty("fontWeight", "bold");

    final FlexTable clInfoTable = new FlexTable();
    clInfoTable.setWidth("100%");

    VerticalPanel clInfoVPanel = new VerticalPanel();
    clInfoVPanel.setSpacing(10);
    clInfoVPanel.setWidth("95%");

    clInfoVPanel.add(lbClaimInfo);
    clInfoVPanel.add(clInfoTable);
    claimsInfoParentTable.setWidget(0, 1, clInfoVPanel);
    claimsInfoParentTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);

    Label lbDos = new Label(_("Date of Service") + ":");
    lbDos.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbDosVal = new Label();

    clInfoTable.setWidget(0, 0, lbDos);
    clInfoTable.setWidget(0, 1, lbDosVal);

    Label lbProvider = new Label(_("Provider") + ":");
    lbProvider.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbProviderVal = new Label();
    Label lbRefProv = new Label(_("Referring Provider") + ":");
    lbRefProv.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbRefProvVal = new Label();

    clInfoTable.setWidget(1, 0, lbProvider);
    clInfoTable.setWidget(1, 1, lbProviderVal);
    clInfoTable.setWidget(1, 2, lbRefProv);
    clInfoTable.setWidget(1, 3, lbRefProvVal);

    Label lbPOS = new Label(_("POS") + ":");
    lbPOS.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbPOSVal = new Label();
    Label lbCharges = new Label(_("Charges") + ":");
    lbCharges.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbChargesVal = new Label();

    clInfoTable.setWidget(2, 0, lbPOS);
    clInfoTable.setWidget(2, 1, lbPOSVal);
    clInfoTable.setWidget(2, 2, lbCharges);
    clInfoTable.setWidget(2, 3, lbChargesVal);

    Label lbCPT = new Label(_("CPT") + ":");
    lbCPT.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbCPTVal = new Label();
    Label lbPaid = new Label(_("Paid") + ":");
    lbPaid.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbPaidVal = new Label();

    clInfoTable.setWidget(3, 0, lbCPT);
    clInfoTable.setWidget(3, 1, lbCPTVal);
    clInfoTable.setWidget(3, 2, lbPaid);
    clInfoTable.setWidget(3, 3, lbPaidVal);

    Label lbICD = new Label(_("ICD") + ":");
    lbICD.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbICDVal = new Label();
    Label lbBalance = new Label(_("Balance") + ":");
    lbBalance.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD);
    final Label lbBalanceVal = new Label();

    clInfoTable.setWidget(4, 0, lbICD);
    clInfoTable.setWidget(4, 1, lbICDVal);
    clInfoTable.setWidget(4, 2, lbBalance);
    clInfoTable.setWidget(4, 3, lbBalanceVal);

    ArrayList<String> params = new ArrayList<String>();
    params.add("" + claimid);
    Util.callApiMethod("ClaimLog", "claim_information", params, new CustomRequestCallback() {
        @Override
        public void onError() {
        }

        @SuppressWarnings("unchecked")
        @Override
        public void jsonifiedData(Object data) {
            if (data != null) {
                HashMap<String, String> result = (HashMap<String, String>) data;
                if (result.get("patient") != null)
                    lbPatientVal.setText(result.get("patient"));
                if (result.get("rp_name") != null) {
                    lbRespPartyVal.setText(result.get("rp_name"));
                    if (result.get("rp_name").toString().equalsIgnoreCase("self")) {
                        lbRpDob.setVisible(false);
                        lbRpDobVal.setVisible(false);
                        lbRpSSN.setVisible(false);
                        lbRpSSNVal.setVisible(false);
                    }
                } else {
                    lbRespParty.setVisible(false);
                    lbRespPartyVal.setVisible(false);
                    lbRpDob.setVisible(false);
                    lbRpDobVal.setVisible(false);
                    lbRpSSN.setVisible(false);
                    lbRpSSNVal.setVisible(false);
                }
                if (result.get("patient_dob") != null)
                    lbdobVal.setText(result.get("patient_dob"));
                if (result.get("provider_name") != null)
                    lbProviderVal.setText(result.get("provider_name"));
                if (result.get("ssn") != null)
                    lbSSNVal.setText(result.get("ssn"));
                if (result.get("rp_ssn") != null)
                    lbRpSSNVal.setText(result.get("rp_ssn"));
                if (result.get("rp_dob") != null)
                    lbRpDobVal.setText(result.get("rp_dob"));
                if (result.get("ref_provider_name") != null)
                    lbRefProvVal.setText(result.get("ref_provider_name"));
                if (result.get("prim_cov") != null && !result.get("prim_cov").equals("")) {
                    lbPrimaryVal.setText(result.get("prim_cov"));
                    if (result.get("prim_copay") != null)
                        lbPrimaryVal.setText(lbPrimaryVal.getText() + "/" + result.get("prim_copay"));
                    if (result.get("prim_deduct") != null)
                        lbPrimaryVal.setText(lbPrimaryVal.getText() + "/" + result.get("prim_deduct"));
                } else {
                    lbPrimary.setVisible(false);
                    lbPrimaryVal.setVisible(false);
                }

                if (result.get("sec_cov") != null && !result.get("sec_cov").equals("")) {
                    lbSecondaryVal.setText(result.get("sec_cov"));
                    if (result.get("sec_copay") != null)
                        lbSecondaryVal.setText(lbSecondaryVal.getText() + "/" + result.get("sec_copay"));
                    if (result.get("sec_deduct") != null)
                        lbSecondaryVal.setText(lbSecondaryVal.getText() + "/" + result.get("sec_deduct"));
                } else {
                    lbSecondary.setVisible(false);
                    lbSecondaryVal.setVisible(false);
                }

                if (result.get("ter_cov") != null && !result.get("ter_cov").equals("")) {
                    lbTertiaryVal.setText(result.get("ter_cov"));
                    if (result.get("ter_copay") != null)
                        lbTertiaryVal.setText(lbTertiaryVal.getText() + "/" + result.get("ter_copay"));
                    if (result.get("ter_deduct") != null)
                        lbTertiaryVal.setText(lbTertiaryVal.getText() + "/" + result.get("ter_deduct"));
                } else {
                    lbTertiary.setVisible(false);
                    lbTertiaryVal.setVisible(false);
                }

                if (result.get("facility") != null)
                    lbPOSVal.setText(result.get("facility"));
                if (result.get("service_date") != null)
                    lbDosVal.setText(result.get("service_date"));
                if (result.get("diagnosis") != null)
                    lbICDVal.setText(result.get("diagnosis"));
                if (result.get("cpt_code") != null)
                    lbCPTVal.setText(result.get("cpt_code"));
                if (result.get("fee") != null)
                    lbChargesVal.setText(result.get("fee"));
                if (result.get("paid") != null)
                    lbPaidVal.setText(result.get("paid"));
                if (result.get("balance") != null)
                    lbBalanceVal.setText(result.get("balance"));
            }
        }
    }, "HashMap<String,String>");
    HorizontalPanel actionPanel = new HorizontalPanel();
    actionPanel.setSpacing(5);
    final Button addEventBtn = new Button(_("Add Event"));
    addEventBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            createClaimLogEventEntryPanel();
        }

    });
    final Button editClaimBtn = new Button(_("Modify Claim"));
    editClaimBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            PatientScreen p = new PatientScreen();
            p.setPatient(patientId);
            Util.spawnTab(patientName, p);
            ProcedureScreen ps = new ProcedureScreen();
            ps.setModificationRecordId(claimid);
            ps.setPatientId(patientId);
            ps.loadData();
            Util.spawnTabPatient(_("Manage Procedures"), ps, p);
            ps.loadData();
        }

    });
    final Button cancelBtn = new Button(_("Return to Search"));
    final ClaimDetailsWidget cdw = this;
    cancelBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            cdw.removeFromParent();
            callback.jsonifiedData("cancel");
        }

    });

    final Button newSearchBtn = new Button(_("New Search"));
    newSearchBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            cdw.removeFromParent();
            callback.jsonifiedData("new");
        }

    });
    actionPanel.add(addEventBtn);
    actionPanel.add(cancelBtn);
    actionPanel.add(newSearchBtn);
    actionPanel.add(editClaimBtn);
    claimDetailsPanel.add(actionPanel);

    final CustomTable claimsLogTable = new CustomTable();
    claimsLogTable.setAllowSelection(false);
    claimsLogTable.setSize("100%", "100%");
    claimsLogTable.addColumn(_("Date"), "date");
    claimsLogTable.addColumn(_("User"), "user");
    claimsLogTable.addColumn(_("Action"), "action");
    claimsLogTable.addColumn(_("Comment"), "comment");
    Util.callApiMethod("ClaimLog", "events_for_procedure", params, new CustomRequestCallback() {
        @Override
        public void onError() {
        }

        @SuppressWarnings("unchecked")
        @Override
        public void jsonifiedData(Object data) {
            if (data != null) {
                HashMap<String, String>[] result = (HashMap<String, String>[]) data;
                claimsLogTable.loadData(result);
            }
        }
    }, "HashMap<String,String>[]");
    claimDetailsPanel.add(claimsLogTable);
}

From source file:org.freemedsoftware.gwt.client.widget.PostCheckWidget.java

License:Open Source License

public PostCheckWidget(HashSet<String> p, CustomRequestCallback cb) {
    callback = cb;//from   w ww.j  a v  a 2  s.  c  om
    procs = p;
    vPanel = new VerticalPanel();
    vPanel.setSpacing(10);
    initWidget(vPanel);
    postCheckInfoFlexTable = new FlexTable();
    // postCheckInfoFlexTable.setWidth("100%");
    // Label payerLb = new Label("Payer");
    // payerWidget = new CustomModuleWidget(
    // "api.ClaimLog.RebillDistinctPayers");
    Label checkNumberLb = new Label(_("Check Number"));
    tbCheckNo = new TextBox();
    Label totalAmountLb = new Label(_("Total Amount"));
    tbTotalAmount = new TextBox();

    // postCheckInfoFlexTable.setWidget(0, 0, payerLb);
    // postCheckInfoFlexTable.setWidget(0, 1, payerWidget);
    postCheckInfoFlexTable.setWidget(1, 0, checkNumberLb);
    postCheckInfoFlexTable.setWidget(1, 1, tbCheckNo);
    postCheckInfoFlexTable.setWidget(2, 0, totalAmountLb);
    postCheckInfoFlexTable.setWidget(2, 1, tbTotalAmount);

    proceduresInfoTable = new CustomTable();
    proceduresInfoTable.setAllowSelection(false);
    proceduresInfoTable.setSize("100%", "100%");
    proceduresInfoTable.setIndexName("id");
    proceduresInfoTable.addColumn(_("Patient"), "pt_name");
    proceduresInfoTable.addColumn(_("Claim"), "clm");
    proceduresInfoTable.addColumn(_("CPT"), "cpt");
    proceduresInfoTable.addColumn(_("Service Date"), "ser_date");
    proceduresInfoTable.addColumn(_("Paid"), "paid");
    proceduresInfoTable.addColumn(_("Amount Billed"), "amnt_bill");
    proceduresInfoTable.addColumn(_("Amount Allowed"), "balance");
    proceduresInfoTable.addColumn(_("Adustment Balance"), "adj_bal");
    proceduresInfoTable.addColumn(_("Payment"), "pay");
    proceduresInfoTable.addColumn(_("Copay"), "copay");
    proceduresInfoTable.addColumn(_("Left Over"), "left");
    proceduresInfoTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {

        @SuppressWarnings("unchecked")
        @Override
        public Widget setColumn(String columnName, final HashMap<String, String> data) {

            final int actionRow = proceduresInfoTable.getActionRow();
            if (columnName.compareTo("balance") == 0) {
                int row = proceduresInfoTable.getActionRow();
                proceduresInfoTable.getFlexTable().getFlexCellFormatter().setWidth(row, 6, "10%");
                pids.add(data.get("id"));
                final TextBox tbAllowedAmount = new TextBox();
                tbAllowedAmount.setWidth("100%");
                tbAllowedAmount.setText(data.get("balance"));
                tbAllowedAmount.addChangeHandler(new ChangeHandler() {

                    @Override
                    public void onChange(ChangeEvent arg0) {
                        float all_amnt = 0;
                        float pay = 0;
                        float copay = 0;
                        if (!(tbAllowedAmount.getText().equals("0") || tbAllowedAmount.getText().equals(""))) {
                            all_amnt = Float.parseFloat(tbAllowedAmount.getText().trim());
                        }
                        TextBox tb1 = (TextBox) proceduresInfoTable.getWidget(8);
                        TextBox tb2 = (TextBox) proceduresInfoTable.getWidget(9);
                        if (!(tb1.getText().equals("0") || tb1.getText().equals(""))) {
                            pay = Float.parseFloat(tb1.getText().trim());
                        }
                        if (!(tb2.getText().equals("0") || tb2.getText().equals(""))) {
                            copay = Float.parseFloat(tb2.getText().trim());
                        }
                        Label left = (Label) proceduresInfoTable.getWidget(10);
                        left.setText("" + (all_amnt - pay - copay));
                    }

                });
                return tbAllowedAmount;
            } else if (columnName.compareTo("pay") == 0) {
                int row = proceduresInfoTable.getActionRow();
                proceduresInfoTable.getFlexTable().getFlexCellFormatter().setWidth(row, 8, "10%");
                final TextBox tbPayment = new TextBox();
                tbPayment.setWidth("100%");
                tbPayment.setText("0");
                tbPayment.addChangeHandler(new ChangeHandler() {

                    @Override
                    public void onChange(ChangeEvent arg0) {
                        float all_amnt = 0;
                        float pay = 0;
                        float copay = 0;
                        if (!(tbPayment.getText().equals("0") || tbPayment.getText().equals(""))) {
                            pay = Float.parseFloat(tbPayment.getText().trim());
                        }
                        TextBox tb1 = (TextBox) proceduresInfoTable.getWidget(6);
                        TextBox tb2 = (TextBox) proceduresInfoTable.getWidget(9);
                        if (!(tb1.getText().equals("0") || tb1.getText().equals(""))) {
                            all_amnt = Float.parseFloat(tb1.getText().trim());
                        }
                        if (!(tb2.getText().equals("0") || tb2.getText().equals(""))) {
                            copay = Float.parseFloat(tb2.getText().trim());
                        }
                        Label left = (Label) proceduresInfoTable.getWidget(10);
                        left.setText("" + (all_amnt - pay - copay));
                    }

                });
                return tbPayment;
            } else if (columnName.compareTo("copay") == 0) {
                int row = proceduresInfoTable.getActionRow();
                proceduresInfoTable.getFlexTable().getFlexCellFormatter().setWidth(row, 9, "10%");
                final TextBox tbCopay = new TextBox();
                tbCopay.setWidth("100%");
                tbCopay.setText("0");
                @SuppressWarnings("rawtypes")
                ArrayList params = new ArrayList();
                tbCopay.addChangeHandler(new ChangeHandler() {

                    @Override
                    public void onChange(ChangeEvent arg0) {
                        float all_amnt = 0;
                        float pay = 0;
                        float copay = 0;
                        if (!(tbCopay.getText().equals("0") || tbCopay.getText().equals(""))) {
                            copay = Float.parseFloat(tbCopay.getText().trim());
                        }
                        TextBox tb1 = (TextBox) proceduresInfoTable.getWidget(6);
                        TextBox tb2 = (TextBox) proceduresInfoTable.getWidget(8);
                        if (!(tb1.getText().equals("0") || tb1.getText().equals(""))) {
                            all_amnt = Float.parseFloat(tb1.getText().trim());
                        }
                        if (!(tb2.getText().equals("0") || tb2.getText().equals(""))) {
                            pay = Float.parseFloat(tb2.getText().trim());
                        }
                        Label left = (Label) proceduresInfoTable.getWidget(10);
                        left.setText("" + (all_amnt - pay - copay));
                    }

                });
                params.add(data.get("pt_id"));
                params.add(data.get("id"));

                Util.callApiMethod("Ledger", "getCoveragesCopayInfo", params, new CustomRequestCallback() {
                    @Override
                    public void onError() {
                    }

                    @Override
                    public void jsonifiedData(Object d) {
                        if (data != null) {
                            HashMap<String, String> result = (HashMap<String, String>) d;
                            // tbAmount.setEnabled(false);
                            if (result != null) {
                                tbCopay.setText(result.get("copay"));
                                try {
                                    Label lbLeft = new Label();
                                    float left = 0;
                                    float copay = Float.parseFloat(result.get("copay"));
                                    left = Float.parseFloat(data.get("left"));
                                    lbLeft.setText("" + (left - copay));
                                    proceduresInfoTable.getFlexTable().setWidget(actionRow, 10, lbLeft);
                                } catch (Exception e) {
                                    Window.alert("aaaa");
                                }
                                // tbAmount.setEnabled(false);
                            }
                        }
                    }
                }, "HashMap<String,String>");
                return tbCopay;
            } else if (columnName.compareTo("left") == 0) {
                int row = proceduresInfoTable.getActionRow();
                proceduresInfoTable.getFlexTable().getFlexCellFormatter().setWidth(row, 10, "10%");
                try {
                    Label lb = (Label) proceduresInfoTable.getWidget(10);
                    return lb;
                } catch (Exception e) {
                    return new Label();
                }
            } else if (columnName.compareTo("adj_bal") == 0) {
                int row = proceduresInfoTable.getActionRow();
                proceduresInfoTable.getFlexTable().getFlexCellFormatter().setWidth(row, 7, "10%");
                Label adjbal = new Label();
                adjbal.setText(data.get("adj_bal"));
                return adjbal;
            } else if (columnName.compareTo("amnt_bill") == 0) {
                int row = proceduresInfoTable.getActionRow();
                proceduresInfoTable.getFlexTable().getFlexCellFormatter().setWidth(row, 5, "10%");
                Label amntbill = new Label();
                amntbill.setText(data.get("amnt_bill"));
                return amntbill;
            }

            else {
                return (Widget) null;
            }

        }
    });
    HorizontalPanel actionPanel = new HorizontalPanel();
    actionPanel.setSpacing(5);
    // actionPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    CustomButton postBtn = new CustomButton(_("Post"), AppConstants.ICON_ADD);
    postBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            prepareDataForPostCheck();
        }

    });
    CustomButton cancelBtn = new CustomButton(_("Cancel"), AppConstants.ICON_CANCEL);
    final PostCheckWidget pcw = this;
    cancelBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            pcw.removeFromParent();
            callback.jsonifiedData("cancel");
        }

    });
    actionPanel.add(postBtn);
    actionPanel.add(cancelBtn);
    vPanel.add(postCheckInfoFlexTable);
    vPanel.add(proceduresInfoTable);
    vPanel.add(actionPanel);
    vPanel.setCellHorizontalAlignment(actionPanel, HasHorizontalAlignment.ALIGN_RIGHT);
    pids = new ArrayList<String>();
    loadSelectedProcedureInfo();
}

From source file:org.freemedsoftware.gwt.client.widget.RemittReportsWidget.java

License:Open Source License

public void loadMonthsInfo() {
    allReportTable = new FlexTable();
    allReportTable.setWidth("80%");
    reportsPanel.clear();/*from  w  w w . j a  va  2 s . c o m*/
    reportsPanel.add(allReportTable);
    Util.callModuleMethod("RemittBillingTransport", "getMonthsInfo", (Integer) null,
            new CustomRequestCallback() {
                @Override
                public void onError() {
                }

                @SuppressWarnings("unchecked")
                @Override
                public void jsonifiedData(Object data) {
                    if (data != null) {
                        final HashMap<String, String>[] result = (HashMap[]) data;
                        for (int i = 0; i < result.length; i++) {
                            int row = i / 2;
                            int col = i % 2;
                            VerticalPanel reportPanel = new VerticalPanel();
                            reportPanel.setSpacing(10);
                            reportPanel.setWidth("70%");
                            HorizontalPanel hpanel = new HorizontalPanel();
                            hpanel.setSpacing(5);
                            final Label expandLb = new Label("+");
                            final CustomTable reportsInfoTable = new CustomTable();
                            reportsInfoTable.setAllowSelection(false);
                            reportsInfoTable.setWidth("100%");
                            reportsInfoTable.addColumn(_("Report"), "filename");
                            reportsInfoTable.addColumn(_("Size"), "filesize");
                            reportsInfoTable.addColumn(_("Date Sent"), "inserted");
                            reportsInfoTable.addColumn(_("Action"), "action");
                            reportsInfoTable
                                    .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;\">"
                                                        + _("View") + "</a>");

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

                                                        String[] params = { "output", data.get("filename"),
                                                                "html" };
                                                        Window.open(URL.encode(Util.getJsonRequest(
                                                                "org.freemedsoftware.api.Remitt.GetFile",
                                                                params)), data.get("filename"), "");

                                                    }

                                                });
                                                HTML htmlReSend = null;
                                                if (data.get("originalId") != null) {
                                                    htmlReSend = new HTML("<a href=\"javascript:undefined;\">"
                                                            + _("Re-Send") + "</a>");

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

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

                                                                }

                                                                @Override
                                                                public void jsonifiedData(Object data) {
                                                                    rebillPanel.setVisible(false);
                                                                    reportsPanel.setVisible(true);
                                                                    loadMonthsInfo();

                                                                }
                                                            };
                                                            reportsPanel.setVisible(false);
                                                            rebillPanel.clear();

                                                            HashSet<String> hs = new HashSet<String>();
                                                            hs.add(data.get("originalId"));
                                                            RemittBillingWidget billClaimsWidget = new RemittBillingWidget(
                                                                    hs, cb, BillingType.REBILL);
                                                            rebillPanel.add(billClaimsWidget);
                                                            rebillPanel.setVisible(true);

                                                        }

                                                    });
                                                } else {
                                                    htmlReSend = new HTML(
                                                            "<a href=\"javascript:undefined;\"  style=\"cursor:default;color: blue;\">"
                                                                    + _("Re-Send") + "</a>");
                                                }
                                                actionPanel.add(htmlLedger);
                                                actionPanel.add(htmlReSend);
                                                return actionPanel;
                                            } else if (columnName.compareTo("inserted") == 0) {
                                                Label lb = new Label(data.get("inserted").substring(0, 10));
                                                return lb;
                                            } else {
                                                return (Widget) null;
                                            }

                                        }
                                    });
                            reportsInfoTable.setVisible(false);
                            expandLb.getElement().getStyle().setCursor(Cursor.POINTER);
                            final int index = i;
                            expandLb.addClickHandler(new ClickHandler() {

                                @Override
                                public void onClick(ClickEvent arg0) {
                                    if (expandLb.getText().trim().equals("+")) {
                                        expandLb.setText("-");
                                        reportsInfoTable.setVisible(true);
                                        loadReportsDetails(result[index].get("month"), reportsInfoTable);
                                    } else {
                                        expandLb.setText("+");
                                        reportsInfoTable.setVisible(false);
                                    }
                                }

                            });
                            hpanel.setWidth("100%");
                            hpanel.setStyleName(AppConstants.STYLE_TABLE_HEADER);
                            Label infoLb = new Label(result[i].get("month"));
                            hpanel.add(expandLb);
                            hpanel.add(infoLb);
                            hpanel.setCellWidth(expandLb, "5px");

                            reportPanel.add(hpanel);
                            reportPanel.add(reportsInfoTable);
                            allReportTable.setWidget(row, col, reportPanel);
                            allReportTable.getFlexCellFormatter().setVerticalAlignment(row, col,
                                    HasVerticalAlignment.ALIGN_TOP);
                            // panel.add();
                            // panel.add(reportsInfoTable);

                        }
                    }
                }
            }, "HashMap<String,String>[]");
}

From source file:org.freemedsoftware.gwt.client.widget.WorkList.java

License:Open Source License

private void createWorkListTableForProvider(int i) {
    final int index = i;
    workListsTables[i] = new CustomTable();
    workListsTables[i].getFlexTable().getElement().setAttribute("cellspacing", "0");
    workListsTables[i].setRowStyle("");
    workListsTables[i].setAlternateRowStyle("");
    workListsTables[i].setTableStyle("");
    if (CurrentState.getDefaultProvider() > 0)
        workListsTables[i].setVisible(true);
    else/*from  w  w  w.  j  a va  2  s . c  om*/
        workListsTables[i].setVisible(false);
    workListsTables[i].setSize("110%", "100%");
    workListsTables[i].setIndexName("id");
    workListsTables[i].addColumn(_("Patient"), "patient_name");
    // workListsTables[i].addColumn("DD/MM", "date");
    workListsTables[i].addColumn(_("Time"), "time");
    // workListsTables[i].addColumn("Description", "note");
    workListsTables[i].addColumn(_("Status"), "status_fullname");
    // workListsTables[i].setVisible(true);

    workListsTables[i].setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {
        public Widget setColumn(String columnName, final HashMap<String, String> data) {

            if (columnName.equalsIgnoreCase("status_fullname")) {
                final HorizontalPanel hp = new HorizontalPanel();
                final Label statusText = new Label();
                final CustomListBox statusList = new CustomListBox();
                statusList.setVisible(false);
                hp.add(statusText);
                hp.add(statusList);
                statusList.addChangeHandler(new ChangeHandler() {
                    @Override
                    public void onChange(ChangeEvent event) {
                        if (statusList.getSelectedIndex() != 0) {
                            statusText.setText(statusList.getItemText(statusList.getSelectedIndex()));
                            changeStatus(statusText, statusList, data.get("id"), data.get("patient"),
                                    statusList.getValue(statusList.getSelectedIndex()), index);
                        }
                    }
                });
                statusText.setTitle(_("Click to change the status for") + " " + data.get("patient_name"));

                statusText.setText(data.get("status_fullname"));

                int currRow = workListsTables[index].getActionRow();
                // workListsTables[index].getFlexTable().getCellFormatter().getElement(currRow,
                // 2).getStyle().setProperty("marginLeft", "4");
                workListsTables[index].getFlexTable().getRowFormatter().getElement(currRow).getStyle()
                        .setProperty("backgroundColor", data.get("status_color"));
                // hp.getElement().getParentElement().getParentElement().getStyle().setProperty(
                // "backgroundColor",
                // data.get("status_color"));
                return hp;
            }
            if (!columnName.equalsIgnoreCase("patient_name")) {
                // Skip renderer
                return null;
            }
            Anchor a = new Anchor();
            a.setTitle(_("View EMR for") + " " + data.get("patient_name"));
            a.setText(data.get("patient_name"));
            a.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent evt) {
                    Integer entityId = Integer.parseInt(data.get("patient"));
                    if (data.get("appointment_type").equals("pat")) {
                        PatientScreen p = new PatientScreen();
                        p.setPatient(entityId);
                        Util.spawnTab(data.get("patient_name"), p);
                    } else if (data.get("appointment_type").equals("group")) {
                        spawnGroupScreen(entityId);
                    }
                }
            });
            return a;
        }
    });
    workListsTables[i].setTableRowClickHandler(new TableRowClickHandler() {
        @Override
        public void handleRowClick(HashMap<String, String> data, int col) {
            try {
                if (col == 1) {
                    // TODO: Open the day of this particular event and
                    // select that screen.
                    SchedulerScreen schedulerScreen = new SchedulerScreen();
                    // schedulerScreen.getSchedulerWidget().
                    Util.spawnTab("Scheduler", schedulerScreen);
                } else if (col == 2) {
                    // Window.alert("col 2 clicked");
                    HorizontalPanel hp = (HorizontalPanel) workListsTables[index].getWidget(2);
                    Label statusText = (Label) hp.getWidget(0);
                    CustomListBox statusList = (CustomListBox) hp.getWidget(1);
                    statusText.setVisible(false);
                    statusList.setVisible(true);
                    Set<String> keys = statusNamesMap.keySet();
                    Iterator<String> iter = keys.iterator();
                    statusList.clear();
                    statusList.addItem("-");
                    while (iter.hasNext()) {

                        final String key = (String) iter.next();
                        final String val = (String) statusNamesMap.get(key);
                        statusList.addItem(val, key);
                    }

                }
            } catch (Exception e) {
                JsonUtil.debug("WorkList.java: Caught exception: " + e.toString());
            }
        }
    });
    retrieveData(i);

}

From source file:org.gatein.management.gadget.client.Application.java

License:Open Source License

/**
 * Create and return the dialog box for the site upload.
 *
 * @return a {@code DialogBox}/*ww w.  j  ava2s  .c om*/
 */
private DialogBox createDialogBox() {

    // Create a dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Import site");
    dialogBox.setAnimationEnabled(true);
    dialogBox.setModal(true);
    dialogBox.setGlassEnabled(true);

    final AbsolutePanel absolutePanel = new AbsolutePanel();
    dialogBox.setWidget(absolutePanel);
    absolutePanel.setStyleName("status-panel");
    absolutePanel.setSize("400px", "220px");

    final Button importButton = new Button("Import");
    final CheckBox overwriteBox = new CheckBox("Overwrite the existing site");
    final HTML statusImg = new HTML("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", true);
    final Label statusLabel = new Label("status label");
    final Label headerLabel = new Label("Select file to import :");
    final AbsolutePanel statusPanel = new AbsolutePanel();
    headerLabel.setSize("380px", "39px");
    headerLabel.setStyleName("header-style");
    absolutePanel.add(headerLabel, 10, 10);

    final MultiUploader uploader = new GTNMultiUploader();
    uploader.setAvoidRepeatFiles(false);
    absolutePanel.add(uploader, 10, 46);
    uploader.setSize("380px", "32px");
    uploader.addOnChangeUploadHandler(new IUploader.OnChangeUploaderHandler() {

        @Override
        public void onChange(IUploader uploader) {
            // Nothing to do
            if (uploader.getFileName() != null) {
                importButton.setEnabled(true);
            }
        }
    });

    // Add a finish handler which will notify user once the upload finishes
    uploader.addOnFinishUploadHandler(new IUploader.OnFinishUploaderHandler() {

        public void onFinish(IUploader uploader) {

            switch (uploader.getStatus()) {
            case SUCCESS:
                statusLabel.setText("File uploaded with success");
                statusLabel.setStyleName("success-style");
                statusImg.setStyleName("success-style-icon");
                break;
            case ERROR:
                statusLabel.setText("File upload error");
                statusLabel.setStyleName("error-style");
                statusImg.setStyleName("error-style-icon");
                break;
            case CANCELED:
                statusLabel.setText("File upload canceled");
                statusLabel.setStyleName("warn-style");
                statusImg.setStyleName("warn-style-icon");
                break;
            default:
                statusLabel.setText("");
                statusLabel.setStyleName("blank-style");
                statusImg.setStyleName("blank-style");
                break;
            }

            overwriteBox.setEnabled(true);
            importButton.setEnabled(true);
        }
    });
    // Add a start handler which will disable the UI until the upload finishes
    uploader.addOnStartUploadHandler(new IUploader.OnStartUploaderHandler() {

        boolean isShwon = false;

        public void onStart(IUploader uploader) {
            statusLabel.setText("Process in progress...");
            statusLabel.setStyleName("progress-style");
            statusImg.setStyleName("progress-style-icon");
            overwriteBox.setEnabled(false);
            importButton.setEnabled(false);
            if (!isShwon) {
                statusPanel.setStyleName("status-panel");
                statusPanel.setSize("380px", "0px");
                absolutePanel.add(statusPanel, 10, 120);

                Timer t = new Timer() {

                    int dx = 5;
                    int height = 0;

                    public void run() {
                        height += dx;
                        statusPanel.setHeight(height + "px");
                        if (height >= 45) {
                            cancel(); // Stop the timer
                        }
                    }
                };

                // Schedule the timer to run once in 100 milliseconds.
                t.scheduleRepeating(100);
                isShwon = true;
            }
        }
    });
    // accept only zip files
    uploader.setValidExtensions(new String[] { "zip" });
    // You can add customized parameters to servlet call
    uploader.setServletPath(UPLOAD_ACTION_URL + "?pc=" + getPortalContainerName());

    overwriteBox.setTitle("If you want to force overwriting an existing site, check this checkbox");
    overwriteBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            String url = UPLOAD_ACTION_URL + "?pc=" + getPortalContainerName() + "&overwrite="
                    + overwriteBox.getValue();
            uploader.setServletPath(url);
        }
    });

    absolutePanel.add(overwriteBox, 10, 84);
    Button closeButton = new Button("Close", new ClickHandler() {

        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    absolutePanel.add(closeButton, 343, 188);

    statusImg.setStyleName("progress-style-icon");
    statusPanel.add(statusImg, 10, 10);
    statusImg.setSize("50px", "30px");

    statusPanel.add(statusLabel, 60, 15);
    statusLabel.setSize("300px", "25px");

    importButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            uploader.submit();
        }
    });
    importButton.setEnabled(false);
    absolutePanel.add(importButton, 10, 188);

    return dialogBox;
}

From source file:org.gatein.management.gadget.mop.exportimport.client.Application.java

License:Open Source License

/**
 * Create and return the dialog box for the site upload.
 *
 * @return a {@code DialogBox}/*w  w  w .j a  v a  2 s. c om*/
 */
private DialogBox createDialogBox() {

    // Create a dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Import site");
    dialogBox.setAnimationEnabled(true);
    dialogBox.setModal(true);
    dialogBox.setGlassEnabled(true);

    final AbsolutePanel absolutePanel = new AbsolutePanel();
    dialogBox.setWidget(absolutePanel);
    absolutePanel.setStyleName("status-panel");
    absolutePanel.setSize("400px", "220px");

    final Button importButton = new Button("Import");
    final Label importModeLabel = new Label("Import Mode:");
    final ListBox importModeListBox = new ListBox(false);
    importModeListBox.addItem("Conserve", "conserve");
    importModeListBox.addItem("Insert", "insert");
    importModeListBox.addItem("Merge", "merge");
    importModeListBox.addItem("Overwrite", "overwrite");
    importModeListBox.setSelectedIndex(2); // set default to 'merge'

    final HTML statusImg = new HTML("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", true);
    final Label statusLabel = new Label("status label");
    final Label headerLabel = new Label("Select file to import :");
    final AbsolutePanel statusPanel = new AbsolutePanel();
    headerLabel.setSize("380px", "39px");
    headerLabel.setStyleName("header-style");
    absolutePanel.add(headerLabel, 10, 10);

    final MultiUploader uploader = new GTNMultiUploader();
    uploader.setAvoidRepeatFiles(false);
    absolutePanel.add(uploader, 10, 46);
    uploader.setSize("380px", "32px");
    uploader.addOnChangeUploadHandler(new IUploader.OnChangeUploaderHandler() {

        @Override
        public void onChange(IUploader uploader) {
            // Nothing to do
            if (uploader.getFileName() != null) {
                importButton.setEnabled(true);
            }
        }
    });

    // Add a finish handler which will notify user once the upload finishes
    uploader.addOnFinishUploadHandler(new IUploader.OnFinishUploaderHandler() {

        public void onFinish(IUploader uploader) {

            switch (uploader.getStatus()) {
            case SUCCESS:
                statusLabel.setText("File uploaded with success");
                statusLabel.setStyleName("success-style");
                statusImg.setStyleName("success-style-icon");
                break;
            case ERROR:
                statusLabel.setText("File upload error");
                statusLabel.setStyleName("error-style");
                statusImg.setStyleName("error-style-icon");
                break;
            case CANCELED:
                statusLabel.setText("File upload canceled");
                statusLabel.setStyleName("warn-style");
                statusImg.setStyleName("warn-style-icon");
                break;
            default:
                statusLabel.setText("");
                statusLabel.setStyleName("blank-style");
                statusImg.setStyleName("blank-style");
                break;
            }

            importModeListBox.setEnabled(true);
            importButton.setEnabled(true);
        }
    });
    // Add a start handler which will disable the UI until the upload finishes
    uploader.addOnStartUploadHandler(new IUploader.OnStartUploaderHandler() {

        boolean isShwon = false;

        public void onStart(IUploader uploader) {
            if (uploader.getStatus() == IUploadStatus.Status.INPROGRESS) {
                statusLabel.setText("Process in progress...");
                statusLabel.setStyleName("progress-style");
                statusImg.setStyleName("progress-style-icon");
                importModeListBox.setEnabled(false);
                importButton.setEnabled(false);
                if (!isShwon) {
                    statusPanel.setStyleName("status-panel");
                    statusPanel.setSize("380px", "0px");
                    absolutePanel.add(statusPanel, 10, 120);

                    Timer t = new Timer() {

                        int dx = 5;
                        int height = 0;

                        public void run() {
                            height += dx;
                            statusPanel.setHeight(height + "px");
                            if (height >= 45) {
                                cancel(); // Stop the timer
                            }
                        }
                    };

                    // Schedule the timer to run once in 100 milliseconds.
                    t.scheduleRepeating(100);
                    isShwon = true;
                }
            }
        }
    });
    // accept only zip files
    uploader.setValidExtensions("zip");
    // You can add customized parameters to servlet call
    uploader.setServletPath(UPLOAD_ACTION_URL + "?pc=" + getPortalContainerName());

    importModeListBox.setTitle("The import mode to use during import.");
    importModeListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent changeEvent) {
            String url = UPLOAD_ACTION_URL + "?pc=" + getPortalContainerName() + "&importMode="
                    + importModeListBox.getValue(importModeListBox.getSelectedIndex());
            uploader.setServletPath(url);
        }
    });

    absolutePanel.add(importModeLabel, 10, 88);
    absolutePanel.add(importModeListBox, 95, 84);
    Button closeButton = new Button("Close", new ClickHandler() {

        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    absolutePanel.add(closeButton, 343, 188);

    statusImg.setStyleName("progress-style-icon");
    statusPanel.add(statusImg, 10, 10);
    statusImg.setSize("50px", "30px");

    statusPanel.add(statusLabel, 60, 15);
    statusLabel.setSize("300px", "25px");

    importButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            uploader.submit();
        }
    });
    importButton.setEnabled(false);
    absolutePanel.add(importButton, 10, 188);

    return dialogBox;
}

From source file:org.geomajas.gwt2.widget.client.featureselectbox.view.FeatureSelectBox.java

License:Open Source License

@Override
public void setLabels(List<String> labels) {
    contentPanel.clear();/*from   w ww .  j a  v a  2  s.c om*/

    for (String s : labels) {
        Label label = new Label();
        label.setStyleName(FeatureSelectBoxResource.INSTANCE.css().featureSelectBoxCell());
        label.setText(s);
        label.addClickHandler(featureClickHandler);
        contentPanel.add(label);
    }
}

From source file:org.geomajas.gwt2.widget.client.featureselectbox.view.FeatureSelectBox.java

License:Open Source License

@Override
public void addLabel(String label) {
    Label l = new Label();
    l.setText(label);
    l.setStyleName(FeatureSelectBoxResource.INSTANCE.css().featureSelectBoxCell());
    l.addClickHandler(featureClickHandler);
    contentPanel.add(l);//from   w ww  .  jav a2  s  .com
}