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.freemedsoftware.gwt.client.screen.ConfigurationScreen.java

License:Open Source License

public ConfigurationScreen() {
    super(moduleName);
    final VerticalPanel verticalPanel = new VerticalPanel();
    initWidget(verticalPanel);//from   ww  w. java  2 s . c om
    verticalPanel.setWidth("100%");

    tabPanel = new TabPanel();
    verticalPanel.add(tabPanel);
    // tabPanel.selectTab(0);

    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    verticalPanel.add(horizontalPanel);
    if (canModify) {
        final CustomButton commitChangesButton = new CustomButton(_("Commit Changes"), AppConstants.ICON_ADD);
        horizontalPanel.add(commitChangesButton);
        commitChangesButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                commitValues();
            }
        });
    }

    populate();
}

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

License:Open Source License

public ModuleFieldCheckerTypeEntryScreen() {
    super("admin");
    final VerticalPanel containerAllVerticalPanel = new VerticalPanel();
    initWidget(containerAllVerticalPanel);

    final HorizontalPanel tabViewPanel = new HorizontalPanel();
    final CheckBox tabView = new CheckBox();
    tabView.setText("Tab View");
    tabView.setValue(true);// w  w w.j ava2s .  c om
    tabViewPanel.add(tabView);

    tabView.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            switchView(tabView.getValue());
        }
    });

    containerAllVerticalPanel.add(tabViewPanel);

    tabPanel = new TabPanel();
    containerAllVerticalPanel.add(tabPanel);

    containerVerticalPanel = new VerticalPanel();
    containerAllVerticalPanel.add(containerVerticalPanel);

    initWorkFlowTypeForm();

    initWorkFlowList();

    if (canWrite)
        tabPanel.selectTab(1);
    else
        tabPanel.selectTab(0);
}

From source file:org.freemedsoftware.gwt.client.screen.patient.EncounterScreen.java

License:Open Source License

public EncounterScreen() {
    moddata = new HashMap<String, String>();
    sections = new HashMap<String, List<String>>();
    verticalPanel = new VerticalPanel();
    verticalPanel.setSize("100%", "100%");
    entryVerticalPanel = new VerticalPanel();
    tabPanel = new TabPanel();
    tabPanel.add(entryVerticalPanel, _("Add"));
    verticalPanel.add(tabPanel);/*from w  ww . j av a 2  s .c  o m*/
    initWidget(verticalPanel);
    tabPanel.selectTab(0);
}

From source file:org.freemedsoftware.gwt.client.screen.patient.ProgressNoteEntry.java

License:Open Source License

