Example usage for org.apache.poi.xwpf.usermodel XWPFParagraph createRun

List of usage examples for org.apache.poi.xwpf.usermodel XWPFParagraph createRun

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel XWPFParagraph createRun.

Prototype

public XWPFRun createRun() 

Source Link

Document

Appends a new run to this paragraph

Usage

From source file:patientmanagerv1.HomeController.java

public void writeEvalToDocX(boolean customPath, String path) {
    FileOutputStream outstream;//from  w  ww.  j  a  v a 2s.co m

    try {
        if (customPath == false) {
            outstream = new FileOutputStream(installationPath + "/userdata/" + firstName + lastName + dob + "/"
                    + firstName + lastName + dob + "psychiatricevaluation.docx");
        } else {
            outstream = new FileOutputStream(path + ".docx");
        }

        XWPFDocument doc = new XWPFDocument();
        //due to the redirection of these e's, even physically, your str will begin to deteriorate. Corpse-like, in other words.

        /*XWPFParagraph para = doc.createParagraph();
        para.setAlignment(ParagraphAlignment.CENTER);
        XWPFRun paraRun = para.createRun();
        paraRun.setBold(true);
        paraRun.setFontSize(12);
        //paraRun.setFontSize(16);
        paraRun.setText("Hello World");*/

        XWPFParagraph header = doc.createParagraph(); //Paragraph
        XWPFRun headerLabel = header.createRun(); //Where the text will be written from
        header.setAlignment(ParagraphAlignment.CENTER);
        headerLabel.setFontFamily("16");
        headerLabel.setBold(true);
        headerLabel.setText("Advanced Psychiatric Associates");
        headerLabel.addBreak();
        headerLabel.setText("Psychiatric Evaluation");
        headerLabel.addBreak();

        XWPFParagraph p = doc.createParagraph(); //Paragraph
        XWPFRun run = p.createRun(); //Where the text will be written from
        XWPFRun run2 = p.createRun();
        XWPFRun run3 = p.createRun();
        XWPFRun run4 = p.createRun();
        XWPFRun run5 = p.createRun();
        XWPFRun run6 = p.createRun();
        XWPFRun run7 = p.createRun();
        XWPFRun run8 = p.createRun();
        XWPFRun run9 = p.createRun();
        XWPFRun run10 = p.createRun();
        XWPFRun run11 = p.createRun();
        XWPFRun run12 = p.createRun();
        XWPFRun run13 = p.createRun();
        XWPFRun run14 = p.createRun();
        XWPFRun run15 = p.createRun();
        XWPFRun run16 = p.createRun();
        XWPFRun run17 = p.createRun();
        XWPFRun run18 = p.createRun();
        XWPFRun anEdit1 = p.createRun();
        XWPFRun run19 = p.createRun();
        XWPFRun run20 = p.createRun();
        XWPFRun run21 = p.createRun();
        XWPFRun run22 = p.createRun();
        XWPFRun run23 = p.createRun();
        XWPFRun run24 = p.createRun();
        XWPFRun run25 = p.createRun();
        XWPFRun run26 = p.createRun();
        XWPFRun run27 = p.createRun();
        XWPFRun run28 = p.createRun();
        XWPFRun run29 = p.createRun();
        XWPFRun run30 = p.createRun();
        XWPFRun run31 = p.createRun(); //Where the text will be written from
        XWPFRun run32 = p.createRun();
        XWPFRun run33 = p.createRun();
        XWPFRun run34 = p.createRun();
        XWPFRun run35 = p.createRun();
        XWPFRun run36 = p.createRun();
        XWPFRun run37 = p.createRun();
        XWPFRun run38 = p.createRun();
        XWPFRun run39 = p.createRun();
        XWPFRun run40 = p.createRun();
        XWPFRun run41 = p.createRun();
        XWPFRun run42 = p.createRun();
        XWPFRun run42Bold = p.createRun();
        XWPFRun runPre43 = p.createRun();
        XWPFRun run43 = p.createRun();
        XWPFRun run44 = p.createRun();
        XWPFRun run45 = p.createRun();
        XWPFRun run46 = p.createRun();
        XWPFRun run47 = p.createRun();
        XWPFRun run48 = p.createRun();
        XWPFRun run49 = p.createRun();
        XWPFRun run50 = p.createRun();
        XWPFRun run51 = p.createRun();
        XWPFRun run52 = p.createRun();
        XWPFRun run53 = p.createRun();
        XWPFRun run54 = p.createRun();
        XWPFRun run55 = p.createRun();
        XWPFRun run56 = p.createRun();
        XWPFRun run57 = p.createRun();
        XWPFRun run58 = p.createRun();
        XWPFRun run59 = p.createRun();
        XWPFRun run60 = p.createRun();

        run.setBold(true);
        run2.setBold(false);
        run3.setBold(true);
        run4.setBold(false);
        run5.setBold(true);
        run6.setBold(false);
        run7.setBold(true);
        run8.setBold(false);
        run9.setBold(true);
        run10.setBold(false);
        run11.setBold(true);
        run12.setBold(false);
        run13.setBold(true);
        run14.setBold(false);
        run15.setBold(true);
        run16.setBold(false);
        run17.setBold(true);
        run18.setBold(false);
        run19.setBold(true);
        run20.setBold(false);
        run21.setBold(true);
        run22.setBold(false);
        run23.setBold(true);
        run24.setBold(false);
        run25.setBold(true);
        run26.setBold(false);
        run27.setBold(true);
        run28.setBold(false);
        run29.setBold(true);
        run30.setBold(false);

        /*
            @FXML
        AnchorPane ap;
        @FXML
        TextField first, last, ageText, dobText;
        @FXML
        TextField ethnicityothertext;
        @FXML
        RadioButton male, female;
        @FXML
        RadioButton single, engaged, married, seperated, divorced, commonlawspouse, cohabiting; 
        @FXML
        CheckBox africanamerican, nativeamerican, hispanic, asian, caucasian, ethnicityother, ocd, bipolardisorder, socialphobia, panicdisorder, eatingdisorder, majordepressivedisorder, psychosis;
        @FXML
        RadioButton insurance, internet, pcp, cps, therapist, referredbyother;
        @FXML
        TextField referredbytherapisttext, referredbyothertext, reasonforreferralbox;
        @FXML
        Button sign, saveButton;
        @FXML
        Label signature;
        @FXML
        CheckBox patient, spouse, mother, father, othersourceofinformation, emp, unemp, disabilityincome;
        @FXML
        TextField othersourceofinformationbox, otherreliabilityofinformationbox;
        @FXML
        RadioButton good, fair, vague, minimizing, otherreliabilityofinformation, sano, sayes, physicalabuseno, physicalabuseyes, sexualabuseno, sexualabuseyes, violentaggressivebehaviorsno, violentaggressivebehaviorsyes, selfinjuriousbehaviorsno, selfinjuriousbehaviorsyes;
        @FXML
        TextArea historyofpresentillness, currentmedications, pastpsychiatrichistory, pasthistoryoftext, historyofmedicationtrialsinthepasttable, historyofmedicationtrialsinthepastcomments, substanceusehistory;
        @FXML
        ListView listOfProgressReports;
        @FXML
        CheckBox significantwithdrawals, dts, withdrawalseizures, historyofdetox, outpatient, inpatient, na, aa, substancetreatmentprogram, nkda, environmental;
        @FXML
        TextField inpatientbox, parents, siblings, children, education, allergiesdescriptionbox;
        @FXML
        TextArea socialhistorygeneral, familyhistoryofmentalillness, legalhistory, pastmedicalhistory;
        @FXML
        RadioButton fhomiNO, fhomiYES, eyecontactgood, eyecontactpoor, eyecontactvariable;
        @FXML
        TextField appearanceotherbox, attitudeotherbox, motoractivityotherbox;
        @FXML
        CheckBox wellgroomed, casual, disheveled, bizarre, inappropriate, appearanceother, cooperative, guarded, suspicious, withdrawn, uncooperative, hostile, defensive, attitudeother;
        @FXML
        CheckBox normal, agitated, motorretardation, hyperactive, catatonia, tremorstics, motoractivityother;
        @FXML
        CheckBox appropriate, labile, expansive, constricted, affecthappy, affectsad, blunted, flat, masking, affectnormalrange;
        @FXML
        CheckBox euthymic, depressed, dysphoric, anxious, euphoric, angry, irritable, moodsad;
        @FXML
        CheckBox normal2, delayed, soft, loud, slurred, excessive, pressured, perseverating, rapid, rambling, incoherent, disorganized, decreasedproductivity;
        @FXML
        CheckBox intact, circumstantial, loa, tangential, foi, logicalgoaldirected, thoughtblocking, ruminating, racingthoughts, thoughtinsertionwithdrawalbroadcast;
        */

        //alternative solution: so I guess, a seperate run for each form element, followed by an if statement
        //run is created here if(divorced.isSelected == "true"){run.setBold(true); run.setText("divorced");} else {run.setBold(false); run.setText("divorced")}
        //single, engaged, married, seperated, divorced, commonlawspouse, cohabiting; 

        //greater: MM, gbits, (much) lesser: id'ing
        run.setText("Patient Name: ");
        //doc.write(outstream);
        //outstream.close();
        // doc.createParagraph().createRun().setBold(true);

        //run.setBold(false);
        //run.setText("Ciel Phantomhive");

        run2.setText(first.getText() + " " + last.getText());
        run3.setText("              Age: ");
        //run2.setTextPosition(run2.getTextPosition());
        run4.setText(ageText.getText());
        run5.setText("                              DOB: ");
        run6.setText(dobText.getText());
        run6.addBreak();
        run6.addBreak();

        run7.setBold(false);
        run7.setText("Marital Status: ");
        //single, engaged, married, seperated, divorced, commonlawspouse, cohabiting;             
        if (single.isSelected()) {
            run7.setText("     Single");
        }
        if (engaged.isSelected()) {
            run7.setText("     Engaged");
        }
        if (married.isSelected()) {
            run7.setText("     Married");
        }
        if (seperated.isSelected()) {
            run7.setText("     Seperated");
        }
        if (divorced.isSelected()) {
            run7.setText("     Divorced");
        }
        if (commonlawspouse.isSelected()) {
            run7.setText("     Common Law Spouse");
        }
        if (cohabiting.isSelected()) {
            run7.setText("     Cohabiting");
        }
        run7.addBreak();
        run7.setText("Ethnicity: ");
        //africanamerican, nativeamerican, hispanic, asian, caucasian, ethnicityother, ocd, bipolardisorder, socialphobia, panicdisorder, eatingdisorder, majordepressivedisorder, psychosis;
        if (africanamerican.isSelected()) {
            run7.setText("     African American");
        }
        if (nativeamerican.isSelected()) {
            run7.setText("      Native American");
        }
        if (hispanic.isSelected()) {
            run7.setText("     Hispanic");
        }
        if (asian.isSelected()) {
            run7.setText("     Asian");
        }
        if (caucasian.isSelected()) {
            run7.setText("     Caucasian");
        }
        if (ethnicityother.isSelected()) {
            run7.setText("     " + ethnicityothertext.getText());
        }

        run7.addBreak();
        run7.setText("Sex: ");
        if (male.isSelected()) {
            run7.setText("     Male");
        }
        if (female.isSelected()) {
            run7.setText("      Female");
        }

        run7.addBreak();
        run7.setText("Referred By: ");
        //insurance, internet, pcp, cps, therapist, referredbyother
        if (insurance.isSelected()) {
            run7.setText("     Insurance");
        }
        if (internet.isSelected()) {
            run7.setText("     Internet");
        }
        if (pcp.isSelected()) {
            run7.setText("     PCP");
        }
        if (cps.isSelected()) {
            run7.setText("     CPS");
        }
        if (therapist.isSelected()) {
            run7.setText("     therapist- " + referredbytherapisttext.getText());
        }
        if (referredbyother.isSelected()) {
            run7.setText("     " + referredbyothertext.getText());
        }

        run7.addBreak();
        run7.setText("Reason for Referral: ");
        if (reasonforreferralpsychiatricevaluation.isSelected()) {
            run7.setText("     Psychiatric Evaluation");
        }
        if (reasonforreferralmedicationmanagement.isSelected()) {
            run7.setText("      Medication Management");
        }

        run7.addBreak();
        run7.setText("Source of Information: ");
        //insurance, internet, pcp, cps, therapist, referredbyother
        if (patient.isSelected()) {
            run7.setText("     Patient");
        }
        if (spouse.isSelected()) {
            run7.setText("     Spouse");
        }
        if (mother.isSelected()) {
            run7.setText("     Mother");
        }
        if (father.isSelected()) {
            run7.setText("     Father");
        }
        if (othersourceofinformation.isSelected()) {
            run7.setText("     " + othersourceofinformationbox.getText());
        }

        run7.addBreak();
        run7.setText("Reliability of Information: ");
        //insurance, internet, pcp, cps, therapist, referredbyother
        if (good.isSelected()) {
            run7.setText("     Good");
        }
        if (fair.isSelected()) {
            run7.setText("     Fair");
        }
        if (vague.isSelected()) {
            run7.setText("     Vague");
        }
        if (minimizing.isSelected()) {
            run7.setText("     Minimizing");
        }
        if (otherreliabilityofinformation.isSelected()) {
            run7.setText("     " + otherreliabilityofinformationbox.getText());
        }

        run7.setText(" (Options: good, fair, vague, minimizing, other)");
        run7.addBreak();
        run7.addBreak();
        run8.setBold(true);
        run8.setUnderline(UnderlinePatterns.SINGLE);
        run8.setText("History of Present Illness");
        run8.addBreak();
        run9.setBold(false);
        run9.setText(historyofpresentillness.getText());
        run9.addBreak();
        run9.addBreak();
        run10.setBold(true);
        run10.setText("Patient denied signs or symptoms of: ");
        run11.setBold(false);

        //ocd, bipolardisorder, socialphobia, panicdisorder, eatingdisorder, majordepressivedisorder, psychosis

        if (ocd.isSelected() == true) {
            run11.setText("     OCD");
        }
        if (bipolardisorder.isSelected() == true) {
            run11.setText("     Bipolar Disorder");
        }
        if (socialphobia.isSelected() == true) {
            run11.setText("     Social Phobia");
        }
        if (panicdisorder.isSelected() == true) {
            run11.setText("     Panic Disorder");
        }
        if (eatingdisorder.isSelected() == true) {
            run11.setText("     Eating Disorder");
        }
        if (majordepressivedisorder.isSelected() == true) {
            run11.setText("     Major Depressive Disorder");
        }
        if (psychosis.isSelected() == true) {
            run11.setText("     Psychosis");
        }
        run11.addBreak();
        run11.addBreak();

        run12.setUnderline(UnderlinePatterns.SINGLE);
        run12.setBold(true);
        run12.setText("Current Medications (including over-the-counter medications and vitamins)");
        run12.addBreak();
        run13.setBold(false);
        run13.setText(currentmedications.getText());

        run13.addBreak();
        run13.addBreak();

        run14.setUnderline(UnderlinePatterns.SINGLE);
        run14.setBold(true);
        run14.setText("Past Psychiatric History");
        run14.addBreak();
        run15.setBold(false);
        run15.setText(pastpsychiatrichistory.getText());
        run15.addBreak();
        run15.addBreak();

        run16.setBold(true);
        run16.setText("Past History Of");
        run16.addBreak();

        run17.setBold(false);
        run17.setText("Suicide Attempts: ");

        //past history of
        if (sano.isSelected() == true) {
            run17.setText("No");
        } else if (sayes.isSelected() == true) {
            run17.setText("Yes");
        }
        run17.addBreak();
        if (physicalabuseno.isSelected() == true) {
            run17.setText("Physical Abuse: No");
        } else if (physicalabuseyes.isSelected() == true) {
            run17.setText("Physical Abuse: Yes");
        }
        run17.addBreak();
        if (sexualabuseno.isSelected() == true) {
            run17.setText("Sexual Abuse: No");
        } else if (sexualabuseyes.isSelected() == true) {
            run17.setText("Sexual Abuse: Yes");
        }
        run17.addBreak();
        if (violentaggressivebehaviorsno.isSelected() == true) {
            run17.setText("Violent/Aggressive Behaviors: No");
        } else if (violentaggressivebehaviorsyes.isSelected() == true) {
            run17.setText("Violent/Aggressive Behaviors: Yes");
        }
        run17.addBreak();
        if (selfinjuriousbehaviorsno.isSelected() == true) {
            run17.setText("Self-Injurious Behaviors: No");
        } else if (selfinjuriousbehaviorsyes.isSelected() == true) {
            run17.setText("Self-Injurious Behaviors: Yes");
        }
        run17.addBreak();
        run17.setText(pasthistoryoftext.getText());
        run17.addBreak();
        run17.addBreak();

        run18.setUnderline(UnderlinePatterns.SINGLE);
        run18.setBold(true);
        run18.setText("History of Medication Trials in the Past");
        run18.addBreak();
        anEdit1.setBold(true);
        anEdit1.setText(
                "Medication                                   Dosage                                 Duration");
        anEdit1.addBreak();

        run19.setBold(false);

        String fulltext = historyofmedicationtrialsinthepasttable.getText();
        String[] lines = fulltext.split("\n");

        for (int i = 0; i < lines.length; i++) {
            String[] modifyThis = lines[i].split("    ");
            for (int j = 0; j < modifyThis.length; j++) {
                run19.setText(modifyThis[j].trim() + "                ");
            }

            //run19.setText(lines[i]);

            run19.addBreak();
        }

        //run19.setText(lines[0]);
        run19.addBreak();
        run19.addBreak();
        run19.setText("Comments: " + historyofmedicationtrialsinthepastcomments.getText());
        run19.addBreak();
        run19.addBreak();

        run20.setBold(true);
        run20.setText("Substance Use History:");
        run20.addBreak();

        run21.setBold(false);
        run21.setText(substanceusehistory.getText());
        run21.addBreak();
        //run21.setText("Denies history of: ");

        String denies = "";

        if (significantwithdrawals.isSelected() == true) {
            denies = denies + "Significant Withdrawals, ";
        }
        if (dts.isSelected() == true) {
            denies = denies + "DTS, ";
        }
        if (withdrawalseizures.isSelected() == true) {
            denies = denies + "Withdrawal Seizures, ";
        }
        if (historyofdetox.isSelected() == true) {
            denies = denies + "History Of Detox, ";
        }
        if (outpatient.isSelected() == true) {
            denies = denies + "Outpatient, ";
        }
        if (inpatient.isSelected() == true) {
            denies = denies + "Inpatient, ";
        }
        if (na.isSelected() == true) {
            denies = denies + "NA, ";
        }
        if (aa.isSelected() == true) {
            denies = denies + "AA, ";
        }
        if (substancetreatmentprogram.isSelected() == true) {
            denies = denies + "Substance Treatment Program, ";
        }

        if (denies.length() > 2) {
            denies = denies.substring(0, denies.length() - 2);
            denies = denies.trim();
        }

        //Fandom Follower- anonomously discuss your fandom
        //select/create/add a new fandom group to the list/search
        //browse fanart, view fandom updates, add materials to your local board
        run21.setText("Denies History Of: " + denies);
        run21.addBreak();
        run21.addBreak();

        run22.setUnderline(UnderlinePatterns.SINGLE);
        run22.setBold(true);
        run22.setText("Social History: ");
        run22.addBreak();
        //y the fm, m homu cov e's, ah chained, ank snk
        //
        //ASP.NET in visual studio, eclipse, netbeans

        //dk y lol
        run23.setBold(false);
        run23.setText(socialhistorygeneral.getText());
        run23.addBreak();
        run23.addBreak();
        run23.setText("Parents: " + parents.getText());
        run23.addBreak();
        run23.setText("Siblings: " + siblings.getText());
        run23.addBreak();
        run23.setText("Children: " + children.getText());
        run23.addBreak();

        String faHist;
        if (fhomiNO.isSelected() == true) {
            faHist = "No";
        } else {
            faHist = "Yes";
        }

        run23.setText("Family History of Mental Illness? " + faHist);
        run23.addBreak();
        run23.setText(familyhistoryofmentalillness.getText());
        run23.addBreak();
        run23.addBreak();
        run23.setText(education.getText());
        run23.addBreak();

        String e = "";
        if (emp.isSelected() == true) {
            e = e + "Employed, ";
        }
        if (unemp.isSelected() == true) {
            e = e + "Unemployed, ";
        }
        if (disabilityincome.isSelected() == true) {
            e = e + "Disability Income, ";
        }

        if (e.length() > 2) {
            e = e.substring(0, e.length() - 2);
            e = e.trim();
        }

        run23.setText("Employment: " + e);
        run23.addBreak();

        run23.setText(legalhistory.getText());
        run23.addBreak();
        run23.addBreak();

        run24.setUnderline(UnderlinePatterns.SINGLE);
        run24.setBold(true);
        run24.setText("Past Medical History");
        run24.addBreak();
        run25.setBold(false);
        run25.setText(pastmedicalhistory.getText());
        run25.addBreak();
        run26.setBold(true);
        run26.setText("Allergies: ");
        String allergies = " ";

        if (nkda.isSelected() == true) {
            allergies = allergies + "nkda, ";
        }
        if (environmental.isSelected() == true) {
            allergies = allergies + "environmental, ";
        }

        if (allergies.length() > 2) {
            allergies = allergies.substring(0, allergies.length() - 2);
            allergies = allergies.trim();
        }

        run27.setBold(false);
        run27.setText(allergies);
        run27.addBreak();
        run27.setText(allergiesdescriptionbox.getText());
        run27.addBreak();
        run27.addBreak();

        run28.setUnderline(UnderlinePatterns.SINGLE);
        run28.setBold(true);
        run28.setText("Mental Status Examination:");
        run29.addBreak();
        run30.setBold(false);

        String appearance = " ";

        if (wellgroomed.isSelected() == true) {
            appearance = appearance + "Well Groomed, ";
        }
        if (casual.isSelected() == true) {
            appearance = appearance + "Casual, ";
        }
        if (disheveled.isSelected() == true) {
            appearance = appearance + "Disheveled, ";
        }
        if (bizarre.isSelected() == true) {
            appearance = appearance + "Bizarre, ";
        }
        if (inappropriate.isSelected() == true) {
            appearance = appearance + "Inappropriate,";
        }
        if (appearanceother.isSelected() == true) {
            appearance = appearance + "Other: ";
        }

        if (appearance.length() > 2) {
            appearance = appearance.substring(0, appearance.length() - 2);
            appearance = appearance.trim();
        }

        run30.setText("Appearance: " + appearance);
        if (appearanceother.isSelected()) {
            run30.setText(" - " + appearanceotherbox.getText());
        }

        run30.addBreak();

        String eC = "blah";

        if (eyecontactgood.isSelected() == true) {
            eC = "Good";
        }
        if (eyecontactpoor.isSelected() == true) {
            eC = "Poor";
        }
        if (eyecontactvariable.isSelected() == true) {
            eC = "Variable";
        }

        run30.setText("Eye Contact: " + eC);
        run30.addBreak();

        String attitude = " ";

        if (cooperative.isSelected() == true) {
            attitude = attitude + "Cooperative, ";
        }
        if (guarded.isSelected() == true) {
            attitude = attitude + "Guarded, ";
        }
        if (suspicious.isSelected() == true) {
            attitude = attitude + "Suspicious, ";
        }
        if (withdrawn.isSelected() == true) {
            attitude = attitude + "Withdrawn, ";
        }
        if (uncooperative.isSelected() == true) {
            attitude = attitude + "Uncooperative, ";
        }
        if (hostile.isSelected() == true) {
            attitude = attitude + "Hostile, ";
        }
        if (defensive.isSelected() == true) {
            attitude = attitude + "Defensive, ";
        }
        if (attitudeother.isSelected() == true) {
            attitude = attitude + "Other: ";
        }

        if (attitude.length() > 2) {
            attitude = attitude.substring(0, attitude.length() - 2);
            attitude = attitude.trim();
        }

        run30.setText("Attitude: " + attitude);
        if (attitudeother.isSelected()) {
            run30.setText(" - " + attitudeotherbox.getText());
        }
        run30.addBreak();

        String motoractivity = " ";

        if (normal.isSelected() == true) {
            motoractivity = motoractivity + "Normal, ";
        }
        if (agitated.isSelected() == true) {
            motoractivity = motoractivity + "Agitated, ";
        }
        if (motorretardation.isSelected() == true) {
            motoractivity = motoractivity + "Motor Retardation, ";
        }
        if (hyperactive.isSelected() == true) {
            motoractivity = motoractivity + "Hyperactive, ";
        }
        if (catatonia.isSelected() == true) {
            motoractivity = motoractivity + "Catatonia, ";
        }
        if (tremorstics.isSelected() == true) {
            motoractivity = motoractivity + "Tremors/Tics, ";
        }
        if (motoractivityother.isSelected() == true) {
            motoractivity = motoractivity + "Other: ";
        }

        if (motoractivity.length() > 2) {
            motoractivity = motoractivity.substring(0, motoractivity.length() - 2);
            motoractivity = motoractivity.trim();
        }

        run30.setText("Motor Activity: " + motoractivity);
        if (motoractivityother.isSelected()) {
            run30.setText(" - " + motoractivityotherbox.getText());
        }

        run30.addBreak();

        String affect = " ";

        if (appropriate.isSelected() == true) {
            affect = affect + "Appropriate, ";
        }
        if (labile.isSelected() == true) {
            affect = affect + "Labile, ";
        }
        if (expansive.isSelected() == true) {
            affect = affect + "Expansive, ";
        }
        if (constricted.isSelected() == true) {
            affect = affect + "Constricted, ";
        }
        if (affecthappy.isSelected() == true) {
            affect = affect + "Happy, ";
        }
        if (affectsad.isSelected() == true) {
            affect = affect + "Sad, ";
        }
        if (blunted.isSelected() == true) {
            affect = affect + "Blunted, ";
        }
        if (flat.isSelected() == true) {
            affect = affect + "Flat, ";
        }
        if (masking.isSelected() == true) {
            affect = affect + "Masking, ";
        }
        if (affectnormalrange.isSelected() == true) {
            affect = affect + "Normal Range, ";
        }

        if (affect.length() > 2) {
            affect = affect.substring(0, affect.length() - 2);
            affect = affect.trim();
        }

        run30.setText("Affect: " + affect);
        run30.addBreak();

        String mood = " ";

        if (euthymic.isSelected() == true) {
            mood = mood + "Euthymic, ";
        }
        if (depressed.isSelected() == true) {
            mood = mood + "Depressed, ";
        }
        if (dysphoric.isSelected() == true) {
            mood = mood + "Dysphoric, ";
        }
        if (anxious.isSelected() == true) {
            mood = mood + "Anxious, ";
        }
        if (euphoric.isSelected() == true) {
            mood = mood + "Euphoric, ";
        }
        if (angry.isSelected() == true) {
            mood = mood + "Angry, ";
        }
        if (irritable.isSelected() == true) {
            mood = mood + "Irritable, ";
        }
        if (moodsad.isSelected() == true) {
            mood = mood + "Sad, ";
        }

        if (mood.length() > 2) {
            mood = mood.substring(0, mood.length() - 2);
            mood = mood.trim();
        }

        run30.setText("Mood: " + mood);
        run30.addBreak();

        String speech = " ";

        if (normal2.isSelected() == true) {
            speech = speech + "Normal, ";
        }
        if (delayed.isSelected() == true) {
            speech = speech + "Delayed, ";
        }
        if (soft.isSelected() == true) {
            speech = speech + "Soft, ";
        }
        if (loud.isSelected() == true) {
            speech = speech + "Loud, ";
        }
        if (slurred.isSelected() == true) {
            speech = speech + "Slurred, ";
        }
        if (excessive.isSelected() == true) {
            speech = speech + "Excessive, ";
        }
        if (pressured.isSelected() == true) {
            speech = speech + "Pressured, ";
        }
        if (perseverating.isSelected() == true) {
            speech = speech + "Perseverating, ";
        }
        if (rapid.isSelected() == true) {
            speech = speech + "Rapid, ";
        }
        if (rambling.isSelected() == true) {
            speech = speech + "Rambling, ";
        }
        if (incoherent.isSelected() == true) {
            speech = speech + "Incoherent, ";
        }
        if (disorganized.isSelected() == true) {
            speech = speech + "Disorganized, ";
        }
        if (decreasedproductivity.isSelected() == true) {
            speech = speech + "Decreased Productivity, ";
        }

        if (speech.length() > 2) {
            speech = speech.substring(0, speech.length() - 2);
            speech = speech.trim();
        }

        run30.setText("Speech: " + speech);
        run30.addBreak();

        String per = " ";

        if (visualhallucinations.isSelected() == true) {
            per = per + "Visual Hallucinations, ";
        }
        if (auditoryhallucinations.isSelected() == true) {
            per = per + "Auditory Hallucinations, ";
        }
        if (depersonalization.isSelected() == true) {
            per = per + "Depersonalization, ";
        }
        if (derealization.isSelected() == true) {
            per = per + "Derealization, ";
        }
        if (commandah.isSelected() == true) {
            per = per + "Command AH, ";
        }
        if (delusions2.isSelected() == true) {
            per = per + "Delusions, ";
        }
        if (illusions.isSelected() == true) {
            per = per + "Illusions, ";
        }
        if (perceptionnoimpairment.isSelected() == true) {
            per = per + "No Impairment, ";
        }

        if (per.length() > 2) {
            per = per.substring(0, per.length() - 2);
            per = per.trim();
        }

        run30.setText("Perception: " + per);
        run30.addBreak();

        String thoughtProcess = " ";

        if (intact.isSelected() == true) {
            thoughtProcess = thoughtProcess + "Intact, ";
        }
        if (circumstantial.isSelected() == true) {
            thoughtProcess = thoughtProcess + "Circumstantial, ";
        }
        if (loa.isSelected() == true) {
            thoughtProcess = thoughtProcess + "LOA, ";
        }
        if (tangential.isSelected() == true) {
            thoughtProcess = thoughtProcess + "Tangential, ";
        }
        if (foi.isSelected() == true) {
            thoughtProcess = thoughtProcess + "FOI, ";
        }
        if (logicalgoaldirected.isSelected() == true) {
            thoughtProcess = thoughtProcess + "Logical Goal Directed, ";
        }
        if (thoughtblocking.isSelected() == true) {
            thoughtProcess = thoughtProcess + "Thought Blocking, ";
        }
        if (ruminating.isSelected() == true) {
            thoughtProcess = thoughtProcess + "Ruminating, ";
        }
        if (racingthoughts.isSelected() == true) {
            thoughtProcess = thoughtProcess + "Racing Thoughts, ";
        }
        if (thoughtinsertionwithdrawalbroadcast.isSelected() == true) {
            thoughtProcess = thoughtProcess + "Thought Insertion/Withdrawal/Broadcast, ";
        }

        if (thoughtProcess.length() > 2) {
            thoughtProcess = thoughtProcess.substring(0, thoughtProcess.length() - 2);
            thoughtProcess = thoughtProcess.trim();
        }

        run30.setText("Thought Process: " + thoughtProcess);
        run30.addBreak();

        String thoughtContent = "";
        //hummus/tahini, "steak", p seeds/walnuts, k p + sm papr; curry, hazelnut meal + a fig + 1tsp pb + 1tsp white flour + a few drops of maple syrup
        //get some (pepper) A1!!!
        //bbq sauce
        if (logicalcoherent.isSelected() == true) {
            thoughtContent = thoughtContent + "Logical Coherent, ";
        }
        if (povertyofcontent.isSelected() == true) {
            thoughtContent = thoughtContent + "Poverty Of Content, ";
        }
        if (ideasofreference.isSelected() == true) {
            thoughtContent = thoughtContent + "Ideas Of Reference, ";
        }
        if (obsessions.isSelected() == true) {
            thoughtContent = thoughtContent + "Obsessions, ";
        }
        if (phobias.isSelected() == true) {
            thoughtContent = thoughtContent + "Phobias, ";
        }
        if (paranoidideation.isSelected() == true) {
            thoughtContent = thoughtContent + "Paranoid Ideation, ";
        }
        if (delusions.isSelected() == true) {
            thoughtContent = thoughtContent + "Delusions, ";
        }

        if (thoughtContent.length() > 2) {
            thoughtContent = thoughtContent.substring(0, thoughtContent.length() - 2);
            thoughtContent = thoughtContent.trim();
        }

        run30.setText("Thought Content: " + thoughtContent);
        if (delusions.isSelected()) {
            run30.setText(" - " + delusionsbox.getText());
        }
        run30.addBreak();

        String suicidality = " ";

        if (suicidalitydenied.isSelected() == true) {
            suicidality = suicidality + "Suicidality Denied, ";
        }
        if (suicidalityideation.isSelected() == true) {
            suicidality = suicidality + "Suicidality Ideation, ";
        }
        if (suicidalityintent.isSelected() == true) {
            suicidality = suicidality + "Suicidality Intent, ";
        }
        if (suicidalityplan.isSelected() == true) {
            suicidality = suicidality + "Suicidality Plan: ";
        }

        if (suicidality.length() > 2) {
            suicidality = suicidality.substring(0, suicidality.length() - 2);
            suicidality = suicidality.trim();
        }

        run30.setText("Suicidality: " + suicidality);
        if (suicidalityplan.isSelected()) {
            run30.setText(" - " + suicidalityplanbox.getText());
        }
        run30.addBreak();

        String homicidality = " ";

        if (homicidalitydenied.isSelected() == true) {
            homicidality = homicidality + "Homicidality Denied, ";
        }
        if (homicidalityideation.isSelected() == true) {
            homicidality = homicidality + "Homicidality Ideation, ";
        }
        if (homicidalityintent.isSelected() == true) {
            homicidality = homicidality + "Homicidality Intent, ";
        }
        if (homicidalityplan.isSelected() == true) {
            homicidality = homicidality + "Homicidality Plan: ";
        }

        if (homicidality.length() > 2) {
            homicidality = homicidality.substring(0, homicidality.length() - 2);
            homicidality = homicidality.trim();
        }

        run30.setText("Homicidality: " + homicidality);
        if (homicidalityplan.isSelected()) {
            run30.setText(" - " + homicidalityplanbox.getText());
        }
        run30.addBreak();
        if (suicidalityhomicidalitycomments.getText().length() >= 2) {
            run30.setText(" \t Comments - " + suicidalityhomicidalitycomments.getText());
        }
        run30.addBreak();

        String orientation = " ";

        if (fullyoriented.isSelected() == true) {
            orientation = orientation + "Fully Oriented, ";
        }
        if (disoriented.isSelected() == true) {
            orientation = orientation + "Disoriented: ";
        }
        if (person.isSelected() == true) {
            orientation = orientation + "Person, ";
        }
        if (place.isSelected() == true) {
            orientation = orientation + "Place, ";
        }
        if (time.isSelected() == true) {
            orientation = orientation + "Time, ";
        }

        if (orientation.length() > 2) {
            orientation = orientation.substring(0, orientation.length() - 2);
            orientation = orientation.trim();
        }

        run30.setText("Orientation: " + orientation);
        run30.addBreak();

        String stm = " ";

        //shorttermmemorywithinnormallimits, shorttermmermorydeficits, longtermmemorywithinnormallimits,longtermmemorydeficits, shorttermmemorydeficitsbox, longtermmemorydeficitsbox
        if (shorttermmemorywithinnormallimits.isSelected() == true) {
            stm = stm + "Within Normal Limits, ";
        }
        if (shorttermmemorydeficits.isSelected() == true) {
            stm = stm + "Deficits, ";
        }

        if (stm.length() > 2) {
            stm = stm.substring(0, stm.length() - 2);
            stm = stm.trim();
        }

        run30.setText("Short Term Memory: " + stm);
        if (shorttermmemorydeficits.isSelected() == true) {
            run30.setText(" - " + shorttermmemorydeficitsbox.getText());
        }
        run30.addBreak();

        String ltm = " ";

        if (longtermmemorywithinnormallimits.isSelected() == true) {
            ltm = ltm + "Within Normal Limits, ";
        }
        if (longtermmemorydeficits.isSelected() == true) {
            ltm = ltm + "Deficits, ";
        }

        if (ltm.length() > 2) {
            ltm = ltm.substring(0, ltm.length() - 2);
            ltm = ltm.trim();
        }

        run30.setText("Long Term Memory: " + ltm);
        if (longtermmemorydeficits.isSelected() == true) {
            run30.setText(" - " + longtermmemorydeficitsbox.getText());
        }
        run30.addBreak();

        String gfok = " ";

        if (generalfundofknowledgewithinnormallimits.isSelected() == true) {
            gfok = gfok + "Within Normal Limits, ";
        }
        if (generalfundofknowledgedeficits.isSelected() == true) {
            gfok = gfok + "Deficits, ";
        }

        if (gfok.length() > 2) {
            gfok = gfok.substring(0, gfok.length() - 2);
            gfok = gfok.trim();
        }

        run30.setText("General Fund of Knowledge: " + gfok);
        if (generalfundofknowledgedeficits.isSelected() == true) {
            run30.setText(" - " + generalfundofknowledgedeficitsbox.getText());
        }
        run30.addBreak();

        String intellect = " ";

        if (intellectaboveaverage.isSelected() == true) {
            intellect = intellect + "Above Average, ";
        }
        if (intellectaverage.isSelected() == true) {
            intellect = intellect + "Average, ";
        }
        if (intellectbelowaverage.isSelected() == true) {
            intellect = intellect + "Below Average, ";
        }

        if (intellect.length() > 2) {
            intellect = intellect.substring(0, intellect.length() - 2);
            intellect = intellect.trim();
        }

        run30.setText("Intellect: " + intellect);
        if (intellectbelowaverage.isSelected() == true) {
            run30.setText(" - " + intellectbelowaveragebox.getText());
        }
        run30.addBreak();

        String abstraction = " ";

        if (abstractionintact.isSelected() == true) {
            abstraction = abstraction + "Intact, ";
        }
        if (abstractionconcrete.isSelected() == true) {
            abstraction = abstraction + "Concrete, ";
        }
        if (abstractionidiosyncratic.isSelected() == true) {
            abstraction = abstraction + "Idiosyncratic, ";
        }

        if (abstraction.length() > 2) {
            abstraction = abstraction.substring(0, abstraction.length() - 2);
            abstraction = abstraction.trim();
        }

        run30.setText("Abstraction: " + abstraction);
        run30.addBreak();

        String judgement = " ";

        if (judgementintact.isSelected() == true) {
            judgement = judgement + "Intact, ";
        }
        if (judgementimpaired.isSelected() == true) {
            judgement = judgement + "Impaired -  ";
        }
        if (judgementminimal.isSelected() == true) {
            judgement = judgement + "Minimal, ";
        }
        if (judgementmoderate.isSelected() == true) {
            judgement = judgement + "Moderate, ";
        }
        if (judgementsevere.isSelected() == true) {
            judgement = judgement + "Severe, ";
        }

        if (judgement.length() > 2) {
            judgement = judgement.substring(0, judgement.length() - 2);
            judgement = judgement.trim();
        }

        run30.setText("Judgement: " + judgement);
        run30.addBreak();

        String insight = " ";

        if (insightintact.isSelected() == true) {
            insight = insight + "Intact, ";
        }
        if (insightimpaired.isSelected() == true) {
            insight = insight + "Impaired -  ";
        }
        if (insightminimal.isSelected() == true) {
            insight = insight + "Minimal, ";
        }
        if (insightmoderate.isSelected() == true) {
            insight = insight + "Moderate, ";
        }
        if (insightsevere.isSelected() == true) {
            insight = insight + "Severe, ";
        }

        if (insight.length() > 2) {
            insight = insight.substring(0, insight.length() - 2);
            insight = insight.trim();
        }

        run30.setText("Insight: " + insight);
        run30.addBreak();
        run30.addBreak();

        run31.setUnderline(UnderlinePatterns.SINGLE);
        run31.setBold(true);
        run31.setText("Clinical Notes pertaining to MSE");
        run31.addBreak();
        run32.setBold(false);
        run32.setText(clinicalnotes.getText());
        run32.addBreak();
        run32.addBreak();

        run33.setBold(true);
        run33.setText("Diagnosis: ");
        run33.addBreak();

        run34.setBold(false);
        run34.setText("Axis I: " + axis1.getText());
        run34.addBreak();
        run34.setText("Axis II: " + axis2.getText());
        run34.addBreak();
        run34.setText("Axis III: " + axis3.getText());
        run34.addBreak();
        run34.setText("Axis IV: " + axis4.getText());
        run34.addBreak();

        String a4cb = " ";

        if (a4none.isSelected() == true) {
            a4cb = a4cb + "None, ";
        }
        if (a4primarysupportgroup.isSelected() == true) {
            a4cb = a4cb + "Primary Support Group, ";
        }
        if (a4partnerrelationalproblems.isSelected() == true) {
            a4cb = a4cb + "Partner Relational Problems, ";
        }
        if (a4parentchildrelationalproblems.isSelected() == true) {
            a4cb = a4cb + "Parent Child Relational Problems, ";
        }
        if (a4socialenvironment.isSelected() == true) {
            a4cb = a4cb + "Social Environment, ";
        }
        //a4occupation, a4economics, a4legalsystem, a4education, a4housing, 
        //a4noncompliancewithtreatment, a4other, axis5none;
        if (a4occupation.isSelected() == true) {
            a4cb = a4cb + "Occupation, ";
        }
        if (a4economics.isSelected() == true) {
            a4cb = a4cb + "Economics, ";
        }
        if (a4legalsystem.isSelected() == true) {
            a4cb = a4cb + "Legal System, ";
        }
        if (a4education.isSelected() == true) {
            a4cb = a4cb + "Education, ";
        }
        if (a4housing.isSelected() == true) {
            a4cb = a4cb + "Housing, ";
        }
        if (a4noncompliancewithtreatment.isSelected() == true) {
            a4cb = a4cb + "Noncompliance With Treatment, ";
        }
        if (a4other.isSelected() == true) {
            a4cb = a4cb + "Other, ";
        }

        if (a4cb.length() > 2) {
            a4cb = a4cb.substring(0, a4cb.length() - 2);
            a4cb = a4cb.trim();
        }

        run34.setText(a4cb);
        if (a4other.isSelected() == true) {
            run34.setText(" - " + axis4otherbox.getText());
        }
        run34.addBreak();

        run34.setText("Axis V: GAF " + "Current: " + axis5current.getText() + "  Highest in Past Year: "
                + axis5highestinpastyear.getText());
        if (axis5none.isSelected() == true) {
            run34.setText("   None");
        }
        run34.addBreak();
        run34.addBreak();

        run35.setUnderline(UnderlinePatterns.SINGLE);
        run35.setBold(true);
        run35.setText("Reccommendations and Plans");
        run35.addBreak();

        run36.setBold(false);
        run36.setText("Diagnosis and treatment options discussed with the patient? - ");
        if (treatmentplancheckbox1.isSelected() == true) {
            run36.setText("Yes");
        } else {
            run36.setText("No");
        }
        run36.addBreak();

        run36.addBreak();

        //run36.setText("Treatment Plan: " + treatmentplanbox1.getText());

        run36.setText("Treatment Plan: ");

        String[] tpLines = treatmentplanbox1.getText().split("\n");

        for (int i = 0; i < tpLines.length; i++) {
            run36.setText(tpLines[i]);
            run36.addBreak();
        }

        run36.addBreak();
        run36.addBreak();

        run36.setText(
                "Discussed that any overuse or abuse of prescription Benzodiazepines could result in patient being discharged from the practice. - ");
        if (treatmentplancheckbox2.isSelected() == true) {
            run36.setText("Yes");
        } else {
            run36.setText("No");
        }
        run36.addBreak();

        run36.setText("Nevada Prescription Monitoring Board Reviewed? - ");
        if (treatmentplancheckbox3.isSelected() == true) {
            run36.setText("Yes");
        } else {
            run36.setText("No");
        }
        run36.addBreak();
        run36.setText(treatmentplantextfield.getText());
        run36.addBreak();
        run36.addBreak();

        run37.setUnderline(UnderlinePatterns.SINGLE);
        run37.setItalic(true);
        run37.setText("Medication Prescribed");
        run37.addBreak();

        run38.setBold(false);
        run38.setText(treatmentplanbox2.getText());
        run38.addBreak();
        run38.addBreak();

        run39.setUnderline(UnderlinePatterns.SINGLE);
        run39.setBold(true);
        run39.setText("Side Effects Discussed: ");
        run39.addBreak();

        run40.setBold(false);

        String se = " ";

        if (riskforreboundhypertension.isSelected() == true) {
            se = se + "Risk For Rebound Hypertension, ";
        }
        if (complexsleeprelatedbehavior.isSelected() == true) {
            se = se + "Complex Sleep Related Behavior, ";
        }
        if (ssoftoxicity.isSelected() == true) {
            se = se + "S/S of Toxicity, ";
        }
        if (withdrawalsyndrome.isSelected() == true) {
            se = se + "Withdrawal Syndrome, ";
        }
        if (riskforaddiction.isSelected() == true) {
            se = se + "Risk for Addiction, ";
        }
        if (seizures.isSelected() == true) {
            se = se + "Seizures, ";
        }
        if (prolongedqtc.isSelected() == true) {
            se = se + "Prolonged QTC, ";
        }
        if (tardivedyskinesiadystonia.isSelected() == true) {
            se = se + "Tardive Dyskinesia/Dystonia, ";
        }
        if (acuteneurologicalse.isSelected() == true) {
            se = se + "Acute Neurological SE, ";
        }
        if (metabolicsyndrome.isSelected() == true) {
            se = se + "Metabolic Syndrome, ";
        }

        //decreasedeffectivenessofobc, teratogenicity, hyponatremia, hypothyroidism, rashsjsyndrome, 
        //weightgainloss, constipation, drymouth, increasedriskofsi, hyperprolactinemia, serotoninsyndrome, 
        //hairloss, hypotension, htn, dizziness, insomnia, sedation, sexual, gi;
        if (decreasedeffectivenessofobc.isSelected() == true) {
            se = se + "Decreased Effectiveness of OBC, ";
        }
        if (teratogenicity.isSelected() == true) {
            se = se + "Teratogenicity- ";
            se = se + sebox2.getText() + ", ";
        }
        if (hyponatremia.isSelected() == true) {
            se = se + "Hyponatremia, ";
        }
        if (hypothyroidism.isSelected() == true) {
            se = se + "Hypothyroidism, ";
        }
        if (rashsjsyndrome.isSelected() == true) {
            se = se + "Rash - SJ Syndrome- ";
            se = se + sebox1.getText() + ", ";
        }
        if (weightgainloss.isSelected() == true) {
            se = se + "Weight Gain/Loss, ";
        }
        if (constipation.isSelected() == true) {
            se = se + "Constipation, ";
        }
        if (drymouth.isSelected() == true) {
            se = se + "Dry Mouth, ";
        }
        if (increasedriskofsi.isSelected() == true) {
            se = se + "Increased Risk of SI, ";
        }
        if (hyperprolactinemia.isSelected() == true) {
            se = se + "Hyperprolactinemia, ";
        }
        if (serotoninsyndrome.isSelected() == true) {
            se = se + "Serotonin Syndrome, ";
        }
        if (hairloss.isSelected() == true) {
            se = se + "Hair Loss, ";
        }
        if (hypotension.isSelected() == true) {
            se = se + "Hypotension, ";
        }
        if (htn.isSelected() == true) {
            se = se + "HTN, ";
        }
        if (dizziness.isSelected() == true) {
            se = se + "Dizziness, ";
        }
        if (insomnia.isSelected() == true) {
            se = se + "Insomnia, ";
        }
        if (sedation.isSelected() == true) {
            se = se + "Sedation, ";
        }
        if (sexual.isSelected() == true) {
            se = se + "Sexual, ";
        }
        if (gi.isSelected() == true) {
            se = se + "GI, ";
        }

        if (se.length() > 2) {
            se = se.substring(0, se.length() - 2);
            se = se.trim();
        }

        run40.setText(se);
        run40.addBreak();
        run40.addBreak();

        run41.setUnderline(UnderlinePatterns.SINGLE);
        run41.setBold(true);
        run41.setText("Labs:");
        run41.addBreak();

        run42.setBold(false);

        String labs = " ";

        if (vitd.isSelected() == true) {
            labs = labs + "Vit D, ";
        }

        if (hivscreen.isSelected() == true) {
            labs = labs + "HIV Screen, ";
        }
        if (vitaminb12folicacid.isSelected() == true) {
            labs = labs + "Vitamin B12/Folic Acid, ";
        }

        if (ua.isSelected() == true) {
            labs = labs + "UA, ";
        }

        if (uds.isSelected() == true) {
            labs = labs + "UDS, ";
        }

        if (selectrolyte.isSelected() == true) {
            labs = labs + "S Electrolyte, ";
        }

        if (lithium.isSelected() == true) {
            labs = labs + "Lithium, ";
        }

        if (lamictallevel.isSelected() == true) {
            labs = labs + "Lamictal Level, ";
        }

        if (trileptallevel.isSelected() == true) {
            labs = labs + "Trileptal Level, ";
        }

        if (depakotelevel.isSelected() == true) {
            labs = labs + "Depakote Level, ";
        }

        if (bmp.isSelected() == true) {
            labs = labs + "BMP, ";
        }

        if (tft.isSelected() == true) {
            labs = labs + "TFT, ";
        }

        if (lft.isSelected() == true) {
            labs = labs + "LFT, ";
        }

        if (hgba1c.isSelected() == true) {
            labs = labs + "HGB A1C, ";
        }

        if (lipidprofile.isSelected() == true) {
            labs = labs + "Lipid Profile, ";
        }

        if (cmp.isSelected() == true) {
            labs = labs + "CMP, ";
        }

        if (cbc.isSelected() == true) {
            labs = labs + "CBC, ";
        }
        if (blanklabs.isSelected() == true) {
            labs = labs + labstextfield.getText() + ", ";
        }

        if (labs.length() > 2) {
            labs = labs.substring(0, labs.length() - 2);
            labs = labs.trim();
        }

        run42.setText(labs);

        run42.addBreak();
        run42.addBreak();

        run42Bold.setBold(true);
        run42Bold.setText(
                "Verbal informed consent obtained from patient for trial of " + ebox1.getText() + ": ");

        if (yes1.isSelected() == true) {
            run42Bold.setText("Yes");
        }
        if (no1.isSelected() == true) {
            run42Bold.setText("No");
        }

        run42Bold.addBreak();

        run42Bold.setText("Risks/benefits of prescribed medications discussed with patient: ");

        if (yes2.isSelected() == true) {
            run42Bold.setText("Yes");
        }
        if (no2.isSelected()) {
            run42Bold.setText("No");
        }

        run42Bold.addBreak();
        run42Bold.addBreak();

        String end = "", end2 = "";

        if (riskofsuicidelow.isSelected() == true) {
            end = end + "Low, ";
        }

        if (riskofsuicidemoderate.isSelected() == true) {
            end = end + "Moderate, ";
        }

        if (riskofsuicidehigh.isSelected() == true) {
            end = end + "High, ";
        }

        if (riskofsuicidemodifiableriskfactorsaddressed.isSelected() == true) {
            end = end + "Modifiable Risk Factors Addressed, ";
        }

        if (dangertootherslow.isSelected() == true) {
            end2 = end2 + "Low, ";
        }

        if (dangertoothersmoderate.isSelected() == true) {
            end2 = end2 + "Moderate, ";
        }

        if (dangertoothershigh.isSelected() == true) {
            end2 = end2 + "High, ";
        }

        if (dangertoothersmodifiableriskfactorsaddressed.isSelected() == true) {
            end2 = end2 + "Modifiable Risk Factors Addressed, ";
        }

        if (end.length() > 2) {
            end = end.substring(0, end.length() - 2);
            end = end.trim();
        }

        if (end2.length() > 2) {
            end2 = end2.substring(0, end2.length() - 2);
            end2 = end2.trim();
        }

        run42Bold.setText("Risk of Suicide/Self-Harm: " + end);
        run42Bold.addBreak();
        run42Bold.setText("Danger to others: " + end2);
        run42Bold.addBreak();
        run42Bold.addBreak();
        run42Bold.addBreak();
        run42Bold.addBreak();

        if (partnerSigned == true) {
            if (businesscardprovided.isSelected()) {
                runPre43.setText("Business Card Provided: Yes");
                runPre43.addBreak();
            } else {
                runPre43.setText("Business Card Provided: No");
                runPre43.addBreak();
            }

            if (discussedassistant.isSelected()) {
                if (who.getText() != null || who.getText() != "" || who.getText() != " ") {
                    runPre43.setText("Discussed with [" + who.getText()
                            + "] accompanying the patient that I am a physician assistant");
                    runPre43.addBreak();
                } else {
                    runPre43.setText("Discussed with patient that I am a physician assistant");
                    runPre43.addBreak();
                }

            } else {

            }

            //runPre43.addBreak();
            //runPre43.addBreak();

            run43.setBold(true);
            run43.setText(
                    "Signature: This Document Has Been Digitally Signed By Izabella Ostolski, PA-C            Date: ");
            DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
            Date date = new Date();
            String alpha = dateFormat.format(date);
            run43.setText(alpha);
        }

        if (dccSigned == true) {
            run44.addBreak();
            run44.addBreak();
            run44.addBreak();
            run44.setBold(false);
            run44.setItalic(true);
            //run44.setTextPosition(20);
            run44.setText("I have reviewed and discussed the case. I agree with the current treatment plan.");
            run44.addBreak();
            //run44.setText(signaturenotes.getText());
            //run44.addBreak();
            run46.setBold(true);
            run46.setText(
                    "Signature: This Document Has Been Digitally Signed By David Zhvikov MD           Date: ");
            DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
            Date date = new Date();
            String alpha = dateFormat.format(date);
            run46.setText(alpha);

            try {
                //code prac'k wrkoxx
                /*FileInputStream is = new FileInputStream("C:/Users/Quiggy/Desktop/javascript-based psych forms/sig.bmp");
                //doc.addPictureData(IOUtils.toByteArray(is), doc.PICTURE_TYPE_BMP)
                        
                XWPFParagraph title = doc.createParagraph();    
                XWPFRun imageRun = title.createRun();
                imageRun.setText("Fig.1 A Natural Scene");
                imageRun.setBold(true);
                title.setAlignment(ParagraphAlignment.CENTER);
                imageRun.addPicture(is, XWPFDocument.PICTURE_TYPE_BMP, "sig.bmp", 300, 200);*/

                //String picId = "C:/Users/Quiggy/Desktop/javascript-based psych forms/sig1.png";
                //doc.addPictureData(new FileInputStream("C:/Users/Quiggy/Desktop/javascript-based psych forms/sig1.png"), XWPFDocument.PICTURE_TYPE_PNG);  
                //doc.add

                //doc.createPicture(picId, doc.getNextPicNameNumber(XWPFDocument.PICTURE_TYPE_PNG), 200, 150);  

                //String imgFile = "C:/Users/Quiggy/Desktop/javascript-based psych forms/sig1.png";
                //FileInputStream is = new FileInputStream(picId);
                //run43.addBreak();
                //run43.addPicture(is, XWPFDocument.PICTURE_TYPE_PNG, picId, 200, 300); // 200x200 pixels
                //run43.addPicture(is, XWPFDocument.PICTURE_TYPE_JPEG, null, 0, 100);
                //run43.add
                //is.close();
            } catch (Exception anException) {
                //System.out.println(anException);

                //add the selected ones to the arraylist, and remove these from the second array list. print the first arraylist in bold, and then print the second arraylist unbolded.

            }
        }

        //Find: laundry bags(3), black pants (cargos), 2nd scientific calculator, iPAD mini CHARGER

        //Daskin NOW 36C
        //Masi pants
        //google jacket model number

        //dcc's old phone (with the lb, lx, & a lockscreen pic:)

        //"Enter the Physician's Assistant Passcode OR the Physician's Passcode to enable/unlock editing"

        //general-access password: dolphin-->dolphin92
        //Isabella's Password: siberianplatypus
        //Your Password: protooncogene-->protooncogene6

        //the "go-to" choice for disorganized writers/authors

        //also make an xml and php -based web chat application to complement f f
        //code this in visual studio with ASP.NET
        //that IBM? tutorial with the "free website" thing

        /*if(single.isSelected())
        {   
        run8.setItalic(true);
        run8.setBold(true);
        run8.setText("      Single");
        }
        else
        {
        run8.setItalic(false);
        run8.setBold(false);
        run8.setText("      Single");
        }
                
        if(engaged.isSelected())
        {
        run9.setItalic(true);
        run9.setBold(true);
        run9.setText("      Engaged");
        }
        else
        {
        run9.setBold(false);
        run9.setItalic(false);
        run9.setText("      Engaged");
        }
        //but not (both AT THE SAME TIME/ARE TRUE/HOLD)
        if(married.isSelected())
        {
        run10.setItalic(true);
        run10.setBold(true);
        run10.setText("     Married");
        }//nightmares, when they occurred, were less terrifying, somehow.
        else
        {
        run10.setItalic(false);
        run10.setBold(false);
        run10.setText("     Married");
        }//is fundamentally incomprehensible from the level of c at which you've considered it
        //because NEITHER are true
        //there is no
        if(seperated.isSelected())
        {
        run11.setItalic(true);
        run11.setBold(true);
        run11.setText("     Seperated");
        }
        else
        {
        run11.setItalic(false);
        run11.setBold(false);
        run11.setText("     Seperated");
        }
                
        if(divorced.isSelected())
        {
        run12.setItalic(true);
        run12.setBold(true);
        run12.setText("     Divorced");
        }//there is only choice...choice is the only thing left to identify/indicate [that] individuality [exists indeed]
        else
        {
        run12.setItalic(false);
        run12.setBold(false);
        run12.setText("     Divorced");
        }
                
        if(commonlawspouse.isSelected())
        {
        run13.setItalic(true);
        run13.setBold(true);
        run13.setText("     Common Law Spouse");
        }
        else
        {
        run13.setItalic(false);
        run13.setBold(false);
        run13.setText("     Common Law Spouse");
        }
                
        if(cohabiting.isSelected())
        {
        run14.setItalic(true);
        run14.setBold(true);
        run14.setText("     Cohabiting");
        }
        else
        {
        run14.setItalic(false);
        run14.setBold(false);
        run14.setText("     Cohabiting");
        }*/

        //run is created here if(divorced.isSelected == "true"){run.setBold(true); run.setText("divorced");} else {run.setBold(false); run.setText("divorced")}
        //single, engaged, married, seperated, divorced, commonlawspouse, cohabiting; 

        //printDOB(doc);

        //one (not-so-great) solution to the numerous runs problem: list everything to be bolded first (array 1- run 1), and then everything else (array 2- run 2)

        //doc.createParagraph().createRun().setText("           " + paragraphs.get(c).toString());
        //doc.createParagraph().createRun().addBreak();

        doc.write(outstream);
        outstream.close();

        //paraRun.setText(Primary.getText());

        //doc.createParagraph().createRun().addBreak();                 //inserts a line break
        //doc.createParagraph().createRun().setText("blah");            //creates another paragraph

        /*for(int c = 0; c < paragraphs.size(); c++)
        {
             /*XWPFParagraph p = doc.createParagraph(); //Paragraph
             XWPFRun run = p.createRun();  //Where the text will be written from
             run.setText("\t");*/

        /*            XWPFParagraph p = doc.createParagraph(); //Paragraph
            XWPFRun run = p.createRun();  //Where the text will be written from
                    
            String currentParagraph = paragraphs.get(c).toString();
            for(int d = 0; d < currentParagraph.length(); d++)
            {
        if(currentParagraph.charAt(d) == '@')
        {
            currentParagraph = currentParagraph.substring(d+1, currentParagraph.length() - 2);
                    
            run.setBold(true);
                    
                    
        }
        else
        {
            //run.setBold(false);
        }
            }
                    
            run.setText("           " + currentParagraph);
            //doc.createParagraph().createRun().setText("           " + paragraphs.get(c).toString());
            //doc.createParagraph().createRun().addBreak();
        }
                
                
        doc.write(outstream);
        outstream.close();
        //JOptionPane.showConfirmDialog(null, "Are you sure you want to create the word document?");
                
        //Makes the chapter titles bold and removes the "@" & "-"
                
        JOptionPane.showMessageDialog(null, "Document Successfully Created. The program/AA will now exit");
        System.exit(0);*/

    } catch (Exception e) {

    }
}

