pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1867855 - in /pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger: hexviewer/HexPane.java ui/PDFTreeCellRenderer.java
Date Tue, 01 Oct 2019 18:04:28 GMT
Author: tilman
Date: Tue Oct  1 18:04:28 2019
New Revision: 1867855

URL: http://svn.apache.org/viewvc?rev=1867855&view=rev
Log:
PDFBOX-4071: use jdk8 lambda expressions; simplify code

Modified:
    pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/hexviewer/HexPane.java
    pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/PDFTreeCellRenderer.java

Modified: pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/hexviewer/HexPane.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/hexviewer/HexPane.java?rev=1867855&r1=1867854&r2=1867855&view=diff
==============================================================================
--- pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/hexviewer/HexPane.java
(original)
+++ pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/hexviewer/HexPane.java
Tue Oct  1 18:04:28 2019
@@ -219,18 +219,12 @@ class HexPane extends JPanel implements
 
     private void fireSelectionChanged(SelectEvent event)
     {
-        for (SelectionChangeListener listener:selectionChangeListeners)
-        {
-            listener.selectionChanged(event);
-        }
+        selectionChangeListeners.forEach(listener -> listener.selectionChanged(event));
     }
 
     private void fireHexValueChanged(byte value, int index)
     {
-        for (HexChangeListener listener:hexChangeListeners)
-        {
-            listener.hexChanged(new HexChangedEvent(value, index));
-        }
+        hexChangeListeners.forEach(listener -> listener.hexChanged(new HexChangedEvent(value,
index)));
     }
 
     public void addSelectionChangeListener(SelectionChangeListener listener)

Modified: pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/PDFTreeCellRenderer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/PDFTreeCellRenderer.java?rev=1867855&r1=1867854&r2=1867855&view=diff
==============================================================================
--- pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/PDFTreeCellRenderer.java
(original)
+++ pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/PDFTreeCellRenderer.java
Tue Oct  1 18:04:28 2019
@@ -32,6 +32,7 @@ import org.apache.pdfbox.cos.COSFloat;
 import org.apache.pdfbox.cos.COSInteger;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSNull;
+import org.apache.pdfbox.cos.COSNumber;
 import org.apache.pdfbox.cos.COSObject;
 import org.apache.pdfbox.cos.COSStream;
 import org.apache.pdfbox.cos.COSString;
@@ -127,13 +128,9 @@ public class PDFTreeCellRenderer extends
         {
             result = Boolean.toString(((COSBoolean) nodeValue).getValue());
         }
-        else if (nodeValue instanceof COSFloat)
-        {
-            result = Float.toString(((COSFloat) nodeValue).floatValue());
-        }
-        else if (nodeValue instanceof COSInteger)
+        else if (nodeValue instanceof COSNumber)
         {
-            result = Integer.toString(((COSInteger) nodeValue).intValue());
+            result = Float.toString(((COSNumber) nodeValue).floatValue());
         }
         else if (nodeValue instanceof COSString)
         {
@@ -356,10 +353,7 @@ public class PDFTreeCellRenderer extends
         public synchronized void paintIcon(Component c, Graphics g, int x, int y)
         {
             base.paintIcon(c, g, x, y);
-            for (ImageIcon icon: overlays)
-            {
-                icon.paintIcon(c, g, x, y);
-            }
+            overlays.forEach(icon -> icon.paintIcon(c, g, x, y));
         }
     }
 }



Mime
View raw message