public ProgressNoteEntry() {
    this.patientIdName = "pnotespat";

    final VerticalPanel verticalPanel = new VerticalPanel();
    initWidget(verticalPanel);/*from w  w w  . ja v  a 2s  .  com*/

    final TabPanel tabPanel = new TabPanel();
    verticalPanel.add(tabPanel);

    final HorizontalPanel buttonBar = new HorizontalPanel();
    buttonBar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    final CustomButton wSubmit = new CustomButton(_("Submit"), AppConstants.ICON_ADD);
    buttonBar.add(wSubmit);
    wSubmit.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent evt) {
            submitForm();
        }
    });
    final CustomButton wReset = new CustomButton(_("Reset"), AppConstants.ICON_CLEAR);
    buttonBar.add(wReset);
    wReset.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent evt) {
            resetForm();
        }
    });
    verticalPanel.add(buttonBar);

    final SimplePanel simplePanel = new SimplePanel();
    tabPanel.add(simplePanel, _("Summary"));

    final FlexTable flexTable = new FlexTable();
    simplePanel.setWidget(flexTable);
    flexTable.setSize("100%", "100%");

    final Label label = new Label(_("Import Previous Notes for") + " ");
    flexTable.setWidget(0, 0, label);

    final HorizontalPanel dateContainer = new HorizontalPanel();
    final CustomDatePicker wImportDate = new CustomDatePicker();
    // wImportDate.setWeekendSelectable(true);
    dateContainer.add(wImportDate);
    final CustomButton wImportPrevious = new CustomButton(_("Import"), AppConstants.ICON_IMPORT);
    dateContainer.add(wImportPrevious);
    flexTable.setWidget(0, 1, dateContainer);

    final Label dateLabel = new Label(_("Date") + " : ");
    flexTable.setWidget(1, 0, dateLabel);

    wDate = new CustomDatePicker();
    wDate.setHashMapping("pnotesdt");
    addEntryWidget("pnotesdt", wDate);
    flexTable.setWidget(1, 1, wDate);

    final Label providerLabel = new Label(_("Provider") + " : ");
    flexTable.setWidget(2, 0, providerLabel);

    wProvider = new SupportModuleWidget("ProviderModule");
    wProvider.setHashMapping("pnotesphy");
    addEntryWidget("pnotesphy", wProvider);
    flexTable.setWidget(2, 1, wProvider);

    final Label descriptionLabel = new Label(_("Description") + " : ");
    flexTable.setWidget(3, 0, descriptionLabel);

    wDescription = new CustomTextArea();
    wDescription.setHashMapping("pnotesdescrip");
    addEntryWidget("pnotesdescrip", wDescription);
    flexTable.setWidget(3, 1, wDescription);
    wDescription.setWidth("100%");

    final Label templateLabel = new Label(_("Template") + " : ");
    flexTable.setWidget(4, 0, templateLabel);

    final HorizontalPanel templatePanel = new HorizontalPanel();

    wTemplate = new SupportModuleWidget("ProgressNotesTemplates");
    templatePanel.add(wTemplate);

    CustomButton importTemplate = new CustomButton(_("Import"), AppConstants.ICON_IMPORT);
    importTemplate.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (wTemplate.getValue() != null && wTemplate.getValue() != 0) {
                JsonUtil.debug("loading template " + wTemplate.getValue());
                if (Util.getProgramMode() == ProgramMode.STUBBED) {
                    Util.showInfoMsg("ProgressNotesTemplates", "Template loaded.");
                } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
                    String[] params = { JsonUtil.jsonify(wTemplate.getValue()) };
                    RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                            URL.encode(Util.getJsonRequest(
                                    "org.freemedsoftware.module.ProgressNotesTemplates.GetTemplate", params)));
                    try {
                        builder.sendRequest(null, new RequestCallback() {
                            public void onError(com.google.gwt.http.client.Request request, Throwable ex) {
                                GWT.log("Exception", ex);
                                Util.showErrorMsg("ProgressNotesTemplates", _("Failed to load template."));
                            }

                            public void onResponseReceived(com.google.gwt.http.client.Request request,
                                    com.google.gwt.http.client.Response response) {
                                if (200 == response.getStatusCode()) {
                                    @SuppressWarnings("unchecked")
                                    HashMap<String, String> result = (HashMap<String, String>) JsonUtil
                                            .shoehornJson(JSONParser.parseStrict(response.getText()),
                                                    "HashMap<String,String>");
                                    if (result != null) {
                                        loadTemplateData(result);
                                        Util.showInfoMsg("ProgressNotesTemplates", _("Loaded template."));
                                    }
                                } else {
                                    Window.alert(response.toString());
                                }
                            }
                        });
                    } catch (RequestException e) {
                        GWT.log("Exception", e);
                        Util.showErrorMsg("ProgressNotesTemplates", _("Failed to load template."));
                    }
                } else {
                    // TODO: Make this work with GWT-RPC
                }
            }
        }
    });
    templatePanel.add(importTemplate);

    flexTable.setWidget(4, 1, templatePanel);

    final SimplePanel containerS = new SimplePanel();
    tabPanel.add(containerS, "S");
    S = new CustomRichTextArea();
    S.setHashMapping("pnotes_S");
    addEntryWidget("pnotes_S", S);
    containerS.setWidget(S);
    S.setSize("100%", "100%");

    final SimplePanel containerO = new SimplePanel();
    tabPanel.add(containerO, "O");
    O = new CustomRichTextArea();
    O.setHashMapping("pnotes_O");
    addEntryWidget("pnotes_O", O);
    containerO.setWidget(O);
    O.setSize("100%", "100%");

    final SimplePanel containerA = new SimplePanel();
    tabPanel.add(containerA, "A");
    A = new CustomRichTextArea();
    A.setHashMapping("pnotes_A");
    addEntryWidget("pnotes_A", A);
    containerA.setWidget(A);
    A.setSize("100%", "100%");

    final SimplePanel containerP = new SimplePanel();
    tabPanel.add(containerP, "P");
    P = new CustomRichTextArea();
    P.setHashMapping("pnotes_P");
    addEntryWidget("pnotes_P", P);
    containerP.setWidget(P);
    P.setSize("100%", "100%");

    final SimplePanel containerI = new SimplePanel();
    tabPanel.add(containerI, "I");
    I = new CustomRichTextArea();
    I.setHashMapping("pnotes_I");
    addEntryWidget("pnotes_I", I);
    containerI.setWidget(I);
    I.setSize("100%", "100%");

    final SimplePanel containerE = new SimplePanel();
    tabPanel.add(containerE, "E");
    E = new CustomRichTextArea();
    E.setHashMapping("pnotes_E");
    addEntryWidget("pnotes_E", E);
    containerE.setWidget(E);
    E.setSize("100%", "100%");

    final VerticalPanel containerR = new VerticalPanel();
    tabPanel.add(containerR, "R");
    R = new CustomRichTextArea();
    R.setHashMapping("pnotes_R");
    addEntryWidget("pnotes_R", R);
    containerR.add(R);
    R.setSize("100%", "100%");
    final RecentMedicationsList recentMedicationsList = new RecentMedicationsList();
    recentMedicationsList.setPatientId(patientId);
    containerR.add(recentMedicationsList);

    tabPanel.selectTab(0);
    Util.setFocus(wProvider);
}

