diff options
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java index 5b8ae4db..59bbed32 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java @@ -69,8 +69,9 @@ class PageEvent extends PdfPageEventHelper { private PdfBean pb; private int pageNo = 0; - private int omit_page_count = 0; - private int DEFAULT_LOGO_SIZE = 100; + private int omitPageCount = 0; + private int defaultLogoSize = 100; + private static String nLogo = "<no logo>"; public PageEvent(PdfBean pb) { this.pb = pb; @@ -79,10 +80,10 @@ class PageEvent extends PdfPageEventHelper { private int getHowManyLogos(){ int howManyLogos = 0; - if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase("<no logo>")) + if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase(nLogo)) howManyLogos ++; - if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase("<no logo>")) + if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase(nLogo)) howManyLogos ++; return howManyLogos; @@ -121,16 +122,16 @@ class PageEvent extends PdfPageEventHelper { PdfPTable foot = new PdfPTable(widths); - if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase("<no logo>")) - addLogo(foot, font, pb.getLogo1Url().substring(pb.getLogo1Url().indexOf("|") + 1).trim(), Cell.ALIGN_LEFT, pb.getLogo1Size() == null ? DEFAULT_LOGO_SIZE : pb.getLogo1Size()); + if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase(nLogo)) + addLogo(foot, font, pb.getLogo1Url().substring(pb.getLogo1Url().indexOf("|") + 1).trim(), Cell.ALIGN_LEFT, pb.getLogo1Size() == null ? defaultLogoSize : pb.getLogo1Size()); PdfPCell spacingCell = new PdfPCell(); spacingCell.setBorderColor(Color.WHITE); foot.addCell(spacingCell); //Using logo1 size for now - use logo2 size if it is required to deal it separately. - if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase("<no logo>")) - addLogo(foot, font, pb.getLogo2Url().substring(pb.getLogo2Url().indexOf("|") + 1).trim(), Cell.ALIGN_RIGHT, pb.getLogo2Size() == null ? DEFAULT_LOGO_SIZE : pb.getLogo2Size()); + if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase(nLogo)) + addLogo(foot, font, pb.getLogo2Url().substring(pb.getLogo2Url().indexOf("|") + 1).trim(), Cell.ALIGN_RIGHT, pb.getLogo2Size() == null ? defaultLogoSize : pb.getLogo2Size()); foot.setTotalWidth(getPageWidth(document)); foot.writeSelectedRows(0, -1, 36, 600, writer.getDirectContent()); @@ -167,19 +168,19 @@ class PageEvent extends PdfPageEventHelper { pageNo++; PdfContentByte cb = writer.getDirectContent(); PdfDestination destination = new PdfDestination(PdfDestination.FITH); - String bookmark = "Data Page " + (pageNo - omit_page_count); + String bookmark = "Data Page " + (pageNo - omitPageCount); if (pageNo == 1) { if (pb.isCoverPageIncluded()) { bookmark = "Cover Page"; - omit_page_count++; + omitPageCount++; } else if (pb.isDisplayChart()) { bookmark = "Chart"; - omit_page_count++; + omitPageCount++; } } if (pageNo == 2 && pb.isCoverPageIncluded() && pb.isDisplayChart()) { bookmark = "Chart"; - omit_page_count++; + omitPageCount++; } PdfOutline outline = new PdfOutline(cb.getRootOutline(), destination, bookmark); |