[gwt-contrib] Fixing a few Cell Widget bugs. I combined these bugs because they are all quick fixes and fairly... (issue1408801)

2011-04-06 Thread jlabanca

Reviewers: fabiomfv,

Description:
Fixing a few Cell Widget bugs. I combined these bugs because they are
all quick fixes and fairly straightforward.

(Issue 5971) CompositeCell does not implement isEditing.  I implemented
isEditing in CompositeCell.

(Issue 5993) TextInputCell and EditTextCell double escape values before
putting them into text boxes. We no longer use the SafeHtmlRenderer to
render the content of the input value, as input values are always treat
their values as text.  SafeHtml isn't valid in an attribute context.

Selecting a range in a CellTable only works on the first page.
DefaultSelectionEventManager now correctly subtracts the page start
index when getting the selected values from the CellTable.

Non-bubbling events (change/load/error/focus/blur) aren't captured in
CellTable in IE9. Switched IE9 to use the StandardBase implementation,
which is much simpler and works for IE9.


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

Affected files:
  M user/src/com/google/gwt/cell/client/CompositeCell.java
  M user/src/com/google/gwt/cell/client/EditTextCell.java
  M user/src/com/google/gwt/cell/client/TextInputCell.java
  M user/src/com/google/gwt/user/cellview/CellView.gwt.xml
  D  
user/src/com/google/gwt/user/cellview/client/CellBasedWidgetImplSafari.java
  A  
user/src/com/google/gwt/user/cellview/client/CellBasedWidgetImplStandardBase.java

  M user/src/com/google/gwt/view/client/DefaultSelectionEventManager.java
  M user/test/com/google/gwt/cell/client/CompositeCellTest.java
  M user/test/com/google/gwt/cell/client/EditTextCellTest.java
  M user/test/com/google/gwt/cell/client/TextInputCellTest.java
  M  
user/test/com/google/gwt/view/client/DefaultSelectionEventManagerTest.java



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


[gwt-contrib] Re: Makes gadget linker shardable, derived from CrossSiteIframeLinker (issue1370808)

2011-04-06 Thread unnurg


http://gwt-code-reviews.appspot.com/1370808/diff/14001/gadgets/src/com/google/gwt/gadgets/linker/computeUrlForGadgetResource.js
File
gadgets/src/com/google/gwt/gadgets/linker/computeUrlForGadgetResource.js
(right):

http://gwt-code-reviews.appspot.com/1370808/diff/14001/gadgets/src/com/google/gwt/gadgets/linker/computeUrlForGadgetResource.js#newcode31
gadgets/src/com/google/gwt/gadgets/linker/computeUrlForGadgetResource.js:31:
return __MODULE_FUNC__.__moduleBase + resource;
How is this file different than the computeUrlForResource.js that the
linker uses?

http://gwt-code-reviews.appspot.com/1370808/

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


[gwt-contrib] Re: Adding a new annotation SafeHtmlTemplates.SafeForCss to specify that a parameter is known to be ... (issue1384801)

2011-04-06 Thread xtof


http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safecss/shared/SafeStyles.java
File user/src/com/google/gwt/safecss/shared/SafeStyles.java (right):

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safecss/shared/SafeStyles.java#newcode71
user/src/com/google/gwt/safecss/shared/SafeStyles.java:71: * attribute:
Maybe instead say, "comply with this type's contract" (here and
elsewhere) -- these examples are not inherently unsafe, they just don't
comply with the type contract (specifically, the composability
requirement).

