Example usage for com.google.gwt.user.client.ui HorizontalPanel setSpacing

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setSpacing

Introduction

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

Prototype

public void setSpacing(int spacing) 

Source Link

Document

Sets the amount of spacing between this panel's cells.

Usage

From source file:org.dataconservancy.dcs.ingest.ui.client.Application.java

License:Apache License

private void displayUploadFileDialog() {
    final DialogBox db = new DialogBox(false, true);

    Panel panel = new FlowPanel();

    db.setAnimationEnabled(true);//  ww w . j av  a2s .  co  m
    db.setText("Upload local file");
    db.setWidget(panel);
    db.center();

    final HorizontalPanel buttons = new HorizontalPanel();
    buttons.setSpacing(5);

    Button upload = new Button("Upload");
    Button cancel = new Button("Cancel");

    buttons.add(upload);
    buttons.add(cancel);

    final FormPanel form = new FormPanel();
    FlowPanel formcontents = new FlowPanel();
    form.add(formcontents);

    final FileUpload upfile = new FileUpload();
    upfile.setName("file");

    Hidden depositurl = new Hidden("depositurl");
    depositurl.setValue(depositConfig.fileUploadUrl());

    formcontents.add(upfile);
    formcontents.add(depositurl);

    form.setMethod(FormPanel.METHOD_POST);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setAction(FILE_UPLOAD_URL);

    panel.add(new Label("Uploaded files will be included in the SIP."));
    panel.add(form);
    panel.add(buttons);

    upload.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            form.submit();
        }
    });

    cancel.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            db.hide();
        }
    });

    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        public void onSubmitComplete(SubmitCompleteEvent event) {
            if (event.getResults() == null) {
                Window.alert("File upload failed");
                db.hide();
                return;
            }

            String[] parts = event.getResults().split("\\^");

            if (parts.length != 4) {
                Window.alert("File upload failed: " + event.getResults());
                db.hide();
                return;
            }

            String filesrc = parts[1].trim();
            // TODO String fileatomurl = parts[2].trim();

            files.setVisible(true);
            String id = nextFileId();
            fileids.add(id);
            files.add(new FileEditor(id, upfile.getFilename(), filesrc), id);
            files.selectTab(files.getWidgetCount() - 1);

            db.hide();
        }
    });
}

From source file:org.dataconservancy.dcs.ingest.ui.client.Application.java

License:Apache License

private void viewCollections() {
    content.clear();/* w w w  .j a  v  a2 s .co  m*/

    content.add(Util.label("Collections help group Deliverable Units.", "Explanation"));

    content.add(collections);

    HorizontalPanel toolbar = new HorizontalPanel();

    Button remove = new Button("Remove collection");

    Button add = new Button("Add collection");

    toolbar.add(add);
    toolbar.add(remove);
    toolbar.setSpacing(5);

    content.add(toolbar);

    if (collections.getWidgetCount() > 0) {
        collections.selectTab(0);
    } else {
        collections.setVisible(false);
    }

    remove.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {

            int tab = collections.getTabBar().getSelectedTab();

            if (tab != -1) {
                collections.remove(tab);
                colids.remove(tab);

                if (collections.getWidgetCount() > 0) {
                    collections.selectTab(0);
                } else {
                    collections.setVisible(false);
                }
            }
        }
    });

    add.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            collections.setVisible(true);

            String id = nextCollectionId();
            colids.add(id);
            collections.add(new CollectionEditor(id, colids), id);
            collections.selectTab(collections.getWidgetCount() - 1);
        }
    });
}

From source file:org.dataconservancy.dcs.ingest.ui.client.Application.java

License:Apache License

private void viewDeliverableUnits() {
    content.clear();/*from  w  w w.  ja  v  a2 s.  c o m*/

    content.add(Util.label("A Deliverable Unit is a semantically meaningfull container for files and metadata.",
            "Explanation"));

    content.add(dus);

    HorizontalPanel toolbar = new HorizontalPanel();

    Button remove = new Button("Remove Deliverable Unit");

    Button add = new Button("Add Deliverable Unit");

    toolbar.add(add);
    toolbar.add(remove);
    toolbar.setSpacing(5);

    content.add(toolbar);

    if (dus.getWidgetCount() > 0) {
        dus.selectTab(0);
    } else {
        dus.setVisible(false);
    }

    remove.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {

            int tab = dus.getTabBar().getSelectedTab();

            if (tab != -1) {
                dus.remove(tab);
                duids.remove(tab);

                if (dus.getWidgetCount() > 0) {
                    dus.selectTab(0);
                } else {
                    dus.setVisible(false);
                }
            }
        }
    });

    add.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            dus.setVisible(true);

            String id = nextDeliverableUnitId();
            duids.add(id);
            dus.add(new DeliverableUnitEditor(id, fileids, duids, colids), id);
            dus.selectTab(dus.getWidgetCount() - 1);
        }
    });
}

From source file:org.daxplore.presenter.client.ui.EmbedPopup.java

License:Open Source License

/**
 * Instantiates a new embed popup panel.
 * //from w ww.j a  va2  s. co m
 * @param eventBus
 *            the system's bus
 * @param uiTexts
 *            the resource that supplies localized text to the UI
 * @param config
 *            supplies configuration parameters to the client
 */
