You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2009/10/27 10:18:08 UTC

svn commit: r830099 - in /incubator/pivot/trunk/wtk/src/org/apache/pivot: wtk/ wtk/content/ wtk/effects/easing/ wtk/skin/ wtk/skin/terra/ wtk/text/ wtkx/

Author: smartini
Date: Tue Oct 27 09:18:05 2009
New Revision: 830099

URL: http://svn.apache.org/viewvc?rev=830099&view=rev
Log:
fixed eclipse warnings

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeRenderer.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Circular.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Cubic.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quadratic.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quartic.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quintic.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/WindowSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/PlainTextSerializer.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java Tue Oct 27 09:18:05 2009
@@ -845,13 +845,13 @@
 
             if (n > 1) {
                 throw new IllegalArgumentException("Selection length is greater than 1.");
-            } else {
-                if (n > 0) {
-                    Span selectedRange = selectedRanges.get(0);
+            }
+
+            if (n > 0) {
+                Span selectedRange = selectedRanges.get(0);
 
-                    if (selectedRange.getLength() > 1) {
-                        throw new IllegalArgumentException("Selected range length is greater than 1.");
-                    }
+                if (selectedRange.getLength() > 1) {
+                    throw new IllegalArgumentException("Selected range length is greater than 1.");
                 }
             }
         }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java Tue Oct 27 09:18:05 2009
@@ -687,17 +687,17 @@
                 if (item.isEnabled()) {
                     item.setActive(true);
                     break;
-                } else {
-                    itemIndex++;
                 }
+
+                itemIndex++;
             }
 
             if (itemIndex < sectionLength) {
                 break;
-            } else {
-                sectionIndex++;
-                itemIndex = 0;
             }
+
+            sectionIndex++;
+            itemIndex = 0;
         }
     }
 
@@ -732,16 +732,16 @@
                 if (item.isEnabled()) {
                     item.setActive(true);
                     break;
-                } else {
-                    itemIndex--;
                 }
+
+                itemIndex--;
             }
 
             if (itemIndex >= 0) {
                 break;
-            } else {
-                sectionIndex--;
             }
+
+            sectionIndex--;
         }
     }
 

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java Tue Oct 27 09:18:05 2009
@@ -1440,13 +1440,13 @@
 
             if (n > 1) {
                 throw new IllegalArgumentException("Selection length is greater than 1.");
-            } else {
-                if (n > 0) {
-                    Span selectedRange = selectedRanges.get(0);
-
-                    if (selectedRange.getLength() > 1) {
-                        throw new IllegalArgumentException("Selected range length is greater than 1.");
-                    }
+            }
+
+            if (n > 0) {
+                Span selectedRange = selectedRanges.get(0);
+
+                if (selectedRange.getLength() > 1) {
+                    throw new IllegalArgumentException("Selected range length is greater than 1.");
                 }
             }
         }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java Tue Oct 27 09:18:05 2009
@@ -226,9 +226,7 @@
                 previousTextNode.getNodeListeners().remove(textNodeListener);
             }
 
-            if (textNode != null) {
                 textNode.getNodeListeners().add(textNodeListener);
-            }
 
             // Clear the selection
             this.textNode = textNode;

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java Tue Oct 27 09:18:05 2009
@@ -171,7 +171,7 @@
 
                 if (string.endsWith("%")) {
                     float percentage = Float.parseFloat(string.substring(0, string.length() - 1)) / 100f;
-                    size = Math.round((float)font.getSize() * percentage);
+                    size = Math.round(font.getSize() * percentage);
                 } else {
                     throw new IllegalArgumentException(value + " is not a valid font size.");
                 }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java Tue Oct 27 09:18:05 2009
@@ -78,9 +78,7 @@
             } else if (item instanceof Image) {
                 icon = (Image)item;
             } else {
-                if (item != null) {
                     text = item.toString();
-                }
             }
 
             // Update the image view

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeRenderer.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeRenderer.java Tue Oct 27 09:18:05 2009
@@ -91,9 +91,7 @@
             } else if (node instanceof Image) {
                 icon = (Image)node;
             } else {
-                if (node != null) {
                     text = node.toString();
-                }
             }
 
             // Update the image view

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Circular.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Circular.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Circular.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Circular.java Tue Oct 27 09:18:05 2009
@@ -31,8 +31,8 @@
     public float easeInOut(float time, float begin, float change, float duration) {
         if ((time /= duration / 2f) < 1f) {
             return -change / 2f * ((float)Math.sqrt(1f - time * time) - 1f) + begin;
-        } else {
-            return change / 2f * ((float)Math.sqrt(1f - (time -= 2f) * time) + 1f) + begin;
         }
+
+        return change / 2f * ((float)Math.sqrt(1f - (time -= 2f) * time) + 1f) + begin;
     }
 }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Cubic.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Cubic.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Cubic.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Cubic.java Tue Oct 27 09:18:05 2009
@@ -31,8 +31,8 @@
     public float easeInOut(float time, float begin, float change, float duration) {
         if ((time /= duration / 2f) < 1f) {
             return change / 2f * time * time * time + begin;
-        } else {
-            return change / 2f * ((time -= 2f) * time * time + 2f) + begin;
         }
+
+        return change / 2f * ((time -= 2f) * time * time + 2f) + begin;
     }
 }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quadratic.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quadratic.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quadratic.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quadratic.java Tue Oct 27 09:18:05 2009