From source file:org.freemedsoftware.gwt.client.screen.patient.ScannedDocumentsEntryScreen.java

License:Open Source License

public ScannedDocumentsEntryScreen() {
    super(SCANNED_DOCUMENT);
    final VerticalPanel containerAllVerticalPanel = new VerticalPanel();
    initWidget(containerAllVerticalPanel);

    final HorizontalPanel tabViewPanel = new HorizontalPanel();
    final CheckBox tabView = new CheckBox();
    tabView.setText(_("Tab View"));
    tabView.setValue(true);//w  w w. j  av a2 s .  com
    tabViewPanel.add(tabView);

    tabView.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            switchView(tabView.getValue());
        }
    });

    containerAllVerticalPanel.add(tabViewPanel);

    tabPanel = new TabPanel();
    containerAllVerticalPanel.add(tabPanel);

    containerVerticalPanel = new VerticalPanel();
    containerAllVerticalPanel.add(containerVerticalPanel);

    initClinicalAssesmentForm();

    initClinicalAssesmentList();

    if (canWrite)
        tabPanel.selectTab(1);
    else
        tabPanel.selectTab(0);
}

From source file:org.freemedsoftware.gwt.client.screen.patient.SummaryScreen.java

License:Open Source License

public SummaryScreen() {
    final FlexTable flexTable = new FlexTable();
    initWidget(flexTable);/*from  w  w w. j av a 2s  .com*/
    flexTable.setSize("100%", "100%");

    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setWidth("70%");
    flexTable.setWidget(0, 0, verticalPanel);

    /*
     * final Label actionItemsLabel = new Label("ACTION ITEMS");
     * actionItemsLabel.setStylePrimaryName("label_bold");
     * verticalPanel.add(actionItemsLabel); final SimplePanel cActionItems =
     * new SimplePanel();
     * cActionItems.setStylePrimaryName("freemed-PatientSummaryContainer");
     * verticalPanel.add(cActionItems);
     * verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
     */

    // Adding messages panel
    actionItemsBox = new ActionItemsBox(false);
    actionItemsBox.setWidth("100%");
    actionItemsBox.setEnableCollapse(false);
    verticalPanel.add(actionItemsBox);

    final CustomTable customSortableTable = new CustomTable();
    verticalPanel.add(customSortableTable);

    final VerticalPanel problemContainer = new VerticalPanel();
    problemContainer.setWidth("70%");
    // final Label problemLabel = new Label("Problems");
    // problemLabel.setStylePrimaryName("freemed-PatientSummaryHeading");
    // problemContainer.add(problemLabel);

    final SimplePanel cProblemList = new SimplePanel();
    cProblemList.setStylePrimaryName("freemed-PatientSummaryContainer");
    problemList = new PatientProblemList();
    problemList.setPatientScreen(patientScreen);
    cProblemList.setWidget(problemList);
    problemContainer.add(cProblemList);
    flexTable.setWidget(1, 0, problemContainer);

    final VerticalPanel verticalPanel_1 = new VerticalPanel();
    verticalPanel_1.setWidth("70%");
    flexTable.setWidget(2, 0, verticalPanel_1);

    // final Label clinicalInformationLabel = new
    // Label("Clinical Information");
    // clinicalInformationLabel
    // .setStylePrimaryName("freemed-PatientSummaryHeading");
    // clinicalInformationLabel.setWidth("78%");
    // verticalPanel_1.add(clinicalInformationLabel);
    final SimplePanel cClinicalInformation = new SimplePanel();
    // cClinicalInformation
    // .setStylePrimaryName("freemed-PatientSummaryContainer");
    cClinicalInformation.setWidth("100%");
    verticalPanel_1.add(cClinicalInformation);
    verticalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    final TabPanel clinicalInformationTabPanel = new TabPanel();
    clinicalInformationTabPanel.setSize("100%", "100%");
    TabBar tbar = clinicalInformationTabPanel.getTabBar();
    Element tabBarFirstChild = tbar.getElement().getFirstChildElement().getFirstChildElement()
            .getFirstChildElement();
    tabBarFirstChild.setAttribute("width", "100%");
    tabBarFirstChild.setInnerHTML(_("CLINICAL INFORMATION"));
    tabBarFirstChild.setClassName("label_bold");
    cClinicalInformation.setWidget(clinicalInformationTabPanel);

    final SimplePanel clinicalTagsPanel = new SimplePanel();
    patientTags = new PatientTagsWidget();
    clinicalTagsPanel.add(patientTags);
    addChildWidget(patientTags);

    final Image tagsLabel = new Image();
    tagsLabel.setUrl("resources/images/dashboard.16x16.png");
    tagsLabel.setTitle(_("Patient Tags"));
    clinicalInformationTabPanel.add(clinicalTagsPanel, tagsLabel);

    /*
     * final SimplePanel clinicalPhotoIdPanel = new SimplePanel(); final
     * Image photoIdLabel = new Image();
     * photoIdLabel.setUrl("resources/images/patient.16x16.png");
     * photoIdLabel.setTitle("Photo Identification"); photoId = new Image();
     * photoId.setWidth("230px"); clinicalPhotoIdPanel.add(photoId);
     * clinicalInformationTabPanel.add(clinicalPhotoIdPanel, photoIdLabel);
     */

    final SimplePanel clinicalMedicationsPanel = new SimplePanel();
    recentMedicationsList = new RecentMedicationsList();
    clinicalMedicationsPanel.add(recentMedicationsList);
    addChildWidget(recentMedicationsList);

    final Image medicationsLabel = new Image();
    medicationsLabel.setUrl("resources/images/rx_prescriptions.16x16.png");
    medicationsLabel.setTitle(_("Medications"));
    clinicalInformationTabPanel.add(clinicalMedicationsPanel, medicationsLabel);

    final SimplePanel clinicalAllergiesPanel = new SimplePanel();
    recentAllergiesList = new RecentAllergiesList();
    clinicalAllergiesPanel.add(recentAllergiesList);
    addChildWidget(recentAllergiesList);

    final Image allergiesLabel = new Image();
    allergiesLabel.setUrl("resources/images/allergy.16x16.png");
    allergiesLabel.setTitle(_("Allergies"));
    clinicalInformationTabPanel.add(clinicalAllergiesPanel, allergiesLabel);

    final VerticalPanel verticalPanel_2 = new VerticalPanel();
    verticalPanel_2.setWidth("70%");
    flexTable.setWidget(3, 0, verticalPanel_2);

    financialWidget = new FinancialWidget();
    final SimplePanel cFinancial = new SimplePanel();
    cFinancial.setStylePrimaryName("freemed-PatientSummaryContainer");
    cFinancial.setWidget(financialWidget);
    verticalPanel_2.add(cFinancial);

    JsonUtil.debug("selectTab(0)");
    clinicalInformationTabPanel.selectTab(0);
}

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