@Inject
public EmbedPopup(final EventBus eventBus, UITexts uiTexts, DaxploreConfig config,
        PrefixProperties prefixProperties) {
    super(true);
    this.prefixProperties = prefixProperties;

    mainPanel = new VerticalPanel();
    mainPanel.setSpacing(5);

    Label popupHeader = new Label(uiTexts.embedPopupTitle());
    mainPanel.add(popupHeader);

    Label popupDescription = new Label(uiTexts.embedPopupDescription());
    mainPanel.add(popupDescription);

    linkTextArea = new TextArea();
    linkTextArea.setText("");

    linkTextArea.addMouseOverHandler(new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            linkTextArea.setFocus(true);
            linkTextArea.selectAll();
        }
    });

    linkTextArea.getElement().setAttribute("spellCheck", "false");

    linkTextArea.addMouseUpHandler(this);
    linkTextArea.addChangeHandler(this);

    setStyleName("daxplore-EmbedPopup");
    popupHeader.addStyleName("daxplore-EmbedPopup-header");
    linkTextArea.addStyleName("daxplore-EmbedPopup-textarea");

    mainPanel.add(linkTextArea);

    DisclosurePanel settingsPanel = new DisclosurePanel(uiTexts.embedSettingsHeader());
    FlowPanel settingsContentPanel = new FlowPanel();
    settingsPanel.add(settingsContentPanel);
    settingsPanel.setWidth("100%");
    mainPanel.add(settingsPanel);

    HorizontalPanel sizeButtonPanel = new HorizontalPanel();
    sizeButtonPanel.setSpacing(10);

    for (final EmbedSize embedSize : EmbedSize.values()) {
        Button button = new Button(embedSize.getButtonText(config, uiTexts));
        button.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                eventBus.fireEvent(new EmbedSizeEvent(embedSize));
            }
        });
        sizeButtonPanel.add(button);
    }

    currentEmbedSize = EmbedSize.MEDIUM;

    settingsContentPanel.add(sizeButtonPanel);

    transparencyCheckbox = new CheckBox(uiTexts.embedTransparentBackground());
    transparencyCheckbox.setValue(true, false);
    transparencyCheckbox.addValueChangeHandler(this);
    settingsContentPanel.add(transparencyCheckbox);

    legendCheckbox = new CheckBox(uiTexts.embedShowLegend());
    legendCheckbox.setValue(true, false);
    legendCheckbox.addValueChangeHandler(this);
    settingsContentPanel.add(legendCheckbox);

    iframeSpot.setStyleName("daxplore-EmbedPopup-iframeSpot");
    mainPanel.add(iframeSpot);

    setWidget(mainPanel);

    EmbedSizeEvent.register(eventBus, this);
    QueryUpdateEvent.register(eventBus, this);
}

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

License:Open Source License

