Example usage for org.apache.poi.ss.usermodel Cell setCellValue

List of usage examples for org.apache.poi.ss.usermodel Cell setCellValue

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel Cell setCellValue.

Prototype

void setCellValue(boolean value);

Source Link

Document

Set a boolean value for the cell

Usage

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerLisaQAXlsReportHelper.java

License:Apache License

/**
 * Add title to the sheet//from ww w .  j av  a 2 s .  c  om
 * 
 * @param p_sheet
 *            the sheet
 * @throws Exception
 */
private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception {
    ResourceBundle bundle = PageHandler.getBundle(request.getSession());
    // Title font is black bold on white
    Font titleFont = p_workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Times");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFont.setColor(IndexedColors.BLACK.getIndex());

    CellStyle titleStyle = p_workbook.createCellStyle();
    titleStyle.setFont(titleFont);
    titleStyle.setWrapText(false);

    Row titleRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(titleRow, 0);
    titleCell.setCellValue(bundle.getString("implemented_comments_check_report"));
    titleCell.setCellStyle(titleStyle);
    p_sheet.setColumnWidth(0, 40 * 256);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerLisaQAXlsReportHelper.java

License:Apache License

/**
 * Write the Job information into the header
 * //w w w .j  a  v a2 s.  c o m
 * @param p_sheet
 *            the sheet
 * @throws Exception
 */
private void writeLanguageInfo(Workbook p_workbook, Sheet p_sheet) throws Exception {
    int col = 0;
    int row = LANGUAGE_INFO_ROW;
    long jobId = 0;

    if (request.getParameter(WebAppConstants.JOB_ID) != null
            && !"*".equals(request.getParameter(WebAppConstants.JOB_ID))) {
        // Request from main reports entrance.
        jobId = Long.valueOf(request.getParameter(WebAppConstants.JOB_ID));
        LocaleManagerLocal manager = new LocaleManagerLocal();
        writeLanguageInfo(p_workbook, p_sheet, jobId,
                manager.getLocaleById(Long.valueOf(request.getParameter(WebAppConstants.TARGET_LANGUAGE)))
                        .getDisplayName(),
                request.getParameter(WebAppConstants.DATE_FORMAT));
    } else if (sessionMgr.getAttribute(WebAppConstants.JOB_ID) != null) {
        // Request from pop up editor or work offline page.
        Object jobIdObject = sessionMgr.getAttribute(WebAppConstants.JOB_ID);
        if (jobIdObject instanceof String) {
            jobId = Long.parseLong((String) jobIdObject);
        } else if (jobIdObject instanceof Long) {
            jobId = (Long) jobIdObject;
        }
        writeLanguageInfo(p_workbook, p_sheet, jobId,
                (String) sessionMgr.getAttribute(WebAppConstants.TARGETVIEW_LOCALE), DEFAULT_DATE_FORMAT);
    } else {
        // If no job exists, just set the cell blank.
        Row infoRow = getRow(p_sheet, row);
        Cell cell_A = getCell(infoRow, col++);
        cell_A.setCellValue("");
        cell_A.setCellStyle(getContentStyle(p_workbook));

        Cell cell_B = getCell(infoRow, col++);
        cell_B.setCellValue("");
        cell_B.setCellStyle(getContentStyle(p_workbook));
    }
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerLisaQAXlsReportHelper.java

License:Apache License

/**
 * Write the Job information into the header
 * //from w w w .ja v a  2 s. co m
 * @param p_sheet
 *            the sheet
 * @param p_jobId
 *            the job id
 * @param p_targetLang
 *            the displayed target language
 * @param p_dateFormat
 *            the date format
 * @throws Exception
 */
private void writeLanguageInfo(Workbook p_workbook, Sheet p_sheet, long p_jobId, String p_targetLang,
        String p_dateFormat) throws Exception {
    Job job = ServerProxy.getJobHandler().getJobById(p_jobId);
    int col = 0;
    int row = LANGUAGE_INFO_ROW;

    // Source Language
    Row langInfoRow = getRow(p_sheet, row);
    Cell cell_A = getCell(langInfoRow, col++);
    cell_A.setCellValue(job.getSourceLocale().getDisplayName(uiLocale));
    cell_A.setCellStyle(getContentStyle(p_workbook));
    p_sheet.setColumnWidth(col - 1, 30 * 256);

    // Target Language
    Cell cell_B = getCell(langInfoRow, col++);
    cell_B.setCellValue(p_targetLang);
    cell_B.setCellStyle(getContentStyle(p_workbook));
    p_sheet.setColumnWidth(col - 1, 30 * 256);

}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerLisaQAXlsReportHelper.java

License:Apache License

/**
 * For Implemented Comments Check Report, Write segment information into
 * each row of the sheet./*from w ww  .j  a v a2 s .c om*/
 * 
 * @see writeSegmentInfoRCR(WritableSheet, long, long, String, int)
 */
private int writeSegmentInfoICC(Workbook p_workbook, Sheet p_sheet, long p_jobId, String p_targetLang,
        String p_srcPageId, int p_row) throws Exception {
    Job job = ServerProxy.getJobHandler().getJobById(p_jobId);
    long companyId = job.getCompanyId();
    Vector<TargetPage> targetPages = new Vector<TargetPage>();

    TranslationMemoryProfile tmp = null;
    List<String> excludItems = null;
    GlobalSightLocale targetLocale = null;
    for (Workflow workflow : job.getWorkflows()) {
        if (Workflow.PENDING.equals(workflow.getState()) || Workflow.CANCELLED.equals(workflow.getState())
        // || Workflow.EXPORT_FAILED.equals(workflow.getState())
                || Workflow.IMPORT_FAILED.equals(workflow.getState())) {
            continue;
        }
        if (p_targetLang.equals(String.valueOf(workflow.getTargetLocale().getId()))) {
            targetLocale = workflow.getTargetLocale();
            targetPages = workflow.getTargetPages();
            tmp = workflow.getJob().getL10nProfile().getTranslationMemoryProfile();
            if (tmp != null) {
                excludItems = new ArrayList<String>(tmp.getJobExcludeTuTypes());
            }
        }
    }

    if (targetPages.isEmpty()) {
        // If no corresponding target page exists
        // and the row is the initial row, then set the cell blank
        if (SEGMENT_START_ROW == p_row) {
            writeBlank(p_workbook, p_sheet, SEGMENT_START_ROW, 10);
        }
    } else {
        LeverageMatchLingManager leverageMatchLingManager = LingServerProxy.getLeverageMatchLingManager();
        TermLeverageManager termLeverageManager = ServerProxy.getTermLeverageManager();

        Locale sourcePageLocale = job.getSourceLocale().getLocale();
        Locale targetPageLocale = targetLocale.getLocale();
        Map<Long, Set<TermLeverageMatch>> termLeverageMatchResultMap = null;
        TermLeverageOptions termLeverageOptions = getTermLeverageOptions(sourcePageLocale, targetPageLocale,
                job.getL10nProfile().getProject().getTermbaseName(), String.valueOf(job.getCompanyId()));
        if (termLeverageOptions != null) {
            termLeverageMatchResultMap = termLeverageManager.getTermMatchesForPages(job.getSourcePages(),
                    targetLocale);
        }

        String category = null;
        PseudoData pData = new PseudoData();
        pData.setMode(PseudoConstants.PSEUDO_COMPACT);
        String sourceSegmentString = null;
        String targetSegmentString = null;
        String sid = null;
        for (int i = 0; i < targetPages.size(); i++) {
            TargetPage targetPage = (TargetPage) targetPages.get(i);
            SourcePage sourcePage = targetPage.getSourcePage();

            if (!"".equals(p_srcPageId) && !p_srcPageId.equals(String.valueOf(sourcePage.getId()))) {
                // ignore the source pages not equal to the one
                // if the request comes from pop up editor
                continue;
            }
            List sourceTuvs = SegmentTuvUtil.getSourceTuvs(sourcePage);
            List targetTuvs = SegmentTuvUtil.getTargetTuvs(targetPage);
            Map<Long, LeverageSegment> exactMatches = leverageMatchLingManager
                    .getExactMatches(sourcePage.getIdAsLong(), new Long(targetPage.getLocaleId()));
            Map<Long, Set<LeverageMatch>> leverageMatcheMap = leverageMatchLingManager
                    .getFuzzyMatches(sourcePage.getIdAsLong(), new Long(targetPage.getLocaleId()));

            sourcePageLocale = sourcePage.getGlobalSightLocale().getLocale();
            targetPageLocale = targetPage.getGlobalSightLocale().getLocale();

            boolean m_rtlSourceLocale = EditUtil.isRTLLocale(sourcePageLocale.toString());
            boolean m_rtlTargetLocale = EditUtil.isRTLLocale(targetPageLocale.toString());

            // Find segment all comments belong to this target page
            Map<Long, IssueImpl> issuesMap = CommentHelper.getIssuesMap(targetPage.getId());

            for (int j = 0; j < targetTuvs.size(); j++) {
                int col = 0;
                Tuv targetTuv = (Tuv) targetTuvs.get(j);
                Tuv sourceTuv = (Tuv) sourceTuvs.get(j);
                category = sourceTuv.getTu(companyId).getTuType();
                if (excludItems != null && excludItems.contains(category)) {
                    continue;
                }

                // Comment
                List issueHistories = null;
                String lastComment = "";
                String failure = "";
                Date issueCreatedDate = null;
                Issue issue = issuesMap.get(targetTuv.getId());
                if (issue != null) {
                    issueHistories = issue.getHistory();
                    failure = issue.getCategory();
                }
                if (issueHistories != null && issueHistories.size() > 0) {
                    IssueHistory issueHistory = (IssueHistory) issueHistories.get(0);
                    lastComment = issueHistory.getComment();
                    issueCreatedDate = issueHistory.dateReportedAsDate();
                }

                sourceSegmentString = sourceTuv.getGxmlElement().getTextValue();
                sid = sourceTuv.getSid();
                targetSegmentString = targetTuv.getGxmlElement().getTextValue();
                Date targetSegmentModifiedDate = targetTuv.getLastModified();

                StringBuilder matches = getMatches(exactMatches, leverageMatcheMap, targetTuv, sourceTuv);

                // Get Terminology/Glossary Source and Target.
                String sourceTerms = "";
                String targetTerms = "";
                if (termLeverageMatchResultMap != null) {
                    Set<TermLeverageMatch> termLeverageMatchSet = termLeverageMatchResultMap
                            .get(sourceTuv.getId());
                    if (termLeverageMatchSet != null && termLeverageMatchSet.size() > 0) {
                        TermLeverageMatch tlm = termLeverageMatchSet.iterator().next();
                        sourceTerms = tlm.getMatchedSourceTerm();
                        targetTerms = tlm.getMatchedTargetTerm();
                    }
                }

                // For Implemented Comments Check Report (LSO Extension)
                if (lastComment.length() == 0) {
                    continue;
                }

                CellStyle style = getContentStyle(p_workbook);
                // Set color format for target segment changed
                if (targetSegmentModifiedDate.before(issueCreatedDate)) {
                    style = getRedStyle(p_workbook);
                }

                // Job id
                Row row = getRow(p_sheet, p_row);
                Cell cell_A = getCell(row, col++);
                cell_A.setCellValue(p_jobId);
                cell_A.setCellStyle(style);
                p_sheet.setColumnWidth(col - 1, 20 * 256);
                // Segment id
                Cell cell_B = getCell(row, col++);
                cell_B.setCellValue(sourceTuv.getTu(companyId).getId());
                cell_B.setCellStyle(style);
                p_sheet.setColumnWidth(col - 1, 20 * 256);

                // Fix for GBS-1484
                String externalPageId = sourcePage.getExternalPageId();
                String[] pathNames = externalPageId.split("\\\\");
                String Name = pathNames[pathNames.length - 1];
                boolean temp = pathNames[0].contains(")");
                if (temp) {
                    String[] firstNames = pathNames[0].split("\\)");
                    String detailName = firstNames[0];
                    Name = Name + detailName + ")";
                }

                // TargetPage id
                Cell cell_C = getCell(row, col++);
                cell_C.setCellValue(Name);
                cell_C.setCellStyle(style);
                p_sheet.setColumnWidth(col - 1, 20 * 256);

                // Source segment
                CellStyle sourceStyle = m_rtlSourceLocale ? getRtlContentStyle(p_workbook) : style;
                String srcContent = m_rtlSourceLocale ? EditUtil.toRtlString(sourceSegmentString)
                        : sourceSegmentString;

                Cell cell_D = getCell(row, col++);
                cell_D.setCellValue(srcContent);
                cell_D.setCellStyle(sourceStyle);
                p_sheet.setColumnWidth(col - 1, 40 * 256);

                // Target segment
                CellStyle targetStyle = m_rtlTargetLocale ? getRtlContentStyle(p_workbook) : style;
                String content = m_rtlTargetLocale ? EditUtil.toRtlString(targetSegmentString)
                        : targetSegmentString;

                Cell cell_E = getCell(row, col++);
                cell_E.setCellValue(content);
                cell_E.setCellStyle(targetStyle);
                p_sheet.setColumnWidth(col - 1, 40 * 256);

                Cell cell_F = getCell(row, col++);
                cell_F.setCellValue(sid);
                cell_F.setCellStyle(style);
                p_sheet.setColumnWidth(col - 1, 40 * 256);

                CellStyle commentStyle = m_rtlTargetLocale ? getUnlockedRightStyle(p_workbook)
                        : getUnlockedStyle(p_workbook);
                // Set color format for target segment changed
                if (targetSegmentModifiedDate.before(issueCreatedDate)) {
                    commentStyle = m_rtlTargetLocale ? getRedRightStyle(p_workbook) : getRedStyle(p_workbook);
                }

                if (m_rtlTargetLocale) {
                    lastComment = EditUtil.toRtlString(lastComment);
                }

                Cell cell_G = getCell(row, col++);
                cell_G.setCellValue(lastComment);
                cell_G.setCellStyle(commentStyle);
                p_sheet.setColumnWidth(col - 1, 40 * 256);

                // Category failure
                CellStyle cfStyle = getUnlockedStyle(p_workbook);

                // Set color format for target segment changed
                if (targetSegmentModifiedDate.before(issueCreatedDate)) {
                    cfStyle = getRedStyle(p_workbook);
                }

                Cell cell_H = getCell(row, col++);
                cell_H.setCellValue(failure);
                cell_H.setCellStyle(cfStyle);
                p_sheet.setColumnWidth(col - 1, 30 * 256);

                // TM match
                Cell cell_I = getCell(row, col++);
                cell_I.setCellValue(matches.toString());
                cell_I.setCellStyle(style);
                p_sheet.setColumnWidth(col - 1, 30 * 256);

                // Glossary source
                Cell cell_J = getCell(row, col++);
                cell_J.setCellValue(sourceTerms);
                cell_J.setCellStyle(style);
                p_sheet.setColumnWidth(col - 1, 30 * 256);

                // Glossary target
                Cell cell_K = getCell(row, col++);
                cell_K.setCellValue(targetTerms);
                cell_K.setCellStyle(style);
                p_sheet.setColumnWidth(col - 1, 30 * 256);
                p_row++;
            }
        }
        // Add category failure drop down list here.
        addCategoryFailureValidation(p_sheet, SEGMENT_START_ROW, p_row, CATEGORY_FAILURE_COLUMN,
                CATEGORY_FAILURE_COLUMN);
    }

    return p_row;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerLisaQAXlsReportHelper.java

License:Apache License

/**
 * Create workbook name areas for category failure drop down list, it is
 * from "AA8" to "AAn".//from   w  w  w .jav a2s .  c om
 * <P>
 * Only write the data of drop down list into the first sheet as it can be
 * referenced from all sheets.
 * </P>
 * <P>
 * The formula is like
 * "[sheetName]!$AA$[startRow]:$AA$[endRow]",i.e."TER!$AA$8:$AA$32".
 * </P>
 */
private void createCategoryFailureNameArea(Workbook p_workbook) {
    Sheet firstSheet = getSheet(p_workbook, 0);
    List<String> categories = getFailureCategoriesList();
    // Set the categories in "AA" column, starts with row 8.
    int col = 26;
    for (int i = 0; i < categories.size(); i++) {
        Row row = getRow(firstSheet, SEGMENT_START_ROW + i);
        Cell cell = getCell(row, col);
        cell.setCellValue(categories.get(i));
    }

    String formula = firstSheet.getSheetName() + "!$AA$" + (SEGMENT_START_ROW + 1) + ":$AA$"
            + (SEGMENT_START_ROW + categories.size());
    Name name = p_workbook.createName();
    name.setRefersToFormula(formula);
    name.setNameName(CATEGORY_FAILURE_DROP_DOWN_LIST);

    // Hide "AA" column
    firstSheet.setColumnHidden(26, true);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerVendorPoXlsReportHelper.java

License:Apache License

private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception {
    Font titleFont = p_workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Arial");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFont.setColor(IndexedColors.BLACK.getIndex());
    CellStyle titleStyle = p_workbook.createCellStyle();
    titleStyle.setWrapText(false);//from   ww  w. ja va  2s  .co m
    titleStyle.setFont(titleFont);

    Row titleRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(titleRow, 0);
    titleCell.setCellValue(EMEA + " " + bundle.getString("lb_reviewer_po"));
    titleCell.setCellStyle(titleStyle);
    p_sheet.setColumnWidth(0, 20 * 256);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerVendorPoXlsReportHelper.java

License:Apache License

/**
 * Adds the table header for the Dell Matches sheet
 * //from  ww w .  j  a v a 2s.c o  m
 */
private void addHeaderForDellMatches(Workbook p_workbook) throws Exception {
    Sheet theSheet = data.dellSheet;
    int c = 0;
    Row headerRow = getRow(theSheet, 2);
    Cell cell_A = getCell(headerRow, c);
    cell_A.setCellValue(bundle.getString("lb_job_id"));
    cell_A.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_B = getCell(headerRow, c);
    cell_B.setCellValue(bundle.getString("lb_job_name"));
    cell_B.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_C = getCell(headerRow, c);
    cell_C.setCellValue(bundle.getString("lb_po_number_report"));
    cell_C.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    theSheet.setColumnWidth(c, 15 * 256);
    c++;
    Cell cell_D = getCell(headerRow, c);
    cell_D.setCellValue(bundle.getString("lb_description"));
    cell_D.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    theSheet.setColumnWidth(c, 15 * 256);
    c++;
    Cell cell_E = getCell(headerRow, c);
    cell_E.setCellValue(bundle.getString("lb_creation_date"));
    cell_E.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_F = getCell(headerRow, c);
    cell_F.setCellValue(bundle.getString("lb_activity_name"));
    cell_F.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    theSheet.setColumnWidth(c, 20 * 256);
    c++;
    Cell cell_G = getCell(headerRow, c);
    cell_G.setCellValue(bundle.getString("lb_accepted_reviewer_date"));
    cell_G.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    theSheet.setColumnWidth(c, 15 * 256);
    c++;
    Cell cell_H = getCell(headerRow, c);
    cell_H.setCellValue(bundle.getString("lb_lang"));
    cell_H.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_I = getCell(headerRow, c);
    cell_I.setCellValue(bundle.getString("lb_word_count"));
    cell_I.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    theSheet.setColumnWidth(c, 15 * 256);

    c++;
    Cell cell_J = getCell(headerRow, c);
    cell_J.setCellValue(bundle.getString("jobinfo.tmmatches.invoice"));
    cell_J.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_K = getCell(headerRow, c);
    cell_K.setCellValue(bundle.getString("lb_tracking"));
    cell_K.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerVendorPoXlsReportHelper.java

License:Apache License

/**
 * Adds the table header for the Trados Matches sheet
 * /*from   w  w w  .j  a va 2  s  .c  om*/
 */
private void addHeaderForTradosMatches(Workbook p_workbook) throws Exception {
    Sheet theSheet = data.tradosSheet;
    int c = 0;
    Row secRow = getRow(theSheet, 1);
    Row thirRow = getRow(theSheet, 2);
    Row fourRow = getRow(theSheet, 3);

    Cell cell_Ldfl = getCell(secRow, 0);
    cell_Ldfl.setCellValue(bundle.getString("lb_desp_file_list"));
    cell_Ldfl.setCellStyle(getContentStyle(p_workbook));

    Cell cell_A = getCell(thirRow, c);
    cell_A.setCellValue(bundle.getString("lb_job_id"));
    cell_A.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_B = getCell(thirRow, c);
    cell_B.setCellValue(bundle.getString("lb_job"));
    cell_B.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_C = getCell(thirRow, c);
    cell_C.setCellValue(bundle.getString("lb_po_number_report"));
    cell_C.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_D = getCell(thirRow, c);
    cell_D.setCellValue(bundle.getString("lb_description"));
    cell_D.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    theSheet.setColumnWidth(c, 15 * 256);
    c++;
    Cell cell_E = getCell(thirRow, c);
    cell_E.setCellValue(bundle.getString("lb_creation_date"));
    cell_E.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_F = getCell(thirRow, c);
    cell_F.setCellValue(bundle.getString("lb_lang"));
    cell_F.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
    c++;
    Cell cell_G_Header = getCell(thirRow, c);
    cell_G_Header.setCellValue(bundle.getString("lb_word_counts"));
    cell_G_Header.setCellStyle(getHeaderStyle(p_workbook));

    if (data.headers[0] != null) {
        theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 7));
        setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 7), getHeaderStyle(p_workbook));
    } else {
        theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 6));
        setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 6), getHeaderStyle(p_workbook));
    }

    Cell cell_G = getCell(fourRow, c++);
    cell_G.setCellValue(bundle.getString("jobinfo.tradosmatches.invoice.per100matches"));
    cell_G.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_H = getCell(fourRow, c++);
    cell_H.setCellValue(bundle.getString("lb_95_99"));
    cell_H.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_I = getCell(fourRow, c++);
    cell_I.setCellValue(bundle.getString("lb_85_94"));
    cell_I.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_J = getCell(fourRow, c++);
    cell_J.setCellValue(bundle.getString("lb_75_84") + "*");
    cell_J.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_K = getCell(fourRow, c++);
    cell_K.setCellValue(bundle.getString("lb_no_match"));
    cell_K.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_L = getCell(fourRow, c++);
    cell_L.setCellValue(bundle.getString("lb_repetition_word_cnt"));
    cell_L.setCellStyle(getHeaderStyle(p_workbook));
    if (data.headers[0] != null) {
        Cell cell_InContext = getCell(fourRow, c++);
        cell_InContext.setCellValue(bundle.getString("lb_in_context_tm"));
        cell_InContext.setCellStyle(getHeaderStyle(p_workbook));
    }
    Cell cell_Total = getCell(fourRow, c++);
    cell_Total.setCellValue(bundle.getString("lb_total"));
    cell_Total.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_Invoice = getCell(thirRow, c);
    cell_Invoice.setCellValue(bundle.getString("jobinfo.tmmatches.invoice"));
    cell_Invoice.setCellStyle(getHeaderStyle(p_workbook));

    if (data.headers[0] != null) {
        theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 9));
        setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 9), getHeaderStyle(p_workbook));
    } else {
        theSheet.addMergedRegion(new CellRangeAddress(2, 2, c, c + 8));
        setRegionStyle(theSheet, new CellRangeAddress(2, 2, c, c + 8), getHeaderStyle(p_workbook));
    }

    Cell cell_Per100Matches = getCell(fourRow, c++);
    cell_Per100Matches.setCellValue(bundle.getString("jobinfo.tradosmatches.invoice.per100matches"));
    cell_Per100Matches.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_95_99 = getCell(fourRow, c++);
    cell_95_99.setCellValue(bundle.getString("lb_95_99"));
    cell_95_99.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_85_94 = getCell(fourRow, c++);
    cell_85_94.setCellValue(bundle.getString("lb_85_94"));
    cell_85_94.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_75_84 = getCell(fourRow, c++);
    cell_75_84.setCellValue(bundle.getString("lb_75_84") + "*");
    cell_75_84.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_NoMatch = getCell(fourRow, c++);
    cell_NoMatch.setCellValue(bundle.getString("lb_no_match"));
    cell_NoMatch.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_Repetition = getCell(fourRow, c++);
    cell_Repetition.setCellValue(bundle.getString("lb_repetition_word_cnt"));
    cell_Repetition.setCellStyle(getHeaderStyle(p_workbook));
    if (data.headers[0] != null) {
        Cell cell_InContext = getCell(fourRow, c++);
        cell_InContext.setCellValue(bundle.getString("lb_in_context_tm"));
        cell_InContext.setCellStyle(getHeaderStyle(p_workbook));
    }

    Cell cell_Total_Invoice = getCell(fourRow, c++);
    cell_Total_Invoice.setCellValue(bundle.getString("lb_translation_total"));
    cell_Total_Invoice.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_Review = getCell(fourRow, c++);
    cell_Review.setCellValue(bundle.getString("lb_review"));
    cell_Review.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_JobTotal = getCell(fourRow, c++);
    cell_JobTotal.setCellValue(bundle.getString("jobinfo.tmmatches.invoice.jobtotal"));
    cell_JobTotal.setCellStyle(getHeaderStyle(p_workbook));

    Cell cell_Tracking = getCell(thirRow, c);
    cell_Tracking.setCellValue(bundle.getString("lb_tracking"));
    cell_Tracking.setCellStyle(getHeaderStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(2, 3, c, c));
    setRegionStyle(theSheet, new CellRangeAddress(2, 3, c, c), getHeaderStyle(p_workbook));
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerVendorPoXlsReportHelper.java

