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

svn commit: r823283 - in /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk: ./ content/ skin/ skin/terra/

Author: tvolkert
Date: Thu Oct  8 19:08:52 2009
New Revision: 823283

URL: http://svn.apache.org/viewvc?rev=823283&view=rev
Log:
Minor formatting updates and add a few missing @Override tags; changed no actual code

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ConstrainedVisual.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewMultiCellRenderer.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=823283&r1=823282&r2=823283&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Thu Oct  8 19:08:52 2009
@@ -1447,6 +1447,7 @@
      * @return The component's baseline relative to the origin of the parent
      *         container. -1 indicates that no baseline exists.
      */
+    @Override
     public int getBaseline(int width) {
         return skin.getBaseline(width);
     }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ConstrainedVisual.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ConstrainedVisual.java?rev=823283&r1=823282&r2=823283&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ConstrainedVisual.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ConstrainedVisual.java Thu Oct  8 19:08:52 2009
@@ -61,5 +61,4 @@
      * this visual does not have a baseline.
      */
     public int getBaseline(int width);
-
 }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewMultiCellRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewMultiCellRenderer.java?rev=823283&r1=823282&r2=823283&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewMultiCellRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewMultiCellRenderer.java Thu Oct  8 19:08:52 2009
@@ -304,7 +304,7 @@
         return new Dimensions(getPreferredWidth(-1), getPreferredHeight(-1));
     }
 
-
+    @Override
     public int getBaseline(int width) {
         // Our baseline is the maximum of all our possible renderers'
         // baseline

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java?rev=823283&r1=823282&r2=823283&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java Thu Oct  8 19:08:52 2009
@@ -409,7 +409,6 @@
         return new Dimensions(preferredWidth, preferredHeight);
     }
 
-
     @Override
     public int getBaseline(int width) {
         int baseline = -1;

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java?rev=823283&r1=823282&r2=823283&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java Thu Oct  8 19:08:52 2009
@@ -45,7 +45,6 @@
 import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.VerticalAlignment;
 
-
 /**
  * Label skin.
  * <p>
@@ -176,51 +175,51 @@
         return new Dimensions(preferredWidth, preferredHeight);
     }
 
-
     @Override
     public int getBaseline(int width) {
-      Label label = (Label)getComponent();
+        Label label = (Label)getComponent();
+
+        // Calculate the baseline of the text
+        int baseline = -1;
 
-      // Calculate the baseline of the text
-      int baseline = -1;
+        String text = label.getText();
+        if (text == null) {
+            text = "";
+        }
 
-      String text = label.getText();
-      if (text == null) {
-          text = "";
-      }
-
-      if (wrapText
-          && text.length() > 0) {
-          int contentWidth = label.getWidth() - (padding.left + padding.right);
-
-          AttributedString attributedText = new AttributedString(text);
-          attributedText.addAttribute(TextAttribute.FONT, font);
-
-          AttributedCharacterIterator aci = attributedText.getIterator();
-          LineBreakMeasurer lbm = new LineBreakMeasurer(aci, fontRenderContext);
-
-          if (lbm.getPosition() < aci.getEndIndex()) {
-              LineMetrics lm = font.getLineMetrics(text, fontRenderContext);
-              baseline = (int)Math.ceil(lm.getAscent()-2);
-          } else {
-              // for multi-line labels, treat the baseline as being the baseline of the first line of text
-              int offset = lbm.nextOffset(contentWidth);
-
-              LineMetrics lm = font.getLineMetrics(aci,
-                  lbm.getPosition(), offset, fontRenderContext);
-
-              baseline = (int) Math.ceil(lm.getAscent()-2);
-          }
-      } else {
-          LineMetrics lm = font.getLineMetrics(text, fontRenderContext);
-          baseline = (int)Math.ceil(lm.getAscent()-2);
-      }
-
-      if (baseline!=-1) {
-       baseline += padding.top;
-      }
+        if (wrapText
+            && text.length() > 0) {
+            int contentWidth = label.getWidth() - (padding.left + padding.right);
+
+            AttributedString attributedText = new AttributedString(text);
+            attributedText.addAttribute(TextAttribute.FONT, font);
+
+            AttributedCharacterIterator aci = attributedText.getIterator();
+            LineBreakMeasurer lbm = new LineBreakMeasurer(aci, fontRenderContext);
+
+            if (lbm.getPosition() < aci.getEndIndex()) {
+                LineMetrics lm = font.getLineMetrics(text, fontRenderContext);
+                baseline = (int)Math.ceil(lm.getAscent()-2);
+            } else {
+                // for multi-line labels, treat the baseline as being the
+                // baseline of the first line of text
+                int offset = lbm.nextOffset(contentWidth);
+
+                LineMetrics lm = font.getLineMetrics(aci,
+                    lbm.getPosition(), offset, fontRenderContext);
+
+                baseline = (int) Math.ceil(lm.getAscent()-2);
+            }
+        } else {
+            LineMetrics lm = font.getLineMetrics(text, fontRenderContext);
+            baseline = (int)Math.ceil(lm.getAscent()-2);
+        }
+
+        if (baseline!=-1) {
+            baseline += padding.top;
+        }
 
-      return baseline;
+        return baseline;
     }
 
     @Override

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java?rev=823283&r1=823282&r2=823283&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java Thu Oct  8 19:08:52 2009
@@ -48,7 +48,6 @@
 import org.apache.pivot.wtk.effects.TransitionListener;
 import org.apache.pivot.wtk.skin.ListButtonSkin;
 
-
 /**
  * Terra list button skin.
  */
@@ -90,7 +89,7 @@
         @Override
         public void windowClosed(Window window, Display display, Window owner) {
             closeTransition = null;
-            }
+        }
     };
 
     private Panorama listViewPanorama;