public AccountsReceivableScreen() {
    final VerticalPanel verticalPanel = new VerticalPanel();
    initWidget(verticalPanel);/* w  w w .j ava  2s .c om*/

    parentSearchTable = new FlexTable();
    parentSearchTable.setSize("100%", "100%");
    parentSearchTable.setBorderWidth(1);
    parentSearchTable.getElement().getStyle().setProperty("borderCollapse", "collapse");
    verticalPanel.add(parentSearchTable);

    searchCriteriaVPanel = new VerticalPanel();
    searchCriteriaVPanel.setWidth("100%");
    searchCriteriaVPanel.setSpacing(5);
    parentSearchTable.setWidget(0, 0, searchCriteriaVPanel);
    parentSearchTable.getFlexCellFormatter().getElement(0, 0).setAttribute("width", "50%");
    parentSearchTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    Label lbSearch = new Label(_("Search 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);

    int row = 0;

    final Label smartLNameSearchLabel = new Label(_("Patient Last Name") + ": ");
    searchCriteriaTable.setWidget(row, 0, smartLNameSearchLabel);

    patientlnTextBox = new TextBox();
    searchCriteriaTable.setWidget(row, 1, patientlnTextBox);
    widgetTracker.put("Patient Last Name", row + ":1:" + "last_name");
    widgetContainer.put("Patient Last Name", patientlnTextBox);

    final Label smartFNameSearchLabel = new Label(_("Patient First Name") + ": ");
    searchCriteriaTable.setWidget(row, 2, smartFNameSearchLabel);

    patientfnTextBox = new TextBox();
    searchCriteriaTable.setWidget(row, 3, patientfnTextBox);
    widgetTracker.put(_("Patient First Name"), row + ":3:" + "last_name");
    widgetContainer.put(_("Patient First Name"), patientfnTextBox);
    row++;

    final Label ptFullName = new Label(_("Patient Full Name") + ": ");
    searchCriteriaTable.setWidget(row, 0, ptFullName);
    patientWidget = new PatientWidget();
    searchCriteriaTable.setWidget(row, 1, patientWidget);
    widgetTracker.put(_("Patient"), row + ":1:" + "patient");
    widgetContainer.put(_("Patient"), patientWidget);
    row++;

    final Label fieldSearchLabel = new Label(_("Provider") + ": ");
    searchCriteriaTable.setWidget(row, 0, fieldSearchLabel);

    providerWidget = new SupportModuleWidget("ProviderModule");
    searchCriteriaTable.setWidget(row, 1, providerWidget);
    widgetTracker.put(_("Provider"), row + ":1:" + "provider");
    widgetContainer.put(_("Provider"), providerWidget);
    row++;

    final Label facilityLabel = new Label(_("Facility") + ": ");
    searchCriteriaTable.setWidget(row, 0, facilityLabel);

    facilityModule = new SupportModuleWidget("FacilityModule");
    searchCriteriaTable.setWidget(row, 1, facilityModule);
    widgetTracker.put(_("Facility"), row + ":1:" + "facility");
    widgetContainer.put(_("Facility"), facilityModule);
    row++;

    final Label dateOfServiceLabel = new Label(_("Date of Service") + ": ");
    searchCriteriaTable.setWidget(row, 0, dateOfServiceLabel);

    wDos = new CustomDatePicker();
    searchCriteriaTable.setWidget(row, 1, wDos);
    widgetTracker.put(_("Date of Service"), row + ":1:" + "date_of");
    widgetContainer.put(_("Date of Service"), wDos);
    row++;

    final Label transactionDateFrom = new Label(_("Transaction Date From") + ": ");
    searchCriteriaTable.setWidget(row, 0, transactionDateFrom);

    wDos2 = new CustomDatePicker();
    searchCriteriaTable.setWidget(row, 1, wDos2);
    widgetTracker.put(_("Transaction Date From"), row + ":1:" + "date_from");
    widgetContainer.put(_("Transaction Date From"), wDos2);

    final Label transactionDateTo = new Label(_("Transaction Date To") + ": ");
    searchCriteriaTable.setWidget(row, 2, transactionDateTo);

    wDos3 = new CustomDatePicker();
    searchCriteriaTable.setWidget(row, 3, wDos3);
    widgetTracker.put(_("Transaction Date To"), row + ":3:" + "date_to");
    widgetContainer.put(_("Transaction Date To"), wDos3);

    row++;

    final Label tagSearch = new Label(_("Tag Search") + ": ");
    searchCriteriaTable.setWidget(row, 0, tagSearch);

    tagWidget = new PatientTagWidget();
    searchCriteriaTable.setWidget(row, 1, tagWidget);
    widgetTracker.put(_("Tag Search"), row + ":1:" + "tag");
    widgetContainer.put(_("Tag Search"), tagWidget);

    row++;

    final HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(5);
    searchButton = new CustomButton(_("Search"), AppConstants.ICON_SEARCH);
    searchButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            // TODO Auto-generated method stub
            refreshSearch();
        }
    });
    buttonPanel.add(searchButton);
    clearButton = new CustomButton(_("Clear"), AppConstants.ICON_CLEAR);
    clearButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            // TODO Auto-generated method stub
            clearForm();
        }
    });

    buttonPanel.add(clearButton);
    buttonPanel.setSpacing(5);

    searchCriteriaTable.setWidget(row, 1, buttonPanel);

    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, 1, currentCriteriaPanel);
    parentSearchTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);

    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    verticalPanel.add(horizontalPanel);

    //creating search result table
    sortableTable = new CustomTable();
    sortableTable.setWidth("100%");
    //      sortableTable.addColumn("", "selected");
    sortableTable.addColumn(_("Svc Date"), "date_of");
    sortableTable.addColumn(_("Acct Bal"), "total_balance");
    sortableTable.addColumn(_("Provider"), "provider");
    sortableTable.addColumn(_("Patient"), "patient");
    sortableTable.addColumn(_("Item"), "item");
    sortableTable.addColumn(_("Type"), "item_type");
    sortableTable.addColumn(_("Svc"), "procedure_id");
    sortableTable.addColumn(_("Date"), "payment_date");
    sortableTable.addColumn(_("Adjs"), "money_in");
    sortableTable.addColumn(_("Charges"), "money_out");
    sortableTable.addColumn(_("Action"), "action");
    sortableTable.setIndexName("item");

    sortableTable.setTableRowClickHandler(new TableRowClickHandler() {
        @Override
        public void handleRowClick(HashMap<String, String> data, int col) {
            if (col == 1) {
                otherCreteriaMap.put(_("Date of Service"),
                        data.get("date_of") + ":date_of:" + data.get("date_of"));
                refreshSearch();
            } else if (col == 3) {
                otherCreteriaMap.put(_("Provider"),
                        data.get("provider") + ":provider:" + data.get("provider_id"));
                refreshSearch();
            } else if (col == 4) {
                otherCreteriaMap.put(_("Patient"), data.get("patient") + ":patient:" + data.get("patient_id"));
                refreshSearch();
            } else if (col == 6) {
                otherCreteriaMap.put(_("Item Type"),
                        data.get("item_type") + ":type:" + data.get("item_type_id"));
                refreshSearch();
            } else if (col == 7) {
                otherCreteriaMap.put(_("Procedure"),
                        data.get("procedure_id") + ":procedure:" + data.get("procedure_id"));
                refreshSearch();
            }

        }
    });

    sortableTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {
        public Widget setColumn(String columnName, final HashMap<String, String> data) {
            Integer id = Integer.parseInt(data.get("procedure_id"));
            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>");
                actionPanel.add(htmlLedger);

                htmlLedger.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent arg0) {
                        LedgerPopup ledgerPopup = new LedgerPopup(data.get("procedure_id"),
                                data.get("patient_id"), data.get("proc_cov_type"));
                        ledgerPopup.removeAction(LedgerPopup.DEDUCTABLE);
                        ledgerPopup.removeAction(LedgerPopup.COPAY);
                        ledgerPopup.show();
                        ledgerPopup.center();
                    }

                });
                return actionPanel;

            }
            if (columnName.compareTo("selected") == 0) {
                CheckBox c = new CheckBox();
                c.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent arg0) {
                    }
                });
                //               checkboxStack.put(c, id);
                return c;

            } else if (data.get("total_balance") != null) {
                Float balance = Float.parseFloat(data.get("total_balance"));
                Label label = new Label(data.get(columnName));
                if (balance == 0)
                    label.getElement().getStyle().setColor("#0B6126");
                else if (balance < 0)
                    label.getElement().getStyle().setColor("#FF0000");
                return label;

            } else {
                return (Widget) null;
            }
        }
    });

    sortableTableEmptyLabel.setStylePrimaryName("freemed-MessageText");
    sortableTableEmptyLabel.setText(_("No patients found with the specified criteria."));
    sortableTableEmptyLabel.setVisible(true);

    verticalPanel.add(sortableTable);

    // Set visible focus *after* this is shown, otherwise it won't focus.
    try {
        patientfnTextBox.setFocus(true);
    } catch (Exception e) {
        GWT.log("Caught exception: ", e);
    }
    Util.setFocus(patientlnTextBox);
}

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

License:Open Source License

