Example usage for com.google.gwt.user.client.ui TabPanel TabPanel

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

Introduction

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

Prototype

public TabPanel() 

Source Link

Document

Creates an empty tab panel.

Usage

From source file:org.drools.guvnor.client.moduleeditor.ModuleEditorWrapper.java

License:Apache License

private void render() {
    final TabPanel tPanel = new TabPanel();
    tPanel.setWidth("100%");

    ArtifactEditor artifactEditor = new ArtifactEditor(packageConfigData, clientFactory, eventBus,
            this.isHistoricalReadOnly);

    Command refreshCommand = new Command() {
        public void execute() {
            refresh();//from  w w w .  j  ava 2  s  .c o m
        }
    };
    AbstractModuleEditor moduleEditor = clientFactory.getPerspectiveFactory().getModuleEditor(packageConfigData,
            clientFactory, eventBus, this.isHistoricalReadOnly, refreshCommand);

    layout.clear();

    Widget actionToolBar = clientFactory.getPerspectiveFactory().getModuleEditorActionToolbar(packageConfigData,
            clientFactory, eventBus, this.isHistoricalReadOnly, refreshCommand);
    layout.add(actionToolBar);

    AssetViewerActivity assetViewerActivity = new AssetViewerActivity(packageConfigData.getUuid(),
            clientFactory);
    assetViewerActivity.start(new AcceptItem() {
        public void add(String tabTitle, IsWidget widget) {
            ScrollPanel pnl = new ScrollPanel();
            pnl.setWidth("100%");
            pnl.add(widget);
            tPanel.add(pnl, constants.Assets());
        }
    }, null);

    ScrollPanel pnl = new ScrollPanel();
    pnl.setWidth("100%");
    pnl.add(artifactEditor);
    tPanel.add(pnl, constants.AttributeForModuleEditor());
    tPanel.selectTab(0);

    pnl = new ScrollPanel();
    pnl.setWidth("100%");
    pnl.add(moduleEditor);
    tPanel.add(pnl, constants.Edit());
    tPanel.selectTab(0);

    tPanel.setHeight("100%");
    layout.add(tPanel);
    layout.setHeight("100%");
}

From source file:org.drools.guvnor.client.packages.PackageEditorWrapper.java

License:Apache License

private void render() {
    this.artifactEditor = new ArtifactEditor(conf, this.isHistoricalReadOnly);
    this.packageEditor = new PackageEditor(conf, this.isHistoricalReadOnly, this.closeCommand,
            this.refreshPackageListCommand, this.openPackageCommand, new Command() {
                public void execute() {
                    refresh();/*w w w  . j a va2 s .  c  om*/
                }
            });
    this.actionToolBar = this.packageEditor.getActionToolbar();

    layout.clear();
    layout.add(this.actionToolBar);

    TabPanel tPanel = new TabPanel();
    tPanel.setWidth("100%");

    ScrollPanel pnl = new ScrollPanel();
    pnl.setWidth("100%");
    pnl.add(this.artifactEditor);
    tPanel.add(pnl, "Attributes");
    tPanel.selectTab(0);

    pnl = new ScrollPanel();
    pnl.setWidth("100%");
    pnl.add(this.packageEditor);
    tPanel.add(pnl, "Edit");
    tPanel.selectTab(0);

    tPanel.setHeight("100%");
    layout.add(tPanel);
    layout.setHeight("100%");
}

From source file:org.drools.guvnor.client.ruleeditor.RuleViewerWrapper.java

License:Apache License

