[gwt-contrib] [google-web-toolkit] r9969 committed - Some small refactors to Css Resource Generation...
Revision: 9969 Author: unn...@google.com Date: Fri Apr 8 13:24:59 2011 Log: Some small refactors to Css Resource Generation Review at http://gwt-code-reviews.appspot.com/1406802 Review by: sce...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=9969 Added: /trunk/user/src/com/google/gwt/resources/client/CssResourceBase.java /trunk/user/src/com/google/gwt/resources/rg/CssObfuscationStyle.java Modified: /trunk/user/src/com/google/gwt/resources/client/CssResource.java /trunk/user/src/com/google/gwt/resources/rg/CssResourceGenerator.java /trunk/user/test/com/google/gwt/resources/rg/CssTestCase.java === --- /dev/null +++ /trunk/user/src/com/google/gwt/resources/client/CssResourceBase.java Fri Apr 8 13:24:59 2011 @@ -0,0 +1,24 @@ +/* + * Copyright 2011 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.resources.client; + +/** + * Marker interface for all classes that should be obfuscated together in + * Css Resource generation. + * TODO(unnurg): Try to get rid of the global obfuscation scheme and delete + * this interface. + */ +public interface CssResourceBase extends ResourcePrototype { } === --- /dev/null +++ /trunk/user/src/com/google/gwt/resources/rg/CssObfuscationStyle.java Fri Apr 8 13:24:59 2011 @@ -0,0 +1,91 @@ +/* + * Copyright 2011 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.resources.rg; + +import com.google.gwt.core.ext.typeinfo.JClassType; + +/** + * Evaluates the obfuscation style the user selected and formats the obfuscated + * name accordingly. + */ +public enum CssObfuscationStyle { + VERBOSE (true, false, true, true), + STABLE_FULL_CLASSNAME (true, true, true, true), + STABLE_SHORT_CLASSNAME (true, true, true, false), + STABLE_NO_CLASSNAME (true, true, false, false), + OBFUSCATED (false, false, false, false); + + static CssObfuscationStyle getObfuscationStyle(String name) { +if (name.equalsIgnoreCase("pretty")) { + return VERBOSE; +} else if (name.equalsIgnoreCase("stable")) { + return STABLE_FULL_CLASSNAME; +} else if (name.equalsIgnoreCase("stable-shorttype")) { + return STABLE_SHORT_CLASSNAME; +} else if (name.equalsIgnoreCase("stable-notype")) { + return STABLE_NO_CLASSNAME; +} +return OBFUSCATED; + } + + private boolean isPretty; + private boolean isStable; + private boolean showClassName; + private boolean showPackageName; + + CssObfuscationStyle(boolean isPretty, boolean isStable, boolean showClassName, + boolean showPackageName) { +this.isPretty = isPretty; +this.isStable = isStable; +this.showClassName = showClassName; +this.showPackageName = showPackageName; + } + + public String getPrettyName(String method, JClassType type, String obfuscatedName) { +if (!isPretty()) { + return obfuscatedName; +} +String toReturn = method; + +/* + * Note that by dropping the type, or using it's short name, you are + * allowing name collisions in the css selector names. These options should + * only be used if you are sure that your GWT application is ensuring that + * there are no namespace collisions. + */ +if (showClassName) { + if (showPackageName) { +toReturn = type.getQualifiedSourceName().replaceAll("[.$]", "-") + "-" + toReturn; + } else { +toReturn = type.getName() + "-" + toReturn; + } +} + +/* + * For stable styles the obfuscated class name is dropped from the pretty + * output. This results in class names that are constant, no matter how + * many other selectors are added. + */ +if (!isStable) { + toReturn = obfuscatedName += "-" + toReturn; +} +return toReturn; + } + + public boolean isPretty() { +return isPretty; + } +} ===
[gwt-contrib] Re: Fixed pom.xml produced by WebAppCreator. Issue 4878 and Issue 6196. (issue1407804)
LGTM w/ caveat: gwt-user.jar and gwt-dev.jar show up in target/www/WEB-INF/lib but shouldn't. This is a result of copyWebapp copying everything, including provided jars. Try gwt-maven-plugin 2.2.0-1 or specifically add gwt-user into the clean section. http://gwt-code-reviews.appspot.com/1407804/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fixed pom.xml produced by WebAppCreator. Issue 4878 and Issue 6196. (issue1407804)
see note re: gwt-maven-plugin version http://gwt-code-reviews.appspot.com/1407804/diff/1/user/src/com/google/gwt/user/tools/templates/maven/pom.xmlsrc File user/src/com/google/gwt/user/tools/templates/maven/pom.xmlsrc (right): http://gwt-code-reviews.appspot.com/1407804/diff/1/user/src/com/google/gwt/user/tools/templates/maven/pom.xmlsrc#newcode71 user/src/com/google/gwt/user/tools/templates/maven/pom.xmlsrc:71: 2.2.0 2.2.0-1 would pick up fix for true so it won't copy provided jars http://gwt-code-reviews.appspot.com/1407804/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r9968 committed - Some small refactors to Css Resource Generation...
Revision: 9968 Author: unn...@google.com Date: Fri Apr 8 11:20:03 2011 Log: Some small refactors to Css Resource Generation Review at http://gwt-code-reviews.appspot.com/1406802 http://code.google.com/p/google-web-toolkit/source/detail?r=9968 Deleted: /trunk/user/src/com/google/gwt/resources/client/CssResourceBase.java /trunk/user/src/com/google/gwt/resources/rg/CssObfuscationStyle.java Modified: /trunk/user/src/com/google/gwt/resources/client/CssResource.java /trunk/user/src/com/google/gwt/resources/rg/CssResourceGenerator.java /trunk/user/test/com/google/gwt/resources/rg/CssTestCase.java === --- /trunk/user/src/com/google/gwt/resources/client/CssResourceBase.java Thu Apr 7 11:55:26 2011 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2011 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.resources.client; - -/** - * Marker interface for all classes that should be obfuscated together in - * Css Resource generation. - * TODO(unnurg): Try to get rid of the global obfuscation scheme and delete - * this interface. - */ -public interface CssResourceBase extends ResourcePrototype { } === --- /trunk/user/src/com/google/gwt/resources/rg/CssObfuscationStyle.java Thu Apr 7 11:55:26 2011 +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2011 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.resources.rg; - -import com.google.gwt.core.ext.typeinfo.JClassType; - -/** - * Evaluates the obfuscation style the user selected and formats the obfuscated - * name accordingly. - */ -public enum CssObfuscationStyle { - VERBOSE (true, false, true, true), - STABLE_FULL_CLASSNAME (true, true, true, true), - STABLE_SHORT_CLASSNAME (true, true, true, false), - STABLE_NO_CLASSNAME (true, true, false, false), - OBFUSCATED (false, false, false, false); - - static CssObfuscationStyle getObfuscationStyle(String name) { -if (name.equalsIgnoreCase("pretty")) { - return VERBOSE; -} else if (name.equalsIgnoreCase("stable")) { - return STABLE_FULL_CLASSNAME; -} else if (name.equalsIgnoreCase("stable-shorttype")) { - return STABLE_SHORT_CLASSNAME; -} else if (name.equalsIgnoreCase("stable-notype")) { - return STABLE_NO_CLASSNAME; -} -return OBFUSCATED; - } - - private boolean isPretty; - private boolean isStable; - private boolean showClassName; - private boolean showPackageName; - - CssObfuscationStyle(boolean isPretty, boolean isStable, boolean showClassName, - boolean showPackageName) { -this.isPretty = isPretty; -this.isStable = isStable; -this.showClassName = showClassName; -this.showPackageName = showPackageName; - } - - public String getPrettyName(String method, JClassType type, String obfuscatedName) { -if (!isPretty()) { - return obfuscatedName; -} -String toReturn = method; - -/* - * Note that by dropping the type, or using it's short name, you are - * allowing name collisions in the css selector names. These options should - * only be used if you are sure that your GWT application is ensuring that - * there are no namespace collisions. - */ -if (showClassName) { - if (showPackageName) { -toReturn = type.getQualifiedSourceName().replaceAll("[.$]", "-") + "-" + toReturn; - } else { -toReturn = type.getName() + "-" + toReturn; - } -} - -/* - * For stable styles the obfuscated class name is dropped from the pretty - * output. This results in class names that are constant, no matter how - * many other selectors are added. - */ -if (!isStable) { - toReturn = obfuscatedName += "-" + toReturn; -} -return toReturn; - } - - public boolean isPretty() { -return isPretty; - } -} ==
[gwt-contrib] Fixed pom.xml produced by WebAppCreator. Issue 4878 and Issue 6196. (issue1407804)
Reviewers: drfibonacci, Description: Fixed pom.xml produced by WebAppCreator. Issue 4878 and Issue 6196. Please review this at http://gwt-code-reviews.appspot.com/1407804/ Affected files: M user/src/com/google/gwt/user/tools/templates/maven/pom.xmlsrc Index: user/src/com/google/gwt/user/tools/templates/maven/pom.xmlsrc === --- user/src/com/google/gwt/user/tools/templates/maven/pom.xmlsrc (revision 9967) +++ user/src/com/google/gwt/user/tools/templates/maven/pom.xmlsrc (working copy) @@ -40,8 +40,21 @@ junit junit - 4.4 + 4.8.1 test + + + javax.validation + validation-api + 1.0.0.GA + provided + + + javax.validation + validation-api + 1.0.0.GA + sources + provided @@ -55,6 +68,24 @@ org.codehaus.mojo gwt-maven-plugin + 2.2.0 + + +com.google.gwt +gwt-user +${gwtVersion} + + +com.google.gwt +gwt-dev +${gwtVersion} + + +com.google.gwt +gwt-servlet +${gwtVersion} + + @@ -72,13 +103,14 @@ target/www - true + true maven-surefire-plugin + 2.5 ${project.build.sourceDirectory} @@ -100,6 +132,7 @@ maven-resources-plugin +2.4.2 compile @@ -121,6 +154,7 @@ maven-clean-plugin + 2.3 src/main/webapp/@renameTo @@ -131,7 +165,25 @@ - + + + maven-eclipse-plugin + 2.7 + + true + false + 2.0 + + + com.google.gwt.eclipse.core.gwtProjectValidator + + + + com.google.gwt.eclipse.core.gwtNature + + + + -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Auto-formats the GWT tools projects (excluding api-checker covered in (issue1402803)
I merged up, so rietveld thinks that every file changed, but in fact, there are no changes other than the removal of several files not related to the autoformat. http://gwt-code-reviews.appspot.com/1402803/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r9967 committed - Reindented pom.xml files...
Revision: 9967 Author: rchan...@google.com Date: Fri Apr 8 08:46:11 2011 Log: Reindented pom.xml files Review at http://gwt-code-reviews.appspot.com/1410801 Review by: drfibona...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=9967 Modified: /trunk/samples/expenses/pom.xml /trunk/user/src/com/google/gwt/user/tools/templates/maven/pom.xmlsrc === --- /trunk/samples/expenses/pom.xml Wed Mar 9 09:59:27 2011 +++ /trunk/samples/expenses/pom.xml Fri Apr 8 08:46:11 2011 @@ -1,652 +1,652 @@ http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> - 4.0.0 - com.google.gwt.sample.expenses - expenses - war - 0.1.0.BUILD-SNAPSHOT - expenses - + 4.0.0 + com.google.gwt.sample.expenses + expenses + war + 0.1.0.BUILD-SNAPSHOT + expenses + 2.2.0 - 1.1.0.RELEASE - 3.0.3.RELEASE - 1.6.1 - 1.4.2 +1.1.0.RELEASE +3.0.3.RELEASE +1.6.1 +1.4.2 1.4.2 ${user.home}/.m2/repository/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk-${gae.version} 1.1.5 - - - -spring-maven-release -Spring Maven Release Repository -http://maven.springframework.org/release - - -spring-maven-milestone -Spring Maven Milestone Repository -http://maven.springframework.org/milestone - - -spring-roo-repository -Spring Roo Repository - http://spring-roo-repository.springsource.org/release - + + -DataNucleus_2 -http://www.datanucleus.org/downloads/maven2/ -DataNucleus - + spring-maven-release + Spring Maven Release Repository + http://maven.springframework.org/release + -JBoss Repo - https://repository.jboss.org/nexus/content/repositories/releases -JBoss Repo - - - + spring-maven-milestone + Spring Maven Milestone Repository + http://maven.springframework.org/milestone + + + spring-roo-repository + Spring Roo Repository + http://spring-roo-repository.springsource.org/release + + + DataNucleus_2 + http://www.datanucleus.org/downloads/maven2/ + DataNucleus + + + JBoss Repo + https://repository.jboss.org/nexus/content/repositories/releases + JBoss Repo + + + -DataNucleus_2 -http://www.datanucleus.org/downloads/maven2/ - - - - - - junit - junit - 4.8.1 - test - - - log4j - log4j - 1.2.16 - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - javax.servlet - servlet-api - 2.5 - provided - - - - org.springframework.roo - org.springframework.roo.annotations - ${roo.version} - provided - - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-test - ${spring.version} - test - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframe
[gwt-contrib] removes extra source path entry from GWT datetimefmtcreator eclipse project (issue1406803)
Reviewers: pdr, jat, Description: removes extra source path entry from GWT datetimefmtcreator eclipse project Please review this at http://gwt-code-reviews.appspot.com/1406803/ Affected files: M eclipse/tools/datetimefmtcreator/.classpath Index: eclipse/tools/datetimefmtcreator/.classpath === --- eclipse/tools/datetimefmtcreator/.classpath (revision 9963) +++ eclipse/tools/datetimefmtcreator/.classpath (working copy) @@ -1,7 +1,6 @@ - path="org.eclipse.jdt.launching.JRE_CONTAINER"/> path="/gwt-user"/> -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Handle SafeHtml as return type in ui:text (issue1409802)
http://gwt-code-reviews.appspot.com/1409802/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Reindented pom.xml files (issue1410801)
LGTM http://gwt-code-reviews.appspot.com/1410801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r9966 committed - Changes the eclipse formatter to put a space between [] and { in an...
Revision: 9966 Author: zun...@google.com Date: Fri Apr 8 07:53:12 2011 Log: Changes the eclipse formatter to put a space between [] and { in an array initializer. Review at http://gwt-code-reviews.appspot.com/1411801 Review by: j...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=9966 Modified: /trunk/eclipse/settings/code-style/gwt-format.xml === --- /trunk/eclipse/settings/code-style/gwt-format.xml Tue Mar 1 11:37:55 2011 +++ /trunk/eclipse/settings/code-style/gwt-format.xml Fri Apr 8 07:53:12 2011 @@ -216,7 +216,7 @@ id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> -id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="do not insert"/> +id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r9965 committed - Fixes to cldr eclipse projects in GWT....
Revision: 9965 Author: zun...@google.com Date: Fri Apr 8 07:51:16 2011 Log: Fixes to cldr eclipse projects in GWT. Review at http://gwt-code-reviews.appspot.com/1410802 Review by: j...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=9965 Modified: /trunk/eclipse/external/cldr-tools/.classpath /trunk/eclipse/tools/cldr-import/.classpath === --- /trunk/eclipse/external/cldr-tools/.classpath Tue Oct 12 14:00:54 2010 +++ /trunk/eclipse/external/cldr-tools/.classpath Fri Apr 8 07:51:16 2011 @@ -4,7 +4,7 @@ path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - sourcepath="/GWT_TOOLS/lib/icu4j/4.4.2/icu4jsrc.jar"/> + sourcepath="/GWT_TOOLS/lib/icu4j/4.4.2/icu4jsrc.jar"/> sourcepath="/GWT_TOOLS/lib/icu4j/4.4.2/icu4jsrc.jar"/> === --- /trunk/eclipse/tools/cldr-import/.classpath Tue Mar 8 08:22:05 2011 +++ /trunk/eclipse/tools/cldr-import/.classpath Fri Apr 8 07:51:16 2011 @@ -9,5 +9,6 @@ sourcepath="/GWT_TOOLS/lib/icu4j/4.4.2/icu4jsrc.jar"/> +path="GWT_TOOLS/lib/cldr/1.8.1/cldr.jar" /> -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fixes to cldr eclipse projects in GWT. (issue1410802)
LGTM -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Changes the eclipse formatter to put a space between [] and { in an (issue1411801)
LGTM -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Fixes to cldr eclipse projects in GWT. (issue1410802)
Reviewers: jat, Description: Fixes to cldr eclipse projects in GWT. Please review this at http://gwt-code-reviews.appspot.com/1410802/ Affected files: M eclipse/external/cldr-tools/.classpath M eclipse/tools/cldr-import/.classpath Index: eclipse/external/cldr-tools/.classpath === --- eclipse/external/cldr-tools/.classpath (revision 9963) +++ eclipse/external/cldr-tools/.classpath (working copy) @@ -4,7 +4,7 @@ path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - sourcepath="/GWT_TOOLS/lib/icu4j/4.4.2/icu4jsrc.jar"/> + sourcepath="/GWT_TOOLS/lib/icu4j/4.4.2/icu4jsrc.jar"/> sourcepath="/GWT_TOOLS/lib/icu4j/4.4.2/icu4jsrc.jar"/> Index: eclipse/tools/cldr-import/.classpath === --- eclipse/tools/cldr-import/.classpath(revision 9963) +++ eclipse/tools/cldr-import/.classpath(working copy) @@ -9,5 +9,6 @@ sourcepath="/GWT_TOOLS/lib/icu4j/4.4.2/icu4jsrc.jar"/> +path="GWT_TOOLS/lib/cldr/1.8.1/cldr.jar" /> -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fixes to cldr eclipse projects in GWT. (issue1410802)
Broke this out from issue 1402803 should be a non-controversial change. http://gwt-code-reviews.appspot.com/1410802/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Changes the eclipse formatter to put a space between [] and { in an (issue1411801)
I broke out this change from another issue, as it should be totally non-controversial. http://gwt-code-reviews.appspot.com/1411801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Changes the eclipse formatter to put a space between [] and { in an (issue1411801)
Reviewers: jat, Description: Changes the eclipse formatter to put a space between [] and { in an array initializer. Please review this at http://gwt-code-reviews.appspot.com/1411801/ Affected files: M eclipse/settings/code-style/gwt-format.xml Index: eclipse/settings/code-style/gwt-format.xml === --- eclipse/settings/code-style/gwt-format.xml (revision 9943) +++ eclipse/settings/code-style/gwt-format.xml (working copy) @@ -216,7 +216,7 @@ id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> -id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="do not insert"/> +id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Handle SafeHtml as return type in ui:text (issue1409802)
Reviewers: rjrjr, Description: Handle SafeHtml as return type in ui:text Review by: rj...@google.com Please review this at http://gwt-code-reviews.appspot.com/1409802/ Affected files: M user/src/com/google/gwt/uibinder/elementparsers/ComputedAttributeInterpreter.java M user/src/com/google/gwt/uibinder/elementparsers/UiTextInterpreter.java M user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java M user/src/com/google/gwt/uibinder/rebind/XMLAttribute.java M user/src/com/google/gwt/uibinder/rebind/XMLElement.java Index: user/src/com/google/gwt/uibinder/elementparsers/ComputedAttributeInterpreter.java === --- user/src/com/google/gwt/uibinder/elementparsers/ComputedAttributeInterpreter.java (revision 9906) +++ user/src/com/google/gwt/uibinder/elementparsers/ComputedAttributeInterpreter.java (working copy) @@ -58,7 +58,16 @@ } if (att.hasComputedValue()) { -String attToken = writer.tokenForStringExpression(att.consumeStringValue()); +String attToken; +String returnValue = att.computedReturnValue(writer.getFieldManager(), +writer.getLogger()); + +if (returnValue.equals("SafeHtml")) { + attToken = writer.tokenForSafeHtmlMethod(att.consumeSafeHtmlValue()); +} else { + attToken = writer.tokenForStringExpression(att.consumeStringValue()); +} + attNameToToken.put(att.getName(), attToken); } else { /* @@ -77,5 +86,5 @@ // Return null because we don't want to replace the dom element return null; - } + } } Index: user/src/com/google/gwt/uibinder/elementparsers/UiTextInterpreter.java === --- user/src/com/google/gwt/uibinder/elementparsers/UiTextInterpreter.java (revision 9906) +++ user/src/com/google/gwt/uibinder/elementparsers/UiTextInterpreter.java (working copy) @@ -44,8 +44,9 @@ if (fieldRef == null) { logger.die(elem, "Attribute 'from' not found."); } + return "\" + " + fieldRef + " + \""; -} + } return null; } } Index: user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java === --- user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (revision 9906) +++ user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (working copy) @@ -575,6 +575,13 @@ } /** + * Returns the fieldManager. + */ + public FieldManager getFieldManager() { +return fieldManager; + } + + /** * Returns the logger, at least until we get get it handed off to parsers via * constructor args. */ @@ -673,7 +680,7 @@ setFieldInitializer(fieldName, formatCode("new %s(%s)", type.getQualifiedSourceName(), asCommaSeparatedList(args))); } - + /** * Like {@link #tokenForStringExpression}, but used for runtime expressions * that we trust to be safe to interpret at runtime as HTML without escaping, @@ -691,6 +698,18 @@ return token; } + /** + * Like {@link #tokenForStringExpression}, but used for runtime methods that + * return a value of type {@link com.google.gwt.safehtml.shared.SafeHtml SafeHtml}. + * + * @param expression + */ + public String tokenForSafeHtmlMethod(String expression) { +String token = tokenator.nextToken(expression); +htmlTemplates.noteSafeConstant(expression); +return token; + } + /** * Returns a string token that can be used in place the given expression * inside any string literals. Before the generated code is written, the Index: user/src/com/google/gwt/uibinder/rebind/XMLAttribute.java === --- user/src/com/google/gwt/uibinder/rebind/XMLAttribute.java (revision 9906) +++ user/src/com/google/gwt/uibinder/rebind/XMLAttribute.java (working copy) @@ -15,7 +15,9 @@ */ package com.google.gwt.uibinder.rebind; +import com.google.gwt.core.ext.TreeLogger.Type; import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.core.ext.typeinfo.JType; import com.google.gwt.uibinder.attributeparsers.FieldReferenceConverter; import org.w3c.dom.Attr; @@ -33,8 +35,23 @@ this.w3cAttr = attr; } + public String computedReturnValue(FieldManager fieldManager, + MortalLogger logger) { +String attrValue = w3cAttr.getValue(); +String[] parts = attrValue.substring(1, attrValue.length() - 1).split("\\."); +JType type = fieldManager.lookup(parts[0]).getReturnType(parts, +new MonitoredLogger(logger.getTreeLogger().branch(Type.TRACE, +"retrieving return type for " + attrValue))); + +return type.getSimpleSourceName(); + } + public String consumeRawValue() { return xmlElem.consumeRawAttribute(w3cAttr.getName()); + } + + public String consumeSafeHtmlValue() throws U