Introduces com.google.gwt.text from bikeshed, along with changes in com.google.gwt.user.client.ui to take advantage of it. This is another step toward getting rid of the bikeshed. Note in particular the new TextBox-like widget ValueBox, which required refactoring a new abstract superclass ValueBoxBase out of TextBoxBase. A smaller change to note is the introduction of TakesValue as a slimmer super-interface for HasValue which doesn't require being an event source. The Editor framework is expected to take advantage of this, although that may still change a bit. Items that are still half-baked (IsWidget, BooleanParser, BooleanValueBox, etc.) have been moved to com.google.gwt.app rather than text or user. This required moving some classes (e.g. the various Record*View interfaces) from valuestore to app, to avoid cirular dependencies. Review at http://gwt-code-reviews.appspot.com/649801 git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8285 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/bikeshed/scripts/maven_script.sh b/bikeshed/scripts/maven_script.sh old mode 100644 new mode 100755
diff --git a/bikeshed/src/com/google/gwt/input/shared/BooleanParser.java b/bikeshed/src/com/google/gwt/app/client/BooleanParser.java similarity index 69% rename from bikeshed/src/com/google/gwt/input/shared/BooleanParser.java rename to bikeshed/src/com/google/gwt/app/client/BooleanParser.java index 7d4a905..d9f064c 100644 --- a/bikeshed/src/com/google/gwt/input/shared/BooleanParser.java +++ b/bikeshed/src/com/google/gwt/app/client/BooleanParser.java
@@ -13,10 +13,16 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.app.client; + +import com.google.gwt.text.shared.Parser; /** - * A no-op renderer. + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> + * An unlocalized simple parser based on {@link Boolean#valueOf}. */ public class BooleanParser implements Parser<Boolean> { @@ -35,7 +41,7 @@ protected BooleanParser() { } - public Boolean parse(String object) { - return Boolean.valueOf(object); + public Boolean parse(CharSequence object) { + return Boolean.valueOf(object.toString()); } }
diff --git a/bikeshed/src/com/google/gwt/input/shared/BooleanRenderer.java b/bikeshed/src/com/google/gwt/app/client/BooleanRenderer.java similarity index 69% rename from bikeshed/src/com/google/gwt/input/shared/BooleanRenderer.java rename to bikeshed/src/com/google/gwt/app/client/BooleanRenderer.java index 86168f4..c8a2695 100644 --- a/bikeshed/src/com/google/gwt/input/shared/BooleanRenderer.java +++ b/bikeshed/src/com/google/gwt/app/client/BooleanRenderer.java
@@ -13,12 +13,19 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.app.client; + +import com.google.gwt.text.shared.AbstractRenderer; +import com.google.gwt.text.shared.Renderer; /** - * Renderer of Boolean values. + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> + * Simple unlocalized renderer of Boolean values. */ -public class BooleanRenderer implements Renderer<Boolean> { +public class BooleanRenderer extends AbstractRenderer<Boolean> { private static BooleanRenderer INSTANCE; /**
diff --git a/bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java b/bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java index 5f455d2..6de1206 100644 --- a/bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java +++ b/bikeshed/src/com/google/gwt/app/client/CellListPlacePickerView.java
@@ -18,7 +18,7 @@ import com.google.gwt.app.place.Place; import com.google.gwt.app.place.PlacePickerView; import com.google.gwt.cell.client.AbstractCell; -import com.google.gwt.input.shared.Renderer; +import com.google.gwt.text.shared.Renderer; import com.google.gwt.user.cellview.client.CellList; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.view.client.SingleSelectionModel;
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/DoubleBox.java b/bikeshed/src/com/google/gwt/app/client/DoubleBox.java similarity index 78% rename from bikeshed/src/com/google/gwt/user/client/ui/DoubleBox.java rename to bikeshed/src/com/google/gwt/app/client/DoubleBox.java index d7e2b7f..43ab5cf 100644 --- a/bikeshed/src/com/google/gwt/user/client/ui/DoubleBox.java +++ b/bikeshed/src/com/google/gwt/app/client/DoubleBox.java
@@ -13,13 +13,16 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.user.client.ui; +package com.google.gwt.app.client; import com.google.gwt.dom.client.Document; -import com.google.gwt.input.shared.DoubleParser; -import com.google.gwt.input.shared.DoubleRenderer; +import com.google.gwt.user.client.ui.ValueBox; /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * A ValueBox that uses {@link DoubleParser} and {@link DoubleRenderer}. */ public class DoubleBox extends ValueBox<Double> {
diff --git a/bikeshed/src/com/google/gwt/input/shared/DoubleParser.java b/bikeshed/src/com/google/gwt/app/client/DoubleParser.java similarity index 61% rename from bikeshed/src/com/google/gwt/input/shared/DoubleParser.java rename to bikeshed/src/com/google/gwt/app/client/DoubleParser.java index 9c6d651..b9f3e14 100644 --- a/bikeshed/src/com/google/gwt/input/shared/DoubleParser.java +++ b/bikeshed/src/com/google/gwt/app/client/DoubleParser.java
@@ -1,27 +1,35 @@ /* * Copyright 2010 Google Inc. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.app.client; + +import com.google.gwt.text.shared.Parser; + +import java.text.ParseException; /** - * A no-op renderer. + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> + * Simple unlocalized parser of Double that wraps {@link Double#valueOf(String)}. */ public class DoubleParser implements Parser<Double> { private static DoubleParser INSTANCE; - + /** * @return the instance of the no-op renderer */ @@ -31,15 +39,15 @@ } return INSTANCE; } - + protected DoubleParser() { } - public Double parse(String object) { + public Double parse(CharSequence object) throws ParseException { try { - return Double.valueOf(object); - } catch (NumberFormatException e) { - throw new ParseException(e); + return Double.valueOf(object.toString()); + } catch (NumberFormatException e) { + throw new ParseException(e.getMessage(), 0); } } }
diff --git a/bikeshed/src/com/google/gwt/input/shared/DoubleRenderer.java b/bikeshed/src/com/google/gwt/app/client/DoubleRenderer.java similarity index 69% rename from bikeshed/src/com/google/gwt/input/shared/DoubleRenderer.java rename to bikeshed/src/com/google/gwt/app/client/DoubleRenderer.java index 6cb9936..9ceaf21 100644 --- a/bikeshed/src/com/google/gwt/input/shared/DoubleRenderer.java +++ b/bikeshed/src/com/google/gwt/app/client/DoubleRenderer.java
@@ -13,12 +13,19 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.app.client; + +import com.google.gwt.text.shared.AbstractRenderer; +import com.google.gwt.text.shared.Renderer; /** - * Renderer of Long values. + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> + * A simple unlocalized renderer of Long values. */ -public class DoubleRenderer implements Renderer<Double> { +public class DoubleRenderer extends AbstractRenderer<Double> { private static DoubleRenderer INSTANCE; /**
diff --git a/bikeshed/src/com/google/gwt/app/client/EditorSupport.java b/bikeshed/src/com/google/gwt/app/client/EditorSupport.java index 7b3bbd0..fb26b55 100644 --- a/bikeshed/src/com/google/gwt/app/client/EditorSupport.java +++ b/bikeshed/src/com/google/gwt/app/client/EditorSupport.java
@@ -15,9 +15,9 @@ */ package com.google.gwt.app.client; +import com.google.gwt.app.place.RecordEditView; import com.google.gwt.valuestore.shared.Property; import com.google.gwt.valuestore.shared.Record; -import com.google.gwt.valuestore.ui.RecordEditView; import java.util.Map; import java.util.Set;
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/IntegerBox.java b/bikeshed/src/com/google/gwt/app/client/IntegerBox.java similarity index 78% rename from bikeshed/src/com/google/gwt/user/client/ui/IntegerBox.java rename to bikeshed/src/com/google/gwt/app/client/IntegerBox.java index e120918..3e762ff 100644 --- a/bikeshed/src/com/google/gwt/user/client/ui/IntegerBox.java +++ b/bikeshed/src/com/google/gwt/app/client/IntegerBox.java
@@ -13,13 +13,16 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.user.client.ui; +package com.google.gwt.app.client; import com.google.gwt.dom.client.Document; -import com.google.gwt.input.shared.IntegerParser; -import com.google.gwt.input.shared.IntegerRenderer; +import com.google.gwt.user.client.ui.ValueBox; /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * A ValueBox that uses {@link IntegerParser} and {@link IntegerRenderer}. */ public class IntegerBox extends ValueBox<Integer> {
diff --git a/bikeshed/src/com/google/gwt/input/shared/IntegerParser.java b/bikeshed/src/com/google/gwt/app/client/IntegerParser.java similarity index 65% rename from bikeshed/src/com/google/gwt/input/shared/IntegerParser.java rename to bikeshed/src/com/google/gwt/app/client/IntegerParser.java index e7338fc..43751da 100644 --- a/bikeshed/src/com/google/gwt/input/shared/IntegerParser.java +++ b/bikeshed/src/com/google/gwt/app/client/IntegerParser.java
@@ -13,10 +13,18 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.app.client; + +import com.google.gwt.text.shared.Parser; + +import java.text.ParseException; /** - * A no-op renderer. + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> + * A simple unlocalized parser based on {@link Integer#valueOf(String)}. */ public class IntegerParser implements Parser<Integer> { @@ -35,11 +43,11 @@ protected IntegerParser() { } - public Integer parse(String object) { + public Integer parse(CharSequence object) throws ParseException { try { - return Integer.valueOf(object); + return Integer.valueOf(object.toString()); } catch (NumberFormatException e) { - throw new ParseException(e); + throw new ParseException(e.getMessage(), 0); } } }
diff --git a/bikeshed/src/com/google/gwt/input/shared/IntegerRenderer.java b/bikeshed/src/com/google/gwt/app/client/IntegerRenderer.java similarity index 72% rename from bikeshed/src/com/google/gwt/input/shared/IntegerRenderer.java rename to bikeshed/src/com/google/gwt/app/client/IntegerRenderer.java index 249895c..b52be11 100644 --- a/bikeshed/src/com/google/gwt/input/shared/IntegerRenderer.java +++ b/bikeshed/src/com/google/gwt/app/client/IntegerRenderer.java
@@ -13,12 +13,19 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.app.client; + +import com.google.gwt.text.shared.AbstractRenderer; +import com.google.gwt.text.shared.Renderer; /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * Renderer of Integer values. */ -public class IntegerRenderer implements Renderer<Integer> { +public class IntegerRenderer extends AbstractRenderer<Integer> { private static IntegerRenderer INSTANCE; /**
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/LongBox.java b/bikeshed/src/com/google/gwt/app/client/LongBox.java similarity index 77% rename from bikeshed/src/com/google/gwt/user/client/ui/LongBox.java rename to bikeshed/src/com/google/gwt/app/client/LongBox.java index eaf5b57..a4e2d70 100644 --- a/bikeshed/src/com/google/gwt/user/client/ui/LongBox.java +++ b/bikeshed/src/com/google/gwt/app/client/LongBox.java
@@ -13,13 +13,16 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.user.client.ui; +package com.google.gwt.app.client; import com.google.gwt.dom.client.Document; -import com.google.gwt.input.shared.LongParser; -import com.google.gwt.input.shared.LongRenderer; +import com.google.gwt.user.client.ui.ValueBox; /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * A ValueBox that uses {@link LongParser} and {@link LongRenderer}. */ public class LongBox extends ValueBox<Long> {
diff --git a/bikeshed/src/com/google/gwt/input/shared/LongParser.java b/bikeshed/src/com/google/gwt/app/client/LongParser.java similarity index 69% rename from bikeshed/src/com/google/gwt/input/shared/LongParser.java rename to bikeshed/src/com/google/gwt/app/client/LongParser.java index 76ba205..49d1a87 100644 --- a/bikeshed/src/com/google/gwt/input/shared/LongParser.java +++ b/bikeshed/src/com/google/gwt/app/client/LongParser.java
@@ -13,9 +13,17 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.app.client; + +import com.google.gwt.text.shared.Parser; + +import java.text.ParseException; /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * A no-op renderer. */ public class LongParser implements Parser<Long> { @@ -35,11 +43,11 @@ protected LongParser() { } - public Long parse(String object) { + public Long parse(CharSequence object) throws ParseException { try { - return Long.valueOf(object); + return Long.valueOf(object.toString()); } catch (NumberFormatException e) { - throw new ParseException(e); + throw new ParseException(e.getMessage(), 0); } } }
diff --git a/bikeshed/src/com/google/gwt/input/shared/LongRenderer.java b/bikeshed/src/com/google/gwt/app/client/LongRenderer.java similarity index 72% rename from bikeshed/src/com/google/gwt/input/shared/LongRenderer.java rename to bikeshed/src/com/google/gwt/app/client/LongRenderer.java index 1b8c896..297d624 100644 --- a/bikeshed/src/com/google/gwt/input/shared/LongRenderer.java +++ b/bikeshed/src/com/google/gwt/app/client/LongRenderer.java
@@ -13,12 +13,19 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.app.client; + +import com.google.gwt.text.shared.AbstractRenderer; +import com.google.gwt.text.shared.Renderer; /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * Renderer of Long values. */ -public class LongRenderer implements Renderer<Long> { +public class LongRenderer extends AbstractRenderer<Long> { private static LongRenderer INSTANCE; /**
diff --git a/bikeshed/src/com/google/gwt/app/place/AbstractRecordEditActivity.java b/bikeshed/src/com/google/gwt/app/place/AbstractRecordEditActivity.java index 2dba31a..6da56eb 100644 --- a/bikeshed/src/com/google/gwt/app/place/AbstractRecordEditActivity.java +++ b/bikeshed/src/com/google/gwt/app/place/AbstractRecordEditActivity.java
@@ -22,7 +22,6 @@ import com.google.gwt.valuestore.shared.Record; import com.google.gwt.valuestore.shared.SyncResult; import com.google.gwt.valuestore.shared.Value; -import com.google.gwt.valuestore.ui.RecordEditView; import java.util.Set;
diff --git a/bikeshed/src/com/google/gwt/app/place/AbstractRecordListActivity.java b/bikeshed/src/com/google/gwt/app/place/AbstractRecordListActivity.java index 10ae125..63f78f4 100644 --- a/bikeshed/src/com/google/gwt/app/place/AbstractRecordListActivity.java +++ b/bikeshed/src/com/google/gwt/app/place/AbstractRecordListActivity.java
@@ -19,7 +19,6 @@ import com.google.gwt.requestfactory.shared.RecordListRequest; import com.google.gwt.valuestore.shared.Record; import com.google.gwt.valuestore.shared.WriteOperation; -import com.google.gwt.valuestore.ui.RecordListView; import com.google.gwt.view.client.ListView; import com.google.gwt.view.client.PagingListView; import com.google.gwt.view.client.Range;
diff --git a/bikeshed/src/com/google/gwt/valuestore/ui/AbstractRecordListView.java b/bikeshed/src/com/google/gwt/app/place/AbstractRecordListView.java similarity index 98% rename from bikeshed/src/com/google/gwt/valuestore/ui/AbstractRecordListView.java rename to bikeshed/src/com/google/gwt/app/place/AbstractRecordListView.java index 07dc460..7f4a37e 100644 --- a/bikeshed/src/com/google/gwt/valuestore/ui/AbstractRecordListView.java +++ b/bikeshed/src/com/google/gwt/app/place/AbstractRecordListView.java
@@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.valuestore.ui; +package com.google.gwt.app.place; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler;
diff --git a/bikeshed/src/com/google/gwt/app/place/Activity.java b/bikeshed/src/com/google/gwt/app/place/Activity.java index 8bb212c..c72abd0 100644 --- a/bikeshed/src/com/google/gwt/app/place/Activity.java +++ b/bikeshed/src/com/google/gwt/app/place/Activity.java
@@ -15,7 +15,6 @@ */ package com.google.gwt.app.place; -import com.google.gwt.user.client.ui.IsWidget; /** * <p>
diff --git a/bikeshed/src/com/google/gwt/app/place/ActivityManager.java b/bikeshed/src/com/google/gwt/app/place/ActivityManager.java index 75215ec..e595583 100644 --- a/bikeshed/src/com/google/gwt/app/place/ActivityManager.java +++ b/bikeshed/src/com/google/gwt/app/place/ActivityManager.java
@@ -17,7 +17,6 @@ import com.google.gwt.app.place.Activity.Display; import com.google.gwt.event.shared.HandlerManager; -import com.google.gwt.user.client.ui.IsWidget; /** * <p>
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/IsWidget.java b/bikeshed/src/com/google/gwt/app/place/IsWidget.java similarity index 77% rename from bikeshed/src/com/google/gwt/user/client/ui/IsWidget.java rename to bikeshed/src/com/google/gwt/app/place/IsWidget.java index 14718bc..38fd4e7 100644 --- a/bikeshed/src/com/google/gwt/user/client/ui/IsWidget.java +++ b/bikeshed/src/com/google/gwt/app/place/IsWidget.java
@@ -13,9 +13,15 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.user.client.ui; +package com.google.gwt.app.place; + +import com.google.gwt.user.client.ui.Widget; /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * Extended by View interfaces that are likely to be implemented by Widgets. * Provides access to that widget, if it exists, without compromising the * ability to provide mock view instance in JRE unit tests.
diff --git a/bikeshed/src/com/google/gwt/app/place/PlacePicker.java b/bikeshed/src/com/google/gwt/app/place/PlacePicker.java index 9984b99..1832af1 100644 --- a/bikeshed/src/com/google/gwt/app/place/PlacePicker.java +++ b/bikeshed/src/com/google/gwt/app/place/PlacePicker.java
@@ -15,7 +15,7 @@ */ package com.google.gwt.app.place; -import com.google.gwt.input.shared.Renderer; +import com.google.gwt.text.shared.Renderer; import java.util.List;
diff --git a/bikeshed/src/com/google/gwt/app/place/PlacePickerView.java b/bikeshed/src/com/google/gwt/app/place/PlacePickerView.java index cc70b2f..c82bb99 100644 --- a/bikeshed/src/com/google/gwt/app/place/PlacePickerView.java +++ b/bikeshed/src/com/google/gwt/app/place/PlacePickerView.java
@@ -15,8 +15,7 @@ */ package com.google.gwt.app.place; -import com.google.gwt.input.shared.Renderer; -import com.google.gwt.user.client.ui.IsWidget; +import com.google.gwt.text.shared.Renderer; import com.google.gwt.user.client.ui.Widget; import java.util.List;
diff --git a/bikeshed/src/com/google/gwt/valuestore/ui/PropertyColumn.java b/bikeshed/src/com/google/gwt/app/place/PropertyColumn.java similarity index 92% rename from bikeshed/src/com/google/gwt/valuestore/ui/PropertyColumn.java rename to bikeshed/src/com/google/gwt/app/place/PropertyColumn.java index c8b640f..1cc44d4 100644 --- a/bikeshed/src/com/google/gwt/valuestore/ui/PropertyColumn.java +++ b/bikeshed/src/com/google/gwt/app/place/PropertyColumn.java
@@ -13,10 +13,10 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.valuestore.ui; +package com.google.gwt.app.place; -import com.google.gwt.input.shared.PassthroughRenderer; -import com.google.gwt.input.shared.Renderer; +import com.google.gwt.text.shared.PassthroughRenderer; +import com.google.gwt.text.shared.Renderer; import com.google.gwt.user.cellview.client.TextColumn; import com.google.gwt.valuestore.shared.Property; import com.google.gwt.valuestore.shared.Record;
diff --git a/bikeshed/src/com/google/gwt/valuestore/ui/PropertyView.java b/bikeshed/src/com/google/gwt/app/place/PropertyView.java similarity index 96% rename from bikeshed/src/com/google/gwt/valuestore/ui/PropertyView.java rename to bikeshed/src/com/google/gwt/app/place/PropertyView.java index 9828574..81f34da 100644 --- a/bikeshed/src/com/google/gwt/valuestore/ui/PropertyView.java +++ b/bikeshed/src/com/google/gwt/app/place/PropertyView.java
@@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.valuestore.ui; +package com.google.gwt.app.place; import com.google.gwt.valuestore.shared.Property; import com.google.gwt.valuestore.shared.Record;
diff --git a/bikeshed/src/com/google/gwt/valuestore/ui/RecordDetailsView.java b/bikeshed/src/com/google/gwt/app/place/RecordDetailsView.java similarity index 93% rename from bikeshed/src/com/google/gwt/valuestore/ui/RecordDetailsView.java rename to bikeshed/src/com/google/gwt/app/place/RecordDetailsView.java index 53194d4..91d9d8d 100644 --- a/bikeshed/src/com/google/gwt/valuestore/ui/RecordDetailsView.java +++ b/bikeshed/src/com/google/gwt/app/place/RecordDetailsView.java
@@ -13,9 +13,8 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.valuestore.ui; +package com.google.gwt.app.place; -import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.TakesValue; /**
diff --git a/bikeshed/src/com/google/gwt/valuestore/ui/RecordEditView.java b/bikeshed/src/com/google/gwt/app/place/RecordEditView.java similarity index 94% rename from bikeshed/src/com/google/gwt/valuestore/ui/RecordEditView.java rename to bikeshed/src/com/google/gwt/app/place/RecordEditView.java index 7c442dd..6d4ef98 100644 --- a/bikeshed/src/com/google/gwt/valuestore/ui/RecordEditView.java +++ b/bikeshed/src/com/google/gwt/app/place/RecordEditView.java
@@ -13,9 +13,8 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.valuestore.ui; +package com.google.gwt.app.place; -import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.TakesValue; import com.google.gwt.valuestore.shared.DeltaValueStore; import com.google.gwt.valuestore.shared.Record;
diff --git a/bikeshed/src/com/google/gwt/valuestore/ui/RecordListView.java b/bikeshed/src/com/google/gwt/app/place/RecordListView.java similarity index 94% rename from bikeshed/src/com/google/gwt/valuestore/ui/RecordListView.java rename to bikeshed/src/com/google/gwt/app/place/RecordListView.java index ca108f1..6e9e48c 100644 --- a/bikeshed/src/com/google/gwt/valuestore/ui/RecordListView.java +++ b/bikeshed/src/com/google/gwt/app/place/RecordListView.java
@@ -13,9 +13,8 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.valuestore.ui; +package com.google.gwt.app.place; -import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.valuestore.shared.Record; import com.google.gwt.view.client.PagingListView;
diff --git a/bikeshed/src/com/google/gwt/input/shared/ParseException.java b/bikeshed/src/com/google/gwt/input/shared/ParseException.java deleted file mode 100644 index 41a0cdf..0000000 --- a/bikeshed/src/com/google/gwt/input/shared/ParseException.java +++ /dev/null
@@ -1,55 +0,0 @@ -/* - * Copyright 2010 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.google.gwt.input.shared; - -/** - * Exception class indicating parsing errors. - */ -public class ParseException extends RuntimeException { - - private final String rawInput; - private final int offset; - - public ParseException(Throwable e) { - this("", "", 0, e); - } - - public ParseException(String rawInput) { - this("", rawInput, 0, null); - } - - public ParseException(String rawInput, int offset) { - this("", rawInput, offset, null); - } - - public ParseException(String message, String rawInput, int offset) { - this(message, rawInput, offset, null); - } - - public ParseException(String message, String rawInput, int offset, Throwable e) { - super(message, e); - this.rawInput = rawInput; - this.offset = offset; - } - - public String getInput() { - return rawInput; - } - - public int getOffset() { - return offset; - } -} \ No newline at end of file
diff --git a/bikeshed/src/com/google/gwt/input/shared/Renderer.java b/bikeshed/src/com/google/gwt/input/shared/Renderer.java deleted file mode 100644 index cfe0ea3..0000000 --- a/bikeshed/src/com/google/gwt/input/shared/Renderer.java +++ /dev/null
@@ -1,31 +0,0 @@ -/* - * Copyright 2010 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.google.gwt.input.shared; - -/** - * An object that can render other objects of a particular type into plain-text - * form. - * <p> - * TODO: steal the slightly richer version from Guava - * - * @param <T> the type to render - */ -public interface Renderer<T> { - /** - * Renders {@code object} as plain text. - */ - String render(T object); -}
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/Scaffold.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/Scaffold.java index e1e2c59..813eceb 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/Scaffold.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/Scaffold.java
@@ -17,6 +17,7 @@ import com.google.gwt.app.place.Activity; import com.google.gwt.app.place.ActivityManager; +import com.google.gwt.app.place.IsWidget; import com.google.gwt.app.place.PlaceController; import com.google.gwt.app.place.PlacePicker; import com.google.gwt.core.client.EntryPoint; @@ -32,7 +33,6 @@ import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory; import com.google.gwt.sample.expenses.gwt.ui.ListActivitiesMapper; import com.google.gwt.sample.expenses.gwt.ui.ScaffoldListPlaceRenderer; -import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.RootLayoutPanel; import com.google.gwt.valuestore.shared.Record;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/ScaffoldMobile.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/ScaffoldMobile.java index 3e32528..bd3b881 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/ScaffoldMobile.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/ScaffoldMobile.java
@@ -18,6 +18,7 @@ import com.google.gwt.app.place.Activity; import com.google.gwt.app.place.ActivityManager; import com.google.gwt.app.place.ActivityMapper; +import com.google.gwt.app.place.IsWidget; import com.google.gwt.app.place.PlaceController; import com.google.gwt.app.place.PlacePicker; import com.google.gwt.core.client.EntryPoint; @@ -31,7 +32,6 @@ import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory; import com.google.gwt.sample.expenses.gwt.ui.ListActivitiesMapper; import com.google.gwt.sample.expenses.gwt.ui.ScaffoldListPlaceRenderer; -import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.RootLayoutPanel; import com.google.gwt.valuestore.shared.Record;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ScaffoldListPlaceRenderer.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ScaffoldListPlaceRenderer.java index ad1e975..7336c68 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ScaffoldListPlaceRenderer.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/ScaffoldListPlaceRenderer.java
@@ -15,16 +15,16 @@ */ package com.google.gwt.sample.expenses.gwt.ui; -import com.google.gwt.input.shared.Renderer; import com.google.gwt.sample.expenses.gwt.client.place.ListScaffoldPlace; import com.google.gwt.sample.expenses.gwt.request.EmployeeRecord; import com.google.gwt.sample.expenses.gwt.request.ReportRecord; +import com.google.gwt.text.shared.AbstractRenderer; import com.google.gwt.valuestore.shared.Record; /** * Renders {@link ListScaffoldPlace}s for display to users. */ -public class ScaffoldListPlaceRenderer implements Renderer<ListScaffoldPlace> { +public class ScaffoldListPlaceRenderer extends AbstractRenderer<ListScaffoldPlace> { public String render(ListScaffoldPlace object) { // TODO These class comparisons are gross, find a cleaner way.
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeDetailsActivity.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeDetailsActivity.java index e1c8ae8..9b62034 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeDetailsActivity.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeDetailsActivity.java
@@ -17,6 +17,7 @@ import com.google.gwt.app.place.AbstractActivity; import com.google.gwt.app.place.PlaceController; +import com.google.gwt.app.place.RecordDetailsView; import com.google.gwt.requestfactory.shared.Receiver; import com.google.gwt.sample.expenses.gwt.client.place.EmployeeScaffoldPlace; import com.google.gwt.sample.expenses.gwt.client.place.ScaffoldPlace; @@ -26,7 +27,6 @@ import com.google.gwt.valuestore.shared.DeltaValueStore; import com.google.gwt.valuestore.shared.SyncResult; import com.google.gwt.valuestore.shared.Value; -import com.google.gwt.valuestore.ui.RecordDetailsView; import java.util.Set;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeDetailsView.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeDetailsView.java index f8b6aca..c1eddbc 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeDetailsView.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeDetailsView.java
@@ -15,6 +15,7 @@ */ package com.google.gwt.sample.expenses.gwt.ui.employee; +import com.google.gwt.app.place.RecordDetailsView; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.SpanElement; import com.google.gwt.event.dom.client.ClickEvent; @@ -27,7 +28,6 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.valuestore.ui.RecordDetailsView; /** * Details view for employee records.
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeEditActivity.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeEditActivity.java index 001b488..509ca40 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeEditActivity.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeEditActivity.java
@@ -17,6 +17,7 @@ import com.google.gwt.app.place.AbstractRecordEditActivity; import com.google.gwt.app.place.PlaceController; +import com.google.gwt.app.place.RecordEditView; import com.google.gwt.requestfactory.shared.Receiver; import com.google.gwt.sample.expenses.gwt.client.place.EmployeeScaffoldPlace; import com.google.gwt.sample.expenses.gwt.client.place.ScaffoldPlace; @@ -24,7 +25,6 @@ import com.google.gwt.sample.expenses.gwt.request.EmployeeRecord; import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory; import com.google.gwt.valuestore.shared.Value; -import com.google.gwt.valuestore.ui.RecordEditView; /** * An activity that requests all info on an employee, allows the user to edit
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeEditView.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeEditView.java index d5d648f..593464e 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeEditView.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeEditView.java
@@ -16,6 +16,7 @@ package com.google.gwt.sample.expenses.gwt.ui.employee; import com.google.gwt.app.client.EditorSupport; +import com.google.gwt.app.place.RecordEditView; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Element; @@ -32,7 +33,6 @@ import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.valuestore.shared.DeltaValueStore; import com.google.gwt.valuestore.shared.Property; -import com.google.gwt.valuestore.ui.RecordEditView; import java.util.Map; import java.util.Set;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListActivity.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListActivity.java index 9bf0883..8d3ce2b 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListActivity.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListActivity.java
@@ -17,6 +17,7 @@ import com.google.gwt.app.place.AbstractRecordListActivity; import com.google.gwt.app.place.PlaceController; +import com.google.gwt.app.place.RecordListView; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.requestfactory.shared.Receiver; @@ -27,7 +28,6 @@ import com.google.gwt.sample.expenses.gwt.request.EmployeeRecord; import com.google.gwt.sample.expenses.gwt.request.EmployeeRecordChanged; import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory; -import com.google.gwt.valuestore.ui.RecordListView; import com.google.gwt.view.client.Range; /**
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListView.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListView.java index dd08e28..65af62b 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListView.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/employee/EmployeeListView.java
@@ -15,6 +15,8 @@ */ package com.google.gwt.sample.expenses.gwt.ui.employee; +import com.google.gwt.app.place.AbstractRecordListView; +import com.google.gwt.app.place.PropertyColumn; import com.google.gwt.core.client.GWT; import com.google.gwt.sample.expenses.gwt.request.EmployeeRecord; import com.google.gwt.uibinder.client.UiBinder; @@ -22,8 +24,6 @@ import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.HTMLPanel; -import com.google.gwt.valuestore.ui.AbstractRecordListView; -import com.google.gwt.valuestore.ui.PropertyColumn; import java.util.ArrayList; import java.util.List;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportDetailsActivity.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportDetailsActivity.java index eb26387..5e0a020 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportDetailsActivity.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportDetailsActivity.java
@@ -17,6 +17,7 @@ import com.google.gwt.app.place.AbstractActivity; import com.google.gwt.app.place.PlaceController; +import com.google.gwt.app.place.RecordDetailsView; import com.google.gwt.requestfactory.shared.Receiver; import com.google.gwt.sample.expenses.gwt.client.place.ReportScaffoldPlace; import com.google.gwt.sample.expenses.gwt.client.place.ScaffoldPlace; @@ -26,7 +27,6 @@ import com.google.gwt.valuestore.shared.DeltaValueStore; import com.google.gwt.valuestore.shared.SyncResult; import com.google.gwt.valuestore.shared.Value; -import com.google.gwt.valuestore.ui.RecordDetailsView; import java.util.Set;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportDetailsView.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportDetailsView.java index a936856..171fa31 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportDetailsView.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportDetailsView.java
@@ -15,6 +15,7 @@ */ package com.google.gwt.sample.expenses.gwt.ui.report; +import com.google.gwt.app.place.RecordDetailsView; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.SpanElement; import com.google.gwt.event.dom.client.ClickEvent; @@ -28,7 +29,6 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.valuestore.ui.RecordDetailsView; /** * Details view for employee records.
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportEditActivity.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportEditActivity.java index 4921a8f..9fa5505 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportEditActivity.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportEditActivity.java
@@ -17,6 +17,7 @@ import com.google.gwt.app.place.AbstractRecordEditActivity; import com.google.gwt.app.place.PlaceController; +import com.google.gwt.app.place.RecordEditView; import com.google.gwt.requestfactory.shared.Receiver; import com.google.gwt.sample.expenses.gwt.client.place.ReportScaffoldPlace; import com.google.gwt.sample.expenses.gwt.client.place.ScaffoldPlace; @@ -24,7 +25,6 @@ import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory; import com.google.gwt.sample.expenses.gwt.request.ReportRecord; import com.google.gwt.valuestore.shared.Value; -import com.google.gwt.valuestore.ui.RecordEditView; /** * An activity that requests all info on a report, allows the user to edit it,
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportEditView.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportEditView.java index 4a260b6..4525bdc 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportEditView.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportEditView.java
@@ -16,6 +16,7 @@ package com.google.gwt.sample.expenses.gwt.ui.report; import com.google.gwt.app.client.EditorSupport; +import com.google.gwt.app.place.RecordEditView; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Element; @@ -33,7 +34,6 @@ import com.google.gwt.user.datepicker.client.DateBox; import com.google.gwt.valuestore.shared.DeltaValueStore; import com.google.gwt.valuestore.shared.Property; -import com.google.gwt.valuestore.ui.RecordEditView; import java.util.Map; import java.util.Set;
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListActivity.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListActivity.java index 224835b..bfcebb2 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListActivity.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListActivity.java
@@ -17,6 +17,7 @@ import com.google.gwt.app.place.AbstractRecordListActivity; import com.google.gwt.app.place.PlaceController; +import com.google.gwt.app.place.RecordListView; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.requestfactory.shared.Receiver; @@ -27,7 +28,6 @@ import com.google.gwt.sample.expenses.gwt.request.ExpensesRequestFactory; import com.google.gwt.sample.expenses.gwt.request.ReportRecord; import com.google.gwt.sample.expenses.gwt.request.ReportRecordChanged; -import com.google.gwt.valuestore.ui.RecordListView; import com.google.gwt.view.client.Range; /**
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListView.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListView.java index c48e65d..7fa5d2b 100644 --- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListView.java +++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/ui/report/ReportListView.java
@@ -15,17 +15,17 @@ */ package com.google.gwt.sample.expenses.gwt.ui.report; +import com.google.gwt.app.place.AbstractRecordListView; +import com.google.gwt.app.place.PropertyColumn; import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.input.shared.DateTimeFormatRenderer; +import com.google.gwt.i18n.client.DateTimeFormatRenderer; import com.google.gwt.sample.expenses.gwt.request.ReportRecord; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.HTMLPanel; -import com.google.gwt.valuestore.ui.AbstractRecordListView; -import com.google.gwt.valuestore.ui.PropertyColumn; import java.util.ArrayList; import java.util.Date;
diff --git a/bikeshed/src/com/google/gwt/user/User.gwt.xml b/bikeshed/src/com/google/gwt/user/User.gwt.xml deleted file mode 100644 index eb25a15..0000000 --- a/bikeshed/src/com/google/gwt/user/User.gwt.xml +++ /dev/null
@@ -1,54 +0,0 @@ -<!-- - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); you may not - use this file except in compliance with the License. You may obtain a copy of - the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - License for the specific language governing permissions and limitations under - the License. ---> - -<!-- Combines all user facilities into a single module for convenience. --> -<!-- Most new code should inherit this module. --> -<!-- --> -<module> - <inherits name="com.google.gwt.input.Input"/> - <inherits name="com.google.gwt.core.Core"/> - <inherits name="com.google.gwt.event.Event"/> - <inherits name="com.google.gwt.animation.Animation"/> - <inherits name="com.google.gwt.resources.Resources"/> - <inherits name="com.google.gwt.layout.Layout"/> - <inherits name="com.google.gwt.uibinder.UiBinder"/> - <inherits name="com.google.gwt.user.AsyncProxy"/> - <inherits name="com.google.gwt.user.RemoteService"/> - <inherits name="com.google.gwt.user.DocumentRoot" /> - <inherits name="com.google.gwt.user.DOM"/> - <inherits name="com.google.gwt.user.Window" /> - <inherits name="com.google.gwt.user.HTTPRequest"/> - <inherits name="com.google.gwt.user.History"/> - <inherits name="com.google.gwt.i18n.I18N"/> - <inherits name="com.google.gwt.user.Popup"/> - <inherits name="com.google.gwt.user.Form"/> - <inherits name="com.google.gwt.user.TextBox"/> - <inherits name="com.google.gwt.user.Focus"/> - <inherits name="com.google.gwt.user.ImageBundle"/> - <inherits name="com.google.gwt.user.ClippedImage"/> - <inherits name="com.google.gwt.user.RichText"/> - <inherits name="com.google.gwt.user.SplitPanel"/> - <inherits name="com.google.gwt.user.CaptionPanel" /> - <inherits name="com.google.gwt.user.Window" /> - <inherits name="com.google.gwt.user.Tree"/> - <inherits name="com.google.gwt.user.Hyperlink"/> - <inherits name="com.google.gwt.user.FileUpload"/> - <inherits name="com.google.gwt.user.datepicker.DatePicker"/> - <inherits name="com.google.gwt.user.cellview.CellView"/> - - <super-source path="translatable"/> - <source path="client"/> -</module>
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/HasValue.java b/bikeshed/src/com/google/gwt/user/client/ui/HasValue.java deleted file mode 100644 index 46eed6c..0000000 --- a/bikeshed/src/com/google/gwt/user/client/ui/HasValue.java +++ /dev/null
@@ -1,68 +0,0 @@ -/* - * Copyright 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.google.gwt.user.client.ui; - -import com.google.gwt.event.logical.shared.HasValueChangeHandlers; - -/** - * Extends {@link TakesValue} to allow the value to be pulled back out, and to - * throw {@link com.google.gwt.event.logical.shared.ValueChangeEvent - * ValueChangeEvent} events. - * <p> - * An object that implements this interface should be a user input widget, where - * the user and programmer can both set and get the object's value. It is - * intended to provide a unified interface to widgets with "atomic" values, like - * Strings and Dates. - * - * @param <T> the type of value - */ -public interface HasValue<T> extends TakesValue<T>, HasValueChangeHandlers<T> { - - /** - * Gets this object's value. - * - * @return the object's value - */ - T getValue(); - - /** - * Sets this object's value without firing any events. This should be - * identical to calling setValue(value, false). - * <p> - * It is acceptable to fail assertions or throw (documented) unchecked - * exceptions in response to bad values. - * <p> - * By convention, GWT widgets that can be cleared accept null for - * <code>value</code>, but it is acceptable for widgets that cannot be cleared - * to throw an exception for null values. - * - * @param value the object's new value - */ - void setValue(T value); - - /** - * Sets this object's value. Fires - * {@link com.google.gwt.event.logical.shared.ValueChangeEvent} when - * fireEvents is true and the new value does not equal the existing value. - * <p> - * It is acceptable to fail assertions or throw (documented) unchecked - * exceptions in response to bad values. - * - * @param value the object's new value - * @param fireEvents fire events if true and value is new - */ - void setValue(T value, boolean fireEvents); -}
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/TextBoxBase.java b/bikeshed/src/com/google/gwt/user/client/ui/TextBoxBase.java deleted file mode 100644 index 0afbe61..0000000 --- a/bikeshed/src/com/google/gwt/user/client/ui/TextBoxBase.java +++ /dev/null
@@ -1,76 +0,0 @@ -/* - * Copyright 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.google.gwt.user.client.ui; - -import com.google.gwt.dom.client.Element; -import com.google.gwt.input.shared.PassthroughParser; -import com.google.gwt.input.shared.PassthroughRenderer; - -/** - * Legacy abstract base class for all text entry widgets. - */ -public class TextBoxBase extends ValueBoxBase<String> { - - /** - * Text alignment constant, used in - * {@link TextBoxBase#setTextAlignment(TextBoxBase.TextAlignConstant)}. - */ - public static class TextAlignConstant { - private String textAlignString; - - private TextAlignConstant(String textAlignString) { - this.textAlignString = textAlignString; - } - - String getTextAlignString() { - return textAlignString; - } - } - - /** - * Center the text. - */ - public static final TextAlignConstant ALIGN_CENTER = new TextAlignConstant( - "center"); - - /** - * Justify the text. - */ - public static final TextAlignConstant ALIGN_JUSTIFY = new TextAlignConstant( - "justify"); - - /** - * Align the text to the left edge. - */ - public static final TextAlignConstant ALIGN_LEFT = new TextAlignConstant( - "left"); - - /** - * Align the text to the right. - */ - public static final TextAlignConstant ALIGN_RIGHT = new TextAlignConstant( - "right"); - - /** - * Creates a text box that wraps the given browser element handle. This is - * only used by subclasses. - * - * @param elem the browser element to wrap - */ - protected TextBoxBase(Element elem) { - super(elem, PassthroughRenderer.instance(), PassthroughParser.instance()); - } -}
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/package.html b/bikeshed/src/com/google/gwt/user/client/ui/package.html deleted file mode 100644 index fbf661f..0000000 --- a/bikeshed/src/com/google/gwt/user/client/ui/package.html +++ /dev/null
@@ -1,9 +0,0 @@ -<html> -<body> -Widgets, Panels, and other user-interface classes. - -This package contains all of the high-level user-interface Widgets, along with -panels and event interfaces. These classes form the bulk of the client-side -libraries used by GWT applications. -</body> -</html>
diff --git a/bikeshed/test/com/google/gwt/app/place/ActivityManagerTest.java b/bikeshed/test/com/google/gwt/app/place/ActivityManagerTest.java index 102dafe..1faf89f 100644 --- a/bikeshed/test/com/google/gwt/app/place/ActivityManagerTest.java +++ b/bikeshed/test/com/google/gwt/app/place/ActivityManagerTest.java
@@ -16,7 +16,6 @@ package com.google.gwt.app.place; import com.google.gwt.event.shared.HandlerManager; -import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.Widget; import junit.framework.TestCase;
diff --git a/bikeshed/src/com/google/gwt/input/shared/DateTimeFormatRenderer.java b/user/src/com/google/gwt/i18n/client/DateTimeFormatRenderer.java similarity index 84% rename from bikeshed/src/com/google/gwt/input/shared/DateTimeFormatRenderer.java rename to user/src/com/google/gwt/i18n/client/DateTimeFormatRenderer.java index f8357ed..6887d89 100644 --- a/bikeshed/src/com/google/gwt/input/shared/DateTimeFormatRenderer.java +++ b/user/src/com/google/gwt/i18n/client/DateTimeFormatRenderer.java
@@ -13,17 +13,16 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.i18n.client; -import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.i18n.client.TimeZone; +import com.google.gwt.text.shared.AbstractRenderer; import java.util.Date; /** * Renders {@link Date} objects with a {@link DateTimeFormat}. */ -public class DateTimeFormatRenderer implements Renderer<Date> { +public class DateTimeFormatRenderer extends AbstractRenderer<Date> { private final DateTimeFormat format; private final TimeZone timeZone;
diff --git a/bikeshed/src/com/google/gwt/input/Input.gwt.xml b/user/src/com/google/gwt/text/Text.gwt.xml similarity index 92% rename from bikeshed/src/com/google/gwt/input/Input.gwt.xml rename to user/src/com/google/gwt/text/Text.gwt.xml index 618ee19..b841ec9 100644 --- a/bikeshed/src/com/google/gwt/input/Input.gwt.xml +++ b/user/src/com/google/gwt/text/Text.gwt.xml
@@ -14,5 +14,6 @@ the License. --> <module> + <inherits name="com.google.gwt.core.Core"/> <source path="shared"/> </module>
diff --git a/user/src/com/google/gwt/text/shared/AbstractRenderer.java b/user/src/com/google/gwt/text/shared/AbstractRenderer.java new file mode 100644 index 0000000..3c69c9e --- /dev/null +++ b/user/src/com/google/gwt/text/shared/AbstractRenderer.java
@@ -0,0 +1,34 @@ +/* + * Copyright 2009 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.text.shared; + +import java.io.IOException; + +/** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> + * Abstract implementation of a renderer to make implementation of rendering + * simpler. + * + * @param <T> the type to render + */ +public abstract class AbstractRenderer<T> implements Renderer<T> { + public void render(T object, Appendable appendable) throws IOException { + appendable.append(render(object)); + } +} \ No newline at end of file
diff --git a/bikeshed/src/com/google/gwt/input/shared/Parser.java b/user/src/com/google/gwt/text/shared/Parser.java similarity index 70% rename from bikeshed/src/com/google/gwt/input/shared/Parser.java rename to user/src/com/google/gwt/text/shared/Parser.java index 91b1c46..ba25b95 100644 --- a/bikeshed/src/com/google/gwt/input/shared/Parser.java +++ b/user/src/com/google/gwt/text/shared/Parser.java
@@ -13,13 +13,19 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.text.shared; + +import java.text.ParseException; /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * An object that can parse text and return a value. * * @param <T> the type to parse */ public interface Parser<T> { - T parse(String s) throws ParseException; + T parse(CharSequence text) throws ParseException; }
diff --git a/bikeshed/src/com/google/gwt/input/shared/PassthroughParser.java b/user/src/com/google/gwt/text/shared/PassthroughParser.java similarity index 75% rename from bikeshed/src/com/google/gwt/input/shared/PassthroughParser.java rename to user/src/com/google/gwt/text/shared/PassthroughParser.java index 6464a42..5e3ecc9 100644 --- a/bikeshed/src/com/google/gwt/input/shared/PassthroughParser.java +++ b/user/src/com/google/gwt/text/shared/PassthroughParser.java
@@ -13,10 +13,14 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.text.shared; /** - * A no-op renderer. + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> + * A no-op String parser. */ public class PassthroughParser implements Parser<String> { @@ -35,7 +39,7 @@ protected PassthroughParser() { } - public String parse(String object) { - return object; + public String parse(CharSequence object) { + return object.toString(); } }
diff --git a/bikeshed/src/com/google/gwt/input/shared/PassthroughRenderer.java b/user/src/com/google/gwt/text/shared/PassthroughRenderer.java similarity index 75% rename from bikeshed/src/com/google/gwt/input/shared/PassthroughRenderer.java rename to user/src/com/google/gwt/text/shared/PassthroughRenderer.java index 6f475e2..1385061 100644 --- a/bikeshed/src/com/google/gwt/input/shared/PassthroughRenderer.java +++ b/user/src/com/google/gwt/text/shared/PassthroughRenderer.java
@@ -13,12 +13,17 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.input.shared; +package com.google.gwt.text.shared; + /** - * A no-op renderer. + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> + * A no-op String renderer. */ -public class PassthroughRenderer implements Renderer<String> { +public class PassthroughRenderer extends AbstractRenderer<String> { private static PassthroughRenderer INSTANCE;
diff --git a/user/src/com/google/gwt/text/shared/Renderer.java b/user/src/com/google/gwt/text/shared/Renderer.java new file mode 100644 index 0000000..431307a --- /dev/null +++ b/user/src/com/google/gwt/text/shared/Renderer.java
@@ -0,0 +1,44 @@ +/* + * Copyright 2007 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.text.shared; + +import java.io.IOException; + +/** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> + * An object that can render other objects of a particular type into plain-text + * form. Allows decoupling that is useful for a dependency-injection + * architecture. + * + * @param <T> the type to render + */ +public interface Renderer<T> { + + /** + * Renders {@code object} as plain text. Should never throw any exceptions! + */ + String render(T object); + + /** + * Renders {@code object} as plain text, appended directly to {@code + * appendable}. Should never throw any exceptions except if {@code appendable} + * throws an {@code IOException}. + */ + void render(T object, Appendable appendable) throws IOException; +}
diff --git a/user/src/com/google/gwt/user/User.gwt.xml b/user/src/com/google/gwt/user/User.gwt.xml index 606d0eb..6d0c941 100644 --- a/user/src/com/google/gwt/user/User.gwt.xml +++ b/user/src/com/google/gwt/user/User.gwt.xml
@@ -19,6 +19,7 @@ <!-- --> <module> <inherits name="com.google.gwt.core.Core"/> + <inherits name="com.google.gwt.text.Text"/> <inherits name="com.google.gwt.event.Event"/> <inherits name="com.google.gwt.animation.Animation"/> <inherits name="com.google.gwt.resources.Resources"/>
diff --git a/user/src/com/google/gwt/user/client/ui/HasValue.java b/user/src/com/google/gwt/user/client/ui/HasValue.java index d8ec389..46eed6c 100644 --- a/user/src/com/google/gwt/user/client/ui/HasValue.java +++ b/user/src/com/google/gwt/user/client/ui/HasValue.java
@@ -1,12 +1,12 @@ /* * Copyright 2008 Google Inc. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -18,18 +18,22 @@ import com.google.gwt.event.logical.shared.HasValueChangeHandlers; /** - * An object that implements this interface should be a user input - * widget, where the user and programmer can both set and get the - * object's value. It is intended to provide a unified interface to - * widgets with "atomic" values, like Strings and Dates. - * - * @param <T> the type of value. + * Extends {@link TakesValue} to allow the value to be pulled back out, and to + * throw {@link com.google.gwt.event.logical.shared.ValueChangeEvent + * ValueChangeEvent} events. + * <p> + * An object that implements this interface should be a user input widget, where + * the user and programmer can both set and get the object's value. It is + * intended to provide a unified interface to widgets with "atomic" values, like + * Strings and Dates. + * + * @param <T> the type of value */ -public interface HasValue<T> extends HasValueChangeHandlers<T> { +public interface HasValue<T> extends TakesValue<T>, HasValueChangeHandlers<T> { /** * Gets this object's value. - * + * * @return the object's value */ T getValue(); @@ -42,9 +46,9 @@ * exceptions in response to bad values. * <p> * By convention, GWT widgets that can be cleared accept null for - * <code>value</code>, but it is acceptable for widgets that cannot - * be cleared to throw an exception for null values. - * + * <code>value</code>, but it is acceptable for widgets that cannot be cleared + * to throw an exception for null values. + * * @param value the object's new value */ void setValue(T value); @@ -56,7 +60,7 @@ * <p> * It is acceptable to fail assertions or throw (documented) unchecked * exceptions in response to bad values. - * + * * @param value the object's new value * @param fireEvents fire events if true and value is new */
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/TakesValue.java b/user/src/com/google/gwt/user/client/ui/TakesValue.java similarity index 83% rename from bikeshed/src/com/google/gwt/user/client/ui/TakesValue.java rename to user/src/com/google/gwt/user/client/ui/TakesValue.java index c64e17f..5a94f49 100644 --- a/bikeshed/src/com/google/gwt/user/client/ui/TakesValue.java +++ b/user/src/com/google/gwt/user/client/ui/TakesValue.java
@@ -16,6 +16,10 @@ package com.google.gwt.user.client.ui; /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * Implemented by objects that hold a value. * * @param <V> value type
diff --git a/user/src/com/google/gwt/user/client/ui/TextBoxBase.java b/user/src/com/google/gwt/user/client/ui/TextBoxBase.java index 18bc451..eab38ab 100644 --- a/user/src/com/google/gwt/user/client/ui/TextBoxBase.java +++ b/user/src/com/google/gwt/user/client/ui/TextBoxBase.java
@@ -15,24 +15,14 @@ */ package com.google.gwt.user.client.ui; -import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Element; -import com.google.gwt.event.dom.client.ChangeEvent; -import com.google.gwt.event.dom.client.ChangeHandler; -import com.google.gwt.event.dom.client.HasChangeHandlers; -import com.google.gwt.event.logical.shared.ValueChangeEvent; -import com.google.gwt.event.logical.shared.ValueChangeHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Event; -import com.google.gwt.user.client.ui.impl.TextBoxImpl; +import com.google.gwt.text.shared.PassthroughParser; +import com.google.gwt.text.shared.PassthroughRenderer; /** - * Abstract base class for all text entry widgets. + * Legacy abstract base class for all text entry widgets. */ -@SuppressWarnings("deprecation") -public class TextBoxBase extends FocusWidget implements SourcesChangeEvents, - HasChangeHandlers, HasText, HasName, HasValue<String> { +public class TextBoxBase extends ValueBoxBase<String> { /** * Text alignment constant, used in @@ -45,7 +35,7 @@ this.textAlignString = textAlignString; } - private String getTextAlignString() { + String getTextAlignString() { return textAlignString; } } @@ -74,11 +64,6 @@ public static final TextAlignConstant ALIGN_RIGHT = new TextAlignConstant( "right"); - private static TextBoxImpl impl = GWT.create(TextBoxImpl.class); - - private Event currentEvent; - private boolean valueChangeHandlerInitialized; - /** * Creates a text box that wraps the given browser element handle. This is * only used by subclasses. @@ -86,251 +71,15 @@ * @param elem the browser element to wrap */ protected TextBoxBase(Element elem) { - super(elem); - } - - public HandlerRegistration addChangeHandler(ChangeHandler handler) { - return addDomHandler(handler, ChangeEvent.getType()); + super(elem, PassthroughRenderer.instance(), PassthroughParser.instance()); } /** - * @deprecated Use {@link #addChangeHandler} instead + * Overridden to return "" from an empty text box. */ - @Deprecated - public void addChangeListener(ChangeListener listener) { - addChangeHandler(new ListenerWrapper.WrappedChangeListener(listener)); - } - - public HandlerRegistration addValueChangeHandler( - ValueChangeHandler<String> handler) { - // Initialization code - if (!valueChangeHandlerInitialized) { - valueChangeHandlerInitialized = true; - addChangeHandler(new ChangeHandler() { - public void onChange(ChangeEvent event) { - ValueChangeEvent.fire(TextBoxBase.this, getText()); - } - }); - } - return addHandler(handler, ValueChangeEvent.getType()); - } - - /** - * If a keyboard event is currently being handled on this text box, calling - * this method will suppress it. This allows listeners to easily filter - * keyboard input. - */ - public void cancelKey() { - if (currentEvent != null) { - DOM.eventPreventDefault(currentEvent); - } - } - - /** - * Gets the current position of the cursor (this also serves as the beginning - * of the text selection). - * - * @return the cursor's position - */ - public int getCursorPos() { - return impl.getCursorPos(getElement()); - } - - public String getName() { - return DOM.getElementProperty(getElement(), "name"); - } - - /** - * Gets the text currently selected within this text box. - * - * @return the selected text, or an empty string if none is selected - */ - public String getSelectedText() { - int start = getCursorPos(); - if (start < 0) { - return ""; - } - int length = getSelectionLength(); - return getText().substring(start, start + length); - } - - /** - * Gets the length of the current text selection. - * - * @return the text selection length - */ - public int getSelectionLength() { - return impl.getSelectionLength(getElement()); - } - - public String getText() { - return DOM.getElementProperty(getElement(), "value"); - } - - public String getValue() { - return getText(); - } - - /** - * Determines whether or not the widget is read-only. - * - * @return <code>true</code> if the widget is currently read-only, - * <code>false</code> if the widget is currently editable - */ - public boolean isReadOnly() { - return DOM.getElementPropertyBoolean(getElement(), "readOnly"); - } - @Override - public void onBrowserEvent(Event event) { - int type = DOM.eventGetType(event); - if ((type & Event.KEYEVENTS) != 0) { - // Fire the keyboard event. Hang on to the current event object so that - // cancelKey() and setKey() can be implemented. - currentEvent = event; - // Call the superclass' onBrowserEvent as that includes the key event - // handlers. - super.onBrowserEvent(event); - currentEvent = null; - } else { - // Handles Focus and Click events. - super.onBrowserEvent(event); - } - } - - /** - * @deprecated Use the {@link HandlerRegistration#removeHandler} method on - * the object returned by {@link #addChangeHandler} instead - */ - @Deprecated - public void removeChangeListener(ChangeListener listener) { - ListenerWrapper.WrappedChangeListener.remove(this, listener); - } - - /** - * Selects all of the text in the box. - * - * This will only work when the widget is attached to the document and not - * hidden. - */ - public void selectAll() { - int length = getText().length(); - if (length > 0) { - setSelectionRange(0, length); - } - } - - /** - * Sets the cursor position. - * - * This will only work when the widget is attached to the document and not - * hidden. - * - * @param pos the new cursor position - */ - public void setCursorPos(int pos) { - setSelectionRange(pos, 0); - } - - /** - * If a keyboard event is currently being handled by the text box, this method - * replaces the unicode character or key code associated with it. This allows - * listeners to easily filter keyboard input. - * - * @param key the new key value - * @deprecated this method only works in IE and should not have been added to - * the API - */ - @Deprecated - public void setKey(char key) { - if (currentEvent != null) { - DOM.eventSetKeyCode(currentEvent, key); - } - } - - public void setName(String name) { - DOM.setElementProperty(getElement(), "name", name); - } - - /** - * Turns read-only mode on or off. - * - * @param readOnly if <code>true</code>, the widget becomes read-only; if - * <code>false</code> the widget becomes editable - */ - public void setReadOnly(boolean readOnly) { - DOM.setElementPropertyBoolean(getElement(), "readOnly", readOnly); - String readOnlyStyle = "readonly"; - if (readOnly) { - addStyleDependentName(readOnlyStyle); - } else { - removeStyleDependentName(readOnlyStyle); - } - } - - /** - * Sets the range of text to be selected. - * - * This will only work when the widget is attached to the document and not - * hidden. - * - * @param pos the position of the first character to be selected - * @param length the number of characters to be selected - */ - public void setSelectionRange(int pos, int length) { - // Setting the selection range will not work for unattached elements. - if (!isAttached()) { - return; - } - - if (length < 0) { - throw new IndexOutOfBoundsException( - "Length must be a positive integer. Length: " + length); - } - if ((pos < 0) || (length + pos > getText().length())) { - throw new IndexOutOfBoundsException("From Index: " + pos + " To Index: " - + (pos + length) + " Text Length: " + getText().length()); - } - impl.setSelectionRange(getElement(), pos, length); - } - - /** - * Sets this object's text. Note that some browsers will manipulate the text - * before adding it to the widget. For example, most browsers will strip all - * <code>\r</code> from the text, except IE which will add a <code>\r</code> - * before each <code>\n</code>. Use {@link #getText()} to get the text - * directly from the widget. - * - * @param text the object's new text - */ - public void setText(String text) { - DOM.setElementProperty(getElement(), "value", text != null ? text : ""); - } - - /** - * Sets the alignment of the text in the text box. - * - * @param align the text alignment (as specified by {@link #ALIGN_CENTER}, - * {@link #ALIGN_JUSTIFY}, {@link #ALIGN_LEFT}, and - * {@link #ALIGN_RIGHT}) - */ - public void setTextAlignment(TextAlignConstant align) { - DOM.setStyleAttribute(getElement(), "textAlign", align.getTextAlignString()); - } - - public void setValue(String value) { - setValue(value, false); - } - - public void setValue(String value, boolean fireEvents) { - String oldValue = getText(); - setText(value); - if (fireEvents) { - ValueChangeEvent.fireIfNotEqual(this, oldValue, value); - } - } - - protected TextBoxImpl getImpl() { - return impl; + public String getValue() { + String raw = super.getValue(); + return raw == null ? "" : raw; } }
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/ValueBox.java b/user/src/com/google/gwt/user/client/ui/ValueBox.java similarity index 78% rename from bikeshed/src/com/google/gwt/user/client/ui/ValueBox.java rename to user/src/com/google/gwt/user/client/ui/ValueBox.java index af47e7d..09afe21 100644 --- a/bikeshed/src/com/google/gwt/user/client/ui/ValueBox.java +++ b/user/src/com/google/gwt/user/client/ui/ValueBox.java
@@ -20,34 +20,22 @@ import com.google.gwt.dom.client.InputElement; import com.google.gwt.i18n.client.BidiUtils; import com.google.gwt.i18n.client.HasDirection; -import com.google.gwt.input.shared.Parser; -import com.google.gwt.input.shared.Renderer; +import com.google.gwt.text.shared.Parser; +import com.google.gwt.text.shared.Renderer; /** - * A standard single-line text box. - * + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> * <p> - * <img class='gallery' src='doc-files/TextBox.png'/> - * </p> - * - * <h3>CSS Style Rules</h3> - * <ul class='css'> - * <li>.gwt-TextBox { primary style }</li> - * <li>.gwt-TextBox-readonly { dependent style set when the text box is - * read-only }</li> - * </ul> - * - * <p> - * <h3>Example</h3> - * {@example com.google.gwt.examples.TextBoxExample} - * </p> + * A text box able to parse its displayed value. * * @param <T> the value type */ public class ValueBox<T> extends ValueBoxBase<T> implements HasDirection { /** - * Creates a TextBox widget that wraps an existing <input type='text'> + * Creates a ValueBox widget that wraps an existing <input type='text'> * element. * * This element must already be attached to the document. If the element is @@ -86,7 +74,7 @@ } /** - * Gets the maximum allowable length of the text box. + * Gets the maximum allowable length. * * @return the maximum length, in characters */ @@ -95,7 +83,7 @@ } /** - * Gets the number of visible characters in the text box. + * Gets the number of visible characters. * * @return the number of visible characters */ @@ -108,7 +96,7 @@ } /** - * Sets the maximum allowable length of the text box. + * Sets the maximum allowable length. * * @param length the maximum length, in characters */ @@ -117,7 +105,7 @@ } /** - * Sets the number of visible characters in the text box. + * Sets the number of visible characters. * * @param length the number of visible characters */
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/ValueBoxBase.java b/user/src/com/google/gwt/user/client/ui/ValueBoxBase.java similarity index 95% rename from bikeshed/src/com/google/gwt/user/client/ui/ValueBoxBase.java rename to user/src/com/google/gwt/user/client/ui/ValueBoxBase.java index 4f59bf1..10e7199 100644 --- a/bikeshed/src/com/google/gwt/user/client/ui/ValueBoxBase.java +++ b/user/src/com/google/gwt/user/client/ui/ValueBoxBase.java
@@ -23,15 +23,20 @@ import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.input.shared.ParseException; -import com.google.gwt.input.shared.Parser; -import com.google.gwt.input.shared.Renderer; +import com.google.gwt.text.shared.Parser; +import com.google.gwt.text.shared.Renderer; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.TextBoxBase.TextAlignConstant; import com.google.gwt.user.client.ui.impl.TextBoxImpl; +import java.text.ParseException; + /** + * <span style="color:red">Experimental API: This class is still under rapid + * development, and is very likely to be deleted. Use it at your own risk. + * </span> + * <p> * Abstract base class for all text entry widgets. * * @param <T> the value type @@ -49,7 +54,7 @@ private boolean valueChangeHandlerInitialized; /** - * Creates a text box that wraps the given browser element handle. This is + * Creates a value box that wraps the given browser element handle. This is * only used by subclasses. * * @param elem the browser element to wrap @@ -151,7 +156,7 @@ /** * Return the parsed value, or null if the field is empty. * - * @throws ParseException if the value cannot be parsed + * @throws ParseFailedException if the value cannot be parsed */ public T getValueOrThrow() throws ParseException { String text = getText().trim();
diff --git a/bikeshed/src/com/google/gwt/user/client/ui/IsWidget.java b/user/super/com/google/gwt/emul/java/text/ParseException.java similarity index 64% copy from bikeshed/src/com/google/gwt/user/client/ui/IsWidget.java copy to user/super/com/google/gwt/emul/java/text/ParseException.java index 14718bc..25b7f52 100644 --- a/bikeshed/src/com/google/gwt/user/client/ui/IsWidget.java +++ b/user/super/com/google/gwt/emul/java/text/ParseException.java
@@ -13,13 +13,23 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.user.client.ui; + +package java.text; /** - * Extended by View interfaces that are likely to be implemented by Widgets. - * Provides access to that widget, if it exists, without compromising the - * ability to provide mock view instance in JRE unit tests. + * Emulation of {@code java.text.ParseException}. */ -public interface IsWidget { - Widget asWidget(); +public class ParseException extends Exception { + + private final int errorOffset; + + public ParseException(String s, int errorOffset) { + super(s); + this.errorOffset = errorOffset; + } + + public int getErrorOffset() { + return errorOffset; + } } +