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/10/23 22:14:30 UTC

svn commit: r829201 - in /incubator/pivot/trunk: tools/src/org/apache/pivot/tools/wtk/ web/test/org/apache/pivot/web/test/ wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/skin/ wtk/test/org/apache/pivot/wtk/text/test/

Author: gbrown
Date: Fri Oct 23 20:14:29 2009
New Revision: 829201

URL: http://svn.apache.org/viewvc?rev=829201&view=rev
Log:
TextArea updates; trim whitespace in WebQueryTestClientBasicOnTomcat.java; eliminate warnings in ComponentInspectorSkin.java.

Modified:
    incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java
    incubator/pivot/trunk/web/test/org/apache/pivot/web/test/WebQueryTestClientBasicOnTomcat.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
    incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/document.wtkx

Modified: incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java?rev=829201&r1=829200&r2=829201&view=diff
==============================================================================
--- incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java (original)
+++ incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java Fri Oct 23 20:14:29 2009
@@ -33,11 +33,9 @@
 import org.apache.pivot.wtk.ButtonStateListener;
 import org.apache.pivot.wtk.Checkbox;
 import org.apache.pivot.wtk.Component;
-import org.apache.pivot.wtk.ComponentStateListener;
 import org.apache.pivot.wtk.Dimensions;
 import org.apache.pivot.wtk.FlowPane;
 import org.apache.pivot.wtk.Form;
-import org.apache.pivot.wtk.Insets;
 import org.apache.pivot.wtk.Label;
 import org.apache.pivot.wtk.Limits;
 import org.apache.pivot.wtk.ListButton;