public ACLScreen() {
    super(moduleName);
    aclContainerVPanel = new VerticalPanel();
    initWidget(aclContainerVPanel);/*from  ww w . j av  a  2  s  . c  om*/

    blockScreenWidget = new BlockScreenWidget(_("Please wait while modules are being populated...."));
    aclContainerVPanel.add(blockScreenWidget);
    tabPanel = new TabPanel();
    aclContainerVPanel.add(tabPanel);

    // Panel #1
    if (canWrite) {
        VerticalPanel groupAddPanel = new VerticalPanel();
        tabPanel.add(groupAddPanel, _("Add Group"));
        tabPanel.selectTab(0);

        HorizontalPanel groupNameHPanel = new HorizontalPanel();
        groupAddPanel.add(groupNameHPanel);
        groupNameHPanel.setSpacing(5);
        groupNameHPanel.add(new Label(_("Group Name")));

        groupName = new TextBox();
        groupName.setWidth("10em");
        groupNameHPanel.add(groupName);

        groupAddTable = new CustomTable();
        groupAddTable.removeTableStyle();
        groupAddPanel.add(groupAddTable);

        Label moduleHeading = new Label(_("Modules"));
        moduleHeading.setStyleName(AppConstants.STYLE_LABEL_LARGE_BOLD);
        groupAddTable.getFlexTable().setWidget(0, 0, moduleHeading);
        HorizontalPanel headerButtonPanels = new HorizontalPanel();
        headerButtonPanels.setWidth("100%");
        groupAddTable.getFlexTable().setWidget(0, 1, headerButtonPanels);
        CustomButton selectAllBtn = new CustomButton(_("Select All"), AppConstants.ICON_SELECT_ALL);
        selectAllBtn.setWidth("100%");
        selectAllBtn.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent arg0) {
                Iterator<String> iterator = aclPermissionsMap.keySet().iterator();
                while (iterator.hasNext()) {
                    aclPermissionsMap.get(iterator.next()).setValue(true);
                }
            }
        });
        headerButtonPanels.add(selectAllBtn);
        CustomButton selectNoneBtn = new CustomButton(_("Select None"), AppConstants.ICON_SELECT_NONE);
        selectNoneBtn.setWidth("100%");
        selectNoneBtn.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent arg0) {
                Iterator<String> iterator = aclPermissionsMap.keySet().iterator();
                while (iterator.hasNext()) {
                    aclPermissionsMap.get(iterator.next()).setValue(false);
                }
            }
        });
        headerButtonPanels.add(selectNoneBtn);

        addGroupButton = new CustomButton(_("Add Group"), AppConstants.ICON_ADD);
        addGroupButton.setWidth("100%");
        addGroupButton.addClickHandler(this);
        headerButtonPanels.add(addGroupButton);

        copyButton = new CustomButton(_("Copy"), AppConstants.ICON_ADD);
        copyButton.setWidth("100%");
        copyButton.addClickHandler(this);
        copyButton.setVisible(false);
        headerButtonPanels.add(copyButton);

        deleteGroupButton = new CustomButton(_("Delete Group"), AppConstants.ICON_DELETE);
        deleteGroupButton.setWidth("100%");
        deleteGroupButton.addClickHandler(this);
        deleteGroupButton.setVisible(false);
        headerButtonPanels.add(deleteGroupButton);

        clearButton = new CustomButton(_("Reset"), AppConstants.ICON_CLEAR);
        clearButton.setWidth("100%");
        clearButton.addClickHandler(this);
        headerButtonPanels.add(clearButton);

        getACLPermissions();
    }
    // Panel #2

    final FlexTable groupListTable = new FlexTable();
    tabPanel.add(groupListTable, _("List Groups"));

    groupListTable.setWidget(0, 0, groupsTable);

    groupsTable.setSize("100%", "100%");
    groupsTable.addColumn(_("Group Name"), "groupname"); // col 0
    //      groupsTable.addColumn("Group Value", "groupvalue"); // col 1
    //      groupsTable.addColumn("Parent Group", "parentgroup"); // col 2
    groupsTable.setIndexName("id");

    groupsTable.setTableRowClickHandler(new TableRowClickHandler() {
        @Override
        public void handleRowClick(HashMap<String, String> data, int col) {
            if (canWrite) {
                clearForm();
                groupId = Integer.parseInt(data.get("id"));
                groupName.setText(data.get("groupname"));
                getGroupPermissions(groupId);
                tabPanel.selectTab(0);
            }
        }
    });

    // TODO:Backend needs to be fixed first
    retrieveAllGroups();
    Util.setFocus(groupName);
}

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

License:Open Source License