private void render() {
    this.artifactEditor = new ArtifactEditor(asset, this.isHistoricalReadOnly, new Command() {
        public void execute() {
            refresh();//from  w  ww . j av a2  s  .co  m
        }
    }, this.openItemCommand, this.closeCommand);

    this.ruleViewer = new RuleViewer(asset, this.openItemCommand, this.closeCommand, this.checkedInCommand,
            this.archiveCommand, new Command() {
                public void execute() {
                    refresh();
                }
            }, this.isHistoricalReadOnly, actionToolbarButtonsConfigurationProvider, ruleViewerSettings);
    this.actionToolBar = this.ruleViewer.getActionToolbar();

    layout.clear();
    layout.add(this.actionToolBar);

    TabPanel tPanel = new TabPanel();
    tPanel.setWidth("100%");

    ScrollPanel pnl = new ScrollPanel();
    pnl.add(this.artifactEditor);
    tPanel.add(pnl, "Attributes");
    // tPanel.selectTab(0);

    pnl = new ScrollPanel();
    // pnl1.setWidth("100%");
    pnl.add(this.ruleViewer);
    tPanel.add(pnl, "Edit");
    tPanel.selectTab(1);

    layout.add(tPanel);
}

From source file:org.drools.guvnor.client.ruleeditor.WorkingSetEditor.java

License:Apache License

private void refreshWidgets() {
    WorkingSetConfigData wsData = (WorkingSetConfigData) workingSet.content;

    TabPanel tPanel = new TabPanel();
    //tPanel.setWidth(800);
    ScrollPanel pnl = new ScrollPanel();
    //        pnl.setAutoWidth(true);
    //pnl.setClosable(false);
    pnl.setTitle("WS Definition"); //TODO {bauna} i18n
    //        pnl.setAutoHeight(true);
    pnl.add(buildDoubleList(wsData));/*from  w w  w. ja va  2s.  c  o m*/
    tPanel.add(pnl, "WS Definition");

    pnl = new ScrollPanel();
    //        pnl.setAutoWidth(true);
    //pnl.setClosable(false);
    //pnl.setTitle("WS Constraints"); //TODO {bauna} i18n
    //        pnl.setAutoHeight(true);
    this.factsConstraintsgEditorPanel = new FactsConstraintsEditorPanel(this);
    pnl.add(this.factsConstraintsgEditorPanel);
    tPanel.add(pnl, "WS Constraints");

    pnl = new ScrollPanel();
    //        pnl.setAutoWidth(true);
    //pnl.setClosable(false);
    pnl.setTitle("WS Custom Forms"); //TODO {bauna} i18n
    //        pnl.setAutoHeight(true);
    this.customFormsEditorPanel = new CustomFormsEditorPanel(this);
    pnl.add(this.customFormsEditorPanel);
    tPanel.add(pnl, "WS Custom Forms");
    tPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<java.lang.Integer>() {

        public void onBeforeSelection(BeforeSelectionEvent<java.lang.Integer> arg0) {
            factsConstraintsgEditorPanel.fillSelectedFacts();
            customFormsEditorPanel.fillSelectedFacts();
        }

    });

    tPanel.selectTab(0);
    initWidget(tPanel);
}

From source file:org.drools.guvnor.client.WorkbenchPart.java

License:Apache License

public WorkbenchPart(EventBus eventBus) {
    panel = new TabPanel();
    initWidget(panel);

}

From source file:org.drools.workbench.screens.guided.rule.client.widget.FromAccumulateCompositeFactPatternWidget.java

License:Apache License