@@ -31,8 +31,8 @@
     public float easeInOut(float time, float begin, float change, float duration) {
         if ((time /= duration / 2) < 1) {
             return change / 2 * time * time + begin;
-        } else {
-            return -change / 2 * ((--time) * (time - 2) - 1) + begin;
         }
+
+        return -change / 2 * ((--time) * (time - 2) - 1) + begin;
     }
 }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quartic.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quartic.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quartic.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quartic.java Tue Oct 27 09:18:05 2009
@@ -31,8 +31,8 @@
     public float easeInOut(float time, float begin, float change, float duration) {
         if ((time /= duration / 2f) < 1) {
             return change / 2f * time * time * time * time + begin;
-        } else {
-            return -change / 2f * ((time -= 2) * time * time * time - 2) + begin;
         }
+
+        return -change / 2f * ((time -= 2) * time * time * time - 2) + begin;
     }
 }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quintic.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quintic.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quintic.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Quintic.java Tue Oct 27 09:18:05 2009
@@ -31,8 +31,8 @@
     public float easeInOut(float time, float begin, float change, float duration) {
         if ((time /= duration / 2f) < 1) {
             return change / 2f * time * time * time * time * time + begin;
-        } else {
-            return change / 2f * ((time -= 2) * time * time * time * time + 2) + begin;
         }
+
+        return change / 2f * ((time -= 2) * time * time * time * time + 2) + begin;
     }
 }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java Tue Oct 27 09:18:05 2009
@@ -181,10 +181,10 @@
                     // The component is too big to fit in the remaining space,
                     // and it is not the only component in this row; wrap
                     break;
-                } else {
-                    baseline = Math.max(baseline, component.getBaseline(componentSize.width));
-                    rowWidth += componentSize.width + horizontalSpacing;
                 }
+
+                baseline = Math.max(baseline, component.getBaseline(componentSize.width));
+                rowWidth += componentSize.width + horizontalSpacing;
             }
         }
 

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java Tue Oct 27 09:18:05 2009
@@ -1203,13 +1203,13 @@
                             if (columnWidths[j + k] < 0) {
                                 adjustCells = false;
                                 break;
-                            } else {
-                                if (defaultWidthColumns[j + k]) {
-                                    spannedDefaultWidthCellCount++;
-                                }
+                            }
 
-                                spannedWidth += columnWidths[j + k];
+                            if (defaultWidthColumns[j + k]) {
+                                spannedDefaultWidthCellCount++;
                             }
+
+                            spannedWidth += columnWidths[j + k];
                         }
 
                         // If we span any relative-width columns, we assume
@@ -1375,13 +1375,13 @@
                             if (rowHeights[i + k] < 0) {
                                 adjustCells = false;
                                 break;
-                            } else {
-                                if (defaultHeightRows[i + k]) {
-                                    spannedDefaultHeightCellCount++;
-                                }
+                            }
 
-                                spannedHeight += rowHeights[i + k];
+                            if (defaultHeightRows[i + k]) {
+                                spannedDefaultHeightCellCount++;
                             }
+
+                            spannedHeight += rowHeights[i + k];
                         }
 
                         // If we span any relative-height rows, we assume

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/WindowSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/WindowSkin.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/WindowSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/WindowSkin.java Tue Oct 27 09:18:05 2009
@@ -42,6 +42,7 @@
      * ensures that focus does not traverse out of the window.
      */
     public static class WindowFocusTraversalPolicy implements FocusTraversalPolicy {
+        @SuppressWarnings("null")
         @Override
         public Component getNextComponent(Container container, Component component, Direction direction) {
             assert (container instanceof Window) : "container is not a Window";

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java Tue Oct 27 09:18:05 2009
@@ -58,6 +58,7 @@
 /**
  * Terra calendar skin.
  */
+@SuppressWarnings("unused")
 public class TerraCalendarSkin extends CalendarSkin
     implements CalendarListener, CalendarSelectionListener {
     public class DateButton extends Button {

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java Tue Oct 27 09:18:05 2009
@@ -750,11 +750,7 @@
                     cursor = Cursor.RESIZE_EAST;
                 } else if (preferredHeightSet) {
                     cursor = Cursor.RESIZE_SOUTH;
-                } else {
-                    cursor = null;
                 }
-            } else {
-                cursor = null;
             }
 
             component.setCursor(cursor);

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java Tue Oct 27 09:18:05 2009
@@ -487,11 +487,7 @@
                     cursor = Cursor.RESIZE_EAST;
                 } else if (preferredHeightSet) {
                     cursor = Cursor.RESIZE_SOUTH;
-                } else {
-                    cursor = null;
                 }
-            } else {
-                cursor = null;
             }
 
             component.setCursor(cursor);

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/PlainTextSerializer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/PlainTextSerializer.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/PlainTextSerializer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/PlainTextSerializer.java Tue Oct 27 09:18:05 2009
@@ -66,6 +66,7 @@
         return document;
     }
 
+    @SuppressWarnings("unused")
     public Document readObject(Reader reader)
         throws IOException, SerializationException {
         Document document = new Document();

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java?rev=830099&r1=830098&r2=830099&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java Tue Oct 27 09:18:05 2009
@@ -221,13 +221,11 @@
             }
 
             // If the function didn't return a value, return the default
-            if (result == null) {
-                Class<?> returnType = method.getReturnType();
-                if (returnType == Vote.class) {
-                    result = Vote.APPROVE;
-                } else if (returnType == Boolean.TYPE) {
-                    result = false;
-                }
+            Class<?> returnType = method.getReturnType();
+            if (returnType == Vote.class) {
+                result = Vote.APPROVE;
+            } else if (returnType == Boolean.TYPE) {
+                result = false;
             }
 
             return result;