harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479418 [29/43] - in /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common: javax/swing/ javax/swing/border/ javax/swing/colorchooser/ javax/swing/event/ javax/swing/filechooser/ javax/swing/plaf/ javax/swing/plaf/basic/ j...
Date Sun, 26 Nov 2006 20:15:55 GMT
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/FlowView_FlowStrategyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/FlowView_FlowStrategyTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/FlowView_FlowStrategyTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/FlowView_FlowStrategyTest.java Sun Nov 26 12:15:43 2006
@@ -23,7 +23,6 @@
 import java.awt.Rectangle;
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.event.DocumentEvent.EventType;
 import javax.swing.text.AbstractDocument.BranchElement;
@@ -33,37 +32,44 @@
 import javax.swing.text.FlowViewTest.FlowViewImplWithFactory;
 import javax.swing.text.GlyphView.GlyphPainter;
 import javax.swing.text.GlyphViewTest.EmptyPainter;
-
 import junit.framework.TestCase;
 
 public class FlowView_FlowStrategyTest extends TestCase {
     private DefaultStyledDocument doc;
+
     private Element root;
+
     private Element p1;
+
     private Element p1L;
+
     private DefaultDocumentEvent event;
+
     private FlowView view;
+
     private View row;
+
     private FlowStrategy strategy;
 
-    static final List viewsCreated = new ArrayList();
+    static final List<Object> viewsCreated = new ArrayList<Object>();
 
     private static final Rectangle alloc = new Rectangle(3, 7, 37, 141);
 
     private static final int X_AXIS = View.X_AXIS;
+
     private static final int Y_AXIS = View.Y_AXIS;
 
     private static boolean excellentBreak;
 
     protected static class TestStrategy extends FlowStrategy {
-
-        protected View createView(FlowView fv, int startOffset, int spanLeft,
-                                  int rowIndex) {
+        @Override
+        protected View createView(FlowView fv, int startOffset, int spanLeft, int rowIndex) {
             View result = super.createView(fv, startOffset, spanLeft, rowIndex);
             viewsCreated.add(result);
             return result;
         }
 
+        @Override
         public String toString() {
             return "logStrategy";
         }
@@ -75,25 +81,25 @@
         private FixedPainter() {
         }
 
-        public int getBoundedPosition(GlyphView v, int startOffset,
-                                      float x, float len) {
-            int result = (int)len / PartView.CHAR_WIDTH + startOffset;
+        @Override
+        public int getBoundedPosition(GlyphView v, int startOffset, float x, float len) {
+            int result = (int) len / PartView.CHAR_WIDTH + startOffset;
             return result <= v.getEndOffset() ? result : v.getEndOffset();
         }
 
-        public float getSpan(GlyphView v,
-                             int startOffset, int endOffset,
-                             TabExpander e, float x) {
+        @Override
+        public float getSpan(GlyphView v, int startOffset, int endOffset, TabExpander e, float x) {
             return PartView.CHAR_WIDTH * (endOffset - startOffset);
         }
-
     }
 
     protected static class PartView extends GlyphView {
         private static int count = 0;
+
         private int id = count++;
 
         static final int CHAR_WIDTH = 4;
+
         static final int CHAR_HEIGHT = 9;
 
         public PartView(Element element) {
@@ -101,18 +107,18 @@
             setGlyphPainter(FixedPainter.PAINTER);
         }
 
+        @Override
         public float getPreferredSpan(int axis) {
-            int result = axis == X_AXIS
-                         ? (int)super.getPreferredSpan(axis)
-                         : CHAR_HEIGHT;
+            int result = axis == X_AXIS ? (int) super.getPreferredSpan(axis) : CHAR_HEIGHT;
             return result;
         }
 
+        @Override
         public String toString() {
             final Element e = getElement();
-            return "glyph(" + id + ", " + e.getName() + "["
-                   + e.getStartOffset() + ", " + e.getEndOffset() + "]"
-                   + ")  [" + getStartOffset() + ", " + getEndOffset() + "]";
+            return "glyph(" + id + ", " + e.getName() + "[" + e.getStartOffset() + ", "
+                    + e.getEndOffset() + "]" + ")  [" + getStartOffset() + ", "
+                    + getEndOffset() + "]";
         }
     }
 
@@ -122,39 +128,34 @@
         }
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DefaultStyledDocument();
         doc.insertString(0, "this is the test text with some long words in p2\n"
-                         //                   |              |
-                         //  0123456789012345678901234567890123456789012345678
-                         //  0         1         2         3         4
-                            + "Long words: internationalization, localization",
-                         null);
+        //                   |              |
+                //  0123456789012345678901234567890123456789012345678
+                //  0         1         2         3         4
+                + "Long words: internationalization, localization", null);
         root = doc.getDefaultRootElement();
         p1 = root.getElement(0);
-
         // Break the first paragraph into several
         doc.writeLock();
-        Element[] leaves = new Element[] {
-            doc.createLeafElement(p1, null, 0, 17),
-            doc.createLeafElement(p1, null, 17, 32),
-            doc.createLeafElement(p1, null, 32, 49)
-        };
-        ((BranchElement)p1).replace(0, p1.getElementCount(), leaves);
+        Element[] leaves = new Element[] { doc.createLeafElement(p1, null, 0, 17),
+                doc.createLeafElement(p1, null, 17, 32),
+                doc.createLeafElement(p1, null, 32, 49) };
+        ((BranchElement) p1).replace(0, p1.getElementCount(), leaves);
         doc.writeUnlock();
-
         p1L = p1.getElement(0);
-
         // Initialize the view
         view = new FlowViewImplWithFactory(p1, Y_AXIS, new PartFactory());
         strategy = view.strategy = new TestStrategy();
         view.loadChildren(null);
-
         row = view.createRow();
         view.append(row);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
         viewsCreated.clear();
@@ -162,11 +163,8 @@
 
     public void testInsertUpdate() {
         event = doc.new DefaultDocumentEvent(4, 5, EventType.INSERT);
-        event.addEdit(new ElementEdit(p1, 0,
-                                      new Element[] {p1L},
-                                      new Element[] {p1L}));
+        event.addEdit(new ElementEdit(p1, 0, new Element[] { p1L }, new Element[] { p1L }));
         event.end();
-
         view.layout(alloc.width, alloc.height);
         assertTrue(view.isAllocationValid());
         view.strategy.insertUpdate(view, event, alloc);
@@ -176,7 +174,6 @@
     public void testInsertUpdateNull() {
         view.layout(alloc.width, alloc.height);
         assertTrue(view.isAllocationValid());
-
         view.strategy.insertUpdate(view, null, null);
         assertFalse(view.isAllocationValid());
         assertFalse(view.isLayoutValid(X_AXIS));
@@ -185,11 +182,8 @@
 
     public void testRemoveUpdate() {
         event = doc.new DefaultDocumentEvent(4, 5, EventType.REMOVE);
-        event.addEdit(new ElementEdit(p1, 0,
-                                      new Element[] {p1L},
-                                      new Element[] {p1L}));
+        event.addEdit(new ElementEdit(p1, 0, new Element[] { p1L }, new Element[] { p1L }));
         event.end();
-
         view.layout(alloc.width, alloc.height);
         assertTrue(view.isAllocationValid());
         view.strategy.removeUpdate(view, event, alloc);
@@ -199,7 +193,6 @@
     public void testRemoveUpdateNull() {
         view.layout(alloc.width, alloc.height);
         assertTrue(view.isAllocationValid());
-
         view.strategy.removeUpdate(view, null, null);
         assertFalse(view.isAllocationValid());
         assertFalse(view.isLayoutValid(X_AXIS));
@@ -208,11 +201,8 @@
 
     public void testChangedUpdate() {
         event = doc.new DefaultDocumentEvent(4, 5, EventType.CHANGE);
-        event.addEdit(new ElementEdit(p1, 0,
-                                      new Element[] {p1L},
-                                      new Element[] {p1L}));
+        event.addEdit(new ElementEdit(p1, 0, new Element[] { p1L }, new Element[] { p1L }));
         event.end();
-
         view.layout(alloc.width, alloc.height);
         assertTrue(view.isAllocationValid());
         view.strategy.changedUpdate(view, event, alloc);
@@ -222,7 +212,6 @@
     public void testChangedUpdateNull() {
         view.layout(alloc.width, alloc.height);
         assertTrue(view.isAllocationValid());
-
         view.strategy.changedUpdate(view, null, null);
         assertFalse(view.isAllocationValid());
         assertFalse(view.isLayoutValid(X_AXIS));
@@ -239,28 +228,21 @@
             views[i] = view.layoutPool.getView(i);
         }
         row.replace(0, 0, views);
-
-        view.layoutSpan =
-            (int)(view.layoutPool.getView(0).getPreferredSpan(X_AXIS)
-                  + view.layoutPool.getView(1).getPreferredSpan(X_AXIS) / 2);
-
+        view.layoutSpan = (int) (view.layoutPool.getView(0).getPreferredSpan(X_AXIS) + view.layoutPool
+                .getView(1).getPreferredSpan(X_AXIS) / 2);
         assertEquals(2, row.getViewCount());
         strategy.adjustRow(view, 0, view.layoutSpan, 0);
         assertEquals(2, row.getViewCount());
-
         // The first physical view will be the same as the logical one (copied)
         assertSame(view.layoutPool.getView(0), row.getView(0));
         assertSame(row, view.layoutPool.getView(0).getParent());
         assertSame(row, row.getView(0).getParent());
-
         // The second is broken
         final View second = row.getView(1);
-        assertEquals(view.layoutPool.getView(1).getStartOffset(),
-                     second.getStartOffset());
+        assertEquals(view.layoutPool.getView(1).getStartOffset(), second.getStartOffset());
         assertEquals(22, row.getView(1).getEndOffset());
         assertSame(view.layoutPool, view.layoutPool.getView(1).getParent());
         assertSame(row, second.getParent());
-
         assertEquals(0, row.getStartOffset());
         assertEquals(22, row.getEndOffset());
     }
@@ -280,17 +262,18 @@
             views[i] = new PartView(view.layoutPool.getView(i).getElement()) {
                 private final boolean excellent = excellentBreak;
 
+                @Override
                 public int getBreakWeight(int axis, float x, float len) {
                     return excellent ? ExcellentBreakWeight : GoodBreakWeight;
                 }
 
+                @Override
                 public View breakView(int axis, int start, float x, float len) {
-                    return createFragment(start,
-                                          start + (getEndOffset()
-                                                   - getStartOffset()) / 2);
+                    return createFragment(start, start + (getEndOffset() - getStartOffset())
+                            / 2);
                 }
             };
-            int span = (int)views[i].getPreferredSpan(X_AXIS);
+            int span = (int) views[i].getPreferredSpan(X_AXIS);
             if (i == views.length - 1) {
                 span = span / 2;
             }
@@ -299,21 +282,17 @@
         row.replace(0, 0, views);
         // layoutSpan includes the first and the second views entirely and
         // only the half of the third.
-
         // The view will break on the second one, that's why the number of
         // children reduces from 3 to 2.
         assertEquals(3, row.getViewCount());
         strategy.adjustRow(view, 0, view.layoutSpan, 0);
         assertEquals(2, row.getViewCount());
-
         View child = row.getView(0);
         assertEquals(0, child.getStartOffset());
         assertEquals(17, child.getEndOffset());
-
         child = row.getView(1);
         assertEquals(17, child.getStartOffset());
         assertEquals(24, child.getEndOffset());
-
         assertEquals(0, row.getStartOffset());
         assertEquals(24, row.getEndOffset());
     }
@@ -325,9 +304,7 @@
         assertEquals(1, view.getViewCount());
         try {
             strategy.adjustRow(view, 1, view.layoutSpan, 0);
-
-            fail("NullPointerException or ArrayIndexOutOfBoundsException "
-                 + "is expected");
+            fail("NullPointerException or ArrayIndexOutOfBoundsException " + "is expected");
         } catch (NullPointerException e) {
         } catch (ArrayIndexOutOfBoundsException e) {
         }
@@ -340,9 +317,7 @@
         assertEquals(1, view.getViewCount());
         try {
             strategy.layoutRow(view, 1, 0);
-
-            fail("NullPointerException or ArrayIndexOutOfBoundsException "
-                 + "is expected");
+            fail("NullPointerException or ArrayIndexOutOfBoundsException " + "is expected");
         } catch (NullPointerException e) {
         } catch (ArrayIndexOutOfBoundsException e) {
         }
@@ -352,32 +327,24 @@
      * Tests the situation where the layoutSpan is exhausted.
      */
     public void testLayoutRowSpanExhausted() {
-        view.layoutSpan =
-            (int)(view.layoutPool.getView(0).getPreferredSpan(X_AXIS)
-                  + view.layoutPool.getView(1).getPreferredSpan(X_AXIS) / 2);
+        view.layoutSpan = (int) (view.layoutPool.getView(0).getPreferredSpan(X_AXIS) + view.layoutPool
+                .getView(1).getPreferredSpan(X_AXIS) / 2);
         assertEquals(98, view.layoutSpan);
-
         int nextOffset = strategy.layoutRow(view, 0, 5);
         assertEquals(2, row.getViewCount());
-
         assertEquals(1, view.getViewCount());
-
         assertEquals(2, viewsCreated.size());
         final View child1 = row.getView(0);
         assertSame(viewsCreated.get(0), child1);
         assertEquals(5, child1.getStartOffset());
-        assertEquals(view.layoutPool.getView(0).getEndOffset(),
-                     child1.getEndOffset());
-
+        assertEquals(view.layoutPool.getView(0).getEndOffset(), child1.getEndOffset());
         assertSame(viewsCreated.get(1), view.layoutPool.getView(1));
         final View child2 = row.getView(1);
         assertNotSame(viewsCreated.get(1), child2);
         assertEquals(child1.getEndOffset(), child2.getStartOffset());
-
         assertEquals(27, child2.getEndOffset());
         assertTrue(view.layoutSpan > child1.getPreferredSpan(X_AXIS)
-                                     + child2.getPreferredSpan(X_AXIS));
-
+                + child2.getPreferredSpan(X_AXIS));
         assertEquals(child2.getEndOffset(), nextOffset);
         assertEquals(row.getEndOffset(), nextOffset);
     }
@@ -389,38 +356,29 @@
     public void testLayoutRowNullReturned() {
         strategy = view.strategy = new TestStrategy() {
             private int count = 0;
-            protected View createView(FlowView fv,
-                                      int startOffset,
-                                      int spanLeft, int rowIndex) {
-                return count++ == 2
-                       ? null
-                       : super.createView(fv, startOffset, spanLeft, rowIndex);
+
+            @Override
+            protected View createView(FlowView fv, int startOffset, int spanLeft, int rowIndex) {
+                return count++ == 2 ? null : super.createView(fv, startOffset, spanLeft,
+                        rowIndex);
             }
         };
         assertEquals(Short.MAX_VALUE, view.layoutSpan);
-
         int nextOffset = strategy.layoutRow(view, 0, 5);
         assertEquals(2, row.getViewCount());
-
         assertEquals(1, view.getViewCount());
-
         assertEquals(2, viewsCreated.size());
         final View child1 = row.getView(0);
         assertSame(viewsCreated.get(0), child1);
         assertEquals(5, child1.getStartOffset());
-        assertEquals(view.layoutPool.getView(0).getEndOffset(),
-                     child1.getEndOffset());
-
+        assertEquals(view.layoutPool.getView(0).getEndOffset(), child1.getEndOffset());
         assertSame(viewsCreated.get(1), view.layoutPool.getView(1));
         final View child2 = row.getView(1);
         assertSame(viewsCreated.get(1), child2);
         assertEquals(child1.getEndOffset(), child2.getStartOffset());
-
-        assertEquals(view.layoutPool.getView(1).getEndOffset(),
-                     child2.getEndOffset());
+        assertEquals(view.layoutPool.getView(1).getEndOffset(), child2.getEndOffset());
         assertTrue(view.layoutSpan > child1.getPreferredSpan(X_AXIS)
-                                     + child2.getPreferredSpan(X_AXIS));
-
+                + child2.getPreferredSpan(X_AXIS));
         assertEquals(child2.getEndOffset(), nextOffset);
         assertEquals(row.getEndOffset(), nextOffset);
     }
@@ -431,73 +389,57 @@
     public void testLayoutRowForcedBreak() {
         strategy = view.strategy = new TestStrategy() {
             private int count = 0;
-            protected View createView(FlowView fv,
-                                      int startOffset,
-                                      int spanLeft, int rowIndex) {
+
+            @Override
+            protected View createView(FlowView fv, int startOffset, int spanLeft, int rowIndex) {
                 if (count++ == 1) {
                     Element e = fv.layoutPool.getView(count - 1).getElement();
                     return new PartView(e) {
-                         private final int half = (getEndOffset()
-                                                   - getStartOffset()) / 2;
-
-                         {
-                             viewsCreated.add(this);
-                         }
-
-                         public int getBreakWeight(int axis,
-                                                   float x, float len) {
-                              if (len > CHAR_WIDTH * half) {
-                                  return ForcedBreakWeight;
-                             }
-                             return super.getBreakWeight(axis, x, len);
-                         }
-
-                         public View breakView(int axis,
-                                               int startOffset,
-                                               float x, float len) {
-                             if (len > CHAR_WIDTH * half) {
-                                 return createFragment(startOffset,
-                                                       startOffset + half);
-                             }
-                             return super.breakView(axis, startOffset,
-                                                    x, len);
-                         }
+                        private final int half = (getEndOffset() - getStartOffset()) / 2;
+                        {
+                            viewsCreated.add(this);
+                        }
+
+                        @Override
+                        public int getBreakWeight(int axis, float x, float len) {
+                            if (len > CHAR_WIDTH * half) {
+                                return ForcedBreakWeight;
+                            }
+                            return super.getBreakWeight(axis, x, len);
+                        }
+
+                        @Override
+                        public View breakView(int axis, int startOffset, float x, float len) {
+                            if (len > CHAR_WIDTH * half) {
+                                return createFragment(startOffset, startOffset + half);
+                            }
+                            return super.breakView(axis, startOffset, x, len);
+                        }
                     };
                 }
                 return super.createView(fv, startOffset, spanLeft, rowIndex);
             }
         };
         assertEquals(Short.MAX_VALUE, view.layoutSpan);
-
         int nextOffset = strategy.layoutRow(view, 0, 5);
         assertEquals(2, row.getViewCount());
-
         assertEquals(1, view.getViewCount());
-
         assertEquals(2, viewsCreated.size());
         final View child1 = row.getView(0);
         assertSame(viewsCreated.get(0), child1);
         assertEquals(5, child1.getStartOffset());
-        assertEquals(view.layoutPool.getView(0).getEndOffset(),
-                     child1.getEndOffset());
-
+        assertEquals(view.layoutPool.getView(0).getEndOffset(), child1.getEndOffset());
         assertNotSame(viewsCreated.get(1), view.layoutPool.getView(1));
-        final View forced = (View)viewsCreated.get(1);
-        assertEquals(view.layoutPool.getView(1).getStartOffset(),
-                     forced.getStartOffset());
-        assertEquals(view.layoutPool.getView(1).getEndOffset(),
-                     forced.getEndOffset());
-
+        final View forced = (View) viewsCreated.get(1);
+        assertEquals(view.layoutPool.getView(1).getStartOffset(), forced.getStartOffset());
+        assertEquals(view.layoutPool.getView(1).getEndOffset(), forced.getEndOffset());
         assertNotSame(viewsCreated.get(1), row.getView(1));
         final View child2 = row.getView(1);
         assertEquals(child1.getEndOffset(), child2.getStartOffset());
-
-        assertEquals((view.layoutPool.getView(1).getEndOffset()
-                     + view.layoutPool.getView(1).getStartOffset()) / 2,
-                     child2.getEndOffset());
+        assertEquals((view.layoutPool.getView(1).getEndOffset() + view.layoutPool.getView(1)
+                .getStartOffset()) / 2, child2.getEndOffset());
         assertTrue(view.layoutSpan > child1.getPreferredSpan(X_AXIS)
-                                     + child2.getPreferredSpan(X_AXIS));
-
+                + child2.getPreferredSpan(X_AXIS));
         assertEquals(child2.getEndOffset(), nextOffset);
         assertEquals(row.getEndOffset(), nextOffset);
     }
@@ -506,25 +448,17 @@
      * Tests how FlowView lays out the second paragraph (with very long words).
      */
     public void testLayout() {
-        view = new FlowViewImplWithFactory(root.getElement(1),
-                                           Y_AXIS, new PartFactory());
+        view = new FlowViewImplWithFactory(root.getElement(1), Y_AXIS, new PartFactory());
         strategy = view.strategy = new TestStrategy();
         view.loadChildren(null);
-
         view.layoutSpan = PartView.CHAR_WIDTH * 13;
         strategy.layout(view);
-
-        String[] text = new String[] {
-            "Long words: ",
-            "international",
-            "ization, ",
-            "localization\n"
-        };
+        String[] text = new String[] { "Long words: ", "international", "ization, ",
+                "localization\n" };
         assertEquals(text.length, view.getViewCount());
         for (int i = 0; i < view.getViewCount(); i++) {
             final View row = view.getView(i);
-            assertEquals("i = " + i + " " + row,
-                         1, row.getViewCount());
+            assertEquals("i = " + i + " " + row, 1, row.getViewCount());
             assertEquals(text[i], getText(row.getView(0)));
         }
     }
@@ -534,12 +468,8 @@
      * the <code>FlowView</code> before layout is performed.
      */
     public void testLayoutRemoved() {
-        View[] dummy = new View[] {
-            new PlainView(p1L),
-            new PlainView(p1)
-        };
+        View[] dummy = new View[] { new PlainView(p1L), new PlainView(p1) };
         view.replace(0, view.getViewCount(), dummy);
-
         assertEquals(2, view.getViewCount());
         view.layoutSpan = Integer.MAX_VALUE;
         view.strategy.layout(view);
@@ -551,39 +481,29 @@
     }
 
     public void testCreateView() {
-        assertSame(view.layoutPool.getView(0),
-                   strategy.createView(view, 0, view.layoutSpan, 0));
-
-        assertSame(view.layoutPool.getView(0),
-                   strategy.createView(view, 0, view.layoutSpan, -1));
-
-        assertSame(view.layoutPool.getView(0),
-                   strategy.createView(view, 0, -1, 0));
-
+        assertSame(view.layoutPool.getView(0), strategy.createView(view, 0, view.layoutSpan, 0));
+        assertSame(view.layoutPool.getView(0), strategy
+                .createView(view, 0, view.layoutSpan, -1));
+        assertSame(view.layoutPool.getView(0), strategy.createView(view, 0, -1, 0));
         View created = strategy.createView(view, 3, view.layoutSpan, 0);
         View logical = view.layoutPool.getView(0);
         assertNotSame(logical, created);
         assertEquals(3, created.getStartOffset());
         assertEquals(logical.getEndOffset(), created.getEndOffset());
-
         created = strategy.createView(view, 3, 2, 0);
         assertEquals(3, created.getStartOffset());
         assertEquals(logical.getEndOffset(), created.getEndOffset());
-
         created = strategy.createView(view, logical.getEndOffset(), 2, 0);
         logical = view.layoutPool.getView(1);
         assertSame(logical, created);
-
         created = strategy.createView(view, logical.getStartOffset() + 2, 2, 0);
         assertNotSame(logical, created);
         assertEquals(logical.getStartOffset() + 2, created.getStartOffset());
         assertEquals(logical.getEndOffset(), created.getEndOffset());
-
         logical = view.layoutPool.getView(view.layoutPool.getViewCount() - 1);
         created = strategy.createView(view, logical.getEndOffset() - 1, 2, 0);
         assertEquals(logical.getEndOffset() - 1, created.getStartOffset());
         assertEquals(logical.getEndOffset(), created.getEndOffset());
-
         try {
             assertNull(strategy.createView(view, logical.getEndOffset(), 2, 0));
         } catch (ArrayIndexOutOfBoundsException e) {
@@ -594,7 +514,6 @@
     }
 
     private static String getText(View v) {
-        return ((GlyphView)v).getText(v.getStartOffset(),
-                                      v.getEndOffset()).toString();
+        return ((GlyphView) v).getText(v.getStartOffset(), v.getEndOffset()).toString();
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/FlowView_FlowStrategy_HostedRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/FlowView_FlowStrategy_HostedRTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/FlowView_FlowStrategy_HostedRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/FlowView_FlowStrategy_HostedRTest.java Sun Nov 26 12:15:43 2006
@@ -22,7 +22,6 @@
 
 import java.awt.Container;
 import java.awt.Rectangle;
-
 import javax.swing.JTextArea;
 import javax.swing.SwingTestCase;
 import javax.swing.event.DocumentEvent;
@@ -38,42 +37,49 @@
  * has associated container.
  *
  */
-public class FlowView_FlowStrategy_HostedRTest extends SwingTestCase
-    implements DocumentListener {
-
+public class FlowView_FlowStrategy_HostedRTest extends SwingTestCase implements
+        DocumentListener {
     private DefaultStyledDocument doc;
+
     private Element p1;
+
     private DefaultDocumentEvent event;
+
     private FlowView view;
+
     private FlowStrategy strategy;
+
     private JTextArea textArea;
+
     private Rectangle alloc;
+
     private Rectangle paintRect;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DefaultStyledDocument();
         doc.insertString(0, "test text\n2nd par", null);
         p1 = doc.getDefaultRootElement().getElement(0);
-
         textArea = new JTextArea(doc) {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             public void repaint(int x, int y, int width, int height) {
                 paintRect = new Rectangle(x, y, width, height);
             }
         };
         view = new FlowViewImplWithFactory(p1, View.Y_AXIS, new PartFactory()) {
+            @Override
             public Container getContainer() {
                 return textArea;
             }
         };
-
         strategy = view.strategy;
         view.loadChildren(null);
-
         doc.addDocumentListener(this);
         alloc = new Rectangle(12, 17, 125, 541);
         paintRect = null;
-
         view.layout(alloc.width, alloc.height);
         assertTrue(view.isAllocationValid());
     }
@@ -94,23 +100,22 @@
     }
 
     public void testChangedUpdate() throws BadLocationException {
-        doc.setCharacterAttributes(p1.getStartOffset(), 3,
-                                   doc.getAttributeContext().getEmptySet(),
-                                   true);
+        doc.setCharacterAttributes(p1.getStartOffset(), 3, doc.getAttributeContext()
+                .getEmptySet(), true);
         strategy.changedUpdate(view, event, alloc);
         assertEquals(alloc, paintRect);
         assertTrue(view.isAllocationValid());
     }
 
     public void insertUpdate(DocumentEvent e) {
-        event = (DefaultDocumentEvent)e;
+        event = (DefaultDocumentEvent) e;
     }
 
     public void removeUpdate(DocumentEvent e) {
-        event = (DefaultDocumentEvent)e;
+        event = (DefaultDocumentEvent) e;
     }
 
     public void changedUpdate(DocumentEvent e) {
-        event = (DefaultDocumentEvent)e;
+        event = (DefaultDocumentEvent) e;
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContentRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContentRTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContentRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContentRTest.java Sun Nov 26 12:15:43 2006
@@ -32,9 +32,7 @@
     public void testShiftGap() throws BadLocationException {
         content = new GapContent(50);
         content.insertString(0, "01234567890123456789");
-        int[] offsets = new int[] {
-            9, 9, 10, 10, 13, 13, 14, 14, 15, 15, 20, 20, 21, 21
-        };
+        int[] offsets = new int[] { 9, 9, 10, 10, 13, 13, 14, 14, 15, 15, 20, 20, 21, 21 };
         Position[] pos = new Position[offsets.length];
         for (int i = 0; i < pos.length; i++) {
             pos[i] = content.createPosition(offsets[i]);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContentTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContentTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContentTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -27,13 +26,13 @@
 import java.lang.reflect.Field;
 import java.util.List;
 import java.util.Vector;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.undo.UndoableEdit;
 
 public class GapContentTest extends AbstractDocument_ContentTest {
     protected AbstractDocument.Content content;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         obj = content = new GapContent(30);
@@ -41,14 +40,13 @@
     }
 
     public void testGetPositionsInRangeVector() throws BadLocationException {
-        Vector v = new Vector();
+        Vector<Object> v = new Vector<Object>();
         v.add(new Object());
         v.add(new Object());
         content.createPosition(0);
         content.createPosition(1);
         content.createPosition(2);
-
-        ((GapContent)content).getPositionsInRange(v, 0, 3);
+        ((GapContent) content).getPositionsInRange(v, 0, 3);
         if (BasicSwingTestCase.isHarmony()) {
             // Position at offset 0 WILL NOT be included
             assertEquals(4, v.size());
@@ -59,75 +57,62 @@
     }
 
     public void testGetPositionsInRange() throws BadLocationException {
-        Vector pos = new Vector();
-
+        Vector<Position> pos = new Vector<Position>();
         for (int i = 0; i < content.length(); i += 2) {
             Position p = content.createPosition(i);
             if (i >= 3 && i <= 3 + 9) {
                 pos.add(p);
             }
         }
-        Vector v = ((GapContent)content).getPositionsInRange(null, 3, 9);
-
+        Vector<?> v = ((GapContent) content).getPositionsInRange(null, 3, 9);
         assertEquals(pos.size(), v.size());
-
         int[] offsets = new int[v.size()];
         for (int i = 0; i < pos.size(); i++) {
-            offsets[i] = ((Position)pos.get(i)).getOffset();
+            offsets[i] = pos.get(i).getOffset();
         }
-
         UndoableEdit ue = content.remove(0, 9);
-
         ue.undo();
-
         for (int i = 0; i < pos.size(); i++) {
-            assertEquals(offsets[i], ((Position)pos.get(i)).getOffset());
+            assertEquals(offsets[i], pos.get(i).getOffset());
         }
     }
 
     public void testUpdatePositions() throws BadLocationException {
         GapContent cont1 = new GapContent();
-
-        final Vector pos = new Vector();
+        final Vector<Position> pos = new Vector<Position>();
         final int posSize = 5;
         final int buffsize = 10;
-
-
         cont1 = new GapContent() {
-            public UndoableEdit remove(int where, int len)
-                throws BadLocationException {
+            private static final long serialVersionUID = 1L;
 
+            @Override
+            public UndoableEdit remove(int where, int len) throws BadLocationException {
                 UndoableEdit u = super.remove(where, len);
                 return u;
-
             }
 
+            @Override
             public UndoableEdit insertString(int offset, String str)
-                throws BadLocationException {
-
+                    throws BadLocationException {
                 UndoableEdit u = super.insertString(offset, str);
                 return u;
             }
 
-            protected void updateUndoPositions(Vector vector, int offset,
-                                               int len) {
+            @SuppressWarnings("unchecked")
+            @Override
+            protected void updateUndoPositions(Vector vector, int offset, int len) {
                 super.updateUndoPositions(vector, 1, 2);
             }
         };
-
         for (int i = 0; i < posSize; i++) {
             pos.add(cont1.createPosition(i));
         }
-
         StringBuffer f = new StringBuffer();
         for (int i = 0; i < buffsize; i++) {
             f.append("a");
         }
-
         cont1.insertString(0, f.toString());
-
         cont1.remove(0, 10).undo();
-
     }
 
     /**
@@ -136,23 +121,21 @@
      */
     public void testGetPositionsInRangeEnd() throws BadLocationException {
         content.createPosition(10);
-        Vector v = ((GapContent)content).getPositionsInRange(null, 0, 10);
+        Vector<?> v = ((GapContent) content).getPositionsInRange(null, 0, 10);
         assertEquals(1, v.size());
     }
 
     public void testPositionGC() throws BadLocationException {
-        Vector pos = new Vector(10);
-        ReferenceQueue rq = new ReferenceQueue();
+        Vector<WeakReference<Position>> pos = new Vector<WeakReference<Position>>(10);
+        ReferenceQueue<Position> rq = new ReferenceQueue<Position>();
         for (int i = 0; i < content.length(); i += 2) {
-            pos.add(new WeakReference(content.createPosition(i), rq));
+            pos.add(new WeakReference<Position>(content.createPosition(i), rq));
         }
-
         int count = 0;
         int i;
         for (i = 0; i < 100; i++) {
             System.gc();
-
-            Reference r;
+            Reference<?> r;
             if ((r = rq.poll()) != null) {
                 pos.remove(r);
                 count++;
@@ -161,21 +144,20 @@
                 }
             }
         }
-
-        fail("Not all Position objects are removed ("
-             + pos.size() + "/" + count + ").");
+        fail("Not all Position objects are removed (" + pos.size() + "/" + count + ").");
     }
 
     private void isContentArraySame(final boolean expected) {
         if (BasicSwingTestCase.isHarmony()) {
             if (expected) {
-                assertSame(((GapContent)obj).getArray(), text.array);
+                assertSame(((GapContent) obj).getArray(), text.array);
             } else {
-                assertNotSame(((GapContent)obj).getArray(), text.array);
+                assertNotSame(((GapContent) obj).getArray(), text.array);
             }
         }
     }
 
+    @Override
     public void testGetCharsAfterGap() throws BadLocationException {
         super.testGetCharsAfterGap();
         isContentArraySame(true);
@@ -184,18 +166,19 @@
     public void testGetCharsAfterGapNoImplied() throws BadLocationException {
         // Move the gap
         obj.insertString(10, "big ");
-
         // Don't include the implied char
         obj.getChars(19, 7, text);
         assertEquals("string.", text.toString());
         isContentArraySame(true);
     }
 
+    @Override
     public void testGetCharsBeforeGap() throws BadLocationException {
         super.testGetCharsBeforeGap();
         isContentArraySame(true);
     }
 
+    @Override
     public void testGetCharsFullLength() throws BadLocationException {
         super.testGetCharsFullLength();
         isContentArraySame(false);
@@ -207,6 +190,7 @@
         isContentArraySame(true);
     }
 
+    @Override
     public void testGetCharsImpliedChar() throws BadLocationException {
         super.testGetCharsImpliedChar();
         isContentArraySame(false);
@@ -214,67 +198,56 @@
 
     public void testGetCharsImpliedCharPartial() throws BadLocationException {
         obj = content = new GapContent();
-
         assertEquals(1, content.length());
-
         text.setPartialReturn(false);
         content.getChars(0, 1, text);
         assertEquals("\n", text.toString());
-        assertEquals(((GapContent)content).getArrayLength(), text.array.length);
-
+        assertEquals(((GapContent) content).getArrayLength(), text.array.length);
         text.setPartialReturn(true);
         content.getChars(0, 1, text);
         assertEquals("\n", text.toString());
-        assertEquals(((GapContent)content).getArrayLength(), text.array.length);
+        assertEquals(((GapContent) content).getArrayLength(), text.array.length);
     }
 
+    @Override
     public void testGetCharsPartial() throws BadLocationException {
         super.testGetCharsPartial();
         isContentArraySame(true);
     }
 
+    @Override
     public void testGetCharsWithGap() throws BadLocationException {
         super.testGetCharsWithGap();
         isContentArraySame(false);
     }
 
     public void testCreatePositionBeforeUndo() throws BadLocationException {
-        UndoableEdit ue  = content.remove(3, 8);
-        Position     pos = content.createPosition(3);
-
+        UndoableEdit ue = content.remove(3, 8);
+        Position pos = content.createPosition(3);
         assertEquals(3, pos.getOffset());
-
         ue.undo();
         assertEquals(11, pos.getOffset());
-
         ue.redo();
         assertEquals(3, pos.getOffset());
     }
 
     public void testCreatePositionAfterUndone() throws BadLocationException {
-        UndoableEdit ue  = content.remove(3, 8);
-
+        UndoableEdit ue = content.remove(3, 8);
         ue.undo();
-
         Position pos = content.createPosition(5);
         assertEquals(5, pos.getOffset());
-
         ue.redo();
         assertEquals(3, pos.getOffset());
-
         ue.undo();
         assertEquals(5, pos.getOffset());
     }
 
     public void testCreatePositionAfterInsert() throws BadLocationException {
-        UndoableEdit ue  = content.insertString(10, "big ");
-        Position     pos = content.createPosition(12);
-
+        UndoableEdit ue = content.insertString(10, "big ");
+        Position pos = content.createPosition(12);
         assertEquals(12, pos.getOffset());
-
         ue.undo();
         assertEquals(10, pos.getOffset());
-
         ue.redo();
         assertEquals(12, pos.getOffset());
     }
@@ -292,17 +265,14 @@
         return -1000;
     }
 
-    public static List getPositionList(final GapContent content) {
+    public static List<?> getPositionList(final GapContent content) {
         try {
-            Field f =
-                content.getClass().getDeclaredField("gapContentPositions");
+            Field f = content.getClass().getDeclaredField("gapContentPositions");
             f.setAccessible(true);
-            ContentPositions gapContentPositions =
-                (ContentPositions) f.get(content);
-
+            ContentPositions gapContentPositions = (ContentPositions) f.get(content);
             f = gapContentPositions.getClass().getSuperclass().getDeclaredField("positionList");
             f.setAccessible(true);
-            return (List)(f.get(gapContentPositions));
+            return (List<?>) (f.get(gapContentPositions));
         } catch (IllegalAccessException e) {
             fail(e.getMessage());
         } catch (NoSuchFieldException e) {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_ComplexUndoTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_ComplexUndoTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_ComplexUndoTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_ComplexUndoTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -25,14 +24,13 @@
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
 import java.util.Vector;
-
 import javax.swing.undo.UndoableEdit;
-
 import junit.framework.TestCase;
 
 public class GapContent_ComplexUndoTest extends TestCase {
     protected AbstractDocument.Content content;
 
+    @Override
     protected void setUp() throws Exception {
         content = new GapContent();
     }
@@ -44,13 +42,12 @@
      * @throws BadLocationException
      */
     public void testUndoRedo1() throws BadLocationException {
-        char[] chars = {'0', '1', '2', '3', '4'};
+        char[] chars = { '0', '1', '2', '3', '4' };
         UndoableEdit[] undo = new UndoableEdit[chars.length];
-        int  i;
+        int i;
         for (i = 0; i < 5; i++) {
             undo[i] = content.insertString(i, new String(chars, i, 1));
         }
-
         // Now undo till the end
         for (i = undo.length - 1; i >= 0; i--) {
             undo[i].undo();
@@ -59,7 +56,6 @@
         for (i = 0; i < undo.length; i++) {
             undo[i].redo();
         }
-
         // This should give us the same result
         assertEquals("01234", content.getString(0, content.length() - 1));
     }
@@ -71,16 +67,15 @@
      * @throws BadLocationException
      */
     public void testUndoRedo2() throws BadLocationException {
-        char[] chars = {'0', '1', '2', '3', '4', 'a', 'b', 'c'};
+        char[] chars = { '0', '1', '2', '3', '4', 'a', 'b', 'c' };
         UndoableEdit[] undo = new UndoableEdit[chars.length];
-        int  i;
+        int i;
         for (i = 0; i < 5; i++) {
             undo[i] = content.insertString(i, new String(chars, i, 1));
         }
         for (; i < chars.length; i++) {
             undo[i] = content.insertString(i - 2, new String(chars, i, 1));
         }
-
         // Now undo till the end
         for (i = undo.length - 1; i >= 3; i--) {
             undo[i].undo();
@@ -89,7 +84,6 @@
         for (++i; i < undo.length; i++) {
             undo[i].redo();
         }
-
         // This should give us the same result
         assertEquals("012abc34", content.getString(0, content.length() - 1));
     }
@@ -101,17 +95,15 @@
      */
     public void testUndoRedo3() throws BadLocationException {
         content.insertString(0, "012345678");
-        char[] chars = {'9', '0', '1', 'a', 'b', 'c'};
+        char[] chars = { '9', '0', '1', 'a', 'b', 'c' };
         UndoableEdit[] undo = new UndoableEdit[chars.length];
-        int  i;
+        int i;
         for (i = 0; i < 3; i++) {
-            undo[i] = content.insertString(content.length() - 1,
-                                           new String(chars, i, 1));
+            undo[i] = content.insertString(content.length() - 1, new String(chars, i, 1));
         }
         for (; i < chars.length; i++) {
             undo[i] = content.insertString(i, new String(chars, i, 1));
         }
-
         // Now undo till the end
         for (i = undo.length - 1; i >= 3; i--) {
             undo[i].undo();
@@ -120,10 +112,8 @@
         for (++i; i < undo.length; i++) {
             undo[i].redo();
         }
-
         // This should give us the same result
-        assertEquals("012abc345678901",
-                     content.getString(0, content.length() - 1));
+        assertEquals("012abc345678901", content.getString(0, content.length() - 1));
     }
 
     /**
@@ -134,8 +124,7 @@
      * @throws BadLocationException
      */
     private void addPositions(final int[] offsets, final Position[] positions)
-        throws BadLocationException {
-
+            throws BadLocationException {
         for (int i = 0; i < offsets.length; i++) {
             positions[i] = content.createPosition(offsets[i]);
         }
@@ -147,8 +136,7 @@
      * @param offsets expected offsets
      * @param positions position array to be checked
      */
-    private void checkPositions(final int[] offsets,
-                                final Position[] positions) {
+    private void checkPositions(final int[] offsets, final Position[] positions) {
         for (int i = 0; i < offsets.length; i++) {
             assertEquals(offsets[i], positions[i].getOffset());
         }
@@ -163,75 +151,52 @@
     public void testUndoRedo4() throws BadLocationException {
         content.insertString(0, "yuiop\n123456\n789987\nabcdef");
         //                       012345 6789012 3456789 012345
-        int[]      off1 = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24};
+        int[] off1 = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 };
         Position[] pos1 = new Position[off1.length];
         addPositions(off1, pos1);
-
         UndoableEdit[] undo = new UndoableEdit[3];
-
         // Remove the second line from the text
         undo[0] = content.remove(6, 7);
-        assertEquals("yuiop\n789987\nabcdef\n",
-                     content.getString(0, content.length()));
-        assertEquals("p\n",
-                     content.getString(pos1[2].getOffset(),
-                                       pos1[6].getOffset()
-                                       - pos1[2].getOffset()));
-
+        assertEquals("yuiop\n789987\nabcdef\n", content.getString(0, content.length()));
+        assertEquals("p\n", content.getString(pos1[2].getOffset(), pos1[6].getOffset()
+                - pos1[2].getOffset()));
         // Remove the second line from the text (it was the third one)
         undo[1] = content.remove(6, 7);
-        assertEquals("yuiop\nabcdef\n",
-                     content.getString(0, content.length()));
-        assertEquals("p\n",
-                     content.getString(pos1[2].getOffset(),
-                                       pos1[6].getOffset()
-                                       - pos1[2].getOffset()));
-
+        assertEquals("yuiop\nabcdef\n", content.getString(0, content.length()));
+        assertEquals("p\n", content.getString(pos1[2].getOffset(), pos1[6].getOffset()
+                - pos1[2].getOffset()));
         // Insert a string at the same position (in the beginning
         // of the second line)
         undo[2] = content.insertString(6, "qwerty");
-        assertEquals("yuiop\nqwertyabcdef\n",
-                     content.getString(0, content.length()));
-
+        assertEquals("yuiop\nqwertyabcdef\n", content.getString(0, content.length()));
         // Add more positions
-        int[]      off2    = {6, 7, 8, 9, 10};
-        Position[] pos2    = new Position[off2.length];
-        int[]      off2Del = {6, 6, 6, 6,  6};
+        int[] off2 = { 6, 7, 8, 9, 10 };
+        Position[] pos2 = new Position[off2.length];
+        int[] off2Del = { 6, 6, 6, 6, 6 };
         addPositions(off2, pos2);
-        assertEquals("p\nqwer",
-                     content.getString(pos1[2].getOffset(),
-                                       pos2[4].getOffset()
-                                       - pos1[2].getOffset()));
-
+        assertEquals("p\nqwer", content.getString(pos1[2].getOffset(), pos2[4].getOffset()
+                - pos1[2].getOffset()));
         // Now undo twice
-
         // Undo the first time
         undo[2].undo();
         // Check the positions we added the second time, and
         // the text between two positions
         checkPositions(off2Del, pos2);
-        assertEquals("", content.getString(pos1[4].getOffset(),
-                                           pos2[1].getOffset()
-                                           - pos1[4].getOffset()));
-
+        assertEquals("", content.getString(pos1[4].getOffset(), pos2[1].getOffset()
+                - pos1[4].getOffset()));
         // Undo the second time
         undo[1].undo();
-        assertEquals("789987\n", content.getString(pos1[4].getOffset(),
-                                                   pos2[1].getOffset()
-                                                   - pos1[4].getOffset()));
-
+        assertEquals("789987\n", content.getString(pos1[4].getOffset(), pos2[1].getOffset()
+                - pos1[4].getOffset()));
         // And redo once
         undo[1].redo();
         // Check positions and text in the buffer
         checkPositions(off2Del, pos2);
-
-        assertEquals("yuiop\nabcdef\n",
-                content.getString(0, content.length()));
+        assertEquals("yuiop\nabcdef\n", content.getString(0, content.length()));
         // This assertion was failing, throwing the exception as
         // pos1[4] was negative :-), but of course shouldn't
-        assertEquals("", content.getString(pos1[4].getOffset(),
-                                           pos2[1].getOffset()
-                                           - pos1[4].getOffset()));
+        assertEquals("", content.getString(pos1[4].getOffset(), pos2[1].getOffset()
+                - pos1[4].getOffset()));
     }
 
     /**
@@ -241,19 +206,16 @@
      */
     public void testUndoGC() throws BadLocationException {
         content.insertString(0, "012345678");
-
-        Vector pos = new Vector(10);
-        ReferenceQueue rq = new ReferenceQueue();
+        Vector<WeakReference<Position>> pos = new Vector<WeakReference<Position>>(10);
+        ReferenceQueue<Position> rq = new ReferenceQueue<Position>();
         for (int i = 0; i < content.length(); i += 2) {
-            pos.add(new WeakReference(content.createPosition(i), rq));
+            pos.add(new WeakReference<Position>(content.createPosition(i), rq));
         }
-
         int count = 0;
         int i;
         for (i = 0; i < 100; i++) {
             System.gc();
-
-            Reference r;
+            Reference<?> r;
             if ((r = rq.poll()) != null) {
                 pos.remove(r);
                 count++;
@@ -262,19 +224,12 @@
                 }
             }
         }
-
         // This call causes all the garbage collected positions to be
         // removed from the internal list
         UndoableEdit ue = content.remove(0, 5);
-
-        assertEquals("5678",
-                     content.getString(0, content.length() - 1));
-
+        assertEquals("5678", content.getString(0, content.length() - 1));
         // Test (it shouldn't fail with any NullPointerException)
         ue.undo();
-
-        assertEquals("012345678",
-                     content.getString(0, content.length() - 1));
+        assertEquals("012345678", content.getString(0, content.length() - 1));
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_GapVectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_GapVectorTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_GapVectorTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_GapVectorTest.java Sun Nov 26 12:15:43 2006
@@ -47,7 +47,7 @@
 
     public void testAllocateArray() {
         final int length = gv.getArrayLength();
-        char[] array = (char[])gv.allocateArray(150);
+        char[] array = (char[]) gv.allocateArray(150);
         assertEquals(150, array.length);
         assertEquals(length, gv.getArrayLength());
     }
@@ -57,7 +57,7 @@
     }
 
     public void testGetArrayLength() {
-        assertEquals(((char[])gv.getArray()).length, gv.getArrayLength());
+        assertEquals(((char[]) gv.getArray()).length, gv.getArrayLength());
     }
 
     public void testGetGapEnd() {
@@ -70,7 +70,6 @@
 
     public void testInsertStringValid() throws BadLocationException {
         gv.insertString(0, "z");
-
         assertEquals(1, gv.getGapStart());
     }
 
@@ -83,14 +82,13 @@
     public void testInsertStringInvalid() {
         try {
             gv.insertString(12, "z");
-
             fail("BadLocationException must be thrown");
-        } catch (BadLocationException e) { }
+        } catch (BadLocationException e) {
+        }
     }
 
     public void testRemoveValid() throws BadLocationException {
         gv.remove(1, 7);
-
         assertEquals(1, gv.getGapStart());
         assertEquals(17, gv.getGapEnd());
     }
@@ -98,28 +96,25 @@
     public void testRemoveInvalidPosition() {
         try {
             gv.remove(10, 1);
-
             fail("BadLocationException should be thrown");
-        } catch (BadLocationException e) { }
+        } catch (BadLocationException e) {
+        }
     }
 
     public void testRemoveInvalidSize() {
         // Try to remove more items than the array actually holds
         try {
             gv.remove(7, 10);
-
             fail("BadLocationException should be thrown");
-        } catch (BadLocationException e) { }
+        } catch (BadLocationException e) {
+        }
     }
 
     public void testReplace() throws BadLocationException {
-        char[] charArray = {'z', 'y', 'x', 'w', 'v'};
-
+        char[] charArray = { 'z', 'y', 'x', 'w', 'v' };
         gv.replace(3, 5, charArray, 3);
-
-        char[] chars1 = {'a', 'b', 'c', 'z', 'y', 'x'};
-        char[] chars2 = {'i', 'j'};
-
+        char[] chars1 = { 'a', 'b', 'c', 'z', 'y', 'x' };
+        char[] chars2 = { 'i', 'j' };
         char[] array = (char[]) gv.getArray();
         for (int i = 0; i < gv.getGapStart(); i++) {
             assertEquals("1 @ " + i, chars1[i], array[i]);
@@ -132,37 +127,30 @@
     public void testShiftEnd() {
         gv.shiftGap(5);
         gv.shiftEnd(20);
-
         // Check the gap boundaries and its size
         assertEquals(5, gv.getGapStart());
         assertEquals(36, gv.getGapEnd());
         assertEquals(31, gv.getGapEnd() - gv.getGapStart());
-
         // Check that values are copied
-        assertEquals('e', ((char[])gv.getArray())[gv.getGapStart() - 1]);
-        assertEquals('f', ((char[])gv.getArray())[gv.getGapEnd()]);
-
+        assertEquals('e', ((char[]) gv.getArray())[gv.getGapStart() - 1]);
+        assertEquals('f', ((char[]) gv.getArray())[gv.getGapEnd()]);
         try {
             gv.shiftEnd(1);
-
             fail("ArrayIndexOutOfBoundsException is expected as the size of "
-                 + "the array can't be decreased.");
-        } catch (ArrayIndexOutOfBoundsException e) { }
+                    + "the array can't be decreased.");
+        } catch (ArrayIndexOutOfBoundsException e) {
+        }
     }
 
-    public void testShiftEndOverfull() throws BadLocationException  {
-
+    public void testShiftEndOverfull() throws BadLocationException {
         gv.insertString(gv.getGapStart(), "0123456");
-
         int size = gv.getArrayLength();
         assertEquals(20, size);
         char c = '7';
         while (size == gv.getArrayLength()) {
             gv.insertString(gv.getGapStart(), String.valueOf(c));
-
             c++;
         }
-
         assertEquals(19, gv.getGapStart());
         assertEquals(41, gv.getGapEnd());
         assertEquals(42, gv.getArrayLength());
@@ -179,8 +167,7 @@
         gv.shiftGap(7);
         assertEquals(7, gv.getGapStart());
         assertEquals(16, gv.getGapEnd());
-
-        char[] array = (char[])gv.getArray();
+        char[] array = (char[]) gv.getArray();
         assertEquals('g', array[gv.getGapStart() - 1]);
         assertEquals('h', array[gv.getGapEnd()]);
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_InternalTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_InternalTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_InternalTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_InternalTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -22,7 +21,6 @@
 package javax.swing.text;
 
 import java.util.List;
-
 import javax.swing.BasicSwingTestCase;
 
 /**
@@ -30,9 +28,9 @@
  *
  */
 public class GapContent_InternalTest extends BasicSwingTestCase {
-
     protected GapContent content;
 
+    @Override
     protected void setUp() throws Exception {
         content = new GapContent(30);
         content.insertString(0, "This is a test string.");
@@ -42,13 +40,11 @@
         if (!isHarmony()) {
             return;
         }
-
         content = new GapContent();
         int size = content.getArrayLength();
         char c = '0';
         while (size == content.getArrayLength()) {
-            content.insertString(content.getGapStart(),
-                                 new String(new char[] {c}));
+            content.insertString(content.getGapStart(), new String(new char[] { c }));
             c++;
         }
         assertEquals("012345678\n", content.getString(0, content.length()));
@@ -58,7 +54,6 @@
         if (!isHarmony()) {
             return;
         }
-
         content.shiftGap(5);
         content.createPosition(10);
         content.createPosition(4);
@@ -66,17 +61,13 @@
         content.createPosition(15);
         content.createPosition(2);
         content.createPosition(23);
-        int[] positions = {2, 4, 12, 17, 22, 30};
-        int[] offsets   = {2, 4,  5, 10, 15, 23};
-
-        List posList = getPositionList(content);
-
+        int[] positions = { 2, 4, 12, 17, 22, 30 };
+        int[] offsets = { 2, 4, 5, 10, 15, 23 };
+        List<?> posList = getPositionList(content);
         for (int i = 0; i < posList.size(); i++) {
-            Position      p = (Position)posList.get(i);
-            assertEquals("Indexes are different @ " + i,
-                         positions[i], getIndex(p));
-            assertEquals("Offsets are different @ " + i,
-                         offsets[i], p.getOffset());
+            Position p = (Position) posList.get(i);
+            assertEquals("Indexes are different @ " + i, positions[i], getIndex(p));
+            assertEquals("Offsets are different @ " + i, offsets[i], p.getOffset());
         }
     }
 
@@ -88,22 +79,19 @@
         if (!isHarmony()) {
             return;
         }
-
         GapContent g = new GapContent();
         g.insertString(0, "123\n");
-        int[] pos = {0, 0, 0, 5, 5, 4};
+        int[] pos = { 0, 0, 0, 5, 5, 4 };
         for (int i = 0; i < pos.length; i++) {
             g.createPosition(pos[i]);
         }
-
-        List posList = getPositionList(g);
-
+        List<?> posList = getPositionList(g);
         // Check all the positions are sorted
         Position dmL;
         Position dmR;
         for (int i = 0; i < posList.size() - 1; i++) {
-            dmL = (Position)posList.get(i);
-            dmR = (Position)posList.get(i + 1);
+            dmL = (Position) posList.get(i);
+            dmR = (Position) posList.get(i + 1);
             assertFalse(getIndex(dmL) > getIndex(dmR));
         }
     }
@@ -112,36 +100,30 @@
         if (!isHarmony()) {
             return;
         }
-
         final Position[] pos = new Position[5];
-
         for (int i = 0; i < 10; i++) {
             Position p = content.createPosition(i * 2);
             if (i < 5) {
                 pos[i] = p;
             }
         }
-
         assertEquals(10, getPositionList(content).size());
-
         for (int i = 0; i < 3; i++) {
             System.gc();
         }
-
         // if this code is omitted the saved objects are
         // considered to be unreachable, so the garbage
         // collector deletes refences to them
         for (int i = 0; i < pos.length; i++) {
             pos[i].getOffset();
         }
-
         // Create another position object. This will implicitly
         // remove all unreachable positions
         content.createPosition(20);
         assertEquals(6, getPositionList(content).size());
     }
 
-    private static List getPositionList(final GapContent content) {
+    private static List<?> getPositionList(final GapContent content) {
         return GapContentTest.getPositionList(content);
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_PositionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_PositionTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_PositionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_PositionTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -22,7 +21,6 @@
 package javax.swing.text;
 
 import java.util.List;
-
 import javax.swing.BasicSwingTestCase;
 
 /**
@@ -36,23 +34,25 @@
     /**
      * Offsets in the document when the document is not changed.
      */
-    private static final int[] offsets = {0, 5, 10, 15, 20};
+    private static final int[] offsets = { 0, 5, 10, 15, 20 };
+
     private Position[] positions;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         content = new GapContent(30);
         content.insertString(0, "This is a test string.");
         content.shiftGap(7);
-
         // Add some positions to the content
-        int[] offsets = {0, 10, 5, 20, 15};
+        int[] offsets = { 0, 10, 5, 20, 15 };
         positions = new Position[offsets.length];
         for (int i = 0; i < offsets.length; i++) {
             positions[i] = content.createPosition(offsets[i]);
         }
     }
-    
+
+    @Override
     protected void tearDown() throws Exception {
         for (int i = 0; i < offsets.length; i++) {
             positions[i] = null;
@@ -64,9 +64,8 @@
         if (!isHarmony()) {
             return;
         }
-
         content.shiftGap(2);
-        checkPositions(new int[] {0, 12, 17, 22, 27});
+        checkPositions(new int[] { 0, 12, 17, 22, 27 });
         checkPositionOffsets(offsets);
     }
 
@@ -74,9 +73,8 @@
         if (!isHarmony()) {
             return;
         }
-
         content.shiftGap(15);
-        checkPositions(new int[] {0, 5, 10, 22, 27});
+        checkPositions(new int[] { 0, 5, 10, 22, 27 });
         checkPositionOffsets(offsets);
     }
 
@@ -87,11 +85,9 @@
      */
     private void checkPositions(final int[] pos) {
         Position p;
-        final List list = GapContentTest.getPositionList(content);
-
+        final List<?> list = GapContentTest.getPositionList(content);
         for (int i = 0; i < pos.length; i++) {
-            p  = (Position)list.get(i);
-
+            p = (Position) list.get(i);
             assertEquals(pos[i], GapContentTest.getIndex(p));
         }
     }
@@ -103,11 +99,9 @@
      */
     private void checkPositionOffsets(final int[] offsets) {
         Position p;
-        List list = GapContentTest.getPositionList(content);
-
+        List<?> list = GapContentTest.getPositionList(content);
         for (int i = 0; i < offsets.length; i++) {
-            p = (Position)list.get(i);
-
+            p = (Position) list.get(i);
             assertEquals(offsets[i], p.getOffset());
         }
     }
@@ -116,42 +110,37 @@
         if (!isHarmony()) {
             return;
         }
-
         content.shiftEnd(20);
         checkPositionOffsets(offsets);
-        checkPositions(new int[] {0, 5, 29, 34, 39});
+        checkPositions(new int[] { 0, 5, 29, 34, 39 });
     }
 
     public void testShiftGapStartDown() {
         if (!isHarmony()) {
             return;
         }
-
         content.shiftGapStartDown(3);
-        checkPositionOffsets(new int[] {0, 3, 6, 11, 16});
-        checkPositions(new int[] {0, 14, 17, 22, 27});
+        checkPositionOffsets(new int[] { 0, 3, 6, 11, 16 });
+        checkPositions(new int[] { 0, 14, 17, 22, 27 });
     }
 
     public void testShiftGapEndUp() {
         if (!isHarmony()) {
             return;
         }
-
         content.shiftGapEndUp(22);
-        checkPositionOffsets(new int[] {0, 5, 7, 7, 12});
-        checkPositions(new int[] {0, 5, 22, 22, 27});
+        checkPositionOffsets(new int[] { 0, 5, 7, 7, 12 });
+        checkPositions(new int[] { 0, 5, 22, 22, 27 });
     }
 
     public void testResetMarksAtZero() {
         if (!isHarmony()) {
             return;
         }
-
         content.shiftGapStartDown(0);
         // No explicit call to content.resetMarksAtZero() is made,
         // as it is called by content.shiftGapStartDown method
-        checkPositions(new int[] {0, 0, 17, 22, 27});
-        checkPositionOffsets(new int [] {0, 0, 3, 8, 13});
+        checkPositions(new int[] { 0, 0, 17, 22, 27 });
+        checkPositionOffsets(new int[] { 0, 0, 3, 8, 13 });
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_SerializeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_SerializeTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_SerializeTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_SerializeTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -22,37 +21,34 @@
 package javax.swing.text;
 
 import java.lang.ref.WeakReference;
-
 import javax.swing.SerializableTestCase;
 
 public class GapContent_SerializeTest extends SerializableTestCase {
     private GapContent content;
 
+    @Override
     protected void setUp() throws Exception {
         toSave = content = new GapContent();
-
         content.insertString(0, "01234");
         content.insertString(5, "abcde");
         content.insertString(5, "!");
         super.setUp();
     }
 
+    @Override
     public void testSerializable() throws Exception {
-        GapContent restored = (GapContent)toLoad;
-
+        GapContent restored = (GapContent) toLoad;
         assertEquals(content.length(), restored.length());
         assertEquals(content.getArrayLength(), restored.getArrayLength());
         assertEquals(content.getGapStart(), restored.getGapStart());
         assertEquals(content.getGapEnd(), restored.getGapEnd());
-        assertEquals(content.getString(0, content.length()),
-                     restored.getString(0, restored.length()));
-
+        assertEquals(content.getString(0, content.length()), restored.getString(0, restored
+                .length()));
         // Test that position handling works the way it is supposed
         Position pos = restored.createPosition(5);
-        WeakReference  wr = new WeakReference(pos);
+        WeakReference<Position> wr = new WeakReference<Position>(pos);
         assertEquals(5, pos.getOffset());
         restored.insertString(0, "aStr");
-        assertEquals(9, pos.getOffset());        
+        assertEquals(9, pos.getOffset());
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_UndoTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_UndoTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_UndoTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GapContent_UndoTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -22,68 +21,56 @@
 package javax.swing.text;
 
 import java.lang.reflect.Field;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.undo.CannotRedoException;
 import javax.swing.undo.CannotUndoException;
 import javax.swing.undo.UndoableEdit;
-
 import junit.framework.TestCase;
 
 public class GapContent_UndoTest extends TestCase {
     protected AbstractDocument.Content content;
+
     protected UndoableEdit insertEdit;
 
+    @Override
     protected void setUp() throws Exception {
         content = new GapContent();
         insertEdit = content.insertString(0, "01234");
     }
 
-    public void testUndoInsertEnd() throws BadLocationException  {
+    public void testUndoInsertEnd() throws BadLocationException {
         UndoableEdit ue = content.insertString(5, "567");
-
         ue.undo();
-
         assertEquals("01234\n", content.getString(0, content.length()));
     }
 
     public void testUndoInsertStart() throws BadLocationException {
         UndoableEdit ue = content.insertString(0, "321");
-
         ue.undo();
-
         assertEquals("01234\n", content.getString(0, content.length()));
     }
 
     public void testUndoInsertMiddle() throws BadLocationException {
         UndoableEdit ue = content.insertString(3, "999");
-
         ue.undo();
-
         assertEquals("01234\n", content.getString(0, content.length()));
     }
 
-    public void testUndoRemoveEnd() throws BadLocationException  {
+    public void testUndoRemoveEnd() throws BadLocationException {
         UndoableEdit ue = content.remove(3, 2);
-
         ue.undo();
-
         assertEquals("01234\n", content.getString(0, content.length()));
     }
 
     public void testUndoRemoveStart() throws BadLocationException {
         UndoableEdit ue = content.remove(0, 2);
-
         ue.undo();
-
         assertEquals("01234\n", content.getString(0, content.length()));
     }
 
     public void testUndoRemoveMiddle() throws BadLocationException {
         UndoableEdit ue = content.remove(3, 2);
-
         ue.undo();
-
         assertEquals("01234\n", content.getString(0, content.length()));
     }
 
@@ -105,7 +92,7 @@
         try {
             Field f = ue.getClass().getSuperclass().getDeclaredField("text");
             f.setAccessible(true);
-            return (String)(f.get(ue));
+            return (String) (f.get(ue));
         } catch (IllegalAccessException e) {
             fail(e.getMessage());
         } catch (NoSuchFieldException e) {
@@ -173,17 +160,16 @@
         insertEdit.undo();
         try {
             insertEdit.undo();
-
             fail("CannotUndoException should be thrown");
-        } catch (CannotUndoException e) { }
+        } catch (CannotUndoException e) {
+        }
     }
 
     public void testCantRedo() {
         try {
             insertEdit.redo();
-
             fail("CannotRedoException should be thrown");
-        } catch (CannotRedoException e) { }
+        } catch (CannotRedoException e) {
+        }
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphViewRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphViewRTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphViewRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphViewRTest.java Sun Nov 26 12:15:43 2006
@@ -23,43 +23,47 @@
 import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Toolkit;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.text.FlowView_FlowStrategyTest.PartFactory;
 
 public class GlyphViewRTest extends BasicSwingTestCase {
     private GlyphView view;
+
     private StyledDocument doc;
+
     private Element root;
+
     private Element leaf;
 
     private Font font;
+
     private FontMetrics metrics;
+
     private float width;
 
-    private static final String FULL_TEXT =
-        "this text to check how view breaks";
-    //   0123456789012345678901234567890123
+    private static final String FULL_TEXT = "this text to check how view breaks";
 
+    //   0123456789012345678901234567890123
     private static final int startOffset = 5;
+
     private static final int endOffset = 28;
+
     private static final int length = endOffset - startOffset;
 
-    private static final String LEAF_TEXT =
-        FULL_TEXT.substring(startOffset, endOffset);
+    private static final String LEAF_TEXT = FULL_TEXT.substring(startOffset, endOffset);
 
     private static final int X_AXIS = View.X_AXIS;
 
+    @SuppressWarnings("deprecation")
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DefaultStyledDocument();
         root = doc.getDefaultRootElement();
         doc.insertString(0, FULL_TEXT, null);
-        doc.setCharacterAttributes(startOffset, length,
-                                   SimpleAttributeSet.EMPTY, false);
+        doc.setCharacterAttributes(startOffset, length, SimpleAttributeSet.EMPTY, false);
         leaf = root.getElement(0).getElement(1);
         view = new GlyphView(leaf);
-
         font = view.getFont();
         metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
     }
@@ -69,13 +73,11 @@
      */
     public void testBreakView() {
         View part;
-
         width = metrics.stringWidth(LEAF_TEXT);
         part = view.breakView(X_AXIS, startOffset, 0, width);
         assertEquals(startOffset, part.getStartOffset());
         assertEquals(endOffset, part.getEndOffset());
         assertSame(view, part);
-
         part = view.breakView(X_AXIS, startOffset + 1, 0, width);
         assertEquals(startOffset + 1, part.getStartOffset());
         assertEquals(endOffset, part.getEndOffset());
@@ -85,19 +87,16 @@
     public void testGetTabExpander() {
         assertNull(view.getParent());
         assertNull(view.getTabExpander());
-
         ParagraphView paragraphView = new ParagraphView(root.getElement(0));
         paragraphView.loadChildren(null);
-        ((CompositeView)paragraphView.layoutPool)
-                .loadChildren(new PartFactory());
-
+        ((CompositeView) paragraphView.layoutPool).loadChildren(new PartFactory());
         View child = paragraphView.layoutPool.getView(0);
         assertTrue(child instanceof GlyphView);
         assertSame(paragraphView, child.getParent().getParent());
         if (isHarmony()) {
-            assertSame(paragraphView, ((GlyphView)child).getTabExpander());
+            assertSame(paragraphView, ((GlyphView) child).getTabExpander());
         } else {
-            assertNull(((GlyphView)child).getTabExpander());
+            assertNull(((GlyphView) child).getTabExpander());
         }
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphViewTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphViewTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphViewTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphViewTest.java Sun Nov 26 12:15:43 2006
@@ -26,8 +26,8 @@
 import java.awt.Rectangle;
 import java.awt.Shape;
 import java.awt.Toolkit;
-
 import javax.swing.BasicSwingTestCase;
+import javax.swing.SwingConstants;
 import javax.swing.text.GlyphView.GlyphPainter;
 import javax.swing.text.Position.Bias;
 
@@ -37,37 +37,47 @@
  */
 public class GlyphViewTest extends BasicSwingTestCase {
     protected static class EmptyPainter extends GlyphPainter {
-        public float getSpan(GlyphView v,
-                             int p0, int p1, TabExpander e, float x) {
+        @Override
+        public float getSpan(GlyphView v, int p0, int p1, TabExpander e, float x) {
             return 0;
         }
+
+        @Override
         public float getHeight(GlyphView v) {
             return 0;
         }
+
+        @Override
         public float getAscent(GlyphView v) {
             return 0;
         }
+
+        @Override
         public float getDescent(GlyphView v) {
             return 0;
         }
-        public void paint(GlyphView v, Graphics g, Shape a,
-                          int p0, int p1) {
+
+        @Override
+        public void paint(GlyphView v, Graphics g, Shape a, int p0, int p1) {
         }
-        public Shape modelToView(GlyphView v, int pos,
-                                 Bias bias, Shape a)
-            throws BadLocationException {
 
+        @Override
+        public Shape modelToView(GlyphView v, int pos, Bias bias, Shape a)
+                throws BadLocationException {
             return null;
         }
-        public int viewToModel(GlyphView v,
-                               float x, float y,
-                               Shape a, Bias[] biasRet) {
+
+        @Override
+        public int viewToModel(GlyphView v, float x, float y, Shape a, Bias[] biasRet) {
             return 0;
         }
-        public int getBoundedPosition(GlyphView v, int p0,
-                                      float x, float len) {
+
+        @Override
+        public int getBoundedPosition(GlyphView v, int p0, float x, float len) {
             return 0;
         }
+
+        @Override
         public String toString() {
             return "GlyphViewTest.EmptyPainter";
         }
@@ -76,19 +86,22 @@
     private static final float ACCURACY = 0.00001f;
 
     private GlyphView view;
+
     private StyledDocument doc;
+
     private Element root;
+
     private Element leaf;
 
     private static final String TEXT = "012345";
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DefaultStyledDocument();
         root = doc.getDefaultRootElement();
         doc.insertString(0, TEXT, null);
-        doc.setCharacterAttributes(0, TEXT.length() - 1,
-                                   SimpleAttributeSet.EMPTY, false);
+        doc.setCharacterAttributes(0, TEXT.length() - 1, SimpleAttributeSet.EMPTY, false);
         leaf = root.getElement(0).getElement(0);
         view = new GlyphView(leaf);
     }
@@ -99,32 +112,31 @@
         assertNull(view.getGlyphPainter());
     }
 
+    @SuppressWarnings("deprecation")
     public void testGetPreferredSpan() {
         assertNull(view.getGlyphPainter());
         Font font = view.getFont();
         FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
-        assertEquals(metrics.stringWidth(TEXT.substring(view.getStartOffset(),
-                                                        view.getEndOffset())),
-                     view.getPreferredSpan(View.X_AXIS), ACCURACY);
-        assertEquals(metrics.getHeight(),
-                     view.getPreferredSpan(View.Y_AXIS), ACCURACY);
+        assertEquals(metrics.stringWidth(TEXT.substring(view.getStartOffset(), view
+                .getEndOffset())), view.getPreferredSpan(View.X_AXIS), ACCURACY);
+        assertEquals(metrics.getHeight(), view.getPreferredSpan(View.Y_AXIS), ACCURACY);
         assertNotNull(view.getGlyphPainter());
     }
 
     public void testGetPreferredSpanCustomPainter() {
         view.setGlyphPainter(new EmptyPainter() {
-            public float getSpan(GlyphView v,
-                                 int p0, int p1, TabExpander e, float x) {
+            @Override
+            public float getSpan(GlyphView v, int p0, int p1, TabExpander e, float x) {
                 return (p1 - p0) * 0.4261f;
             }
 
+            @Override
             public float getHeight(GlyphView v) {
                 return 0.524f;
             }
         });
-
-        assertEquals((view.getEndOffset() - view.getStartOffset()) * 0.4261f,
-                     view.getPreferredSpan(View.X_AXIS), ACCURACY);
+        assertEquals((view.getEndOffset() - view.getStartOffset()) * 0.4261f, view
+                .getPreferredSpan(View.X_AXIS), ACCURACY);
         assertEquals(0.524f, view.getPreferredSpan(View.Y_AXIS), ACCURACY);
     }
 
@@ -151,28 +163,23 @@
         assertEquals(TEXT.substring(2, TEXT.length() - 1), text.toString());
         try {
             view.getText(3, 2).toString();
-
             fail("an Error is expected");
         } catch (Error e) {
-//            System.out.println(e.getMessage());
+            //            System.out.println(e.getMessage());
         }
     }
 
     public void testGetTabExpander() throws BadLocationException {
         assertNull(view.getTabExpander());
-
         View plainView = new ParagraphView(root.getElement(0));
-
         assertTrue(plainView instanceof TabExpander);
-        plainView.replace(0, 0, new View[] {view});
-
+        plainView.replace(0, 0, new View[] { view });
         assertTrue(view.getParent() instanceof TabExpander);
         if (isHarmony()) {
             assertSame(plainView, view.getTabExpander());
         } else {
             assertNull(view.getTabExpander());
         }
-
         doc.insertString(1, "\t", null);
         if (isHarmony()) {
             assertSame(plainView, view.getTabExpander());
@@ -181,49 +188,41 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void testGetTabbedSpan() throws BadLocationException {
         final Font font = view.getFont();
-        final FontMetrics metrics =
-            Toolkit.getDefaultToolkit().getFontMetrics(font);
-
+        final FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
         TabExpander expander = new TabExpander() {
             public float nextTabStop(float x, int tabOffset) {
                 return (x / 10 + 1) * 10;
             }
         };
-        final String leafText = view.getText(view.getStartOffset(),
-                                             view.getEndOffset()).toString();
-        assertEquals(metrics.stringWidth(leafText),
-                     (int)view.getTabbedSpan(0, expander));
-
+        final String leafText = view.getText(view.getStartOffset(), view.getEndOffset())
+                .toString();
+        assertEquals(metrics.stringWidth(leafText), (int) view.getTabbedSpan(0, expander));
         doc.insertString(2, "\t", null); // leafText doesn't contain tab
         final int beforeTab = metrics.stringWidth(leafText.substring(0, 2));
         assertEquals(metrics.stringWidth(leafText.substring(2))
-                     + (int)expander.nextTabStop(beforeTab, 2),
-                     (int)view.getTabbedSpan(0, expander));
+                + (int) expander.nextTabStop(beforeTab, 2), (int) view.getTabbedSpan(0,
+                expander));
     }
 
+    @SuppressWarnings("deprecation")
     public void testGetPartialSpan() {
         final Font font = view.getFont();
-        final FontMetrics metrics =
-            Toolkit.getDefaultToolkit().getFontMetrics(font);
-
-        final String leafText = view.getText(view.getStartOffset(),
-                                             view.getEndOffset()).toString();
-        assertEquals(metrics.stringWidth(leafText),
-                     (int)view.getPartialSpan(view.getStartOffset(),
-                                              view.getEndOffset()));
-
+        final FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
+        final String leafText = view.getText(view.getStartOffset(), view.getEndOffset())
+                .toString();
+        assertEquals(metrics.stringWidth(leafText), (int) view.getPartialSpan(view
+                .getStartOffset(), view.getEndOffset()));
         final String subText = leafText.substring(2, 4);
-        assertEquals(metrics.stringWidth(subText),
-                     (int)view.getPartialSpan(2, 4));
+        assertEquals(metrics.stringWidth(subText), (int) view.getPartialSpan(2, 4));
     }
 
     public void testCheckPainter() {
         assertNull(view.getGlyphPainter());
         view.checkPainter();
         assertNotNull(view.getGlyphPainter());
-
         GlyphView other = new GlyphView(root);
         other.checkPainter();
         assertSame(view.getGlyphPainter(), other.getGlyphPainter());
@@ -256,15 +255,14 @@
         assertNull(view.getGlyphPainter());
         try {
             view.getNextVisualPositionFrom(0, Bias.Forward, new Rectangle(),
-                                           View.EAST, new Bias[1]);
+                    SwingConstants.EAST, new Bias[1]);
             fail("No default painter is installed when this method is called");
-        } catch (NullPointerException e) { }
-
+        } catch (NullPointerException e) {
+        }
         view.setGlyphPainter(new EmptyPainter());
         assertNotNull(view.getGlyphPainter());
         // Causes no exception
-        view.getNextVisualPositionFrom(0, Bias.Forward, new Rectangle(),
-                                       View.EAST, new Bias[1]);
+        view.getNextVisualPositionFrom(0, Bias.Forward, new Rectangle(), SwingConstants.EAST,
+                new Bias[1]);
     }
-
 }



Mime
View raw message