public CallInScreen() {
    super(ModuleName);
    final boolean canBook = CurrentState.isActionAllowed(SchedulerWidget.moduleName, AppConstants.WRITE);

    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    initWidget(horizontalPanel);//  w  w w  .  j  a va2 s. c o  m
    horizontalPanel.setSize("100%", "100%");

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

    tabPanel = new TabPanel();
    tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            // TODO Auto-generated method stub
            if (event.getSelectedItem() == 1 && formSelection.getWidgetValue().equals("Basic"))
                ((TextBox) basicFormFields.get("cifname")).setFocus(true);
        }
    });
    verticalPanel.add(tabPanel);

    /*
     * final Label callInLabel = new Label("Call-in Patient Management.");
     * verticalPanelMenu.add(callInLabel);
     * callInLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
     */

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

    final HorizontalPanel menuButtonsPanel = new HorizontalPanel();
    menuButtonsPanel.setSpacing(1);
    headerHPanel.add(menuButtonsPanel);
    if (canDelete || canWrite || canBook) {
        final CustomButton selectAllButton = new CustomButton(_("Select All"), AppConstants.ICON_SELECT_ALL);
        menuButtonsPanel.add(selectAllButton);
        selectAllButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent wvt) {
                Iterator<CheckBox> iter = checkboxStack.keySet().iterator();
                while (iter.hasNext()) {
                    CheckBox t = iter.next();
                    t.setValue(true);
                    callInTable.selectionAdd(checkboxStack.get(t).toString());
                    // }
                }
            }
        });
    }
    if (canDelete || canWrite || canBook) {
        final CustomButton selectNoneButton = new CustomButton(_("Select None"), AppConstants.ICON_SELECT_NONE);
        menuButtonsPanel.add(selectNoneButton);
        selectNoneButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent evt) {
                clearSelection();
            }
        });
    }

    if (canDelete) {
        final CustomButton deleteButton = new CustomButton(_("Delete"), AppConstants.ICON_DELETE);
        menuButtonsPanel.add(deleteButton);
        deleteButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent evt) {
                if (callInTable.getSelectedCount() < 1)
                    Window.alert(_("Please select at least one entry!"));
                else if (Window.confirm(_("Are you sure you want to delete these item(s)?"))) {
                    List<String> slectedItems = callInTable.getSelected();
                    Iterator<String> itr = slectedItems.iterator();// Get all
                    // selected
                    // items
                    // from
                    // custom
                    // table
                    int totalItems = slectedItems.size();
                    int curItem = 1;
                    while (itr.hasNext())
                        deleteEntry(Integer.parseInt(itr.next()), curItem++, totalItems);// delete
                    // messages
                    // one by
                    // one
                }
            }
        });
    }
    if (canWrite) {
        final CustomButton enterButton = new CustomButton(_("Create Patient"), AppConstants.ICON_ADD_PERSON);
        menuButtonsPanel.add(enterButton);
        enterButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent evt) {
                if (callInTable.getSelectedCount() < 1)
                    Window.alert(_("Please select at least one entry!"));
                else if (callInTable.getSelectedCount() > 1)
                    Window.alert(_("You can create only a single patient at a time!"));
                else {
                    List<String> slectedItems = callInTable.getSelected();
                    Integer id = Integer.parseInt(slectedItems.get(0));
                    final HashMap<String, String> data = callInTable.getDataById(id);
                    if (data.get("archive") == null || data.get("archive").compareTo("0") == 0) {
                        //                     openPatientForm(id,getCallInScreen());
                        callinConvertFromPatient(id, new CustomCommand() {
                            @Override
                            public void execute(Object id) {
                                populate(null);
                                Util.spawnPatientScreen((Integer) id, data.get("name"));
                            }

                        });
                    } else {
                        Window.alert(_("You can't create patient of archived enteries!"));
                    }
                }
            }
        });
    }

    if (canBook) {
        final CustomButton bookButton = new CustomButton(_("Book"), AppConstants.ICON_BOOK_APP);
        menuButtonsPanel.add(bookButton);
        bookButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent evt) {
                if (callInTable.getSelectedCount() < 1)
                    Window.alert(_("Please select at least one entry!"));
                else if (callInTable.getSelectedCount() > 1)
                    Window.alert(_("You can book only a single appointment at a time!"));
                else {
                    List<String> slectedItems = callInTable.getSelected();
                    Integer id = Integer.parseInt(slectedItems.get(0));
                    HashMap<String, String> data = callInTable.getDataById(id);
                    if (data.get("archive") == null || data.get("archive").compareTo("0") == 0) {
                        SchedulerScreen schedulerScreen = SchedulerScreen.getInstance();
                        EventData eventData = schedulerScreen.getSchedulerWidget().getNewExternalDataEvent();
                        eventData.setPatientId(id);
                        if (data.get("provider") != null)
                            eventData.setProviderId(Integer.parseInt(data.get("provider")));
                        eventData.setResourceType(AppConstants.APPOINTMENT_TYPE_CALLIN_PATIENT);
                        schedulerScreen.getSchedulerWidget().setExternalDataEvent(eventData);
                        Util.spawnTab(AppConstants.SCHEDULER, schedulerScreen);
                    } else {
                        Window.alert(_("You can't book archived enteries!"));
                    }

                }
            }
        });

        if (canModify) {
            final CustomButton modifyButton = new CustomButton(_("Modify"), AppConstants.ICON_MODIFY);
            menuButtonsPanel.add(modifyButton);
            modifyButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent evt) {
                    if (callInTable.getSelectedCount() < 1)
                        Window.alert(_("Please select an entry!"));
                    else if (callInTable.getSelectedCount() > 1)
                        Window.alert(_("You can modify only a single entry at a time!"));
                    else {
                        List<String> slectedItems = callInTable.getSelected();
                        Integer id = Integer.parseInt(slectedItems.get(0));
                        selectedEntryId = id;
                        HashMap<String, String> data = callInTable.getDataById(id);
                        if (data.get("archive") == null || data.get("archive").compareTo("0") == 0) {
                            tabPanel.selectTab(1);
                            selectedEntryId = id;
                            modifyEntry(selectedEntryId);
                        } else {
                            Util.confirm(_(
                                    "You can not modify an archived record. Do you want to un-archive this record?"),
                                    new Command() {

                                        @Override
                                        public void execute() {
                                            // TODO Auto-generated method stub
                                            unarchiveEntry(selectedEntryId);
                                        }
                                    }, null);
                        }
                    }
                }
            });
        }

    }

    if (canWrite) {
        final CustomButton addEventButton = new CustomButton(_("Add Event"), AppConstants.ICON_ADD);
        menuButtonsPanel.add(addEventButton);
        addEventButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent evt) {
                if (callInTable.getSelectedCount() < 1)
                    Window.alert(_("Please select an entry!"));
                else if (callInTable.getSelectedCount() > 1)
                    Window.alert(_("You can modify only a single entry at a time!"));
                else {
                    List<String> slectedItems = callInTable.getSelected();
                    Integer id = Integer.parseInt(slectedItems.get(0));
                    HashMap<String, String> data = callInTable.getDataById(id);
                    String name = null;
                    if (data != null && data.get("name") != null) {
                        name = data.get("name");
                    }
                    openAddEventForm(id, name);
                }
            }
        });
    }

    if (canRead) {
        final CustomButton searchButton = new CustomButton(_("Search"), AppConstants.ICON_SEARCH);
        menuButtonsPanel.add(searchButton);
        searchButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent evt) {
                initSearchPopup();
            }
        });
    }

    callInTable = new CustomTable();
    verticalPanelMenu.add(callInTable);
    callInTable.setAllowSelection(false);
    callInTable.setSize("100%", "100%");
    // //what for is this used???To work on this
    callInTable.setIndexName("id");
    // ///
    if (canDelete || canWrite || canBook)
        callInTable.addColumn("", "selected");
    callInTable.addColumn(_("Date"), "call_date_mdy");
    callInTable.addColumn(_("Name"), "name");
    callInTable.addColumn(_("Contact Phone"), "contact_phone");
    callInTable.addColumn(_("Coverage"), "coverage");
    callInTable.addColumn(_("Complaint"), "complaint");

    callInTable.setTableRowClickHandler(new TableRowClickHandler() {
        @Override
        public void handleRowClick(HashMap<String, String> data, int col) {
            try {
                if (col != 0 || !(canBook || canWrite || canDelete)) {
                    final Integer callinId = Integer.parseInt(data.get("id"));
                    showCallinInfo(callinId);

                }
            } catch (Exception e) {
                GWT.log("Caught exception: ", e);
            }
        }
    });

    callInTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {
        public Widget setColumn(String columnName, HashMap<String, String> data) {
            Integer id = Integer.parseInt(data.get("id"));
            if (columnName.compareTo("selected") == 0) {
                CheckBox c = new CheckBox();
                c.addClickHandler(getCallInScreen());
                checkboxStack.put(c, id);
                return c;
            } else if (data.get("archive") != null && data.get("archive").compareTo("1") == 0) {
                Label label = new Label(data.get(columnName));
                label.setStyleName(AppConstants.STYLE_LABEL_ALERT);
                return label;
            }
            return (Widget) null;
        }
    });

    tabPanel.add(verticalPanelMenu, _("Menu"));
    if (canWrite) {
        //         tabPanel.add(createEntryTabBar(), "Entry");
        entryVPanel = new VerticalPanel();
        tabPanel.add(entryVPanel, _("Entry"));
        final HorizontalPanel selectionHPanel = new HorizontalPanel();
        selectionHPanel.setStyleName(AppConstants.STYLE_LABEL_HEADER_SMALL);
        entryVPanel.add(selectionHPanel);
        selectionHPanel.setSpacing(5);
        final Label selectionLabel = new Label(_("Select Form Type") + ":");
        selectionHPanel.add(selectionLabel);
        formSelection = new CustomListBox();
        selectionHPanel.add(formSelection);
        formSelection.addItem("", "");
        formSelection.addItem(_("Basic Entry Form"), "Basic");
        formSelection.addChangeHandler(new ChangeHandler() {
            public void onChange(ChangeEvent arg0) {
                handleFormSelection();
            }
        });
    }
    // tabPanel.add(new VerticalPanel(),"Entry");
    tabPanel.selectTab(0);
    // createEntryTabBar();

    // callInTable.formatTable(5);
    // callInTable.getFlexTable().setWidth("100%");

    // //////
    populate(null);
}

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  ww  .java2s .  co  m
    ledgerStep1HPanel = new HorizontalPanel();
    ledgerStep1HPanel.setSpacing(10);
    Label actionType = new Label(_("Action"));
    // actionType.setStyleName(AppConstants.STYLE_LABEL_LARGE_BOLD);
    ledgerStep1HPanel.add(actionType);
    // ledgerStep1HPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    actionsList = new ListBox();
    actionsList.addItem(_("NONE SELECTED"));
    actionsList.addItem(_("Rebill"));
    actionsList.addItem(_("Payment"));
    // actionsList.addItem("Copay");
    actionsList.addItem(_("Adjustment"));
    // actionsList.addItem("Deductable");
    actionsList.addItem(_("Withhold"));
    actionsList.addItem(_("Transfer"));
    actionsList.addItem(_("Allowed Amount"));
    actionsList.addItem(_("Denial"));
    actionsList.addItem(_("Writeoff"));
    actionsList.addItem(_("Refund"));
    // actionsList.addItem("Mistake");
    actionsList.addItem(_("Ledger"));
    ledgerStep1HPanel.add(actionsList);

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

                    }

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

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

    });

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

        }

    });

    btnSearchClaim.addClickHandler(new ClickHandler() {

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

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

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

    });

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

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

                }

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

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

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

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

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

    tagWidget = new PatientTagWidget();

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

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

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

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

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

        }

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

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

        }

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

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

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

        }

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

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

        }

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

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

        }

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

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

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

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

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

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

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

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

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

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

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

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

        }

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

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

        }

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

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

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

                }

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

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

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

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

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

                });

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

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

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

                    }

                });

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

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

                                }

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

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

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

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

                                    }

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

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

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

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

            } else {
                return (Widget) null;
            }
        }

    });

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

                        }

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

                        }

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

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

                        }

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

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

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

                        }

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

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

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

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

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

                }

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

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

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

                }

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

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

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

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

                }

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

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

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

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

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

