pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1785174 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java
Date Thu, 02 Mar 2017 17:47:18 GMT
Author: tilman
Date: Thu Mar  2 17:47:18 2017
New Revision: 1785174

URL: http://svn.apache.org/viewvc?rev=1785174&view=rev
Log:
PDFBOX-2852: use switch

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java?rev=1785174&r1=1785173&r2=1785174&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/printing/PDFPageable.java Thu Mar
 2 17:47:18 2017
@@ -137,24 +137,25 @@ public final class PDFPageable extends B
         format.setPaper(paper);
         
         // auto portrait/landscape
-        if (orientation == Orientation.AUTO)
+        switch (orientation)
         {
-            if (isLandscape)
-            {
+            case AUTO:
+                if (isLandscape)
+                {
+                    format.setOrientation(PageFormat.LANDSCAPE);
+                }
+                else
+                {
+                    format.setOrientation(PageFormat.PORTRAIT);
+                }   break;
+            case LANDSCAPE:
                 format.setOrientation(PageFormat.LANDSCAPE);
-            }
-            else
-            {
+                break;
+            case PORTRAIT:
                 format.setOrientation(PageFormat.PORTRAIT);
-            }
-        }
-        else if (orientation == Orientation.LANDSCAPE)
-        {
-            format.setOrientation(PageFormat.LANDSCAPE);
-        }
-        else if (orientation == Orientation.PORTRAIT)
-        {
-            format.setOrientation(PageFormat.PORTRAIT);
+                break;
+            default:
+                break;
         }
         
         return format;



Mime
View raw message