From source file:pe.gob.onpe.rae.controller.registro.registroController.java

@RequestMapping(value = "generateFVDoc/{codExpediente}", method = RequestMethod.GET)
public void generateFVDoc(HttpServletRequest request, @PathVariable("codExpediente") int codExpediente,
        HttpServletResponse response) {//from w  ww.  ja  va 2  s. c o m
    try {
        ServletContext sc = request.getSession().getServletContext();

        Expediente expediente = new Expediente(codExpediente);
        expediente = expedienteDAO.find(expediente);

        Ambito amb = new Ambito(expediente.getAmbito().getId());
        amb = ambitoDAO.find(amb);

        int totalElectoresRemitidos = expedientePadronDAO.getCountByExpediente(expediente);
        int totalElectoresIncorporados = expedientePadronDAO.getCountByExpedienteAndEstado(expediente,
                Parametros.ESTADO_ELECTOR_ACTIVO);

        JsonParser jsonParser = new JsonParser();
        JsonObject jsonObject = (JsonObject) jsonParser.parse(amb.getInformacion());
        String nombre = jsonObject.get("nombres").toString() + " "
                + jsonObject.get("apellidoPaterno").toString() + " "
                + jsonObject.get("apellidoMaterno").toString();

        InputStream is = registroController.class.getResourceAsStream("/ejemplo.docx");
        XWPFDocument document = new XWPFDocument(is);

        XWPFHeaderFooterPolicy policy = document.getHeaderFooterPolicy();
        if (policy == null) {
            CTSectPr sectPr = document.getDocument().getBody().addNewSectPr();
            policy = new XWPFHeaderFooterPolicy(document, sectPr);
        }

        if (policy.getDefaultHeader() == null && policy.getFirstPageHeader() == null
                && policy.getDefaultFooter() == null) {
            XWPFFooter footerD = policy.getFooter(1);// createFooter(policy.DEFAULT);
            XWPFRun run = footerD.getParagraphs().get(0).createRun();
            run.setText("usuario");
            XWPFParagraph paragraph = footerD.createParagraph();
            paragraph.setAlignment(ParagraphAlignment.DISTRIBUTE);
            run = paragraph.createRun();
            run.setFontFamily("Arial");
            run.setFontSize(8);
            run.setText(
                    "Jr.Washington N 1894, Cercado de Lima. Central Telefonica: 417-0630 www.onpe.gob.pe informes@onpe.gob.pe");

        }

        XWPFParagraph paragraph = document.createParagraph();

        XWPFRun run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.setText("Lima,");
        run.addBreak();

        paragraph = document.createParagraph();
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.setBold(true);
        run.setText("OFICIO N       -2016-GPP/ONPE");
        run.setUnderline(UnderlinePatterns.SINGLE);
        run.addBreak();

        paragraph = document.createParagraph();
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.setText("Seor");

        XWPFRun run1 = paragraph.createRun();
        run1.setFontSize(11);
        run1.setFontFamily("Arial");
        run1.setText(nombre.replace("\"", ""));
        run1.setBold(true);
        run1.addBreak();

        XWPFRun run2 = paragraph.createRun();
        run2.setFontSize(11);
        run2.setFontFamily("Arial");
        run2.setText(jsonObject.get("cargo").toString().replace("\"", ""));
        run2.addBreak();
        run2.setText("Centro Poblado " + amb.getNombreAmbito());
        run2.addBreak();
        run2.setText("Av. 28 de Julio S/N Centro Cvico Huacrachuco - Municipalidad Provincial de "
                + amb.getProvincia());
        run2.addBreak();
        run2.setText(amb.getDepartamento() + " - " + amb.getProvincia() + " - " + amb.getDistrito());
        run2.addBreak();

        run2 = paragraph.createRun();
        run2.setFontSize(11);
        run2.setFontFamily("Arial");
        run2.setUnderline(UnderlinePatterns.WORDS);
        run2.setText("Presente");

        run2 = paragraph.createRun();
        run2.setFontSize(11);
        run2.setFontFamily("Arial");
        run2.setText(".-");

        paragraph = document.createParagraph();
        run.addBreak();
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.addBreak();
        run.setText("Asunto");
        run.addTab();
        run.addTab();
        run.setText(": SOLICITUD DE CREACIN DE MESA DE SUFRAGIO.");
        run.addBreak();

        paragraph = document.createParagraph();
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.setText("Referencia");
        run.addTab();
        run.setText(": OFICIO N 087-2016/M-CP.CHOCOBAMBA (16AGO2016) - Exp. " + expediente.getExpediente());
        run.addBreak();

        paragraph = document.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.THAI_DISTRIBUTE);
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.setText(
                "Me dirijo a usted con relacin al documento de la referencia con la finalidad de hacer de su "
                        + "conocimiento que se ha cumplido con todos los requisitos que dan inicio al trmite de "
                        + "instalacin de mesas de sufragio en el Centro Poblado " + amb.getNombreAmbito()
                        + ", distrito " + amb.getDistrito() + ", " + "provincia " + amb.getProvincia()
                        + ", departamento " + amb.getDepartamento() + ".");
        paragraph = document.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.THAI_DISTRIBUTE);
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.addBreak();
        run.setText("Al respecto, el mencionado expediente contiene un listado de electores que solicitan ser "
                + "parte de la mesa de sufragio de la localidad " + amb.getNombreAmbito()
                + ", el cual, luego de la validacin " + "realizada, se informa que podrn ser incorporados "
                + totalElectoresIncorporados + " electores del total de " + totalElectoresRemitidos
                + " registros "
                + "de electores remitidos. Se adjunta un cuadro resumen con las observaciones mencionadas.");
        paragraph = document.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.THAI_DISTRIBUTE);
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.addBreak();
        run.setText(
                "Asimismo, se programar un viaje para la verificacin de rutas, tiempos y servicios de la "
                        + "localidad, la cual se coordinar previamente con las autoridades del centro poblado a fin de "
                        + "programarla adecuadamente; luego de lo cual se emitir un informe de respuesta al "
                        + "resultado de la solicitud, que de ser positivo, conllevara a la instalacin de mesas de sufragio "
                        + "en el centro poblado en mencin, con miras a las ");
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.setBold(true);
        run.setText("Elecciones Regionales y Municipales de 2018.");
        paragraph = document.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.THAI_DISTRIBUTE);
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.addBreak();
        run.setText("Finalmente, de requerir mayor informacin, agradeceremos se comunique con nosotros al "
                + "telefono 417-0630 anexo 8484 o al 8481.");
        paragraph = document.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.THAI_DISTRIBUTE);
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.addBreak();
        run.setText("Sin otro particular.");

        paragraph = document.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.THAI_DISTRIBUTE);
        run = paragraph.createRun();
        run.setFontSize(11);
        run.setFontFamily("Arial");
        run.addBreak();
        run.addBreak();
        run.setText("Atentamente,");
        response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
        document.write(response.getOutputStream());
    } catch (Exception ex) {
        Logger.getLogger(registroController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:pqm.client.DocGenerator.java

public void work() {
    FileOutputStream out = null;//from  ww w  .j  ava  2s.c o  m
    try {
        XWPFDocument document = new XWPFDocument();
        out = new FileOutputStream(new File("C:\\Users\\Tiago\\Desktop\\gsiteste.docx"));
        XWPFParagraph paragraph = document.createParagraph();
        XWPFRun run = paragraph.createRun();
        run.setText("PQM");
        paragraph = document.createParagraph();
        run = paragraph.createRun();
        run.setText("2015-2016");
        document.createParagraph();
        gerar_introducao(document);
        document.createParagraph();
        gerar_missao(document);
        document.createParagraph();
        //gerar_influencias(document);
        document.createParagraph();
        gerar_fcs(document);
        document.createParagraph();
        gerar_pn(document);
        document.createParagraph();
        tabela_fcs_pn(document); /*tabela fcs vs pcn*/
        document.createParagraph();
        gerar_matriz1(document);
        document.createParagraph();
        tabela_importancia(document); /*tabela analise */
        document.createParagraph();
        gerar_matriz2(document);
        document.createParagraph();
        gerar_conclusao(document);
        document.write(out);
        out.close();
        System.out.println("createdocument.docx written successully");
    } catch (FileNotFoundException ex) {
        Logger.getLogger(DocGenerator.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(DocGenerator.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        try {
            out.close();
        } catch (IOException ex) {
            Logger.getLogger(DocGenerator.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:pqm.client.DocGenerator.java

public static void gerar_introducao(XWPFDocument document) {
    XWPFParagraph paragraph = document.createParagraph();
    XWPFRun run = paragraph.createRun();
    run.setText("INTRODUCAO:");
    paragraph = document.createParagraph();
    run = paragraph.createRun();/*w  w w  .j  a  v  a2  s . com*/
    run.setText(pqm.introducao.texto);
}

From source file:pqm.client.DocGenerator.java

public static void tabela_fcs_pn(XWPFDocument document) {

    XWPFParagraph paragraph = document.createParagraph();
    XWPFRun run = paragraph.createRun();
    run.setText("MATRIZES DA METODOLOGIA PQM:");

    XWPFTable table = document.createTable();
    XWPFTableRow tableRowOne = table.getRow(0);
    tableRowOne.getCell(0).setText("");

    teste t1 = new teste();
    pqm = t1.escreve();//from w  w w .  j a  va 2s  .c o m

    /* ler fcs e colocar na tabela*/
    int num_fcs = pqm.fcs.size();
    for (int i = 0; i < num_fcs; i++) {
        tableRowOne.addNewTableCell().setText(pqm.fcs.get(i).texto);
    }

    /*criar analise */
    for (int i = 0; i < 3; i++) {
        tableRowOne.addNewTableCell();
    }
    tableRowOne.getCell(num_fcs + 1).setText("Tot. Imp");
    tableRowOne.getCell(num_fcs + 2).setText("Qual. Proc.");
    tableRowOne.getCell(num_fcs + 3).setText("Proc. Gast");

    /*processos*/
    for (int j = 0; j < pqm.processosNegocio.processos.size(); j++) {
        int contador = 0;
        XWPFTableRow tableRow = table.createRow();
        tableRow.getCell(0).setText("" + pqm.processosNegocio.processos.get(j).id + " - "
                + pqm.processosNegocio.processos.get(j).texto);
        int cont_cell = pqm.processosNegocio.processos.get(j).relacoes.size();
        for (int x = 0; x < cont_cell; x++) {
            if (pqm.processosNegocio.processos.get(j).relacoes.get(x).estado == true) {
                tableRow.getCell(x + 1).setText("x");
                contador++;
            }
        }
        cont_cell++;
        tableRow.getCell(cont_cell).setText(Integer.toString(contador));
        cont_cell++;
        tableRow.getCell(cont_cell).setText(pqm.processosNegocio.processos.get(j).qualidadep);
        cont_cell++;
        if (pqm.processosNegocio.processos.get(j).gastador == true) {
            tableRow.getCell(cont_cell).setText("x");
        }
    }

    paragraph = document.createParagraph();
    run = paragraph.createRun();
    run.setText("Tabela 1 - Analise dos FCS nos PN");

}

From source file:pqm.client.DocGenerator.java

public static void gerar_matriz1(XWPFDocument document) {

    /*criar matrizes*/
    XWPFTable table1 = document.createTable();

    XWPFTableRow tableRow = table1.getRow(0);
    tableRow.getCell(0).setText("   4   ");

    for (int i = 3; i > 0; i--) {
        table1.createRow().getCell(0).setText("   " + Integer.toString(i) + "   ");
    }/*from w  w  w  . j  a  v a2s. c o  m*/

    table1.createRow().getCell(0).setText("");

    for (int i = 0; i <= 4; i++) {
        for (int j = 1; j <= 5; j++) {
            table1.getRow(i).addNewTableCell();
        }
    }

    table1.getRow(4).getCell(1).setText("   E   ");
    table1.getRow(4).getCell(2).setText("   D   ");
    table1.getRow(4).getCell(3).setText("   C   ");
    table1.getRow(4).getCell(4).setText("   B   ");
    table1.getRow(4).getCell(5).setText("   A   ");

    /*preencher matriz*/

    teste t1 = new teste();
    pqm = t1.escreve();

    int tot_imp = 0;
    String qual;
    int qual_int = 0;
    String id_p;
    for (int p = 0; p < pqm.processosNegocio.processos.size(); p++) {
        for (int t = 0; t < pqm.processosNegocio.processos.get(p).relacoes.size(); t++) {
            if (pqm.processosNegocio.processos.get(p).relacoes.get(t).estado == true)
                tot_imp++;
        }
        qual = pqm.processosNegocio.processos.get(p).qualidadep;

        if (qual.equals("E") || qual.equals("e"))
            qual_int = 1;
        else if (qual.equals("D") || qual.equals("d"))
            qual_int = 2;
        if (qual.equals("C") || qual.equals("c"))
            qual_int = 3;
        if (qual.equals("B") || qual.equals("b"))
            qual_int = 4;
        if (qual.equals("A") || qual.equals("a"))
            qual_int = 5;

        id_p = pqm.processosNegocio.processos.get(p).id;
        System.out.println("tot_imp: " + tot_imp);
        table1.getRow(4 - tot_imp).getCell(qual_int).setText(id_p + " ");

        if (pqm.processosNegocio.processos.get(p).gastador == true) {
            proc_gastador.add(pqm.processosNegocio.processos.get(p).id);
        }

        if (4 - tot_imp == 4 && qual_int == 1 || qual_int == 2 || qual_int == 3) {
            proc_criticos.add(id_p);
            proc_criticos.add(pqm.processosNegocio.processos.get(p).texto);
        } else if (4 - tot_imp == 3 && qual_int == 1 || qual_int == 2) {
            proc_criticos.add(id_p);
            proc_criticos.add(pqm.processosNegocio.processos.get(p).texto);
        } else if (4 - tot_imp == 2 && qual_int == 1) {
            proc_criticos.add(id_p);
            proc_criticos.add(pqm.processosNegocio.processos.get(p).texto);
        }

        tot_imp = 0;
    }

    XWPFParagraph paragraph = document.createParagraph();
    XWPFRun run = paragraph.createRun();
    run.setText("Tabela 2 - Divisao dos Processos por nivel de importancia e criticidade");
}

From source file:pqm.client.DocGenerator.java

public static void tabela_importancia(XWPFDocument document) {
    /*criar tabela pn vs fcs */
    XWPFTable table = document.createTable();
    XWPFTableRow tableRowOne = table.getRow(0);
    tableRowOne.getCell(0).setText("");
    /*tableRowOne.addNewTableCell().setText("FC1");
    tableRowOne.addNewTableCell().setText("FC2");*/

    teste t1 = new teste();
    pqm = t1.escreve();/*from w  ww  .  j a  va  2  s  .  co m*/

    /* ler fcs e colocar na tabela*/
    int num_fcs = pqm.fcs.size();
    for (int i = 0; i < num_fcs; i++) {
        tableRowOne.addNewTableCell().setText(pqm.fcs.get(i).texto);
    }

    /*criar analise */
    for (int i = 0; i < 5; i++) {
        tableRowOne.addNewTableCell();
    }

    /*escrever analise*/
    tableRowOne.getCell(num_fcs + 1).setText("Tot. Imp");
    tableRowOne.getCell(num_fcs + 2).setText("Qual. Proc.");
    tableRowOne.getCell(num_fcs + 3).setText("Proc. Gast");
    tableRowOne.getCell(num_fcs + 4).setText("Qual. Neg.");
    tableRowOne.getCell(num_fcs + 5).setText("Qual. Tecn.");

    /*processos*/
    for (int j = 0; j < pqm.processosNegocio.processos.size(); j++) {
        int contador = 0;
        XWPFTableRow tableRow = table.createRow();
        tableRow.getCell(0).setText("" + pqm.processosNegocio.processos.get(j).id + " - "
                + pqm.processosNegocio.processos.get(j).texto);
        int cont_cell = pqm.processosNegocio.processos.get(j).relacoes.size();
        for (int x = 0; x < cont_cell; x++) {
            if (pqm.processosNegocio.processos.get(j).relacoes.get(x).estado == true) {
                tableRow.getCell(x + 1).setText("x");
                contador++;
            }
        }
        cont_cell++;
        tableRow.getCell(cont_cell).setText(Integer.toString(contador));
        cont_cell++;
        tableRow.getCell(cont_cell).setText(pqm.processosNegocio.processos.get(j).qualidadep);
        cont_cell++;
        if (pqm.processosNegocio.processos.get(j).gastador == true) {
            tableRow.getCell(cont_cell).setText("x");
        }
        cont_cell++;
        tableRow.getCell(cont_cell).setText(pqm.processosNegocio.processos.get(j).qualidaden);
        cont_cell++;
        tableRow.getCell(cont_cell).setText(pqm.processosNegocio.processos.get(j).qualidadet);
    }
    XWPFParagraph paragraph = document.createParagraph();
    XWPFRun run = paragraph.createRun();
    run.setText("Tabela 3 - Analise da importancia dos FCS nos PN e nas IT associadas");
}

From source file:pqm.client.DocGenerator.java

public static void gerar_matriz2(XWPFDocument document) {

    /*criar matrizes*/
    XWPFTable table1 = document.createTable();
    XWPFTableRow tableRow = table1.getRow(0);
    tableRow.getCell(0).setText("   A   ");

    table1.createRow().getCell(0).setText("   B   ");
    table1.createRow().getCell(0).setText("   C   ");
    table1.createRow().getCell(0).setText("   D   ");
    table1.createRow().getCell(0).setText("");

    for (int i = 0; i <= 4; i++) {
        for (int j = 1; j <= 4; j++) {
            table1.getRow(i).addNewTableCell();
        }// w  ww  .j av a 2s  . c  om
    }

    table1.getRow(4).getCell(1).setText("    D    ");
    table1.getRow(4).getCell(2).setText("    C    ");
    table1.getRow(4).getCell(3).setText("    B    ");
    table1.getRow(4).getCell(4).setText("    A    ");

    /*preencher matriz*/

    teste t1 = new teste();
    pqm = t1.escreve();

    int qual_neg = 0;
    String qual_n;
    String qual_t;
    int qual_int = 0;
    String id_p;
    for (int p = 0; p < pqm.processosNegocio.processos.size(); p++) {

        qual_n = pqm.processosNegocio.processos.get(p).qualidaden;
        if (qual_n.equals("D") || qual_n.equals("d"))
            qual_neg = 3;
        else if (qual_n.equals("C") || qual_n.equals("c"))
            qual_neg = 2;
        if (qual_n.equals("B") || qual_n.equals("b"))
            qual_neg = 1;
        if (qual_n.equals("A") || qual_n.equals("a"))
            qual_neg = 0;

        qual_t = pqm.processosNegocio.processos.get(p).qualidadet;

        if (qual_t.equals("D") || qual_t.equals("d"))
            qual_int = 1;
        else if (qual_t.equals("C") || qual_t.equals("c"))
            qual_int = 2;
        if (qual_t.equals("B") || qual_t.equals("b"))
            qual_int = 3;
        if (qual_t.equals("A") || qual_t.equals("a"))
            qual_int = 4;

        id_p = pqm.processosNegocio.processos.get(p).id;
        table1.getRow(qual_neg).getCell(qual_int).setText(id_p + " ");

        if (qual_neg == 1 || qual_neg == 0 && qual_int == 1 || qual_int == 2) {
            proc_ti.add(id_p);
            proc_ti.add(pqm.processosNegocio.processos.get(p).texto);
        }

        qual_neg = 0;
        qual_int = 0;

    }

    XWPFParagraph paragraph = document.createParagraph();
    XWPFRun run = paragraph.createRun();
    run.setText("Tabela 4 - Divisao dos processos por nivel de criticidade");
}

From source file:pqm.client.DocGenerator.java

public static void gerar_conclusao(XWPFDocument document) {

    XWPFParagraph paragraph = document.createParagraph();
    XWPFRun run = paragraph.createRun();
    run.setText("CONCLUSAO:");
    paragraph = document.createParagraph();
    run = paragraph.createRun();// ww  w  .  j a  v a2  s . c o  m
    run.setText("Apos uma analise das tabelas geradas podemos concluir que os processos mais criticos sao: ");
    paragraph = document.createParagraph();
    run = paragraph.createRun();
    for (int i = 0; i < proc_criticos.size(); i = i + 2) {
        run.setText(proc_criticos.get(i) + " - " + proc_criticos.get(i + 1));
        paragraph = document.createParagraph();
        run = paragraph.createRun();
    }
    run.setText("Tambem podemos verificar quais os processos gastadores, que sao: ");
    for (int i = 0; i < proc_gastador.size(); i++) {
        if (i < proc_gastador.size() - 1)
            run.setText(proc_gastador.get(i) + ", ");
        else
            run.setText(proc_gastador.get(i) + ".");
    }
    paragraph = document.createParagraph();
    run = paragraph.createRun();
    run.setText("Por fim podemos verificar que os processos com as ti inadequadas sao: ");
    paragraph = document.createParagraph();
    run = paragraph.createRun();
    for (int i = 0; i < proc_ti.size(); i = i + 2) {
        run.setText(proc_ti.get(i) + " - " + proc_ti.get(i + 1));
        paragraph = document.createParagraph();
        run = paragraph.createRun();
    }

}

From source file:pqm.client.DocGenerator.java

public static void gerar_missao(XWPFDocument document) {
    XWPFParagraph paragraph = document.createParagraph();
    XWPFRun run = paragraph.createRun();
    run.setText("MISSAO:");
    paragraph = document.createParagraph();
    run = paragraph.createRun();/*from   w  w w . j a v  a 2  s .  c  om*/
    run.setText(pqm.missao.texto);
}