@Override
protected Widget getCompositeLabel() {
    ClickHandler leftPatternclick = new ClickHandler() {

        public void onClick(ClickEvent event) {
            Widget w = (Widget) event.getSource();
            showFactTypeSelector(w);//from  w  w w.j av a  2 s.co m
        }
    };
    ClickHandler sourcePatternClick = new ClickHandler() {

        public void onClick(ClickEvent event) {
            Widget w = (Widget) event.getSource();
            showSourcePatternSelector(w);
        }
    };

    String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName("from accumulate") + "</div>";

    FlexTable panel = new FlexTable();

    int r = 0;

    if (pattern.getFactPattern() == null) {
        panel.setWidget(r++, 0,
                new ClickableLabel("<br> <font color='red'>"
                        + GuidedRuleEditorResources.CONSTANTS.clickToAddPattern() + "</font>", leftPatternclick,
                        !this.readOnly));
    }

    panel.setWidget(r++, 0, new HTML(lbl));

    if (this.getFromAccumulatePattern().getSourcePattern() == null) {
        panel.setWidget(r++, 0,
                new ClickableLabel("<br> <font color='red'>"
                        + GuidedRuleEditorResources.CONSTANTS.clickToAddPattern() + "</font>",
                        sourcePatternClick, !this.readOnly));
    } else {
        IPattern rPattern = this.getFromAccumulatePattern().getSourcePattern();

        RuleModellerWidget sourcePatternWidget;
        if (rPattern instanceof FactPattern) {
            sourcePatternWidget = new FactPatternWidget(this.getModeller(), getEventBus(), rPattern, true, true,
                    this.readOnly);

        } else if (rPattern instanceof FromAccumulateCompositeFactPattern) {
            sourcePatternWidget = new FromAccumulateCompositeFactPatternWidget(this.getModeller(),
                    this.getEventBus(), (FromAccumulateCompositeFactPattern) rPattern, this.readOnly);

        } else if (rPattern instanceof FromCollectCompositeFactPattern) {
            sourcePatternWidget = new FromCollectCompositeFactPatternWidget(this.getModeller(),
                    this.getEventBus(), (FromCollectCompositeFactPattern) rPattern, this.readOnly);

        } else if (rPattern instanceof FromEntryPointFactPattern) {
            sourcePatternWidget = new FromEntryPointFactPatternWidget(this.getModeller(), this.getEventBus(),
                    (FromEntryPointFactPattern) rPattern, this.readOnly);

        } else if (rPattern instanceof FromCompositeFactPattern) {
            sourcePatternWidget = new FromCompositeFactPatternWidget(this.getModeller(), this.getEventBus(),
                    (FromCompositeFactPattern) rPattern, this.readOnly);
        } else {
            throw new IllegalArgumentException(
                    "Unsupported pattern " + rPattern + " for right side of FROM ACCUMULATE");
        }

        sourcePatternWidget.addOnModifiedCommand(new Command() {
            public void execute() {
                setModified(true);
            }
        });

        panel.setWidget(r++, 0, addRemoveButton(sourcePatternWidget, new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisBlockOfData())) {
                    setModified(true);
                    getFromAccumulatePattern().setSourcePattern(null);
                    getModeller().refreshWidget();
                }

            }
        }));
    }

    //REVISIT: Nested TabLayoutPanel does not work, its content is truncated. 
    //TabLayoutPanel tPanel = new TabLayoutPanel(2, Unit.EM);
    TabPanel tPanel = new TabPanel();

    FlexTable codeTable = new FlexTable();
    int codeTableRow = 0;
    int codeTableCol = 0;

    codeTable.setWidget(codeTableRow, codeTableCol++,
            new HTML("<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Init() + ":</div>"));

    final TextBox initField = new TextBox();
    initField.setTitle(GuidedRuleEditorResources.CONSTANTS.InitCode());
    initField.setText(getFromAccumulatePattern().getInitCode());
    initField.setEnabled(!this.readOnly);
    codeTable.setWidget(codeTableRow++, codeTableCol--, initField);

    codeTable.setWidget(codeTableRow, codeTableCol++,
            new HTML("<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Action() + ":</div>"));
    final TextBox actionField = new TextBox();
    actionField.setTitle(GuidedRuleEditorResources.CONSTANTS.ActionCode());
    actionField.setText(getFromAccumulatePattern().getActionCode());
    actionField.setEnabled(!this.readOnly);
    codeTable.setWidget(codeTableRow++, codeTableCol--, actionField);

    codeTable.setWidget(codeTableRow, codeTableCol++,
            new HTML("<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Reverse() + ":</div>"));
    final TextBox reverseField = new TextBox();
    reverseField.setTitle(GuidedRuleEditorResources.CONSTANTS.ReverseCode());
    reverseField.setText(getFromAccumulatePattern().getReverseCode());
    reverseField.setEnabled(!this.readOnly);
    codeTable.setWidget(codeTableRow++, codeTableCol--, reverseField);

    codeTable.setWidget(codeTableRow, codeTableCol++,
            new HTML("<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Result() + ":</div>"));
    final TextBox resultField = new TextBox();
    resultField.setTitle(GuidedRuleEditorResources.CONSTANTS.ResultCode());
    resultField.setText(getFromAccumulatePattern().getResultCode());
    resultField.setEnabled(!this.readOnly);
    codeTable.setWidget(codeTableRow++, codeTableCol--, resultField);

    //panel.setWidget(r++, 0, codeTable);
    ScrollPanel codePanel = new ScrollPanel();
    codePanel.add(codeTable);

    tPanel.add(codePanel, GuidedRuleEditorResources.CONSTANTS.CustomCode());

    FlexTable functionTable = new FlexTable();

    functionTable.setWidget(0, 0,
            new HTML("<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Function() + ":</div>"));
    final TextBox functionField = new TextBox();
    functionField.setTitle(GuidedRuleEditorResources.CONSTANTS.FunctionCode());
    functionField.setText(getFromAccumulatePattern().getFunction());
    functionField.setEnabled(!this.readOnly);
    functionTable.setWidget(0, 1, functionField);

    //        panel.setWidget(r++, 0, functionTable);

    ScrollPanel functionPanel = new ScrollPanel();
    functionPanel.add(functionTable);

    tPanel.add(functionPanel, GuidedRuleEditorResources.CONSTANTS.Function());
    ChangeHandler changehandler = new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            Widget sender = (Widget) event.getSource();
            TextBox senderTB = (TextBox) event.getSource();
            String code = senderTB.getText();
            setModified(true);
            if (sender == initField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setInitCode(code);
            } else if (sender == actionField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setActionCode(code);
            } else if (sender == reverseField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setReverseCode(code);
            } else if (sender == resultField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setResultCode(code);
            } else if (sender == functionField) {
                getFromAccumulatePattern().clearCodeFields();
                initField.setText("");
                actionField.setText("");
                reverseField.setText("");
                resultField.setText("");
                getFromAccumulatePattern().setFunction(code);
            }
        }
    };

    initField.addChangeHandler(changehandler);
    actionField.addChangeHandler(changehandler);
    reverseField.addChangeHandler(changehandler);
    resultField.addChangeHandler(changehandler);
    functionField.addChangeHandler(changehandler);

    boolean useFunction = getFromAccumulatePattern().useFunctionOrCode()
            .equals(FromAccumulateCompositeFactPattern.USE_FUNCTION);

    tPanel.selectTab(useFunction ? 1 : 0);

    panel.setWidget(r++, 0, tPanel);

    return panel;
}

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

License:Open Source License

public ACLScreen() {
    super(moduleName);
    aclContainerVPanel = new VerticalPanel();
    initWidget(aclContainerVPanel);/*  w  w w .ja v  a  2s .c  o  m*/

    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);//from  w  ww .  jav a  2  s.  com
    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.CallInScreen.java

License:Open Source License

private VerticalPanel createBasicEntryForm() {
    final VerticalPanel verticalPanelEntry = new VerticalPanel();
    verticalPanelEntry.setWidth("100%");

    basicFormEntryTabPanel = new TabPanel();
    basicFormEntryTabPanel.setWidth("100%");
    verticalPanelEntry.add(basicFormEntryTabPanel);

    HorizontalPanel horPanel = new HorizontalPanel();
    basicFormEntryTabPanel.add(horPanel, _("Contact"));
    horPanel.setWidth("");

    final FlexTable flexTable = new FlexTable();
    horPanel.add(flexTable);/*  www .  jav  a2  s . c  o  m*/
    int row = 0;

    final Label lblLastName = new Label(_("Last Name"));
    flexTable.setWidget(row, 0, lblLastName);
    final TextBox txtLastName = new TextBox();
    txtLastName.setWidth("200px");
    flexTable.setWidget(row, 1, txtLastName);
    basicFormFields.put("cilname", txtLastName);

    row++;

    final Label lblFirstName = new Label(_("First Name"));
    flexTable.setWidget(row, 0, lblFirstName);
    final TextBox txtFirstName = new TextBox();
    txtFirstName.setWidth("200px");
    flexTable.setWidget(row, 1, txtFirstName);
    basicFormFields.put("cifname", txtFirstName);

    row++;

    final Label lblMiddleName = new Label(_("Middle Name"));
    flexTable.setWidget(row, 0, lblMiddleName);
    final TextBox txtMiddleName = new TextBox();
    txtMiddleName.setWidth("200px");
    flexTable.setWidget(row, 1, txtMiddleName);
    basicFormFields.put("cimname", txtMiddleName);

    row++;

    final Label lblDob = new Label(_("Date of Birth"));
    flexTable.setWidget(row, 0, lblDob);
    final CustomDatePicker dobBox = new CustomDatePicker();
    flexTable.setWidget(row, 1, dobBox);
    basicFormFields.put("cidob", dobBox);

    row++;

    final Label lblComplaint = new Label(_("Complaint"));
    flexTable.setWidget(row, 0, lblComplaint);
    final TextArea taComplaints = new TextArea();
    taComplaints.setCharacterWidth(22);
    taComplaints.setVisibleLines(5); // FIXME
    flexTable.setWidget(row, 1, taComplaints);
    basicFormFields.put("cicomplaint", taComplaints);

    row++;

    final Label lblFacility = new Label(_("Facility"));
    flexTable.setWidget(row, 0, lblFacility);
    final SupportModuleWidget facility = new SupportModuleWidget("FacilityModule");
    facility.setValue(CurrentState.getDefaultFacility());
    facility.setWidth("200px");
    flexTable.setWidget(row, 1, facility);
    basicFormFields.put("cifacility", lblFacility);

    row++;

    final Label lblPhysician = new Label(_("Provider"));
    flexTable.setWidget(row, 0, lblPhysician);
    final ProviderWidget provider = new ProviderWidget();
    provider.setWidth("200px");
    flexTable.setWidget(row, 1, provider);
    basicFormFields.put("ciphysician", provider);

    btnAdd = new CustomButton(_("Add"), AppConstants.ICON_ADD);
    btnAdd.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            // TODO Auto-generated method stub
            saveForm();
        }
    });
    btnClear = new CustomButton(_("Clear"), AppConstants.ICON_CLEAR);
    btnClear.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            // TODO Auto-generated method stub
            clearForm();
        }
    });

    horPanel.add(createContactInformation());

    //handling coverages
    callinPatientCoverages = new PatientCoverages();
    callinPatientCoverages.setMaxCoveragesCount(1);
    basicFormEntryTabPanel.add(callinPatientCoverages, _("Insurance"));

    basicFormEntryTabPanel.selectTab(0);

    HorizontalPanel panelButtons = new HorizontalPanel();
    verticalPanelEntry.add(panelButtons);
    verticalPanelEntry.setCellHorizontalAlignment(panelButtons, HasHorizontalAlignment.ALIGN_CENTER);

    panelButtons.add(btnAdd);
    panelButtons.add(btnClear);

    return verticalPanelEntry;
}

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

License:Open Source License

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

    patientWidget = new PatientWidget();
    // date for service's date and its simple format i;e without time.
    dateBox = new DateBox();
    dateBox.setFormat(new DefaultFormat(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT)));
    cbShowZeroBalance = new CheckBox(_("Include Zero Balances"));
    cbWholeWeek = new CheckBox(_("Select Week"));
    // Buttons for
    btnSearchClaim = new CustomButton(_("Search Claim"), AppConstants.ICON_SEARCH);
    popupVPanel = new VerticalPanel();
    popupVPanel.setSize("100%", "100%");
    popupVPanel.setSpacing(5);/*w 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);
}