License:Open Source License

public PatientForm() {
    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setWidth("100%");
    initWidget(verticalPanel);/*from ww w .j  a v a2s. co  m*/

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

    verticalPanel.add(tabView);

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

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

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

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

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

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

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

    });

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

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

    });

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

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

    });

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    });

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    inHouseDoctor = new ProviderWidget();

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

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

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

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

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

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

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

    numberofOtherPhysicians.addChangeHandler(new ChangeHandler() {

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

    });

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

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

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

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

    updateOtherPhysiciansBoxes(0);

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

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

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

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

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

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

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

                } else
                    commitChanges();
            }
        }
    });

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

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

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

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

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

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

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

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

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

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

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

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

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

        }

    });

    Util.setFocus(title);
}

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

License:Open Source License

public PatientScreen() {
    super(moduleName);
    final VerticalPanel verticalPanel = new VerticalPanel();
    initWidget(verticalPanel);/*from w  w w .j a va 2 s.  c o m*/
    verticalPanel.setSize("100%", "100%");

    patientInfoBar = new PatientInfoBar();
    patientInfoBar.setParentScreen(this);
    verticalPanel.add(patientInfoBar);

    {
        final MenuBar menuBar = new MenuBar();
        verticalPanel.add(menuBar);

        boolean menuItemAdded = false;

        final MenuBar menuBar_1 = new MenuBar(true);
        if (CurrentState.isActionAllowed(AllergyEntryScreen.moduleName, AppConstants.WRITE)) {
            menuBar_1.addItem(_("Allergy"), new Command() {
                public void execute() {
                    AllergyEntryScreen allergyEntryScreen = new AllergyEntryScreen();
                    Util.spawnTabPatient(_("Allergy"), allergyEntryScreen, getObject());
                    allergyEntryScreen.populate();
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Drug Sample"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Drug Sample"), new DrugSampleEntry(), getObject());
                }
            });
            menuItemAdded = true;
        }
        if (true) {
            menuBar_1.addItem(_("Episode of Care"), new Command() {
                public void execute() {
                    EpisodeOfCareScreen eoc = new EpisodeOfCareScreen();
                    Util.spawnTabPatient(_("Episode of Care"), eoc, getObject());
                    eoc.loadData();
                }
            });
            menuItemAdded = true;
        }
        if (true) {
            menuBar_1.addItem(_("Encounter/Progress Notes"), new Command() {
                public void execute() {
                    EncounterScreen ens = new EncounterScreen();
                    Util.spawnTabPatient(_("Encounter/Progress Notes"), ens, getObject());
                    ens.laodData();
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Foreign ID"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Foreign ID"), new PatientIdEntry(), getObject());
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Form"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Form"), new FormEntry(), getObject());
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Immunization"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Immunization"), new ImmunizationEntry(), getObject());
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Letter"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Letter"), new LetterEntry(), getObject());
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Patient Correspondence"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Patient Correspondence"), new PatientCorrespondenceEntry(),
                            getObject());
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Patient Link"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Patient Link"), new PatientLinkEntry(), getObject());
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Progress Note"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Progress Note"), new ProgressNoteEntry(), getObject());
                }
            });
            menuItemAdded = true;
        }

        if (CurrentState.isActionAllowed(PrescriptionsScreen.moduleName, AppConstants.WRITE)) {
            menuBar_1.addItem(_("Prescription"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Prescription"), new PrescriptionsScreen(), getObject());
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Referral"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Referral"), new ReferralEntry(), getObject());
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Vitals"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Vitals"), new VitalsEntry(), getObject());
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_1.addItem(_("Scanned Documents"), new Command() {
                public void execute() {
                    ScannedDocumentsEntryScreen scannedDocumentsEntryScreen = new ScannedDocumentsEntryScreen();
                    Util.spawnTabPatient(_("Scanned Documents"), scannedDocumentsEntryScreen, getObject());
                    scannedDocumentsEntryScreen.populateAvailableData();
                }
            });
            menuItemAdded = true;
        }
        if (menuItemAdded)
            menuBar.addItem(_("New"), menuBar_1);
        menuItemAdded = false;
        final MenuBar menuBar_2 = new MenuBar(true);

        if (CurrentState.isActionAllowed(ProcedureScreen.moduleName, AppConstants.SHOW)) {
            menuBar_2.addItem(_("Manage Procedures"), new Command() {
                public void execute() {
                    ProcedureScreen ps = new ProcedureScreen();
                    Util.spawnTabPatient(_("Manage Procedures"), ps, getObject());
                    ps.loadData();
                }
            });
            menuItemAdded = true;
        }

        if (true) {
            menuBar_2.addItem(_("Payment"), new Command() {
                public void execute() {
                    AdvancePayment ap = new AdvancePayment();
                    Util.spawnTabPatient(_("Payment"), ap, getObject());
                    ap.loadUI();
                }
            });
            menuItemAdded = true;
        }

        if (CurrentState.isActionAllowed(PatientReportingScreen.moduleName, AppConstants.SHOW)) {
            menuBar_2.addItem(_("Patient Reporting"), new Command() {
                public void execute() {
                    Util.spawnTabPatient(_("Patient Reporting"), new PatientReportingScreen(), getObject());
                }
            });
            menuItemAdded = true;
        }

        menuBar_2.addItem(_("Billing/Payment"), (Command) null);

        if (true) {
            menuBar_2.addItem(_("Growth Charts"), new Command() {
                public void execute() {
                    GrowthChartScreen growthChartScreen = new GrowthChartScreen();
                    JsonUtil.debug("Calling growth charts with ptsex = " + patientInfo.get("ptsex"));
                    growthChartScreen.setGender(patientInfo.get("ptsex"));
                    growthChartScreen.setBirthDate(Util.sqlToDate(patientInfo.get("ptdob")));
                    growthChartScreen.init();
                    Util.spawnTabPatient(_("Growth Charts"), growthChartScreen, getObject());
                }
            });
            menuItemAdded = true;
        }

        menuBar_2.addItem(_("Trending"), (Command) null);

        menuBar.addItem(_("Reporting"), menuBar_2);
    }

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

    tabPanel = new TabPanel();
    verticalPanel_1.add(tabPanel);
    summaryScreen = new SummaryScreen();
    tabPanel.add(summaryScreen, _("Summary"));
    summaryScreen.assignPatientScreen(getObject());
    addChildWidget(summaryScreen);
    tabPanel.selectTab(0);

    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);
            }
        }
    });

}

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