@@ -675,7 +674,7 @@
                                 Bounds itemBounds = listView.getItemBounds(selectedIndex);
                                 listView.scrollAreaToVisible(itemBounds);
                             }
-                    }
+                        }
                     });
 
                     listView.requestFocus();

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java?rev=823283&r1=823282&r2=823283&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java Thu Oct  8 19:08:52 2009
@@ -162,8 +162,8 @@
 
         // Paint the background
         if (backgroundColor != null) {
-        graphics.setPaint(backgroundColor);
-        graphics.fillRect(0, 0, width, height);
+            graphics.setPaint(backgroundColor);
+            graphics.fillRect(0, 0, width, height);
         }
 
         // Paint the list contents
@@ -295,8 +295,8 @@
 
         int itemBaseline = renderer.getBaseline(width);
         if (listView.getCheckmarksEnabled()) {
-            itemBaseline = Math.max(CHECKBOX.getBaseline(width) + checkboxPadding.top
-                , itemBaseline);
+            itemBaseline = Math.max(CHECKBOX.getBaseline(width) + checkboxPadding.top,
+                itemBaseline);
         }
 
         return itemBaseline;
@@ -829,8 +829,8 @@
                     if (!listView.isCheckmarkDisabled(selectedIndex)) {
                         listView.setItemChecked(selectedIndex,
                             !listView.isItemChecked(selectedIndex));
-                            consumed = true;
-                        }
+                        consumed = true;
+                    }
                 }
 
                 break;

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java?rev=823283&r1=823282&r2=823283&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java Thu Oct  8 19:08:52 2009
@@ -233,7 +233,6 @@
         return preferredSize;
     }
 
-
     @Override
     public int getBaseline(int width) {
         int baseline = -1;

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java?rev=823283&r1=823282&r2=823283&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java Thu Oct  8 19:08:52 2009
@@ -329,21 +329,21 @@
 
     @Override
     public int getBaseline(int width) {
-      // Calculate the baseline of the text
-      int baseline = -1;
+        // Calculate the baseline of the text
+        int baseline = -1;
 
-      // TODO Localize?
-      // TODO Recalculate only when font changes
-      String testString = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
+        // TODO Localize?
+        // TODO Recalculate only when font changes
+        String testString = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
 
-      LineMetrics lm = font.getLineMetrics(testString, fontRenderContext);
-      baseline = (int)Math.ceil(lm.getAscent()-2);
+        LineMetrics lm = font.getLineMetrics(testString, fontRenderContext);
+        baseline = (int)Math.ceil(lm.getAscent()-2);
 
-      if (baseline!=-1) {
-          baseline += padding.top + 1;
-      }
+        if (baseline!=-1) {
+            baseline += padding.top + 1;
+        }
 
-      return baseline;
+        return baseline;
     }
 
     @Override