You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/11/05 20:49:54 UTC

svn commit: r833149 - in /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk: skin/TextAreaSkin.java text/Element.java text/ImageNode.java text/Node.java text/TextNode.java

Author: gbrown
Date: Thu Nov  5 19:49:54 2009
New Revision: 833149

URL: http://svn.apache.org/viewvc?rev=833149&view=rev
Log:
Additional TextArea updates.

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/ImageNode.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Node.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=833149&r1=833148&r2=833149&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Thu Nov  5 19:49:54 2009
@@ -750,21 +750,6 @@
         }
 
         @Override
-        public void paint(Graphics2D graphics) {
-            // TODO DEBUG
-            /*
-            graphics.setColor(Color.LIGHT_GRAY);
-            graphics.fillRect(0, 0, getWidth(), getHeight());
-
-            graphics.setColor(Color.RED);
-            graphics.fillRect(terminatorBounds.x, terminatorBounds.y,
-                terminatorBounds.width, terminatorBounds.height);
-            */
-
-            super.paint(graphics);
-        }
-
-        @Override
         public NodeView getNext() {
             return null;
         }
@@ -787,6 +772,7 @@
                             NodeView lastNodeView = row.nodeViews.get(row.nodeViews.getLength() - 1);
                             offset = lastNodeView.getOffset() + lastNodeView.getCharacterCount();
 
+                            // TODO Check for whitespace character here
                             if (offset < getCharacterCount() - 1) {
                                 offset--;
                             }
@@ -874,6 +860,7 @@
                         NodeView lastNodeView = row.nodeViews.get(row.nodeViews.getLength() - 1);
                         offset = lastNodeView.getOffset() + lastNodeView.getCharacterCount();
 
+                        // TODO Check for whitespace character here
                         if (offset < getCharacterCount() - 1) {
                             offset--;
                         }
@@ -1373,7 +1360,7 @@
 
                     if (offset != -1) {
                         textArea.setSelection(offset, selectionEnd - offset + 1);
-                        scrollCharacterToVisible(offset);
+                        scrollCharacterToVisible(offset + 1);
                     }
 
                     break;
@@ -1422,8 +1409,6 @@
     public TextAreaSkin() {
         Theme theme = Theme.getTheme();
         font = theme.getFont();
-        // TODO DEBUG
-        // font = new Font("Monaco", Font.PLAIN, 11);
         color = Color.BLACK;
         inactiveColor = Color.GRAY;
         backgroundColor = null;
@@ -1854,9 +1839,6 @@
             visibleArea = new Bounds(viewportOrigin.x, viewportOrigin.y,
                 visibleArea.width, visibleArea.height);
 
-            int width = getWidth();
-            x = Math.max(margin.left, Math.min(width - margin.right - 1, x));
-
             if (y >= visibleArea.y
                 && y < visibleArea.y + visibleArea.height) {
                 // Stop the scroll selection timer

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java?rev=833149&r1=833148&r2=833149&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java Thu Nov  5 19:49:54 2009
@@ -54,6 +54,11 @@
         }
 
         @Override
+        public char getCharacter(int offset) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
         public int getCharacterCount() {
             return 0;
         }
@@ -327,6 +332,12 @@
     }
 
     @Override
+    public char getCharacter(int offset) {
+        // TODO Find the node that contains offset, translate, and call getCharacter() on it
+        return 0;
+    }
+
+    @Override
     public int getCharacterCount() {
         return characterCount;
     }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/ImageNode.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/ImageNode.java?rev=833149&r1=833148&r2=833149&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/ImageNode.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/ImageNode.java Thu Nov  5 19:49:54 2009
@@ -128,6 +128,11 @@
     }
 
     @Override
+    public char getCharacter(int offset) {
+        return 0x00;
+    }
+
+    @Override
     public int getCharacterCount() {
         return 1;
     }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Node.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Node.java?rev=833149&r1=833148&r2=833149&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Node.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Node.java Thu Nov  5 19:49:54 2009
@@ -156,6 +156,13 @@
     public abstract Node getRange(int offset, int characterCount);
 
     /**
+     * Returns the character at the given offset.
+     *
+     * @param offset
+     */
+    public abstract char getCharacter(int offset);
+
+    /**
      * Returns the number of characters in this node.
      */
     public abstract int getCharacterCount();

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java?rev=833149&r1=833148&r2=833149&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java Thu Nov  5 19:49:54 2009
@@ -182,6 +182,7 @@
         return text;
     }
 
+    @Override
     public char getCharacter(int index) {
         if (index < 0
             || index >= textBuilder.length()) {