Reviewers: jat, jlabanca,

Description:
Setting ValueBox to be LTR by default, and disabling direction
estimation for it. Adding some documentation in TextArea and TextBox.


Please review this at http://gwt-code-reviews.appspot.com/811801/show

Affected files:
  M user/src/com/google/gwt/user/client/ui/TextArea.java
  M user/src/com/google/gwt/user/client/ui/TextBox.java
  M user/src/com/google/gwt/user/client/ui/ValueBox.java


Index: user/src/com/google/gwt/user/client/ui/TextArea.java
===================================================================
--- user/src/com/google/gwt/user/client/ui/TextArea.java        (revision 8503)
+++ user/src/com/google/gwt/user/client/ui/TextArea.java        (working copy)
@@ -31,6 +31,14 @@
  * <li>.gwt-TextArea { primary style }</li>
* <li>.gwt-TextArea-readonly { dependent style set when the text area is read-only }</li>
  * </ul>
+ *
+ * <p>
+ * <h3>Built-in Bidi Text Support</h3>
+ * This widget is capable of automatically adjusting its direction according to + * the input text. This feature is controlled by {...@link #setDirectionEstimator}, + * and is available by default when at least one of the application's locales is
+ * right-to-left.
+ * </p>
  *
  * <p>
  * <h3>Example</h3> {...@example com.google.gwt.examples.TextBoxExample}
Index: user/src/com/google/gwt/user/client/ui/TextBox.java
===================================================================
--- user/src/com/google/gwt/user/client/ui/TextBox.java (revision 8503)
+++ user/src/com/google/gwt/user/client/ui/TextBox.java (working copy)
@@ -32,6 +32,14 @@
  * <li>.gwt-TextBox-readonly { dependent style set when the text box is
  * read-only }</li>
  * </ul>
+ *
+ * <p>
+ * <h3>Built-in Bidi Text Support</h3>
+ * This widget is capable of automatically adjusting its direction according to + * the input text. This feature is controlled by {...@link #setDirectionEstimator}, + * and is available by default when at least one of the application's locales is
+ * right-to-left.
+ * </p>
  *
  * <p>
  * <h3>Example</h3>
Index: user/src/com/google/gwt/user/client/ui/ValueBox.java
===================================================================
--- user/src/com/google/gwt/user/client/ui/ValueBox.java        (revision 8503)
+++ user/src/com/google/gwt/user/client/ui/ValueBox.java        (working copy)
@@ -18,7 +18,7 @@
 import com.google.gwt.dom.client.Document;
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.dom.client.InputElement;
-import com.google.gwt.i18n.client.BidiUtils;
+import com.google.gwt.i18n.client.LocaleInfo;
 import com.google.gwt.text.shared.Parser;
 import com.google.gwt.text.shared.Renderer;

@@ -65,12 +65,12 @@
    */
protected ValueBox(Element element, Renderer<T> renderer, Parser<T> parser) {
     super(element, renderer, parser);
+    // BiDi input is not expected - disable direction estimation.
+    setDirectionEstimator(false);
+    if (LocaleInfo.getCurrentLocale().isRTL()) {
+      setDirection(Direction.LTR);
+    }
     assert InputElement.as(element).getType().equalsIgnoreCase("text");
-  }
-
-  @Override
-  public Direction getDirection() {
-    return BidiUtils.getDirectionOnElement(getElement());
   }

   /**
@@ -89,11 +89,6 @@
    */
   public int getVisibleLength() {
     return getInputElement().getSize();
-  }
-
-  @Override
-  public void setDirection(Direction direction) {
-    BidiUtils.setDirectionOnElement(getElement(), direction);
   }

   /**


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to