Make the alignment parsers field ref friendly Review by jgw git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6632 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/uibinder/parsers/HorizontalAlignmentConstantParser.java b/user/src/com/google/gwt/uibinder/parsers/HorizontalAlignmentConstantParser.java index b70b717..85d05fd 100644 --- a/user/src/com/google/gwt/uibinder/parsers/HorizontalAlignmentConstantParser.java +++ b/user/src/com/google/gwt/uibinder/parsers/HorizontalAlignmentConstantParser.java
@@ -24,7 +24,7 @@ * Parses a * {@link com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant}. */ -public class HorizontalAlignmentConstantParser implements AttributeParser { +public class HorizontalAlignmentConstantParser extends StrictAttributeParser { private static final HashMap<String, String> values = new HashMap<String, String>(); @@ -41,9 +41,9 @@ public String parse(String value, MortalLogger logger) throws UnableToCompleteException { String translated = values.get(value); - if (translated == null) { - logger.die("Invalid value: horizontalAlignment='" + value + "'"); + if (translated != null) { + return translated; } - return translated; + return super.parse(value, logger); } }
diff --git a/user/src/com/google/gwt/uibinder/parsers/StrictAttributeParser.java b/user/src/com/google/gwt/uibinder/parsers/StrictAttributeParser.java index 18acbc7..2dd6a14 100644 --- a/user/src/com/google/gwt/uibinder/parsers/StrictAttributeParser.java +++ b/user/src/com/google/gwt/uibinder/parsers/StrictAttributeParser.java
@@ -66,7 +66,7 @@ try { return new FieldReferenceConverter(new FieldReferenceDelegate()).convert(value); } catch (IllegalFieldReferenceException e) { - logger.die("Bad field reference: \"%s\"", value); + logger.die("Cannot parse value: \"%s\"", value); return null; // Unreachable } }
diff --git a/user/src/com/google/gwt/uibinder/parsers/VerticalAlignmentConstantParser.java b/user/src/com/google/gwt/uibinder/parsers/VerticalAlignmentConstantParser.java index 6a7fcad..f1d0a69 100644 --- a/user/src/com/google/gwt/uibinder/parsers/VerticalAlignmentConstantParser.java +++ b/user/src/com/google/gwt/uibinder/parsers/VerticalAlignmentConstantParser.java
@@ -24,7 +24,7 @@ * Parses a * {@link com.google.gwt.user.client.ui.HasVerticalAlignment.VerticalAlignmentConstant}. */ -public class VerticalAlignmentConstantParser implements AttributeParser { +public class VerticalAlignmentConstantParser extends StrictAttributeParser { private static final HashMap<String, String> values = new HashMap<String, String>(); @@ -41,9 +41,9 @@ public String parse(String value, MortalLogger logger) throws UnableToCompleteException { String translated = values.get(value); - if (translated == null) { - logger.die("Invalid value: vorizontalAlignment='%s'", value); + if (translated != null) { + return translated; } - return translated; + return super.parse(value, logger); } }
diff --git a/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml b/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml index f3f2f48..e1c8d1a 100644 --- a/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml +++ b/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
@@ -278,7 +278,7 @@ <ui:attribute name="text" description="radio button name"/> </demo:PointlessRadioButtonSubclass> - <gwt:HorizontalPanel> + <gwt:HorizontalPanel horizontalAlignment="ALIGN_LEFT"> <gwt:Cell><gwt:HTMLPanel> <p> ... a StackPanel ... </p>