With that in mind, perhaps move the examples after the paragraph about
composability?

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safecss/shared/SafeStyles.java#newcode88
user/src/com/google/gwt/safecss/shared/SafeStyles.java:88: * {@code
http://trackingurl.com)"} is appended to {@code background:url("}, the
Hmm, so generally the SafeHtml contracts don't guarantee that the
resulting HTML is side-effect free; in particular when we sanitize
untrusted URIs we'll leave them alone as long as they have a whitelisted
scheme.  I.e. we'd allow  where the value of {0} is
http://trackingurl.com/

Complete side effect freedom in this sense would be much harder to
enforce (we'd have to somehow have a way to configure filters that know
which domains are "trusted" and which ones are third-party).

Perhaps a better example would be to use "javascript:evil()" as a url?

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safecss/shared/SafeStylesBuilder.java
File user/src/com/google/gwt/safecss/shared/SafeStylesBuilder.java
(right):

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safecss/shared/SafeStylesBuilder.java#newcode42
user/src/com/google/gwt/safecss/shared/SafeStylesBuilder.java:42: * any
escaping to it.
Perhaps, "any escaping or sanitization"?

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java
File
user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java
(right):

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java#newcode131
user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java:131:
*   If the parameter is not of type {@link SafeStyles}, the result
is then
I think this comment should remain unchanged; we always HTML escape the
attribute value even if it came from a SafeStyles.

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java#newcode176
user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java:176:
// TODO(xtof): Throw an exception if using SafeHtml within an attribute.
I think you can remove this TODO, isn't this handled now in your new
checks at the start of emitParameterExpression?

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java#newcode280
user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java:280:
* definitely isn't what the user intended to do.
Maybe "user" -> "developer"?

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java#newcode315
user/src/com/google/gwt/safehtml/rebind/SafeHtmlTemplatesImplMethodCreator.java:315:
logger.log(TreeLogger.WARN,
I find the code is a bit hard to understand with the checks related to
CSS_ATTRIBUTE contexts partially done here, and partially done up above
in line 270ff.  Might it be more readable if you move the checks from
above to here (possibly splitting the two cases)?  Not sure on this;
might make the code more verbose...

Otherwise, a comment noting the precondition established by the check in
270ff might help.

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/user/cellview/client/CellBrowser.java
File user/src/com/google/gwt/user/cellview/client/CellBrowser.java
(right):

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/src/com/google/gwt/user/cellview/client/CellBrowser.java#newcode728
user/src/com/google/gwt/user/cellview/client/CellBrowser.java:728:
private static final SafeHtml LEAF_IMAGE = SafeHtmlUtils
Maybe break after = ?

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java
File user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java
(right):

http://gwt-code-reviews.appspot.com/1384801/diff/8001/user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java#newcode60
user/test/com/google/gwt/safehtml/client/SafeHtmlTemplatesTest.java:60:
SafeHtml templateWithCssAttribute(int height /* generates a compiled
time warning */,
"compile time"

http://gwt-code-reviews.apps

[gwt-contrib] Re: Comment on CodeSplitting in google-web-toolkit

2011-04-06 Thread codesite-noreply

Comment by boj...@gmail.com:

However philosophically we speak, the fact is software will be modular. GWT  
promotes building huge monolithic apps with no inherent plugability. If you  
don't realize and fix this sooner, GWT will be on its death bed. OSGi is  
getting so much focus that it would be childish to ignore these concerns.


For more information:
http://code.google.com/p/google-web-toolkit/wiki/CodeSplitting

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


[gwt-contrib] [google-web-toolkit] r9952 committed - Change RequestFactoryMagic -> RequestFactorySource in comment...

2011-04-06 Thread codesite-noreply

Revision: 9952
Author:   r...@google.com
Date: Wed Apr  6 10:54:18 2011
Log:  Change RequestFactoryMagic -> RequestFactorySource in comment

Review at http://gwt-code-reviews.appspot.com/1406801

Review by: robertvaw...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=9952

Modified:
  
/trunk/user/src/com/google/web/bindery/requestfactory/server/testing/InProcessRequestTransport.java


===
---  
/trunk/user/src/com/google/web/bindery/requestfactory/server/testing/InProcessRequestTransport.java	 
Tue Apr  5 10:47:39 2011
+++  
/trunk/user/src/com/google/web/bindery/requestfactory/server/testing/InProcessRequestTransport.java	 
Wed Apr  6 10:54:18 2011

@@ -28,7 +28,7 @@
  * ServiceLayer serviceLayer = ServiceLayer.create();
  * SimpleRequestProcessor processor = new  
SimpleRequestProcessor(serviceLayer);

  * EventBus eventBus = new SimpleEventBus();
- * MyRequestFactory f = RequestFactoryMagic.create(MyRequestFactory.class);
+ * MyRequestFactory f =  
RequestFactorySource.create(MyRequestFactory.class);

  * f.initialize(eventBus, new InProcessRequestTransport(processor));
  * 
  *

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


[gwt-contrib] Re: Adding table rendering tests to micro benchmarks. Table rendering tests are multiple orders of m... (issue1394802)

2011-04-06 Thread jlabanca

committed as r9925

http://gwt-code-reviews.appspot.com/1394802/

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


[gwt-contrib] Re: Adding a new annotation SafeHtmlTemplates.SafeForCss to specify that a parameter is known to be ... (issue1384801)

2011-04-06 Thread jlabanca

I renamed SafeCssProperties to SafeStyles, but I left the package as
com.google.gwt.css so we can add more CSS support in the future (such as
support for CSS in a CSS file or a style tag). The generator now throws
an error if SafeStyles doesn't appear in the CSS_ATTRIBUTE_START
context.


http://gwt-code-reviews.appspot.com/1384801/diff/6006/user/src/com/google/gwt/safecss/shared/SafeCssProperties.java
File user/src/com/google/gwt/safecss/shared/SafeCssProperties.java
(right):

http://gwt-code-reviews.appspot.com/1384801/diff/6006/user/src/com/google/gwt/safecss/shared/SafeCssProperties.java#newcode46
user/src/com/google/gwt/safecss/shared/SafeCssProperties.java:46: * By
convention, {@link SafeCssProperties} should only contain single quotes
On 2011/03/14 23:10:02, xtof wrote:

Since SafeHtmlTemplates has been changed to HTML-escape the value of

style

attributes, perhaps it might avoid some confusion to remove the

suggestion about

the quotes.



It wouldn't hurt to instead remind users that SafeCssProperties

strings may

contain literal single or double quotes, and as such the entire CSS

must be HTML

escaped when used in a style attribute.



One thing that is important to require is that SafeCssProperties may

never

contain literal angle brackets. Otherwise, it could be unsafe to place

a

SafeCssProperties into a  tag (where it can't be HTML escaped),
e.g. if
the SafeCssProperties such as
font: 'foo evil'
is used in a style sheet in a 

[gwt-contrib] Re: Convert AutoBeans to use JSOs as their backing store with lazy reification of (issue1407802)

2011-04-06 Thread rice

LGTM

I think you probably meant "codec" rather than "codex", but I can
understand if this name change would be too much at this point.

I hate the word "reify", I don't really understand what it means and I
doubt 99% of our users will either.  Can you add a juicy comment
somewhere that explains what it means in this context?


http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/rebind/AutoBeanFactoryGenerator.java
File
user/src/com/google/gwt/autobean/rebind/AutoBeanFactoryGenerator.java
(right):

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/rebind/AutoBeanFactoryGenerator.java#newcode235
user/src/com/google/gwt/autobean/rebind/AutoBeanFactoryGenerator.java:235:
sw.println("%s toReturn =  getOrReify(\"%s\");", castType,
method.getPropertyName());
two spaces after =

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/server/impl/FactoryHandler.java
File user/src/com/google/gwt/autobean/server/impl/FactoryHandler.java
(right):

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/server/impl/FactoryHandler.java#newcode77
user/src/com/google/gwt/autobean/server/impl/FactoryHandler.java:77:
Whitespace-only change

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/server/impl/JsonSplittable.java
File user/src/com/google/gwt/autobean/server/impl/JsonSplittable.java
(left):

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/server/impl/JsonSplittable.java#oldcode65
user/src/com/google/gwt/autobean/server/impl/JsonSplittable.java:65: *
Private equivalent of org.json.JSONObject.getNames(JSONObject)
Please restore this method and remove call to JSONObject.getNames below
(in getPropertyKeys).

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/server/impl/JsonSplittable.java
File user/src/com/google/gwt/autobean/server/impl/JsonSplittable.java
(right):

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/server/impl/JsonSplittable.java#newcode194
user/src/com/google/gwt/autobean/server/impl/JsonSplittable.java:194:
String[] names = JSONObject.getNames(obj);
Call local getNames method (for Android compatibility)

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/server/impl/ProxyAutoBean.java
File user/src/com/google/gwt/autobean/server/impl/ProxyAutoBean.java
(right):

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/server/impl/ProxyAutoBean.java#newcode180
user/src/com/google/gwt/autobean/server/impl/ProxyAutoBean.java:180:
return null;
Does this need a doc comment (to indicate that it's a stub
implementation)?

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/shared/AutoBeanCodex.java
File user/src/com/google/gwt/autobean/shared/AutoBeanCodex.java (right):

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/shared/AutoBeanCodex.java#newcode27
user/src/com/google/gwt/autobean/shared/AutoBeanCodex.java:27: public
class AutoBeanCodex {
Do you mean 'codec'?  (coder/decoder)

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/shared/ValueCodex.java
File user/src/com/google/gwt/autobean/shared/ValueCodex.java (right):

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/shared/ValueCodex.java#newcode31
user/src/com/google/gwt/autobean/shared/ValueCodex.java:31: public class
ValueCodex {
Codec?

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/shared/impl/AutoBeanCodexImpl.java
File user/src/com/google/gwt/autobean/shared/impl/AutoBeanCodexImpl.java
(right):

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/shared/impl/AutoBeanCodexImpl.java#newcode40
user/src/com/google/gwt/autobean/shared/impl/AutoBeanCodexImpl.java:40:
public class AutoBeanCodexImpl {
Codec

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/shared/impl/SplittableSet.java
File user/src/com/google/gwt/autobean/shared/impl/SplittableSet.java
(right):

http://gwt-code-reviews.appspot.com/1407802/diff/1/user/src/com/google/gwt/autobean/shared/impl/SplittableSet.java#newcode26
user/src/com/google/gwt/autobean/shared/impl/SplittableSet.java:26: *
This type is optimized for the read-only case.
Might want to note that contains() is O(n)?

http://gwt-code-reviews.appspot.com/1407802/

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


[gwt-contrib] Re: Adding a new annotation SafeHtmlTemplates.SafeForCss to specify that a parameter is known to be ... (issue1384801)

2011-04-06 Thread jlabanca

http://gwt-code-reviews.appspot.com/1384801/

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


[gwt-contrib] Re: Temporarily introduces configuration property UiBinder.xssSafe to (issue1402801)

2011-04-06 Thread rjrjr

r9948

http://gwt-code-reviews.appspot.com/1402801/

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


[gwt-contrib] [google-web-toolkit] r9951 committed - Cherry picking r9950 into releases/2.3m1. http://gwt-code-reviews.apps...

2011-04-06 Thread codesite-noreply

Revision: 9951
Author:   schen...@google.com
Date: Wed Apr  6 09:03:10 2011
Log:  Cherry picking r9950 into releases/2.3m1.  
http://gwt-code-reviews.appspot.com/1386805/


http://code.google.com/p/google-web-toolkit/source/detail?r=9951

Added:
  
/releases/2.3/user/src/com/google/gwt/user/client/rpc/XsrfProtectedServiceAsync.java


===
--- /dev/null
+++  
/releases/2.3/user/src/com/google/gwt/user/client/rpc/XsrfProtectedServiceAsync.java	 
Wed Apr  6 09:03:10 2011

@@ -0,0 +1,22 @@
+/*
+ * 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.user.client.rpc;
+
+/**
+ * Async peer of {@link XsrfProtectedService}.
+ */
+public interface XsrfProtectedServiceAsync {
+}

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


[gwt-contrib] Re: Autoformat the api-checker tool source (issue1405801)

2011-04-06 Thread zundel

Patch updates the formatting to put a space between ] and { in array
initializers (see gwt_format.xml change in
http://gwt-code-reviews.appspot.com/1402803 )


http://gwt-code-reviews.appspot.com/1405801/

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


[gwt-contrib] [google-web-toolkit] r9950 committed - Adding an empty interface to prevent the Google Plugin for Eclipse fro...

2011-04-06 Thread codesite-noreply

Revision: 9950
Author:   schen...@google.com
Date: Wed Apr  6 07:57:12 2011
Log:  Adding an empty interface to prevent the Google Plugin for  
Eclipse from

marking XsrfProtectedService as missing an Async class.

Review at http://gwt-code-reviews.appspot.com/1386805

http://code.google.com/p/google-web-toolkit/source/detail?r=9950

Added:
  
/trunk/user/src/com/google/gwt/user/client/rpc/XsrfProtectedServiceAsync.java


===
--- /dev/null
+++  
/trunk/user/src/com/google/gwt/user/client/rpc/XsrfProtectedServiceAsync.java	 
Wed Apr  6 07:57:12 2011

@@ -0,0 +1,22 @@
+/*
+ * 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.user.client.rpc;
+
+/**
+ * Async peer of {@link XsrfProtectedService}.
+ */
+public interface XsrfProtectedServiceAsync {
+}

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


[gwt-contrib] Re: Autoformat the api-checker tool source (issue1405801)

2011-04-06 Thread zundel

http://gwt-code-reviews.appspot.com/1405801/

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


[gwt-contrib] Creating groups of rows in CellTable

2011-04-06 Thread Jeff Larsen
I have a requirement that our users should be able to dynamically create 
groups of rows inside a celltable.

For example, lets say a user was searching for books, and wanted to group by 
Author. The Author column should be hidden (this isn't a problem), but there 
should be a new row with a colspan="numColumns" and eventually the ability 
to show/hide the Books written by the author. The tricky part is adding a 
new row basically breaks a lot of assumptions inside HasDataPresenter. From 
what I can gather, and through my testing, it assumes row x = list.get(x) 
which is true under the current model of CellTable, but that becomes false 
when I start dynamcially adding rows. So now in order to get rows/columns to 
work properly, i've got a ton of copy/paste coding to do.

HasDataPresenter, AbstractHasData and CellTable are the 3 that I've narrowed 
down so far that I need to copy/paste and then modify in order to get access 
to the correct items. The only reason I need to extend AbstractHasData is 
because I need to plug in my own version of HasDataPresenter.

So my first question is, what would you think about changing AbstractHasData 
to allow for a pluggable HasDataPresenter and changing HasDataPresenter to 
be a protected instead of package private class and then refactoring some of 
the methods in there to be overrideable and refactor some of them to be 
smaller,  HasDataPresenter#resolvePendingState() for example.

If I'm missing something and there is an easy way to do what I've described 
above, I would love to hear how to do it, but currently I'm doing the 
ugly/error prone/non-updateable process of copy/pasting those classes and 
making my own CellTable etc.

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

Re: [gwt-contrib] Re: Autoformat the api-checker tool source (issue1405801)

2011-04-06 Thread Eric Ayers
On Wed, Apr 6, 2011 at 12:11 AM, John Tamplin  wrote:
> On Tue, Apr 5, 2011 at 8:35 PM, Ray Ryan  wrote:
>>
>> I don't think it's reasonable to ask Eric to tweak the auto formatter. We
>> had that conversation already. He's just doing the same thing we have
>> eclipse configured to do, right?
>
> Well, my understanding of the changes made to the formatter settings were:
>
> change the line width to 100
> let lines break at method invocations
>
> So, I am not sure why there are other changes which, IMHO, look really
> terrible.
> I thought the point of doing a few small blocks of code first was
> specifically to look for things like this that could be improved before we
> run it on everything.
>>
>> I can't look for real right now. Did you really find something aggregious?
>
> Well, I think it is pretty egregious, but YMMV.  In particular:
>
> the loss of the space in array initialization is a change for the worse that
> is one checkbox to fix

Fixed in another patch

> the assignment breaking is harder to fix, but I think the change is net for
> the worse because while the old settings allowed overly long lines,

The decision to turn that property on was due to the effects in:

  http://gwt-code-reviews.appspot.com/1368802

There were some internal discussions about this that culminated in the
gwt_format.xml change to turn on wrapping assignments at

http://gwt-code-reviews.appspot.com/1371802

> they
> seemed to occur only rarely in field initializers, and it is easy enough to
> work around that by initializing them in an initializer block instead of on
> the same line.  The current settings will screw up line breaks on
> assignments all over the place.
> The indentation issue I am talking about is like this.  Previous settings:
> logger.log(TreeLogger.log,
>     "A really long message "
>     + variable);
> while the new settings do this:
> logger.log(TreeLogger.log,
>     "A really long message "
>       + variable);
> however, I don't see where this is coming from.

>From what I can tell, this isn't a setting (at least not anymore),
maybe the eclipse formatter in Eclipse 3.6 has changed.

> Regarding detecting the builder pattern, it could detect multiple
> invocations a.foo().bar().foo().baz() etc, but I agree the current formatter
> doesn't have that capability and the new setting is better than the old
> setting.




-- 
Eric Z. Ayers
Google Web Toolkit, Atlanta, GA USA

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


[gwt-contrib] Re: Auto-formats the GWT tools projects (excluding api-checker covered in (issue1402803)

2011-04-06 Thread zundel


http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
File
tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
(right):

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java#newcode396
tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java:396:
+ "dayPeriodContext[@type=\"format\"]/"
On 2011/04/06 15:39:55, jat wrote:

On 2011/04/06 15:33:49, zundel wrote:
>  I think it looks wrong to us because we're used to not indenting

before the

> string concatenation when formatted on a second line.  The unwritten

rule it

> seems to consistently follow is that new statements get one indent

from the

> parent of the statement, (2 spaces), line continuation gets 2

indents from the

> parent statement (4 spaces).



I disagree, but I won't fight it (mostly because it appears to be a

change in

the Eclipse formatter that I didn't find a knob to control).



By that logic, every succeeding line with + should be indented

further, but it

isn't (and would be very ugly if it did).  It also represents a change

to the

formatting we have been using for 4+ years.



I think there is an argument for indenting again when there is another

level of

nesting, like:



foo(long,list,of,arguments,
 bar(more,arguments,here,
   and,here))



but that isn't what is happening here.


The rule I think its following is illustrated below at 399+
line 399 is the start of a new line
line 400 is the continuation of line 399 - it gets 2 indents
line 401 is also a continutation of 399 so it also gets 2 indents...
from tthe start of 399.

http://gwt-code-reviews.appspot.com/1402803/

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


[gwt-contrib] Re: Auto-formats the GWT tools projects (excluding api-checker covered in (issue1402803)

2011-04-06 Thread jat


http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
File
tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
(right):

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java#newcode396
tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java:396:
+ "dayPeriodContext[@type=\"format\"]/"
On 2011/04/06 15:33:49, zundel wrote:

  I think it looks wrong to us because we're used to not indenting

before the

string concatenation when formatted on a second line.  The unwritten

rule it

seems to consistently follow is that new statements get one indent

from the

parent of the statement, (2 spaces), line continuation gets 2 indents

from the

parent statement (4 spaces).


I disagree, but I won't fight it (mostly because it appears to be a
change in the Eclipse formatter that I didn't find a knob to control).

By that logic, every succeeding line with + should be indented further,
but it isn't (and would be very ugly if it did).  It also represents a
change to the formatting we have been using for 4+ years.

I think there is an argument for indenting again when there is another
level of nesting, like:

foo(long,list,of,arguments,
bar(more,arguments,here,
  and,here))

but that isn't what is happening here.

http://gwt-code-reviews.appspot.com/1402803/

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


[gwt-contrib] Re: Auto-formats the GWT tools projects (excluding api-checker covered in (issue1402803)

2011-04-06 Thread zundel


http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
File
tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
(right):

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java#newcode52
tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java:52:
new String[]{"sun", "mon", "tue", "wed", "thu", "fri", "sat"};
On 2011/04/06 04:15:00, jat wrote:

The whitespace is easily fixed by changing the formatter:



whitespace / arrays / array initializers / before opening brace


Added that to this patch.


The lousy line breaks on assignments seems harder to fix -- the

options are no

breaks or break like the above.  I think it is more likely that

assignments all

over the place will be made worse by this than the alternative, which

seems to

mostly hit field initializations.


Hey look at that, the brace formatting change killed 2 birds with one
stone in this case.

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java#newcode396
tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java:396:
+ "dayPeriodContext[@type=\"format\"]/"
On 2011/04/05 13:43:27, jat wrote:

Why does this get indended again?  If it is consistent I can live with

it, but

it seems wrong.


 I think it looks wrong to us because we're used to not indenting before
the string concatenation when formatted on a second line.  The unwritten
rule it seems to consistently follow is that new statements get one
indent from the parent of the statement, (2 spaces), line continuation
gets 2 indents from the parent statement (4 spaces).

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/GenerateGwtCldrData.java
File
tools/cldr-import/src/com/google/gwt/tools/cldr/GenerateGwtCldrData.java
(right):

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/GenerateGwtCldrData.java#newcode59
tools/cldr-import/src/com/google/gwt/tools/cldr/GenerateGwtCldrData.java:59:
UOption[] options =
On 2011/04/05 13:43:27, jat wrote:

Wow, this one is really ugly:  It splts the assignment in a weird

place, it puts

the opening brace on its own line yet puts the closing brace at the

end (with no

space even).



I definitely think this needs more tweaking.



The assignment break is consistent with the way assignments are
formatted everywhere else (setting PROCESSORS  above).  I have no idea
why it put the lead curly on its own line and spent about 30 minutes
diddling unsuccessfully to make it go away.

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/LocaleData.java
File tools/cldr-import/src/com/google/gwt/tools/cldr/LocaleData.java
(right):

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/LocaleData.java#newcode432
tools/cldr-import/src/com/google/gwt/tools/cldr/LocaleData.java:432:
"type");
On 2011/04/05 13:43:27, jat wrote:

Why does it increase the indent level and then go back?


I can't find a specific setting that allows you to control this, but the
general indentation rule is:

1 indent (2 spaces) is for a new statement
2 indents (4 spaces) is for a continuation of the previous line.

In the olden days, I thought there used to be special cases for string
concatenation, but I don't see them any more.

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/LocalizedNamesProcessor.java
File
tools/cldr-import/src/com/google/gwt/tools/cldr/LocalizedNamesProcessor.java
(right):

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/LocalizedNamesProcessor.java#newcode100
tools/cldr-import/src/com/google/gwt/tools/cldr/LocalizedNamesProcessor.java:100:
.getVariantNotNull());
On 2011/04/05 13:43:27, jat wrote:

Another awkward split.


Consequence of the "builder pattern" formatter change we discussed back
when that change was made.

http://gwt-code-reviews.appspot.com/1402803/diff/1/tools/cldr-import/src/com/google/gwt/tools/cldr/LocalizedNamesProcessor.java#newcode339
tools/cldr-import/src/com/google/gwt/tools/cldr/LocalizedNamesProcessor.java:339:
.getRegions(locale.getLanguageNotNull() + "_" +
locale.getScriptNotNull());
On 2011/04/05 13:43:27, jat wrote:

Yikes.  Bad assignment split, and splitting at . rather than in the

argument

list looks really bad.


Again, the assignment split appears to me to be consistent throughout
the reformatting.

http://gwt-code-reviews.appspot.com/1402803/diff/6001/eclipse/external/cldr-tools/.classpath
File eclipse/external/cldr-tools/.classpath (right):

http://gwt-code-reviews.appspot.com/1402803/diff/6001/eclipse/external/cldr-tools/.classpath#new

[gwt-contrib] Re: Auto-formats the GWT tools projects (excluding api-checker covered in (issue1402803)

2011-04-06 Thread jat

I still the the assignment line breaks are really ugly this way, but if
others would rather avoid long lines no matter how ugly the result is, I
can go with it.


http://gwt-code-reviews.appspot.com/1402803/diff/6001/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
File
tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
(right):

http://gwt-code-reviews.appspot.com/1402803/diff/6001/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java#newcode51
tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java:51:
private static final String[] DAYS = new String[] {
Thanks.

http://gwt-code-reviews.appspot.com/1402803/

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


[gwt-contrib] Convert AutoBeans to use JSOs as their backing store with lazy reification of (issue1407802)

2011-04-06 Thread bobv

Reviewers: rice, rjrjr,

Description:
Convert AutoBeans to use JSOs as their backing store with lazy
reification of
values.
Use JsonSplittable in DevMode to avoid JSNI overhead.
Patch by: bobv
Review by: rice, rjrjr


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

Affected files:
  M dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
  M tools/api-checker/config/gwt22_23userApi.conf
  M  
user/src/com/google/gwt/autobean/client/impl/AbstractAutoBeanFactory.java

  M user/src/com/google/gwt/autobean/client/impl/ClientPropertyContext.java
  M user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java
  M user/src/com/google/gwt/autobean/rebind/AutoBeanFactoryGenerator.java
  M user/src/com/google/gwt/autobean/server/impl/BeanMethod.java
  M user/src/com/google/gwt/autobean/server/impl/BeanPropertyContext.java
  M user/src/com/google/gwt/autobean/server/impl/FactoryHandler.java
  M user/src/com/google/gwt/autobean/server/impl/JsonSplittable.java
  M user/src/com/google/gwt/autobean/server/impl/ProxyAutoBean.java
  M user/src/com/google/gwt/autobean/server/impl/ShimHandler.java
  M user/src/com/google/gwt/autobean/server/impl/SimpleBeanHandler.java
  M user/src/com/google/gwt/autobean/server/impl/TypeUtils.java
  M user/src/com/google/gwt/autobean/shared/AutoBean.java
  M user/src/com/google/gwt/autobean/shared/AutoBeanCodex.java
  M user/src/com/google/gwt/autobean/shared/AutoBeanUtils.java
  M user/src/com/google/gwt/autobean/shared/Splittable.java
  M user/src/com/google/gwt/autobean/shared/ValueCodex.java
  M user/src/com/google/gwt/autobean/shared/impl/AbstractAutoBean.java
  A user/src/com/google/gwt/autobean/shared/impl/AutoBeanCodexImpl.java
  M user/src/com/google/gwt/autobean/shared/impl/EnumMap.java
  A user/src/com/google/gwt/autobean/shared/impl/HasSplittable.java
  D user/src/com/google/gwt/autobean/shared/impl/LazySplittable.java
  A user/src/com/google/gwt/autobean/shared/impl/SplittableComplexMap.java
  A user/src/com/google/gwt/autobean/shared/impl/SplittableList.java
  A user/src/com/google/gwt/autobean/shared/impl/SplittableSet.java
  A user/src/com/google/gwt/autobean/shared/impl/SplittableSimpleMap.java
  M user/src/com/google/gwt/autobean/shared/impl/StringQuoter.java
  M user/src/com/google/gwt/core/client/JsonUtils.java
  M  
user/src/com/google/web/bindery/requestfactory/shared/impl/AbstractRequestContext.java
  M  
user/src/com/google/web/bindery/requestfactory/shared/impl/EntityCodex.java
  M  
user/super/com/google/gwt/autobean/super/com/google/gwt/autobean/shared/impl/StringQuoter.java

  M user/test/com/google/gwt/autobean/AutoBeanSuite.java
  M user/test/com/google/gwt/autobean/client/AutoBeanTest.java
  A user/test/com/google/gwt/autobean/server/SplittableJreTest.java
  M user/test/com/google/gwt/autobean/shared/AutoBeanCodexTest.java
  A user/test/com/google/gwt/autobean/shared/SplittableTest.java


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


[gwt-contrib] [google-web-toolkit] r9949 committed - Reformat autobeans package to cut down on diff churn for lazy reificat...

2011-04-06 Thread codesite-noreply

Revision: 9949
Author:   b...@google.com
Date: Wed Apr  6 04:44:12 2011
Log:  Reformat autobeans package to cut down on diff churn for lazy  
reification patch.

Patch by: bobv
Review by: rice

Review at http://gwt-code-reviews.appspot.com/1407801

http://code.google.com/p/google-web-toolkit/source/detail?r=9949

Modified:
  
/trunk/user/src/com/google/gwt/autobean/client/impl/AbstractAutoBeanFactory.java
  
/trunk/user/src/com/google/gwt/autobean/client/impl/ClientPropertyContext.java

 /trunk/user/src/com/google/gwt/autobean/client/impl/JsniCreatorMap.java
 /trunk/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java
  
/trunk/user/src/com/google/gwt/autobean/rebind/AutoBeanFactoryGenerator.java

 /trunk/user/src/com/google/gwt/autobean/server/AutoBeanFactoryMagic.java
 /trunk/user/src/com/google/gwt/autobean/server/Configuration.java
 /trunk/user/src/com/google/gwt/autobean/shared/AutoBeanCodex.java
 /trunk/user/src/com/google/gwt/autobean/shared/AutoBeanUtils.java
 /trunk/user/src/com/google/gwt/autobean/shared/AutoBeanVisitor.java

===
---  
/trunk/user/src/com/google/gwt/autobean/client/impl/AbstractAutoBeanFactory.java	 
Thu Mar  3 07:14:17 2011
+++  
/trunk/user/src/com/google/gwt/autobean/client/impl/AbstractAutoBeanFactory.java	 
Wed Apr  6 04:44:12 2011

@@ -26,8 +26,7 @@
 /**
  * Provides base implementations of AutoBeanFactory methods.
  */
-public abstract class AbstractAutoBeanFactory implements AutoBeanFactory,
-EnumMap {
+public abstract class AbstractAutoBeanFactory implements AutoBeanFactory,  
EnumMap {


   protected Map, String> enumToStringMap;
   // This map is almost always one-to-one
===
---  
/trunk/user/src/com/google/gwt/autobean/client/impl/ClientPropertyContext.java	 
Mon Mar 21 12:22:19 2011
+++  
/trunk/user/src/com/google/gwt/autobean/client/impl/ClientPropertyContext.java	 
Wed Apr  6 04:44:12 2011

@@ -64,8 +64,7 @@
 this.paramCounts = null;
   }

-  public ClientPropertyContext(Object instance, Setter setter,
-  Class[] types, int[] paramCounts) {
+  public ClientPropertyContext(Object instance, Setter setter, Class[]  
types, int[] paramCounts) {

 this.instance = instance;
 this.setter = setter;
 this.simpleType = null;
@@ -77,14 +76,14 @@
  * plus one for the root type, equals the total number of types passed  
in.

  */
 if (ClientPropertyContext.class.desiredAssertionStatus()) {
-  assert types.length == paramCounts.length : "Length mismatch "
-  + types.length + " != " + paramCounts.length;
+  assert types.length == paramCounts.length : "Length mismatch " +  
types.length + " != "

+  + paramCounts.length;
   int count = 1;
   for (int i = 0, j = paramCounts.length; i < j; i++) {
 count += paramCounts[i];
   }
-  assert count == types.length : "Mismatch in total parameter count "
-  + count + " != " + types.length;
+  assert count == types.length : "Mismatch in total parameter count "  
+ count + " != "

+  + types.length;
 }
   }

===
--- /trunk/user/src/com/google/gwt/autobean/client/impl/JsniCreatorMap.java	 
Thu Mar  3 07:14:17 2011
+++ /trunk/user/src/com/google/gwt/autobean/client/impl/JsniCreatorMap.java	 
Wed Apr  6 04:44:12 2011

@@ -48,8 +48,7 @@
 return null;
   }

-  public  AutoBean create(Class clazz,
-  AbstractAutoBeanFactory factory, Object delegate) {
+  public  AutoBean create(Class clazz, AbstractAutoBeanFactory  
factory, Object delegate) {

 JsArray arr = get(clazz.getName());
 if (arr != null) {
   assert arr.get(1) != null : "No delegate-based constructor";
@@ -62,8 +61,7 @@
 return this[key];
   }-*/;

-  private native  AutoBean invoke(JavaScriptObject fn, Object arg1,
-  Object arg2)/*-{
+  private native  AutoBean invoke(JavaScriptObject fn, Object arg1,  
Object arg2)/*-{

 return fn(arg1, arg2);
   }-*/;

===
--- /trunk/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java	 
Wed Nov 24 12:33:58 2010
+++ /trunk/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java	 
Wed Apr  6 04:44:12 2011

@@ -109,8 +109,7 @@
   }

   public String getPayload() {
-throw new UnsupportedOperationException(
-"Cannot convert JsoSplittable to payload");
+throw new UnsupportedOperationException("Cannot convert JsoSplittable  
to payload");

   }

   public List getPropertyKeys() {
@@ -136,7 +135,7 @@
   }-*/;

   public native boolean isString() /*-{
-return typeof(this) == 'string' || this instanceof String;
+return typeof (this) == 'string' || this instanceof String;
   }-*/;

   public native int size() /*-{
===
---  
/trunk/user/src/com/google/gwt/autobean/rebind/AutoBeanFactoryGenerator.java	 
Thu Mar  3 07:14:17 2011
+++  
/trunk/user/src/com/google/gwt/autobean/rebind/AutoB

[gwt-contrib] Re: Change RequestFactoryMagic -> RequestFactorySource in comment (issue1406801)

2011-04-06 Thread bobv

LGTM

http://gwt-code-reviews.appspot.com/1406801/

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


[gwt-contrib] Re: Reformat autobeans package to cut down on diff churn for lazy reification patch. (issue1407801)

2011-04-06 Thread rice

LGTM

http://gwt-code-reviews.appspot.com/1407801/

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


[gwt-contrib] Reformat autobeans package to cut down on diff churn for lazy reification patch. (issue1407801)

2011-04-06 Thread bobv

Reviewers: rice,

Description:
Reformat autobeans package to cut down on diff churn for lazy
reification patch.
Patch by: bobv
Review by: rice


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

Affected files:
  M  
user/src/com/google/gwt/autobean/client/impl/AbstractAutoBeanFactory.java

  M user/src/com/google/gwt/autobean/client/impl/ClientPropertyContext.java
  M user/src/com/google/gwt/autobean/client/impl/JsniCreatorMap.java
  M user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java
  M user/src/com/google/gwt/autobean/rebind/AutoBeanFactoryGenerator.java
  M user/src/com/google/gwt/autobean/server/AutoBeanFactoryMagic.java
  M user/src/com/google/gwt/autobean/server/Configuration.java
  M user/src/com/google/gwt/autobean/shared/AutoBeanCodex.java
  M user/src/com/google/gwt/autobean/shared/AutoBeanUtils.java
  M user/src/com/google/gwt/autobean/shared/AutoBeanVisitor.java


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


[gwt-contrib] Change RequestFactoryMagic -> RequestFactorySource in comment (issue1406801)

2011-04-06 Thread rice

Reviewers: robertvawter,

Description:
Change RequestFactoryMagic -> RequestFactorySource in comment


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

Affected files:
  M  
user/src/com/google/web/bindery/requestfactory/server/testing/InProcessRequestTransport.java



Index:  
user/src/com/google/web/bindery/requestfactory/server/testing/InProcessRequestTransport.java

===
---  
user/src/com/google/web/bindery/requestfactory/server/testing/InProcessRequestTransport.java	 
(revision 9947)
+++  
user/src/com/google/web/bindery/requestfactory/server/testing/InProcessRequestTransport.java	 
(working copy)

@@ -28,7 +28,7 @@
  * ServiceLayer serviceLayer = ServiceLayer.create();
  * SimpleRequestProcessor processor = new  
SimpleRequestProcessor(serviceLayer);

  * EventBus eventBus = new SimpleEventBus();
- * MyRequestFactory f = RequestFactoryMagic.create(MyRequestFactory.class);
+ * MyRequestFactory f =  
RequestFactorySource.create(MyRequestFactory.class);

  * f.initialize(eventBus, new InProcessRequestTransport(processor));
  * 
  *


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


[gwt-contrib] [google-web-toolkit] r9948 committed - Temporarily introduces configuration property UiBinder.useSafeHtmlTemp...

2011-04-06 Thread codesite-noreply

Revision: 9948
Author:   rj...@google.com
Date: Wed Apr  6 03:31:11 2011
Log:  Temporarily introduces configuration property  
UiBinder.useSafeHtmlTemplates to

allow UiBinder's SafeHtml integration to be disabled while the last
couple of kinks are worked out.

Review at http://gwt-code-reviews.appspot.com/1402801

Review by: sbruba...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=9948

Modified:
 /trunk/user/src/com/google/gwt/uibinder/UiBinder.gwt.xml
  
/trunk/user/src/com/google/gwt/uibinder/elementparsers/AttributeMessageInterpreter.java
  
/trunk/user/src/com/google/gwt/uibinder/elementparsers/WidgetInterpreter.java
  
/trunk/user/src/com/google/gwt/uibinder/elementparsers/WidgetPlaceholderInterpreter.java

 /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java
 /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java
  
/trunk/user/test/com/google/gwt/uibinder/elementparsers/MockUiBinderWriter.java


===
--- /trunk/user/src/com/google/gwt/uibinder/UiBinder.gwt.xml	Wed Feb  9  
13:31:48 2011
+++ /trunk/user/src/com/google/gwt/uibinder/UiBinder.gwt.xml	Wed Apr  6  
03:31:11 2011

@@ -18,9 +18,19 @@

   
   
+
   
-  is-multi-valued="false"/>
+  is-multi-valued="false"/>
   value="com.google.gwt.uibinder.rebind.GwtDomHtmlElementFactory"/>

+
+  
+  is-multi-valued="false"/>
+  value="true"/>

+
   
 
   
===
---  
/trunk/user/src/com/google/gwt/uibinder/elementparsers/AttributeMessageInterpreter.java	 
Wed Mar  9 09:01:28 2011
+++  
/trunk/user/src/com/google/gwt/uibinder/elementparsers/AttributeMessageInterpreter.java	 
Wed Apr  6 03:31:11 2011

@@ -46,8 +46,16 @@
   throws UnableToCompleteException {
 MessagesWriter messages = writer.getMessages();
 for (AttributeMessage am : messages.consumeAttributeMessages(elem)) {
+  String message = am.getMessageUnescaped();
+  if (!writer.useSafeHtmlTemplates()) {
+/*
+ * We have to do our own simple escaping to if the SafeHtml  
integration

+ * is off
+ */
+message += ".replaceAll(\"&\", \"&\").replaceAll(\"'\",  
\"'\")";

+  }
   elem.setAttribute(am.getAttribute(),
-writer.tokenForStringExpression(am.getMessageUnescaped()));
+writer.tokenForStringExpression(message));
 }

 /*
===
---  
/trunk/user/src/com/google/gwt/uibinder/elementparsers/WidgetInterpreter.java	 
Wed Mar  9 09:01:28 2011
+++  
/trunk/user/src/com/google/gwt/uibinder/elementparsers/WidgetInterpreter.java	 
Wed Apr  6 03:31:11 2011

@@ -91,8 +91,12 @@

   // Create an element to hold the widget.
   String tag = getLegalPlaceholderTag(elem);
-  return "<" + tag + " id='" +  
uiWriter.tokenForStringExpression(idHolder)

-  + "'>";
+  if (uiWriter.useSafeHtmlTemplates()) {
+idHolder = uiWriter.tokenForStringExpression(idHolder);
+  } else {
+idHolder = "\" + " + idHolder + " + \"";
+  }
+  return "<" + tag + " id='" + idHolder  + "'>";
 }
 return null;
   }
===
---  
/trunk/user/src/com/google/gwt/uibinder/elementparsers/WidgetPlaceholderInterpreter.java	 
Wed Mar  9 09:01:28 2011
+++  
/trunk/user/src/com/google/gwt/uibinder/elementparsers/WidgetPlaceholderInterpreter.java	 
Wed Apr  6 03:31:11 2011

@@ -55,8 +55,10 @@
  * message.
  */
 class WidgetPlaceholderInterpreter extends HtmlPlaceholderInterpreter {
-  // Could break this up into three further classes, for HasText, HasHTML
-  // and Other, but that seems more trouble than it's worth.
+  /*
+   * Could break this up into three further classes, for HasText, HasHTML  
and

+   * Other, but that seems more trouble than it's worth.
+   */

   private int serial = 0;
   private final String ancestorExpression;
@@ -132,8 +134,12 @@
   }

   private String genOpenTag(String name, String idHolder) {
-String openTag = String.format("",
-uiWriter.tokenForStringExpression(idHolder));
+if (uiWriter.useSafeHtmlTemplates()) {
+  idHolder = uiWriter.tokenForStringExpression(idHolder);
+} else {
+  idHolder = "\" + " + idHolder + " + \"";
+}
+String openTag = String.format("", idHolder);
 String openPlaceholder = nextOpenPlaceholder(name + "Begin", openTag);
 return openPlaceholder;
   }
@@ -180,8 +186,12 @@
   }

   private String handleOpaqueWidgetPlaceholder(String name, String  
idHolder) {

-String tag = String.format("",
-  uiWriter.tokenForStringExpression(idHolder));
+if (uiWriter.useSafeHtmlTemplates()) {
+  idHolder = uiWriter.tokenForStringExpression(idHolder);
+} else {
+  idHolder = "\" + " + idHolder + " + \"";
+}
+String tag = String.format("", idHolder);
 String placeholder = nextPlaceholder(name, "", tag);
 return placeholder;
   }
===
--- /trunk/user/src/com/google/

[gwt-contrib] Re: Auto-formats the GWT tools projects (excluding api-checker covered in (issue1402803)

2011-04-06 Thread zundel

http://gwt-code-reviews.appspot.com/1402803/

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