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/11/13 23:44:38 UTC

svn commit: r836041 - in /incubator/pivot/trunk: core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/collections/immutable/ wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/skin/ wtk/test/org/apache/pivot/wtk/test/

Author: tvolkert
Date: Fri Nov 13 22:44:38 2009
New Revision: 836041

URL: http://svn.apache.org/viewvc?rev=836041&view=rev
Log:
Minor code clean-up

Modified:
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/immutable/ImmutableList.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPane.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPaneListener.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java
    incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BaselineTest.java

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java Fri Nov 13 22:44:38 2009
@@ -141,7 +141,7 @@
     }
 
     public ArrayList(int capacity) {
-            CollectionArgChecks.zeroOrGreater("capacity", capacity);
+        CollectionArgChecks.zeroOrGreater("capacity", capacity);
 
         items = new Object[capacity];
     }
@@ -220,7 +220,7 @@
     }
 
     private void insert(T item, int index, boolean validate) {
-            CollectionArgChecks.indexBounds(index, 0, length);
+        CollectionArgChecks.indexBounds(index, 0, length);
 
         if (comparator != null
             && validate) {
@@ -250,7 +250,7 @@
     @SuppressWarnings("unchecked")
     @Override
     public T update(int index, T item) {
-            CollectionArgChecks.indexBounds(index, 0, length - 1);
+        CollectionArgChecks.indexBounds(index, 0, length - 1);
 
         T previousItem = (T)items[index];
 
@@ -295,7 +295,7 @@
     @SuppressWarnings("unchecked")
     @Override
     public Sequence<T> remove(int index, int count) {
-            CollectionArgChecks.indexBounds(index, count, 0, length);
+        CollectionArgChecks.indexBounds(index, count, 0, length);
 
         ArrayList<T> removed = new ArrayList<T>((T[])items, index, count);
 
@@ -336,7 +336,7 @@
     @SuppressWarnings("unchecked")
     @Override
     public T get(int index) {
-           CollectionArgChecks.indexBounds(index, 0, length);
+        CollectionArgChecks.indexBounds(index, 0, length);
 
         return (T)items[index];
     }
@@ -504,8 +504,8 @@
 
     @SuppressWarnings("unchecked")
     public static <T> void sort(ArrayList<T> arrayList, int from, int to, Comparator<T> comparator) {
-            CollectionArgChecks.notNull("arrayList", arrayList);
-            CollectionArgChecks.notNull("comparator", comparator);
+        CollectionArgChecks.notNull("arrayList", arrayList);
+        CollectionArgChecks.notNull("comparator", comparator);
 
         Arrays.sort((T[])arrayList.items, from, to, comparator);
 
@@ -523,9 +523,9 @@
 
     @SuppressWarnings("unchecked")
     public static <T> int binarySearch(ArrayList<T> arrayList, T item, Comparator<T> comparator) {
-            CollectionArgChecks.notNull("arrayList", arrayList);
-            CollectionArgChecks.notNull("comparator", comparator);
-            CollectionArgChecks.notNull("item", item);
+        CollectionArgChecks.notNull("arrayList", arrayList);
+        CollectionArgChecks.notNull("comparator", comparator);
+        CollectionArgChecks.notNull("item", item);
 
         int index = Arrays.binarySearch((T[])arrayList.items, 0, arrayList.length, item, comparator);
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java Fri Nov 13 22:44:38 2009
@@ -19,8 +19,6 @@
 /**
  * Implements various assert-style checking for the Pivot collections classes.
  * Throws nice descriptive exceptions if something goes wrong.
- *
- * @author Noel Grandin
  */
 public class CollectionArgChecks {
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java Fri Nov 13 22:44:38 2009
@@ -27,7 +27,6 @@
 import org.apache.pivot.collections.Sequence;
 import org.apache.pivot.util.ListenerList;
 
-
 /**
  * Implementation of the {@link List} interface that is backed by an enum.
  */

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java Fri Nov 13 22:44:38 2009
@@ -22,7 +22,6 @@
 
 import org.apache.pivot.util.ListenerList;
 
-
 /**
  * Implementation of the {@link Set} interface whose keys are backed by a set
  * of enum values.

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java Fri Nov 13 22:44:38 2009
@@ -21,7 +21,6 @@
 
 import org.apache.pivot.util.ImmutableIterator;
 
-
 /**
  * Interface representing an ordered sequence of items.
  */

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/immutable/ImmutableList.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/immutable/ImmutableList.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/immutable/ImmutableList.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/immutable/ImmutableList.java Fri Nov 13 22:44:38 2009
@@ -25,7 +25,6 @@
 import org.apache.pivot.util.ImmutableIterator;
 import org.apache.pivot.util.ListenerList;
 
-
 /**
  * Unmodifiable implementation of the {@link List} interface.
  */

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPane.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPane.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPane.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPane.java Fri Nov 13 22:44:38 2009
@@ -23,7 +23,6 @@
 import org.apache.pivot.util.ImmutableIterator;
 import org.apache.pivot.util.ListenerList;
 
-
 /**
  * Container that arranges components in a two-dimensional grid, where every cell is the same size.
  */
@@ -149,7 +148,6 @@
                 }
 
                 cells.update(index, component);
-                previousComponent.setAttributes(null);
 
                 if (gridPane != null) {
                     gridPane.add(component);
@@ -175,11 +173,6 @@
         public Sequence<Component> remove(int index, int count) {
             Sequence<Component> removed = cells.remove(index, count);
 
-            for (int i = 0, n = removed.getLength(); i < n; i++) {
-                Component component = removed.get(i);
-                component.setAttributes(null);
-            }
-
             if (gridPane != null) {
                 gridPane.gridPaneListeners.cellsRemoved(this, index, removed);
 
@@ -298,7 +291,7 @@
     }
 
     /**
-     * grid pane skin interface. grid pane skins must implement
+     * Grid pane skin interface. Grid pane skins must implement
      * this interface to facilitate additional communication between the
      * component and the skin.
      */
@@ -578,8 +571,6 @@
 
     private GridPaneListenerList gridPaneListeners = new GridPaneListenerList();
 
-    public static final String RELATIVE_SIZE_INDICATOR = "*";
-
     /**
      * Creates a new <tt>GridPane</tt> with empty row and column sequences.
      */
@@ -712,23 +703,6 @@
     }
 
     /**
-     * Sets the component at the specified cell in this grid pane.
-     *
-     * @param row
-     * The row index of the cell
-     *
-     * @param column
-     * The column index of the cell
-     *
-     * @param component
-     * The component to place in the specified cell, or <tt>null</tt> to empty
-     * the cell
-     */
-    public void setCellComponent(int row, int column, Component component) {
-        rows.get(row).update(column, component);
-    }
-
-    /**
      * Overrides the base method to check whether or not a cell component is
      * being removed, and fires the appropriate event in that case.
      *
@@ -763,6 +737,4 @@
     public ListenerList<GridPaneListener> getGridPaneListeners() {
         return gridPaneListeners;
     }
-
-
 }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPaneListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPaneListener.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPaneListener.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPaneListener.java Fri Nov 13 22:44:38 2009
@@ -19,11 +19,11 @@
 import org.apache.pivot.collections.Sequence;
 
 /**
- * Table pane listener interface.
+ * Grid pane listener interface.
  */
 public interface GridPaneListener {
     /**
-     * Table pane listener adapter.
+     * Grid pane listener adapter.
      */
     public static class Adapter implements GridPaneListener {
         @Override
@@ -31,8 +31,7 @@
         }
 
         @Override
-        public void rowsRemoved(GridPane GridPane, int index,
-            Sequence<GridPane.Row> rows) {
+        public void rowsRemoved(GridPane GridPane, int index, Sequence<GridPane.Row> rows) {
         }
 
         @Override
@@ -57,18 +56,16 @@
         }
 
         @Override
-        public void cellsRemoved(GridPane.Row row, int column,
-            Sequence<Component> removed) {
+        public void cellsRemoved(GridPane.Row row, int column, Sequence<Component> removed) {
         }
 
         @Override
-        public void cellUpdated(GridPane.Row row, int column,
-            Component previousComponent) {
+        public void cellUpdated(GridPane.Row row, int column, Component previousComponent) {
         }
     }
 
     /**
-     * Called when a row has been inserted into a table pane.
+     * Called when a row has been inserted into a grid pane.
      *
      * @param GridPane
      * @param index
@@ -76,14 +73,13 @@
     public void rowInserted(GridPane GridPane, int index);
 
     /**
-     * Called when rows have been removed from a table pane.
+     * Called when rows have been removed from a grid pane.
      *
      * @param GridPane
      * @param index
      * @param rows
      */
-    public void rowsRemoved(GridPane GridPane, int index,
-        Sequence<GridPane.Row> rows);
+    public void rowsRemoved(GridPane GridPane, int index, Sequence<GridPane.Row> rows);
 
     /**
      * Called when a row's highlighted state has changed.
@@ -93,7 +89,7 @@
     public void rowHighlightedChanged(GridPane.Row row);
 
     /**
-     * Called when a column has been inserted into a table pane.
+     * Called when a column has been inserted into a grid pane.
      *
      * @param GridPane
      * @param index
@@ -101,14 +97,13 @@
     public void columnInserted(GridPane GridPane, int index);
 
     /**
-     * Called when column's have been removed from a table pane.
+     * Called when column's have been removed from a grid pane.
      *
      * @param GridPane
      * @param index
      * @param columns
      */
-    public void columnsRemoved(GridPane GridPane, int index,
-        Sequence<GridPane.Column> columns);
+    public void columnsRemoved(GridPane GridPane, int index, Sequence<GridPane.Column> columns);
 
     /**
      * Called when a column's highlighted state has changed.
@@ -118,7 +113,7 @@
     public void columnHighlightedChanged(GridPane.Column column);
 
     /**
-     * Called when a cell has been inserted into a table pane.
+     * Called when a cell has been inserted into a grid pane.
      *
      * @param row
      * @param column
@@ -126,22 +121,20 @@
     public void cellInserted(GridPane.Row row, int column);
 
     /**
-     * Called when cell's have been removed from a table pane.
+     * Called when cell's have been removed from a grid pane.
      *
      * @param row
      * @param column
      * @param removed
      */
-    public void cellsRemoved(GridPane.Row row, int column,
-        Sequence<Component> removed);
+    public void cellsRemoved(GridPane.Row row, int column, Sequence<Component> removed);
 
     /**
-     * Called when a cell has been updated in a table pane.
+     * Called when a cell has been updated in a grid pane.
      *
      * @param row
      * @param column
      * @param previousComponent
      */
-    public void cellUpdated(GridPane.Row row, int column,
-        Component previousComponent);
+    public void cellUpdated(GridPane.Row row, int column, Component previousComponent);
 }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java Fri Nov 13 22:44:38 2009
@@ -35,8 +35,7 @@
 /**
  * Grid pane skin.
  */
-public class GridPaneSkin extends ContainerSkin implements GridPane.Skin,
-    GridPaneListener {
+public class GridPaneSkin extends ContainerSkin implements GridPane.Skin, GridPaneListener {
     private Insets padding = Insets.NONE;
     private int horizontalSpacing = 0;
     private int verticalSpacing = 0;

Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BaselineTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BaselineTest.java?rev=836041&r1=836040&r2=836041&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BaselineTest.java (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BaselineTest.java Fri Nov 13 22:44:38 2009
@@ -24,10 +24,6 @@
 import org.apache.pivot.wtk.Frame;
 import org.apache.pivot.wtkx.WTKXSerializer;
 
-/**
- *
- * @author Noel Grandin
- */
 public class BaselineTest implements Application {
     private Frame frame = null;