List of usage examples for com.google.gwt.user.client.ui TabPanel clear
public void clear()
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);// ww w. j a v a2 s .c o 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:ro.zg.opengroups.gwt.client.views.EntityUserActionsTabView.java
License:Apache License
private void update(CommandDefinitionsList cdl, List<Integer> desiredActionPath, List<Integer> currentActionPath) { TabPanel container = getContainer(); this.currentActionPath = currentActionPath; if (handlerReg != null) { handlerReg.removeHandler();// w ww.j a va 2s . c om } container.clear(); addCommandDefinitionsList(cdl, desiredActionPath, container); }