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

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

Introduction

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

Prototype

public void selectTab(int index) 

Source Link

Document

Programmatically selects the specified tab and fires events.

Usage

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);/*w  w  w . j a v 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.PatientScreenInterface.java

License:Open Source License

/**
 * Close this screen by removing it from the tab panel.
 *//*w  ww  . j a  va 2s.  c  o  m*/
public void closeScreen() {
    TabPanel t = patientScreen.getTabPanel();
    if (t.getWidgetIndex(this) != -1) {
        t.selectTab(t.getWidgetIndex(this) - 1);
        t.remove(t.getWidgetIndex(this));
    }
    Integer patientId = getPatientId();
    CurrentState.getPatientSubScreenMap().get(patientId).remove(this.getClass().getName());
}

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);/* ww w.j  a  v a2s  .c  om*/

    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.SummaryScreen.java

License:Open Source License

public SummaryScreen() {
    final FlexTable flexTable = new FlexTable();
    initWidget(flexTable);//from   ww  w .j  a v  a  2  s .  c  o m
    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);//  w  ww  .j av  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:org.freemedsoftware.gwt.client.screen.ReportingLogScreen.java

License:Open Source License

public ReportingLogScreen() {
    super(moduleName);
    final VerticalPanel verticalPanel = new VerticalPanel();
    initWidget(verticalPanel);/*  ww  w.  ja  v  a 2  s .  c o m*/

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

    // Panel #2

    final FlexTable groupListTable = new FlexTable();
    tabPanel.add(groupListTable, _("Failed Reports"));

    groupListTable.setWidget(0, 0, printLogTable);

    printLogTable.setSize("100%", "100%");
    printLogTable.addColumn(_("Report Name"), "report_name"); // col 0
    printLogTable.addColumn(_("Format"), "report_format"); // col 1
    printLogTable.addColumn(_("Date"), "stamp"); // col 2
    printLogTable.addColumn(_("Action"), "action"); // col 2
    printLogTable.setIndexName("id");

    printLogTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {
        public Widget setColumn(String columnName, HashMap<String, String> data) {
            // Render only action column, otherwise skip renderer
            if (columnName.compareToIgnoreCase("action") != 0) {
                return null;
            }
            final CustomActionBar actionBar = new CustomActionBar(data);
            actionBar.hideAction(HandleCustomAction.ADD);
            actionBar.hideAction(HandleCustomAction.LOCK);
            actionBar.hideAction(HandleCustomAction.MODIFY);
            actionBar.setHandleCustomAction(new HandleCustomAction() {
                @Override
                public void handleAction(int id, HashMap<String, String> data, int action) {
                    if (action == HandleCustomAction.DELETE)
                        deleteFailedReportsLog(id);
                    else if (action == HandleCustomAction.PRINT) {
                        Util.generateReportToPrinter(data.get("report_name"), data.get("report_format"),
                                convertParamsToList(data.get("report_params")), false);
                    } else if (action == HandleCustomAction.VIEW) {
                        Util.generateReportToBrowser(data.get("report_name"), data.get("report_format"),
                                convertParamsToList(data.get("report_params")));
                    }
                }
            });

            // Push value back to table
            return actionBar;
        }
    });

    printLogTable.setTableRowClickHandler(new TableRowClickHandler() {
        @Override
        public void handleRowClick(HashMap<String, String> data, int col) {
        }
    });
    tabPanel.selectTab(0);
    // TODO:Backend needs to be fixed first
    retrieveFailedReportsLog();
}

From source file:org.freemedsoftware.gwt.client.ScreenInterface.java

License:Open Source License

/**
 * Remove the current ScreenInterface from the parent TabPanel.
 *///from w w w  .  j  a va2s. com
public void closeScreen() {
    TabPanel t = CurrentState.getTabPanel();
    if (t.getWidgetIndex(this) != -1) {
        t.selectTab(t.getWidgetIndex(this) - 1);
        t.remove(t.getWidgetIndex(this));
    }
    this.removeFromParent();
}

From source file:org.freemedsoftware.gwt.client.Util.java

License:Open Source License

/**
 * Close tab from main window// ww w. j av a  2  s  .  c om
 * 
 * @param screen
 *            Object containing extended composite with content
 */
public static synchronized void closeTab(ScreenInterface screen) {

    TabPanel t = CurrentState.getTabPanel();
    t.selectTab(t.getWidgetIndex(screen) - 1);
    t.remove(t.getWidgetIndex(screen));

    // Special handling for PatientScreen
    if (screen instanceof PatientScreen) {
        HashMap<Integer, PatientScreen> map = CurrentState.getPatientScreenMap();
        Integer oldId = ((PatientScreen) screen).getPatient();
        if (map.get(oldId) != null) {
            map.remove(oldId);
        }
    }
}

From source file:org.freemedsoftware.gwt.client.Util.java

License:Open Source License

/**
 * Close all tabs from main window after logout
 * /*from w  w  w.ja v a2s.  com*/
 */
public static synchronized void closeAllTabs() {

    TabPanel t = CurrentState.getTabPanel();
    while (t.getWidgetCount() > 1) {

        ScreenInterface screen = (ScreenInterface) t.getWidget(1);
        // Special handling for PatientScreen
        if (screen instanceof PatientScreen) {
            HashMap<Integer, PatientScreen> map = CurrentState.getPatientScreenMap();
            Integer oldId = ((PatientScreen) screen).getPatient();
            if (map.get(oldId) != null) {
                map.remove(oldId);
            }
        }
        screen.closeScreen();
    }
    t.selectTab(0);
}

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

License:Open Source License

public ClosableTab(String labelText, Widget w, ClosableTabInterface cTI) {
    // Store in namespace where we can see it later
    widget = w;//  w w w .  j a v  a 2 s  . c  o  m
    closableTabInterface = cTI;

    final HorizontalPanel panel = new HorizontalPanel();
    initWidget(panel);

    final Label label = new Label(labelText);
    label.setStyleName(AppConstants.STYLE_LABEL_TAB);
    panel.add(label);
    panel.setTitle(labelText);
    panel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_LEFT);
    panel.setCellVerticalAlignment(label, HasVerticalAlignment.ALIGN_TOP);

    final Image image = new Image();
    image.setUrl("resources/images/close_x.16x16.png");

    // Create spacer
    panel.add(new HTML("&nbsp;"));

    panel.add(image);
    panel.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_TOP);
    panel.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_RIGHT);

    image.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent evt) {
            boolean goodToGo = true;
            // If we have a ClosableTabInterface, make sure it's ready to
            // die
            if (closableTabInterface != null) {
                goodToGo = closableTabInterface.isReadyToClose();
            }
            if (goodToGo) {
                if (closableTabInterface != null) {
                    closableTabInterface.onClose();
                }
                TabPanel t = ((TabPanel) widget.getParent().getParent().getParent());
                t.selectTab(t.getWidgetIndex(widget) - 1);
                widget.removeFromParent();

                // If we're dealing with PatientScreen, remove from mapping
                if (widget instanceof ScreenInterface) {
                    ScreenInterface screen = (ScreenInterface) widget;
                    screen.closeScreen();
                }
            }
        }
    });
}