List of usage examples for org.apache.poi.ss.usermodel Cell setCellValue
void setCellValue(boolean value);
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CharacterCountReportGenerator.java
License:Apache License
/** * Add title to the sheet/*from w w w. j a v a 2 s . c om*/ * * @param p_workBook * @param p_sheet * the sheet * @throws Exception */ private void addTitle(Workbook p_workBook, Sheet p_sheet) throws Exception { ResourceBundle bundle = m_bundle; // 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); CellStyle cs = p_workBook.createCellStyle(); cs.setFont(titleFont); Row titleRow = getRow(p_sheet, 0); Cell titleCell = getCell(titleRow, 0); titleCell.setCellValue(bundle.getString("character_count_report")); titleCell.setCellStyle(cs); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CharacterCountReportGenerator.java
License:Apache License
/** * Add job header to the sheet/* ww w . java 2s . co m*/ * * @param p_workBook * @param p_sheet * the sheet * @throws Exception */ private void addLanguageHeader(Workbook p_workBook, Sheet p_sheet) throws Exception { ResourceBundle bundle = m_bundle; int col = 0; int row = LANGUAGE_HEADER_ROW; Row langRow = getRow(p_sheet, row); Cell srcLangCell = getCell(langRow, col); srcLangCell.setCellValue(bundle.getString("lb_source_language")); srcLangCell.setCellStyle(getHeaderStyle(p_workBook)); col++; Cell trgLangCell = getCell(langRow, col); trgLangCell.setCellValue(bundle.getString("lb_target_language")); trgLangCell.setCellStyle(getHeaderStyle(p_workBook)); col++; Cell jobIdCell = getCell(langRow, col); jobIdCell.setCellValue(bundle.getString("jobinfo.jobid")); jobIdCell.setCellStyle(getHeaderStyle(p_workBook)); col++; Cell TotalSegmentsCell = getCell(langRow, col); TotalSegmentsCell.setCellValue(bundle.getString("lb_segmentCount_in_job")); TotalSegmentsCell.setCellStyle(getHeaderStyle(p_workBook)); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CharacterCountReportGenerator.java
License:Apache License
/** * Add segment header to the sheet//from www .j ava2 s .c o m * * @param p_workBook * @param p_sheet * the sheet * @throws Exception */ private void addSegmentHeader(Workbook p_workBook, Sheet p_sheet) throws Exception { ResourceBundle bundle = m_bundle; int col = 0; int row = SEGMENT_HEADER_ROW; Row segHeaderRow = getRow(p_sheet, row); Cell cell_A = getCell(segHeaderRow, col); cell_A.setCellValue(bundle.getString("lb_segment_id")); cell_A.setCellStyle(getHeaderStyle(p_workBook)); p_sheet.setColumnWidth(col, 20 * 256); col++; Cell cell_PathAndName = getCell(segHeaderRow, col); cell_PathAndName.setCellValue(bundle.getString("lb_file_path_and_name")); cell_PathAndName.setCellStyle(getHeaderStyle(p_workBook)); p_sheet.setColumnWidth(col, 40 * 256); col++; Cell cell_B = getCell(segHeaderRow, col); cell_B.setCellValue(bundle.getString("lb_source_segment")); cell_B.setCellStyle(getHeaderStyle(p_workBook)); p_sheet.setColumnWidth(col, 40 * 256); col++; Cell cell_C = getCell(segHeaderRow, col); cell_C.setCellValue(bundle.getString("lb_source_character_count")); cell_C.setCellStyle(getHeaderStyle(p_workBook)); p_sheet.setColumnWidth(col, 30 * 256); col++; Cell cell_D = getCell(segHeaderRow, col); cell_D.setCellValue(bundle.getString("lb_target_segment")); cell_D.setCellStyle(getHeaderStyle(p_workBook)); p_sheet.setColumnWidth(col, 40 * 256); col++; Cell cell_E = getCell(segHeaderRow, col); cell_E.setCellValue(bundle.getString("lb_target_character_count")); cell_E.setCellStyle(getHeaderStyle(p_workBook)); p_sheet.setColumnWidth(col, 30 * 256); col++; Cell cell_F = getCell(segHeaderRow, col); cell_F.setCellValue(bundle.getString("lb_tm_match_original")); cell_F.setCellStyle(getHeaderStyle(p_workBook)); p_sheet.setColumnWidth(col, 30 * 256); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CharacterCountReportGenerator.java
License:Apache License
/** * Write the Job information into the header * /*from w w w. java 2 s .c om*/ * @param p_workbook * workbook * @param p_sheet * sheet * @param p_sourceLang * the displayed source language * @param p_targetLang * the displayed target language * @param p_job * the job * @throws Exception */ private void writeLanguageInfo(Workbook p_workbook, Sheet p_sheet, String p_sourceLang, String p_targetLang, Job p_job) throws Exception { int col = 0; int row = LANGUAGE_INFO_ROW; Row langInfoRow = getRow(p_sheet, row); // Source Language Cell srcLangCell = getCell(langInfoRow, col++); srcLangCell.setCellValue(p_sourceLang); srcLangCell.setCellStyle(getContentStyle(p_workbook)); // Target Language Cell trgLangCell = getCell(langInfoRow, col++); trgLangCell.setCellValue(p_targetLang); trgLangCell.setCellStyle(getContentStyle(p_workbook)); // Job ID Cell jobIdCell = getCell(langInfoRow, col++); jobIdCell.setCellValue(p_job.getId()); jobIdCell.setCellStyle(getContentStyle(p_workbook)); //total SegmentCount Cell totalSegmentsCell = getCell(langInfoRow, col++); totalSegmentsCell.setCellStyle(getContentStyle(p_workbook)); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CharacterCountReportGenerator.java
License:Apache License
/** * Write segment information into each row of the sheet * /*from w ww .jav a 2 s .c o m*/ * @param p_workBook * the workBook * @param p_sheet * the sheet * @param p_job * the job data for report * @param p_targetLang * the target language * @param p_srcPageId * the source page id * @param p_row * the segment row in sheet * @throws Exception */ private void writeCharacterCountSegmentInfo(Workbook p_workBook, Sheet p_sheet, Job p_job, GlobalSightLocale trgLocale, String p_srcPageId, int p_row) throws Exception { Vector<TargetPage> targetPages = new Vector<TargetPage>(); TranslationMemoryProfile tmp = null; Vector<String> excludItems = null; long jobId = p_job.getId(); String p_targetLang = trgLocale.getDisplayName(m_uiLocale); for (Workflow workflow : p_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(workflow.getTargetLocale().getDisplayName())) { targetPages = workflow.getTargetPages(); tmp = workflow.getJob().getL10nProfile().getTranslationMemoryProfile(); if (tmp != null) { excludItems = tmp.getJobExcludeTuTypes(); } } } if (!targetPages.isEmpty()) { String category = null; String sourceSegmentString = null; String targetSegmentString = null; Locale sourcePageLocale = p_job.getSourceLocale().getLocale(); Locale targetPageLocale = trgLocale.getLocale(); LeverageMatchLingManager leverageMatchLingManager = LingServerProxy.getLeverageMatchLingManager(); 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; } // Leverage TM MatchTypeStatistics tuvMatchTypes = leverageMatchLingManager.getMatchTypesForStatistics( sourcePage.getIdAsLong(), targetPage.getLocaleId(), p_job.getLeverageMatchThreshold()); Map<Long, Set<LeverageMatch>> fuzzyLeverageMatcheMap = leverageMatchLingManager .getFuzzyMatches(sourcePage.getIdAsLong(), targetPage.getLocaleId()); SegmentTuUtil.getTusBySourcePageId(sourcePage.getId()); boolean m_rtlSourceLocale = EditUtil.isRTLLocale(sourcePageLocale.toString()); boolean m_rtlTargetLocale = EditUtil.isRTLLocale(targetPageLocale.toString()); List sourceTuvs = SegmentTuvUtil.getSourceTuvs(sourcePage); List targetTuvs = SegmentTuvUtil.getTargetTuvs(targetPage); PseudoData pData = new PseudoData(); pData.setMode(PseudoConstants.PSEUDO_COMPACT); for (int j = 0; j < targetTuvs.size(); j++) { int col = 0; Tuv targetTuv = (Tuv) targetTuvs.get(j); Tuv sourceTuv = (Tuv) sourceTuvs.get(j); sourceSegmentString = sourceTuv.getGxmlElement().getTextValue(); targetSegmentString = targetTuv.getGxmlElement().getTextValue(); category = sourceTuv.getTu(p_job.getId()).getTuType(); if (excludItems != null && excludItems.contains(category)) { continue; } StringBuilder matches = getMatches(fuzzyLeverageMatcheMap, tuvMatchTypes, excludItems, sourceTuvs, targetTuvs, sourceTuv, targetTuv, p_job.getId()); CellStyle contentStyle = getContentStyle(p_workBook); Row currentRow = getRow(p_sheet, p_row); // Segment id Cell cell_A = getCell(currentRow, col); cell_A.setCellValue(sourceTuv.getTu(jobId).getId()); cell_A.setCellStyle(contentStyle); col++; //File Path and Name String filePathName = targetPage.getSourcePage().getExternalPageId(); filePathName = filePathName.replace("\\", "/"); if (filePathName.indexOf("/") > -1) { filePathName = filePathName.substring( filePathName.indexOf("/" + (int) jobId + "/") + Long.toString(jobId).length() + 2, filePathName.length()); } Cell cell_PathAndName = getCell(currentRow, col); cell_PathAndName.setCellValue(filePathName); cell_PathAndName.setCellStyle(contentStyle); col++; // Source segment Cell cell_B = getCell(currentRow, col); cell_B.setCellValue(getSegment(pData, sourceTuv, m_rtlSourceLocale, jobId)); cell_B.setCellStyle(contentStyle); col++; ; // Source Character count Cell cell_C = getCell(currentRow, col); cell_C.setCellValue(sourceSegmentString.length()); cell_C.setCellStyle(contentStyle); col++; // Target segment Cell cell_D = getCell(currentRow, col); cell_D.setCellValue(getSegment(pData, targetTuv, m_rtlTargetLocale, jobId)); cell_D.setCellStyle(contentStyle); col++; // Target Character count Cell cell_E = getCell(currentRow, col); cell_E.setCellValue(targetSegmentString.length()); cell_E.setCellStyle(contentStyle); col++; // TM match Cell cell_F = getCell(currentRow, col); cell_F.setCellValue(matches.toString()); cell_F.setCellStyle(contentStyle); p_row++; } } } totalSegmentCount.put(p_targetLang, p_row - 7); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CommentsAnalysisReportGenerator.java
License:Apache License
/** * Add segment header to the sheet for Comments Analysis Report * /* www . j av a 2 s . c om*/ * @param p_workBook * @param p_sheet * the sheet * @throws Exception */ private void addSegmentHeader(Workbook p_workBook, Sheet p_sheet) throws Exception { int col = 0; int row = SEGMENT_HEADER_ROW; Row segHeaderRow = getRow(p_sheet, row); CellStyle headerStyle = getHeaderStyle(p_workBook); Cell cell_A = getCell(segHeaderRow, col); cell_A.setCellValue(bundle.getString("lb_job_id_report")); cell_A.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 20 * 256); col++; Cell cell_B = getCell(segHeaderRow, col); cell_B.setCellValue(bundle.getString("lb_segment_id")); cell_B.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 20 * 256); col++; Cell cell_C = getCell(segHeaderRow, col); cell_C.setCellValue(bundle.getString("lb_targetpage_id")); cell_C.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 20 * 256); col++; Cell cell_D = getCell(segHeaderRow, col); cell_D.setCellValue(bundle.getString("lb_source_segment")); cell_D.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 40 * 256); col++; Cell cell_E = getCell(segHeaderRow, col); cell_E.setCellValue(bundle.getString("lb_target_segment")); cell_E.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 40 * 256); col++; Cell cell_F = getCell(segHeaderRow, col); cell_F.setCellValue(bundle.getString("lb_sid")); cell_F.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 40 * 256); col++; Cell cell_G = getCell(segHeaderRow, col); cell_G.setCellValue(bundle.getString("lb_character_count")); cell_G.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 30 * 256); col++; Cell cell_H = getCell(segHeaderRow, col); cell_H.setCellValue(bundle.getString("lb_comments")); cell_H.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 40 * 256); col++; Cell cell_I = getCell(segHeaderRow, col); cell_I.setCellValue(bundle.getString("lb_category_failure")); cell_I.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 30 * 256); col++; Cell cell_J = getCell(segHeaderRow, col); cell_J.setCellValue(bundle.getString("lb_tm_match_original")); cell_J.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 30 * 256); col++; Cell cell_K = getCell(segHeaderRow, col); cell_K.setCellValue(bundle.getString("lb_glossary_source")); cell_K.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 30 * 256); col++; Cell cell_L = getCell(segHeaderRow, col); cell_L.setCellValue(bundle.getString("lb_glossary_target")); cell_L.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 30 * 256); col++; Cell cell_M = getCell(segHeaderRow, col); cell_M.setCellValue(bundle.getString("lb_previous_segment_report")); cell_M.setCellStyle(headerStyle); p_sheet.setColumnWidth(col, 40 * 256); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CommentsAnalysisReportGenerator.java
License:Apache License
/** * Add job header to the sheet/*from www.j ava 2s . c om*/ * * @param p_workBook * @param p_sheet * the sheet * @throws Exception */ private void addLanguageHeader(Workbook p_workBook, Sheet p_sheet) throws Exception { int col = 0; int row = LANGUAGE_HEADER_ROW; Row langRow = getRow(p_sheet, row); Cell srcLangCell = getCell(langRow, col); srcLangCell.setCellValue(bundle.getString("lb_source_language")); srcLangCell.setCellStyle(getHeaderStyle(p_workBook)); col++; Cell trgLangCell = getCell(langRow, col); trgLangCell.setCellValue(bundle.getString("lb_target_language")); trgLangCell.setCellStyle(getHeaderStyle(p_workBook)); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CommentsAnalysisReportGenerator.java
License:Apache License
/** * Add title to the sheet/*from w ww . j a va2 s. c o m*/ * * @param p_workBook * @param p_sheet * the sheet * @throws Exception */ private void addTitle(Workbook p_workBook, Sheet p_sheet) throws Exception { Row titleRow = getRow(p_sheet, 0); Cell titleCell = getCell(titleRow, 0); titleCell.setCellValue(bundle.getString("review_comments")); titleCell.setCellStyle(getTitleStyle(p_workBook)); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CommentsAnalysisReportGenerator.java
License:Apache License
/** * For Comments Analysis Report, Write segment information into each row of * the sheet.//from ww w . j a va 2 s . com * * @param p_workBook * the workBook * @param p_sheet * the sheet * @param p_job * the job data for report * @param p_targetLocale * the target locale * @param p_dateFormat * the dateFormat * @param p_row * the segment row in sheet * @throws Exception */ @SuppressWarnings("unchecked") private int writeSegmentInfo(Workbook p_workBook, Sheet p_sheet, Job p_job, GlobalSightLocale p_targetLocale, String p_dateFormat, int p_row) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat(p_dateFormat); Vector<TargetPage> targetPages = new Vector<TargetPage>(); long jobId = p_job.getId(); TranslationMemoryProfile tmp = p_job.getL10nProfile().getTranslationMemoryProfile(); Vector<String> excludItems = null; for (Workflow workflow : p_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_targetLocale.getId() == workflow.getTargetLocale().getId()) { targetPages = workflow.getTargetPages(); tmp = workflow.getJob().getL10nProfile().getTranslationMemoryProfile(); if (tmp != null) { excludItems = tmp.getJobExcludeTuTypes(); } } } if (!targetPages.isEmpty()) { LeverageMatchLingManager leverageMatchLingManager = LingServerProxy.getLeverageMatchLingManager(); TermLeverageManager termLeverageManager = ServerProxy.getTermLeverageManager(); Map<Long, Set<TermLeverageMatch>> termLeverageMatchResultMap = termLeverageManager .getTermMatchesForPages(p_job.getSourcePages(), p_targetLocale); TargetPage targetPage = null; SourcePage sourcePage = null; String sourceSegmentString = null; String targetSegmentString = null; String sid = null; for (int i = 0; i < targetPages.size(); i++) { targetPage = (TargetPage) targetPages.get(i); sourcePage = targetPage.getSourcePage(); SegmentTuUtil.getTusBySourcePageId(sourcePage.getId()); List sourceTuvs = SegmentTuvUtil.getSourceTuvs(sourcePage); List targetTuvs = SegmentTuvUtil.getTargetTuvs(targetPage); // Leverage TM MatchTypeStatistics tuvMatchTypes = leverageMatchLingManager.getMatchTypesForStatistics( sourcePage.getIdAsLong(), targetPage.getLocaleId(), p_job.getLeverageMatchThreshold()); Map<Long, Set<LeverageMatch>> fuzzyLeverageMatcheMap = leverageMatchLingManager .getFuzzyMatches(sourcePage.getIdAsLong(), targetPage.getLocaleId()); // Find segment comments Map<Long, IssueImpl> issuesMap = CommentHelper.getIssuesMap(targetPage.getId()); // tuvId : Tuv Map<Long, Tuv> allTuvMap = this.getAllTuvsMap(targetPage); Locale sourcePageLocale = sourcePage.getGlobalSightLocale().getLocale(); Locale targetPageLocale = targetPage.getGlobalSightLocale().getLocale(); boolean rtlSourceLocale = EditUtil.isRTLLocale(sourcePageLocale.toString()); boolean rtlTargetLocale = EditUtil.isRTLLocale(targetPageLocale.toString()); String category = null; for (int j = 0; j < targetTuvs.size(); j++) { int col = 0; Tuv targetTuv = (Tuv) targetTuvs.get(j); Tuv sourceTuv = (Tuv) sourceTuvs.get(j); sourceSegmentString = sourceTuv.getGxmlElement().getTextValue(); targetSegmentString = targetTuv.getGxmlElement().getTextValue(); sid = sourceTuv.getSid(); category = sourceTuv.getTu(jobId).getTuType(); if (excludItems != null && excludItems.contains(category)) { continue; } StringBuilder matches = getMatches(fuzzyLeverageMatcheMap, tuvMatchTypes, excludItems, sourceTuvs, targetTuvs, sourceTuv, targetTuv, p_job.getId()); List<IssueHistory> issueHistories = new ArrayList<IssueHistory>(); String failure = ""; Issue issue = issuesMap.get(targetTuv.getId()); if (issue != null) { issueHistories = issue.getHistory(); failure = issue.getCategory(); } StringBuilder comments = new StringBuilder(); for (int k = 0; k < issueHistories.size(); k++) { IssueHistory issueHistory = (IssueHistory) issueHistories.get(k); String date = dateFormat.format(issueHistory.dateReportedAsDate()); comments.append("[").append(date).append(" ") .append(UserUtil.getUserNameById(issueHistory.reportedBy())).append("]:\r\n") .append(issueHistory.getComment()); if (k != issueHistories.size() - 1) { comments.append("\r\n"); } } // Get Terminology/Glossary Source and Target. String sourceTerms = ""; String targetTerms = ""; if (termLeverageMatchResultMap != null) { Set<TermLeverageMatch> termLeverageMatchSet = termLeverageMatchResultMap .get(sourceTuv.getId()); if (termLeverageMatchSet != null) { TermLeverageMatch tlm = termLeverageMatchSet.iterator().next(); sourceTerms = tlm.getMatchedSourceTerm(); targetTerms = tlm.getMatchedTargetTerm(); } } CellStyle contentStyle = getContentStyle(p_workBook); Row currentRow = getRow(p_sheet, p_row); // Job id Cell cell_A = getCell(currentRow, col); cell_A.setCellValue(p_job.getId()); cell_A.setCellStyle(contentStyle); col++; // Segment id Cell cell_B = getCell(currentRow, col); cell_B.setCellValue(sourceTuv.getTu(jobId).getId()); cell_B.setCellStyle(contentStyle); col++; // TargetPage id Cell cell_C = getCell(currentRow, col); cell_C.setCellValue(targetPage.getId()); cell_C.setCellStyle(contentStyle); col++; // Source segment CellStyle srcStyle = rtlSourceLocale ? getRtlContentStyle(p_workBook) : contentStyle; String srcContent = rtlSourceLocale ? EditUtil.toRtlString(sourceSegmentString) : sourceSegmentString; Cell cell_D = getCell(currentRow, col); cell_D.setCellValue(srcContent); cell_D.setCellStyle(srcStyle); col++; // Target segment CellStyle trgStyle = rtlTargetLocale ? getRtlContentStyle(p_workBook) : contentStyle; String content = rtlTargetLocale ? EditUtil.toRtlString(targetSegmentString) : targetSegmentString; Cell cell_E = getCell(currentRow, col); cell_E.setCellValue(content); cell_E.setCellStyle(trgStyle); col++; // Sid Cell cell_F = getCell(currentRow, col); cell_F.setCellValue(sid); cell_F.setCellStyle(contentStyle); col++; // Character count Cell cell_G = getCell(currentRow, col); cell_G.setCellValue(targetSegmentString.length()); cell_G.setCellStyle(contentStyle); col++; // Comments CellStyle commentStyle = rtlTargetLocale ? getUnlockedRightStyle(p_workBook) : getUnlockedStyle(p_workBook); String commentContent = rtlTargetLocale ? EditUtil.toRtlString(comments.toString()) : comments.toString(); Cell cell_H = getCell(currentRow, col); cell_H.setCellValue(commentContent); cell_H.setCellStyle(commentStyle); col++; // Category failure CellStyle unlockedStyle = getUnlockedStyle(p_workBook); Cell cell_I = getCell(currentRow, col); cell_I.setCellValue(failure); cell_I.setCellStyle(unlockedStyle); col++; // TM match Cell cell_J = getCell(currentRow, col); cell_J.setCellValue(matches.toString()); cell_J.setCellStyle(contentStyle); col++; // Glossary source Cell cell_K = getCell(currentRow, col); cell_K.setCellValue(sourceTerms); cell_K.setCellStyle(contentStyle); col++; // Glossary target Cell cell_L = getCell(currentRow, col); cell_L.setCellValue(targetTerms); cell_L.setCellStyle(contentStyle); col++; // Previous segment String previousSegments = getPreviousSegments(allTuvMap, targetTuv.getId(), targetSegmentString, jobId); Cell cell_M = getCell(currentRow, col); cell_M.setCellValue(previousSegments); cell_M.setCellStyle(contentStyle); p_row++; } SegmentTuTuvCacheManager.clearCache(); sourceTuvs = null; targetTuvs = null; fuzzyLeverageMatcheMap = null; issuesMap = null; allTuvMap = null; } // Add category failure drop down list here. addCategoryFailureValidation(p_sheet, SEGMENT_START_ROW, p_row, CATEGORY_FAILURE_COLUMN, CATEGORY_FAILURE_COLUMN); termLeverageMatchResultMap = null; } return p_row; }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.CommentsAnalysisReportGenerator.java
License:Apache License
private void addCriteriaSheet(Workbook p_workbook, List<Job> p_jobsList, Set<String> stateSet, Set<String> projectSet) throws Exception { Sheet sheet = p_workbook.createSheet(bundle.getString("lb_criteria")); StringBuffer temp = new StringBuffer(); int row = 0;// www .j a v a2s. com int headerColumn = 1; int valueColumn = 2; Row targetLocalesRow = getRow(sheet, row++); Row statusRow = getRow(sheet, row++); Row projectRow = getRow(sheet, row++); Row dateRangeRow = getRow(sheet, row++); Row jobsRow = getRow(sheet, row); Cell cell_TargetLocales = getCell(targetLocalesRow, headerColumn); cell_TargetLocales.setCellValue(bundle.getString("lb_report_target_locales")); cell_TargetLocales.setCellStyle(getContentStyle(p_workbook)); sheet.setColumnWidth(headerColumn, 20 * 256); Cell cell_Status = getCell(statusRow, headerColumn); cell_Status.setCellValue(bundle.getString("job_status")); cell_Status.setCellStyle(getContentStyle(p_workbook)); Cell cell_Project = getCell(projectRow, headerColumn); cell_Project.setCellValue(bundle.getString("lb_report_project")); cell_Project.setCellStyle(getContentStyle(p_workbook)); Cell cell_DateRange = getCell(dateRangeRow, headerColumn); cell_DateRange.setCellValue(bundle.getString("lb_report_date_range")); cell_DateRange.setCellStyle(getContentStyle(p_workbook)); Cell cell_Jobs = getCell(jobsRow, headerColumn); cell_Jobs.setCellValue(bundle.getString("lb_jobs")); cell_Jobs.setCellStyle(getContentStyle(p_workbook)); //locale Set<String> localeSet = rowsMap.keySet(); for (String locale : localeSet) { temp.append(locale + "\n"); } Cell cell_TargetLocalesValue = getCell(targetLocalesRow, valueColumn); cell_TargetLocalesValue.setCellValue(temp.substring(0, temp.length() - 1)); cell_TargetLocalesValue.setCellStyle(getContentStyle(p_workbook)); sheet.setColumnWidth(valueColumn, 45 * 256); //status temp.setLength(0); for (String status : stateSet) { temp.append(status + "\n"); } Cell cell_StatusValue = getCell(statusRow, valueColumn); cell_StatusValue.setCellValue(temp.substring(0, temp.length() - 1)); cell_StatusValue.setCellStyle(getContentStyle(p_workbook)); //project temp.setLength(0); for (String status : projectSet) { temp.append(status + "\n"); } Cell cell_ProjectValue = getCell(projectRow, valueColumn); cell_ProjectValue.setCellValue(temp.substring(0, temp.length() - 1)); cell_ProjectValue.setCellStyle(getContentStyle(p_workbook)); //date range temp.setLength(0); String startCount = request.getParameter(JobSearchConstants.CREATION_START); if (startCount != null && startCount != "") { temp.append("Starts:" + startCount + "\n"); } String endCount = request.getParameter(JobSearchConstants.CREATION_END); if (endCount != null && endCount != "") { temp.append("Ends:" + endCount); } Cell cell_DateRangeValue = getCell(dateRangeRow, valueColumn); cell_DateRangeValue.setCellValue(temp.toString()); cell_DateRangeValue.setCellStyle(getContentStyle(p_workbook)); //jobs int jobRowNum = 4; for (Job job : p_jobsList) { Cell cell_JobValue = getCell(getRow(sheet, jobRowNum++), valueColumn); cell_JobValue.setCellValue(job.getJobId() + "," + job.getJobName()); cell_JobValue.setCellStyle(getContentStyle(p_workbook)); } }