@@ -157,7 +155,8 @@
                 boolean readOnly = beanDictionary.isReadOnly(propertyName);
 
                 if (!readOnly) {
-                    Class<?> propertyType = beanDictionary.getType(propertyName);
+                    // TODO?
+                    // Class<?> propertyType = beanDictionary.getType(propertyName);
 
                     Method method = BeanDictionary.getGetterMethod(sourceType, propertyName);
                     Class<?> declaringClass = method.getDeclaringClass();

Modified: incubator/pivot/trunk/web/test/org/apache/pivot/web/test/WebQueryTestClientBasicOnTomcat.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/web/test/org/apache/pivot/web/test/WebQueryTestClientBasicOnTomcat.java?rev=829201&r1=829200&r2=829201&view=diff
==============================================================================
--- incubator/pivot/trunk/web/test/org/apache/pivot/web/test/WebQueryTestClientBasicOnTomcat.java (original)
+++ incubator/pivot/trunk/web/test/org/apache/pivot/web/test/WebQueryTestClientBasicOnTomcat.java Fri Oct 23 20:14:29 2009
@@ -38,12 +38,12 @@
  * Before Run these tests with local instance of Tomcat, some steps are required:
  *   - configure role and users in Tomcat users file, under its conf folder,
  *     but note that for the digest authentication, passwords have to be encoded
- *     (see Tomcat docs for this) 
- *   - start the web application pivot-test, containing the 
- *     required resources (dir /public , dir /protected protected with 
+ *     (see Tomcat docs for this)
+ *   - start the web application pivot-test, containing the
+ *     required resources (dir /public , dir /protected protected with
  *     basic authentication) and files.
- * 
- * Then, before to run these tests, ensure that all has been successfully setup 
+ *
+ * Then, before to run these tests, ensure that all has been successfully setup
  * (the webapp has started), trying to ask the same URLs from a Web Browser.
  *
  * TODO:

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java?rev=829201&r1=829200&r2=829201&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java Fri Oct 23 20:14:29 2009
@@ -45,17 +45,29 @@
      */
     public interface Skin {
         /**
-         * Returns the offset of the character at a given location.
+         * Returns the insertion point for a given location.
          *
          * @param x
          * @param y
          *
          * @return
-         * The character offset at the given location.
+         * The insertion point for the given location.
          */
         public int getInsertionPoint(int x, int y);
 
         /**
+         * Returns the next insertion point given an x coordinate and a character offset.
+         *
+         * @param x
+         * @param from
+         * @param direction
+         *
+         * @return
+         * The next insertion point.
+         */
+        public int getNextInsertionPoint(int x, int from, Direction direction);
+
+        /**
          * Returns the bounds of the character at a given offset within the
          * document.
          *
@@ -579,6 +591,11 @@
         return textAreaSkin.getInsertionPoint(x, y);
     }
 
+    public int getNextInsertionPoint(int x, int from, Direction direction) {
+        TextArea.Skin textAreaSkin = (TextArea.Skin)getSkin();
+        return textAreaSkin.getNextInsertionPoint(x, from, direction);
+    }
+
     public Bounds getCharacterBounds(int offset) {
         TextArea.Skin textAreaSkin = (TextArea.Skin)getSkin();
         return textAreaSkin.getCharacterBounds(offset);

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=829201&r1=829200&r2=829201&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 Fri Oct 23 20:14:29 2009
@@ -755,17 +755,21 @@
                 i = (direction == Direction.FORWARD) ? -1 : rows.getLength();
             } else {
                 // Find the row that contains offset
-                i = 0;
-                while (i < n) {
-                    Row row = rows.get(i);
-                    NodeView firstNodeView = row.nodeViews.get(0);
-                    NodeView lastNodeView = row.nodeViews.get(row.nodeViews.getLength() - 1);
-                    if (from >= firstNodeView.getOffset()
-                        && from < lastNodeView.getOffset() + lastNodeView.getCharacterCount()) {
-                        break;
-                    }
+                if (from == getCharacterCount() - 1) {
+                    i = rows.getLength() - 1;
+                } else {
+                    i = 0;
+                    while (i < n) {
+                        Row row = rows.get(i);
+                        NodeView firstNodeView = row.nodeViews.get(0);
+                        NodeView lastNodeView = row.nodeViews.get(row.nodeViews.getLength() - 1);
+                        if (from >= firstNodeView.getOffset()
+                            && from < lastNodeView.getOffset() + lastNodeView.getCharacterCount()) {
+                            break;
+                        }
 
-                    i++;
+                        i++;
+                    }
                 }
             }
 
@@ -794,7 +798,7 @@
                 if (offset == -1) {
                     // No node view contained the x position; move to the end of the row
                     NodeView lastNodeView = row.nodeViews.get(row.nodeViews.getLength() - 1);
-                    offset = lastNodeView.getOffset() + lastNodeView.getCharacterCount() - 1;
+                    offset = lastNodeView.getOffset() + lastNodeView.getCharacterCount();
                 }
             }
 
@@ -1256,6 +1260,19 @@
     }
 
     @Override
+    public int getNextInsertionPoint(int x, int from, Direction direction) {
+        int offset;
+
+        if (documentView == null) {
+            offset = -1;
+        } else {
+            offset = documentView.getNextInsertionPoint(x - margin.left, from, direction);
+        }
+
+        return offset;
+    }
+
+    @Override
     public Bounds getCharacterBounds(int offset) {
         Bounds characterBounds;
 
@@ -1462,9 +1479,8 @@
 
                     consumed = true;
                 } else if (keyCode == Keyboard.KeyCode.UP) {
-                    // TODO Call skin method; don't adjust caretX
-                    int offset = documentView.getNextInsertionPoint(caretX - margin.left,
-                        textArea.getSelectionStart(), Direction.BACKWARD);
+                    int offset = getNextInsertionPoint(caretX, textArea.getSelectionStart(),
+                        Direction.BACKWARD);
 
                     if (offset != -1) {
                         // TODO Modify selection based on SHIFT key
@@ -1477,9 +1493,8 @@
                         consumed = true;
                     }
                 } else if (keyCode == Keyboard.KeyCode.DOWN) {
-                    // TODO Call skin method; don't adjust caretX
-                    int offset = documentView.getNextInsertionPoint(caretX - margin.left,
-                        textArea.getSelectionStart(), Direction.FORWARD);
+                    int offset = getNextInsertionPoint(caretX, textArea.getSelectionStart(),
+                        Direction.FORWARD);
 
                     if (offset != -1) {
                         // TODO Modify selection based on SHIFT key

Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/document.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/document.wtkx?rev=829201&r1=829200&r2=829201&view=diff
==============================================================================
Binary files - no diff available.