License:Open Source License

public void openPopup() {

    getProcDetails();/*from   w ww . jav a  2  s.  c  om*/
    popupVPanel.clear();
    HorizontalPanel popupClosePanel = new HorizontalPanel();
    popupClosePanel.setWidth("100%");
    popupClosePanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    Image closeImage = new Image("resources/images/close_x.16x16.png");
    closeImage.setTitle("Close Popup");
    closeImage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            ledgerPopup.clear();
            ledgerPopup.hide();
        }
    });
    closeImage.getElement().getStyle().setProperty("cursor", "pointer");

    popupClosePanel.add(closeImage);
    popupVPanel.add(popupClosePanel);
    actionsList.setSelectedIndex(0);

    Label lblHeading2 = new Label(_("Procedure"));
    lblHeading2.setStyleName(AppConstants.STYLE_LABEL_LARGE_BOLD);
    HorizontalPanel topHp = new HorizontalPanel();
    topHp.setSpacing(5);
    topHp.add(lblHeading2);
    topHp.add(viewLedgerDetails);
    popupVPanel.add(topHp);
    popupVPanel.add(procDetailsHPanel);
    popupVPanel.add(ledgerStep1HPanel);
    popupVPanel.setCellHorizontalAlignment(ledgerStep1HPanel, HasHorizontalAlignment.ALIGN_CENTER);
    ledgerPopup = new DialogBox();
    ledgerPopup.setPixelSize(700, 20);
    PopupView viewInfo = new PopupView(popupVPanel);
    // ledgerPopup.setNewWidget(viewInfo);
    // ledgerPopup.initialize();
    ledgerPopup.setWidget(viewInfo);
    ledgerPopup.setStylePrimaryName(SchedulerCss.EVENT_DIALOG);
    ledgerPopup.center();
    ledgerPopup.show();
    // showProcedureCostPopup();
}

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