License:Apache License

private void writeProjectDataForDellMatches(Workbook p_workbook, HashMap p_projectMap, IntHolder p_row)
        throws Exception {
    Sheet theSheet = data.dellSheet;/*  w  w  w.java2s.  c  om*/
    ArrayList projects = new ArrayList(p_projectMap.keySet());
    SortUtil.sort(projects);
    Iterator projectIter = projects.iterator();

    while (projectIter.hasNext()) {
        String jobName = (String) projectIter.next();
        boolean isWrongJob = data.wrongJobNames.contains(jobName);
        HashMap localeMap = (HashMap) p_projectMap.get(jobName);
        ArrayList locales = new ArrayList(localeMap.keySet());
        SortUtil.sort(locales);
        Iterator localeIter = locales.iterator();

        while (localeIter.hasNext()) {
            int row = p_row.getValue();
            Row theRow = getRow(theSheet, row);
            int col = 0;
            String localeName = (String) localeIter.next();
            ProjectWorkflowData data = (ProjectWorkflowData) localeMap.get(localeName);

            // Job Id
            // Job Name
            Cell cell_A = getCell(theRow, col++);
            cell_A.setCellValue(data.jobId);
            Cell cell_B = getCell(theRow, col++);
            cell_B.setCellValue(data.jobName);
            if (isWrongJob) {
                cell_A.setCellStyle(getWrongJobStyle(p_workbook));
                cell_B.setCellStyle(getWrongJobStyle(p_workbook));
            } else {
                cell_A.setCellStyle(getContentStyle(p_workbook));
                cell_B.setCellStyle(getContentStyle(p_workbook));
            }
            theSheet.setColumnWidth(col - 2, 5 * 256);
            theSheet.setColumnWidth(col - 1, 50 * 256);

            // PO Number
            Cell cell_C = getCell(theRow, col++);
            cell_C.setCellValue("");
            cell_C.setCellStyle(getContentStyle(p_workbook));

            // Description
            Cell cell_D = getCell(theRow, col++);
            cell_D.setCellValue(data.projectDesc);
            cell_D.setCellStyle(getContentStyle(p_workbook));
            theSheet.setColumnWidth(col - 1, 22 * 256);

            // Create Date
            Cell cell_E = getCell(theRow, col++);
            cell_E.setCellValue(data.creationDate);
            cell_E.setCellStyle(getDateStyle(p_workbook));
            theSheet.setColumnWidth(col - 1, 15 * 256);

            Cell cell_F = getCell(theRow, col++);
            cell_F.setCellValue(data.currentActivityName);
            cell_F.setCellStyle(getContentStyle(p_workbook));

            // Accepted Reviewer Date
            Cell cell_G = getCell(theRow, col++);
            if (data.dellReviewActivityState == Task.STATE_REJECTED) {
                cell_G.setCellValue(bundle.getString("lb_rejected"));
                cell_G.setCellStyle(getContentStyle(p_workbook));
            } else if (data.acceptedReviewerDate == null) {
                cell_G.setCellValue(bundle.getString("lb_not_accepted"));
                cell_G.setCellStyle(getContentStyle(p_workbook));
            } else {
                cell_G.setCellValue(data.acceptedReviewerDate);
                cell_G.setCellStyle(getDateStyle(p_workbook));
            }
            theSheet.setColumnWidth(col - 1, 22 * 256);

            // Lang
            Cell cell_H = getCell(theRow, col++);
            cell_H.setCellValue(data.targetLang);
            cell_H.setCellStyle(getContentStyle(p_workbook));

            // Word Count
            Cell cell_I = getCell(theRow, col++);
            cell_I.setCellValue(data.dellTotalWordCount);
            cell_I.setCellStyle(getContentStyle(p_workbook));

            // Invoice
            Cell cell_J = getCell(theRow, col++);
            if ((data.dellReviewActivityState == Task.STATE_REJECTED) || (data.acceptedReviewerDate == null)) {
                cell_J.setCellValue(0);
                cell_J.setCellStyle(getMoneyStyle(p_workbook));
            } else {
                cell_J.setCellValue(asDouble(data.dellTotalWordCountCostForDellReview));
                cell_J.setCellStyle(getMoneyStyle(p_workbook));
            }

            p_row.inc();
        }
    }

    p_row.inc();
    p_row.inc();
    addTotalsForDellMatches(p_workbook, p_row);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerVendorPoXlsReportHelper.java

License:Apache License

/** Adds totals */
private void addTotalsForDellMatches(Workbook p_workbook, IntHolder p_row) throws Exception {
    Sheet theSheet = data.dellSheet;/*w  w  w .j  a va 2  s. c  o  m*/
    // Totals
    int totalsRow = p_row.getValue() + 1; // skip a row
    Row totalRow = getRow(theSheet, totalsRow);
    Cell cell_A = getCell(totalRow, 0);
    cell_A.setCellValue(bundle.getString("lb_totals"));
    cell_A.setCellStyle(getSubTotalStyle(p_workbook));
    theSheet.addMergedRegion(new CellRangeAddress(totalsRow, totalsRow, 0, 7));
    setRegionStyle(theSheet, new CellRangeAddress(totalsRow, totalsRow, 0, 7), getSubTotalStyle(p_workbook));

    int lastRow = p_row.getValue() - 2;
    int c = 8;
    // Word Count
    Cell cell_I = getCell(totalRow, c++);
    cell_I.setCellFormula("SUM(I5" + ":I" + lastRow + ")");
    cell_I.setCellStyle(getSubTotalStyle(p_workbook));
    // Invoice
    Cell cell_J = getCell(totalRow, c++);
    cell_J.setCellFormula("SUM(J5" + ":J" + lastRow + ")");
    cell_J.setCellStyle(getTotalMoneyStyle(p_workbook));
    // add an extra column for Dell Tracking Use
    Cell cell_K = getCell(totalRow, c++);
    cell_K.setCellValue("");
    cell_K.setCellStyle(getTotalMoneyStyle(p_workbook));
}