From b749f86953463ef33544967c4b24c3f5e8cf0f49 Mon Sep 17 00:00:00 2001 From: Henning von Bargen Date: Mon, 18 Nov 2024 09:52:53 +0100 Subject: [PATCH] Remove German texts, fix some typos, remove unnecessary overiden methods, improve error handling --- .../engine/emitter/pdf/PDFPageDevice.java | 15 ++++------ .../report/engine/emitter/pdf/PDFRender.java | 30 ------------------- .../engine/content/impl/CellContent.java | 6 ++-- .../engine/nLayout/area/impl/TextArea.java | 2 +- 4 files changed, 10 insertions(+), 43 deletions(-) diff --git a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPageDevice.java b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPageDevice.java index 3e5fcbd2d63..14ff5d7faf9 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPageDevice.java +++ b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPageDevice.java @@ -953,10 +953,10 @@ private byte[] createXmpMetadataBytes() { continue; if (PdfName.TITLE.equals(key)) { // The XMPMetadata allows defining the title for different languages. - // We add the title in the default language - // and a german translation of the title. + // We add the title in the default language. LangAlt langAlt = new LangAlt(((PdfString) obj).toUnicodeString()); - langAlt.addLanguage("de_DE", "Das ist der Titel für deutsche Leser"); + // Example: How to add a translation of the title in a different language. + // langAlt.addLanguage("de_DE", "Das ist der Titel für deutsche Leser"); dc.setProperty(DublinCoreSchema.TITLE, langAlt); } if (PdfName.AUTHOR.equals(key)) { @@ -1076,7 +1076,7 @@ private void setPdfIccXmp() { } try { - // PDF create the xmp metaddata based on the document information + // PDF create the XMP metadata based on the document information byte[] xmpMetadata = this.createXmpMetadataBytes(); writer.setXmpMetadata(xmpMetadata); } catch (Exception e) { @@ -1192,7 +1192,6 @@ public void pushTag(String tagType, IArea area) { if (!writer.isTagged()) { return; } -// logger.finest("pushTag " + tagType); if ("pageHeader".equals(tagType)) { currentPage.beginArtifact(); } else if ("pageFooter".equals(tagType)) { @@ -1280,8 +1279,7 @@ private PdfName pdfScope(String scope) { if ("row".equals(scope)) { return new PdfName("Row"); } - // FIXME better error handling - System.err.println("Unsupported scope: " + scope); + logger.warning("Unsupported scope: " + scope); return null; } @@ -1292,7 +1290,6 @@ public void popTag(String tagType) { if (!writer.isTagged()) { return; } -// logger.finest("popTag " + tagType); if ("pageHeader".equals(tagType)) { currentPage.endArtifact(); } else if ("pageFooter".equals(tagType)) { @@ -1305,7 +1302,7 @@ public void popTag(String tagType) { } /** - * if the writer is expected to create tagged PDF.. + * Is the writer is expected to create tagged PDF or not? */ public boolean isTagged() { return writer.isTagged(); diff --git a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFRender.java b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFRender.java index 69ceae3f348..40622312ca1 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFRender.java +++ b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFRender.java @@ -106,8 +106,6 @@ public void visitImage(IImageArea imageArea) { @Override public void visitText(ITextArea textArea) { -// if (logger.isLoggable(Level.FINEST)) -// logger.finest("visitText " + textArea.getText()); super.visitText(textArea); int x = currentX + getX(textArea); int y = currentY + getY(textArea); @@ -157,13 +155,9 @@ public void end(IReportContent rc) { @Override protected void drawContainer(IContainerArea container) { - - // FIXME Warum wird das zweimal aufgerufen? - super.drawContainer(container); int x = currentX + getX(container); int y = currentY + getY(container); - createBookmark(container, x, y); createHyperlink(container, x, y); } @@ -275,18 +269,8 @@ protected void createBookmark(IArea area, int x, int y) { } } - @Override - public void visitContainer(IContainerArea container) { -// if (logger.isLoggable(Level.FINEST)) -// logger.finest("visitContainer " + container.toString() + " tagType=" + container.getTagType()); - super.visitContainer(container); - } - @Override protected void visitChildren(IContainerArea container) { -// if (logger.isLoggable(Level.FINEST)) -// logger.finest("visitChildren " + container.toString() + " tagType=" + container.getTagType()); - String tagType = null; if (currentPageDevice.isTagged()) { if (container.getChildrenCount() > 0) { @@ -302,20 +286,6 @@ protected void visitChildren(IContainerArea container) { } } - @Override - protected void startContainer(IContainerArea container) { -// if (logger.isLoggable(Level.FINEST)) -// logger.finest("startContainer " + container.toString() + " tagType=" + container.getTagType()); - super.startContainer(container); - } - - @Override - protected void endContainer(IContainerArea container) { -// if (logger.isLoggable(Level.FINEST)) -// logger.finest("endContainer " + container.toString() + " tagType=" + container.getTagType()); - super.endContainer(container); - } - private void createTOC() { currentPageDevice.createTOC(bookmarks); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/impl/CellContent.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/impl/CellContent.java index 388776ed5a3..824b9e12ce4 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/impl/CellContent.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/impl/CellContent.java @@ -59,7 +59,7 @@ public class CellContent extends AbstractContent implements ICellContent { protected int column = -1; /** - * Flag indicading if this cell is the start of a group. + * Flag indicating if this cell is the start of a group. */ protected Boolean displayGroupIcon; @@ -198,7 +198,7 @@ public int getRow() { } /** - * Set te drop property + * Set the drop property * * @param drop drop value */ @@ -645,7 +645,7 @@ public String getHeaders() { return (String) exeContext.evaluate(expr); } catch (BirtException be) { be.printStackTrace(); - // FIXME correct error handling + exeContext.addException(be); return null; } } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextArea.java index 5ba0f715757..b78d89bdb21 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextArea.java @@ -444,4 +444,4 @@ public boolean isLastInLine() { return lastInLine; } -} \ No newline at end of file +}