License:Open Source License

public MainScreen() {
    final DockPanel mainPanel = new DockPanel();
    initWidget(mainPanel);//from   w w  w.j a  v a  2 s.  c  o m
    mainPanel.setSize("100%", "100%");

    // CurrentState.retrieveUserConfiguration(true);
    CurrentState.retrieveSystemConfiguration(true);

    // populateLeftNavigationPanel();

    JsonUtil.debug("MainScreen: call populateDefaultProvider");
    populateDefaultProvider();

    JsonUtil.debug("MainScreen: call populateDefaultFacility");
    JsonUtil.debug("MainScreen: assign object to CurrentState static object");
    CurrentState.assignMainScreen(this);

    /*
     * Top Header panel to use top header shortcuts e.g logoff,add patient
     * etc
     */

    VerticalPanel topHeaderPanel = new VerticalPanel();
    topHeaderPanel.ensureDebugId("topHeaderPanel");
    topHeaderPanel.setStyleName(AppConstants.STYLE_HEADER_PANEL);
    topHeaderPanel.setWidth("100%");

    Image logoImage = new Image();
    logoImage.setUrl("resources/images/FreemedHeader.jpg");
    logoImage.setSize("100%", "55px");
    topHeaderPanel.add(logoImage);
    topHeaderPanel.setCellHorizontalAlignment(logoImage, HasHorizontalAlignment.ALIGN_CENTER);
    topHeaderPanel.setCellWidth(logoImage, "100%");

    HorizontalPanel topHeaderHorPanel = new HorizontalPanel();
    topHeaderHorPanel.setWidth("100%");

    HorizontalPanel facilityInfoPanel = new HorizontalPanel();
    facilityInfoPanel.setStyleName(AppConstants.STYLE_HEADER_PANEL);

    // adding userInfoPanel at top left
    HorizontalPanel userInfoPanel = new HorizontalPanel();
    userInfoPanel.setStyleName(AppConstants.STYLE_HEADER_PANEL);
    Image userImage = new Image();
    userImage.setUrl("resources/images/user-icon.png");
    userImage.setSize("13px", "100%");
    userInfoPanel.add(userImage);
    userInfoPanel.add(loginUserInfo);// Adding loginuserinfo link
    setLoginUserInfo();
    // Adding UserInfoPanel into top headerhorpanel
    HorizontalPanel hp = new HorizontalPanel();

    Image homeImage = new Image();
    homeImage.setUrl("resources/images/home-icon.png");
    homeImage.setSize("15px", "100%");
    facilityInfoPanel.add(homeImage);
    facilityInfoPanel.add(facilityInfo);

    HTML separator = new HTML("|");
    separator.setWidth("8px");
    separator.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    hp.add(userInfoPanel);
    hp.add(separator);
    hp.add(facilityInfoPanel);
    // Adding UserInfoPanel into top headerhorpanel
    topHeaderHorPanel.add(hp);
    topHeaderHorPanel.setCellHorizontalAlignment(hp, HasHorizontalAlignment.ALIGN_LEFT);
    topHeaderHorPanel.setCellHorizontalAlignment(facilityInfoPanel, HasHorizontalAlignment.ALIGN_LEFT);
    // topHeaderHorPanel.setCellWidth(facilityInfoPanel, "20%");

    // adding shortcuts panel at top right corder

    shortCutsPanel = new HorizontalPanel();

    // Adding shortCutsPanel into top header
    topHeaderHorPanel.add(shortCutsPanel);
    topHeaderHorPanel.setCellHorizontalAlignment(shortCutsPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    // Adding tophorpanel into top topheaderpanel
    topHeaderPanel.add(topHeaderHorPanel);
    topHeaderPanel.setCellWidth(topHeaderHorPanel, "100%");

    // Adding top header to main panel
    mainPanel.add(topHeaderPanel, DockPanel.NORTH);
    mainPanel.setCellWidth(topHeaderPanel, "100%");
    mainPanel.setCellHeight(topHeaderPanel, "3%");

    /*
     * SimplePanel to hold (hopefully) a horizontal sub menu, going to try
     * to use the Menu Bar items to call each sub-menu -JA
     */

    JsonUtil.debug("MainScreen: create accordion panel");

    // Creating Left Navigation area with decorated stack panel
    stackPanel = new AccordionPanel();
    stackPanel.setWidth("100%");
    // stackPanel.setHeight("100%");

    {
        JsonUtil.debug("MainScreen: add main pane");
        mainAccPanel = new VerticalPanel();
        mainAccPanel.setStyleName("accordion-panel");
        mainAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Main Panel(System) into stack panel
        // stackPanel.add(mainAccPanel,
        // getHeaderString(AppConstants.SYSTEM_CATEGORY, null), true);

        JsonUtil.debug("MainScreen: add patient pane");
        patientAccPanel = new VerticalPanel();
        patientAccPanel.setStyleName("accordion-panel");
        patientAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Patient Panel into stack panel
        // stackPanel.add(patientAccPanel,
        // getHeaderString(AppConstants.PATIENT_CATEGORY, null), true);

        JsonUtil.debug("MainScreen: add document pane");
        documentAccPanel = new VerticalPanel();
        documentAccPanel.setStyleName("accordion-panel");
        documentAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Documents Panel into stack panel
        // stackPanel.add(documentAccPanel,
        // getHeaderString(AppConstants.DOCUMENTS_CATEGORY, null), true);
        JsonUtil.debug("MainScreen: add Billing pane");
        billingAccPanel = new VerticalPanel();
        billingAccPanel.setStyleName("accordion-panel");
        billingAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Billing Panel into stack panel
        // stackPanel.add(billingAccPanel,
        // getHeaderString(AppConstants.BILLING_CATEGORY, null), true);

        JsonUtil.debug("MainScreen: add Reporting pane");
        reportingAccPanel = new VerticalPanel();
        reportingAccPanel.setStyleName("accordion-panel");
        reportingAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        // adding Reporting Panel into stack panel
        // stackPanel.add(reportingAccPanel,
        // getHeaderString(AppConstants.REPORTING_CATEGORY, null), true);

        JsonUtil.debug("MainScreen: add utilities pane");
        utilitiesAccPanel = new VerticalPanel();
        utilitiesAccPanel.setStyleName("accordion-panel");
        utilitiesAccPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

        // adding Utilities Panel into stack panel
        // stackPanel.add(utilitiesAccPanel,
        // getHeaderString(AppConstants.UTILITIES_CATEGORY, null), true);

        // Disable for now
        // accordionPanel.selectPanel("Main");
    }
    JsonUtil.debug("MainScreen: create container hpanel for accordion and tabs");

    HorizontalPanel menuAndContent = new HorizontalPanel();
    menuAndContent.setSize("100%", "100%");

    // Jam them together, no space.
    menuAndContent.setSpacing(0);
    // menuAndContent.setCellWidth(accordionPanel, "250px");

    JsonUtil.debug("MainScreen: add accordion and tab panel to container");
    menuAndContent.add(stackPanel);
    stackPanel.ensureDebugId("cwStackPanel");

    // defining left navigation area width
    menuAndContent.setCellWidth(stackPanel, "12%");

    JsonUtil.debug("MainScreen: create tabPanel");
    tabPanel = new DecoratedTabPanel();

    tabPanel.setSize("100%", "100%");
    tabPanel.setAnimationEnabled(true);
    menuAndContent.add(tabPanel);
    // defining content area width
    menuAndContent.setCellWidth(tabPanel, "88%");

    menuAndContent.setCellHorizontalAlignment(tabPanel, HasHorizontalAlignment.ALIGN_LEFT);
    JsonUtil.debug("MainScreen: add container to dock panel");
    mainPanel.add(menuAndContent, DockPanel.CENTER);

    JsonUtil.debug("MainScreen: add dashboard panel to tabs and select");
    // tabPanel.add(dashboard, "Dashboard");
    tabPanel.add(dashboardScreenNew, "Dashboard");

    tabPanel.selectTab(0);
    JsonUtil.debug("MainScreen: pass tabPanel to static CurrentState");
    CurrentState.assignTabPanel(tabPanel);

    // Get configuration
    CurrentState.retrieveUserConfiguration(true, new Command() {
        public void execute() {
            JsonUtil.debug("MainScreen: Set State of dashboard");
            dashboardScreenNew.loadWidgets();
            dashboardScreenNew.reloadDashboard();
        }
    });

    // Expand out main tabpanel to take up all extra room
    JsonUtil.debug("MainScreen: expand tabpanel");
    // mainPanel.setCellWidth(tabPanel, "100%");
    // mainPanel.setCellHeight(tabPanel, "100%");

    final HTML poweredByLabel = new HTML(_("Powered By FreeMED&trade;"));
    poweredByLabel.setStyleName(AppConstants.STYLE_LABEL_SMALL);
    mainPanel.add(poweredByLabel, DockPanel.SOUTH);
    mainPanel.setCellHorizontalAlignment(poweredByLabel, HasHorizontalAlignment.ALIGN_CENTER);

    JsonUtil.debug("MainScreen: split panel");
    statusBarContainer = new HorizontalSplitPanel();
    mainPanel.add(statusBarContainer, DockPanel.SOUTH);
    statusBarContainer.setSize("100%", "30px");
    statusBarContainer.setSplitPosition("50%");

    JsonUtil.debug("MainScreen: status bar");
    statusBar1 = new Label(_("Ready"));
    statusBar1.setStyleName("statusBar");
    statusBarContainer.add(statusBar1);
    CurrentState.assignStatusBar(statusBar1);
    statusBar2 = new Label("-");
    statusBar2.setStyleName("statusBar");
    statusBarContainer.add(statusBar2);
    if (Util.isStubbedMode()) {
        statusBar2.setText("STUBBED / TEST MODE");
    }
    populateDefaultFacility();

    // Create notification toaster
    JsonUtil.debug("MainScreen: create toaster");
    if (CurrentState.getToaster() == null) {
        Toaster toaster = new Toaster();
        CurrentState.assignToaster(toaster);
        toaster.setTimeout(7);
    }

    // Handle system notifications
    // notifications.setState(getCurrentState());
    JsonUtil.debug("MainScreen: start notifications");
    notifications.start();

    if (Util.getProgramMode() == ProgramMode.STUBBED)
        initNavigations();

    tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> arg0) {
            if (tabPanel.getWidget(arg0.getSelectedItem()) instanceof ScreenInterface) {
                ScreenInterface screenInterface = ((ScreenInterface) tabPanel
                        .getWidget(arg0.getSelectedItem()));
                String className = screenInterface.getClass().getName();
                className = className.substring(className.lastIndexOf('.') + 1);
                CurrentState.assignCurrentPageHelp(className);
            }
        }
    });

    // Force showing the screen
    // show();
}