License:Open Source License

public PatientsGroupScreen() {
    super(ModuleName);
    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    initWidget(horizontalPanel);/*  w  w w  .  j a  v a  2s.  co 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)
                groupName.setFocus(true);
        }
    });

    verticalPanel.add(tabPanel);

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

    final HorizontalPanel menuButtonsPanel = new HorizontalPanel();
    menuButtonsPanel.setSpacing(1);
    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);
                    patientGroupTable.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) {
                Iterator<CheckBox> iter = checkboxStack.keySet().iterator();
                while (iter.hasNext()) {
                    CheckBox t = iter.next();
                    t.setValue(false);
                    patientGroupTable.selectionRemove(checkboxStack.get(t).toString());
                }
            }
        });
    }

    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 (patientGroupTable.getSelectedCount() < 1)
                    Window.alert(_("Please select at least one entry."));
                else {
                    List<String> slectedItems = patientGroupTable.getSelected();
                    SchedulerScreen schedulerScreen = SchedulerScreen.getInstance();
                    EventData eventData = schedulerScreen.getSchedulerWidget().getNewExternalDataEvent();
                    eventData.setPatientId(Integer.parseInt(slectedItems.get(0)));
                    eventData.setResourceType(AppConstants.APPOINTMENT_TYPE_GROUP);
                    schedulerScreen.getSchedulerWidget().setExternalDataEvent(eventData);
                    Util.spawnTab(AppConstants.SCHEDULER, schedulerScreen);
                }
            }
        });
    }

    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 (patientGroupTable.getSelectedCount() < 1)
                    Window.alert(_("Please select an entry."));
                else if (patientGroupTable.getSelectedCount() > 1)
                    Window.alert(_("You can modify only a single entry at a time."));
                else {
                    List<String> slectedItems = patientGroupTable.getSelected();
                    Iterator<String> itr = slectedItems.iterator();// Get all
                    // selected
                    // items
                    // from
                    // custom
                    // table
                    tabPanel.selectTab(1);
                    groupName.setFocus(true);
                    btnAdd.setText(_("Modify"));
                    selectedEntryId = Integer.parseInt(itr.next());
                    modifyEntry(selectedEntryId);
                }
            }
        });
    }

    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 (patientGroupTable.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 = patientGroupTable.getSelected();
                    Iterator<String> itr = slectedItems.iterator();// Get all
                    // selected
                    // items
                    // from
                    // custom
                    // table
                    while (itr.hasNext())
                        deleteEntry(Integer.parseInt(itr.next()));// delete
                    // messages
                    // one by
                    // one
                    populate();
                }
            }
        });
    }

    verticalPanelMenu.add(menuButtonsPanel);
    patientGroupTable = new CustomTable();
    verticalPanelMenu.add(patientGroupTable);
    patientGroupTable.setAllowSelection(false);
    patientGroupTable.setSize("100%", "100%");
    // //what for is this used???To work on this
    patientGroupTable.setIndexName("id");
    // ///
    if (canBook || canDelete)
        patientGroupTable.addColumn(_("Selected"), "selected");

    patientGroupTable.addColumn(_("Group Name"), "groupname");
    patientGroupTable.addColumn(_("Group Facility"), "groupfacility");
    patientGroupTable.addColumn(_("Group Frequency (in days)"), "groupfrequency");
    patientGroupTable.addColumn(_("Group Length (min)"), "grouplength");

    patientGroupTable.setTableRowClickHandler(new TableRowClickHandler() {
        @Override
        public void handleRowClick(HashMap<String, String> data, int col) {
            try {
                if (col != 0)
                    showGroupInfo(Integer.parseInt(data.get("id")));
            } catch (Exception e) {
                GWT.log("Caught exception: ", e);
            }
        }
    });

    patientGroupTable.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(getPatientGroupScreen());
                checkboxStack.put(c, id);
                return c;
            } else {
                return (Widget) null;
            }
        }
    });

    tabPanel.add(verticalPanelMenu, _("Menu"));
    if (canWrite)
        tabPanel.add(createEntryTabBar(), _("Entry"));

    // tabPanel.add(new VerticalPanel(),"Entry");
    tabPanel.selectTab(0);
    // createEntryTabBar();

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

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

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

License:Open Source License

public PreferencesScreen() {
    final VerticalPanel verticalPanel = new VerticalPanel();
    initWidget(verticalPanel);//from   w w  w  . j av a2s .co  m
    verticalPanel.setWidth("100%");

    tabPanel = new TabPanel();
    verticalPanel.add(tabPanel);
    sectionFieldsMap = new HashMap<String, List<String>>();
    List<String> widgetsList = new ArrayList<String>();
    widgetsList.add(_("WORK LIST"));
    widgetsList.add(_("MESSAGES"));
    widgetsList.add(_("UNFILED DOCUMENTS"));
    widgetsList.add(_("RX REFILLS"));
    widgetsList.add(_("ACTION ITEMS"));
    sectionFieldsMap.put(_("Sections"), widgetsList);
    createTabs();
    tabPanel.selectTab(0);
    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    verticalPanel.add(horizontalPanel);

    final CustomButton commitChangesButton = new CustomButton("Commit Changes", AppConstants.ICON_ADD);
    horizontalPanel.add(commitChangesButton);
    commitChangesButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            ////////////////Handling UI////////////////////////
            if (isThemeChanged)
                CurrentState.setUserConfig(AppConstants.SYSTEM_THEME, CurrentState.CUR_THEME);
            CurrentState.setUserConfig("defaultPrinter", printersList.getStoredValue());
            CurrentState.setUserConfig("providerGroup", providerGroupList.getStoredValue());
            CurrentState.setUserConfig(AppConstants.SYSTEM_NOTIFICATION,
                    systemNotificationSettingsList.getStoredValue());
            CurrentState.setUserConfig("defaultWidgets", templateWidget.getSelectedSectionFeildsMap());
            CurrentState.assignSYSTEM_NOTIFY_TYPE(systemNotificationSettingsList.getStoredValue());
            try {
                CurrentState.defaultProviderGroup = new Integer(providerGroupList.getStoredValue());
            } catch (Exception e) {

            }
            ////////////////End Handling UI////////////////////////

            ////////////////Handling Navigation////////////////////////
            if (isNavigatioMenuChanged)
                CurrentState.setUserConfig("LeftNavigationMenu", CurrentState.getLeftNavigationOptions());
            CurrentState.getMainScreen().initNavigations();
            ////////////////End Handling Navigation////////////////////////
            Util.showInfoMsg("PreferencesScreen", _("Preferences saved."));
            if (currentPassword.getText().length() > 0 || newPassword.getText().length() > 0
                    || newPassword.getText().length() > 0)
                chagePasswordProcess();
            else
                Util.closeTab(getPreferencesScreen());
            DashboardScreenNew dashboard = DashboardScreenNew.getInstance();
            dashboard.loadWidgets();
            dashboard.reloadDashboard();
        }
    });

    setDefaultPreferences();
    loadPrefererences();
}