[gwt-contrib] Re: Fix for issue 4111 (UiBinder emitting comma as decimal separator on non-US locales).
About test - Locale.setDefault(new Locale(fr, FR)) seems to work. http://gwt-code-reviews.appspot.com/77802 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Fix for issue 4111 (UiBinder emitting comma as decimal separator on non-US locales).
Ah, thanks. I suppose I could have checked that myself :PI'll add a test momentarily. On Fri, Oct 9, 2009 at 5:03 AM, raul.pel...@mail.ee wrote: About test - Locale.setDefault(new Locale(fr, FR)) seems to work. http://gwt-code-reviews.appspot.com/77802 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Comment on UsingOOPHM in google-web-toolkit
Comment by aharsani: if you got No GWT plugin found or hosted-mode connection failed try to recompile GWT from trunk. For more information: http://code.google.com/p/google-web-toolkit/wiki/UsingOOPHM --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Comment on UiBinder in google-web-toolkit
Comment by dygger: rjrjr, thanks, I've just started studying GWT and looking for best practices to save time. I am playing with GWT starter application refactoring it to use UiBinder, runAsync and to follow MVP, Humble Dialog patterns etc. One problem I found is that attributes of UiBinder-generated VerticalPanel are set at the end of panel construction: {{{ buttonClose.setText(Close2); f_VerticalPanel2.add(buttonClose); f_VerticalPanel2.setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.ALIGN_RIGHT); f_TestDialogBox1.add(f_VerticalPanel2); }}} while to make it look as in original starter app, it there should be the way to call it before button close is added: {{{ dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton); }}} It there any way to get Close button right-aligned? For more information: http://code.google.com/p/google-web-toolkit/wiki/UiBinder --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Comment on UiBinder in google-web-toolkit
Comment by dygger: One more thing: to give Presenter more flexibility to manipulate DialogBox view, it might be useful to introduce cancellable closing event for dialog, similar to FormPanel.SubmitEvent. Do you think it makes sense? For more information: http://code.google.com/p/google-web-toolkit/wiki/UiBinder --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Comment on UiBinder in google-web-toolkit
Comment by rj...@google.com: @gal.dobler That won't work until http://gwt-code-reviews.appspot.com/77805 lands, later today I expect. For more information: http://code.google.com/p/google-web-toolkit/wiki/UiBinder --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Comment on UiBinder in google-web-toolkit
Comment by rj...@google.com: @dygger, that sounds like a plain old bug on VerticalPanel, but I doubt we'll fix it. That panel is on the verge of being deprecated in favor of the new Layout classes. Look for the samples to be updated accordingly in the coming weeks. Re: the cancelable close event on DialogBox, that's a fine idea (God knows when we'll *get* to that fine idead, but...) Would you mind filing an issue? For more information: http://code.google.com/p/google-web-toolkit/wiki/UiBinder --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: UiBinder and HTML's label for=
On Tue, Oct 6, 2009 at 5:47 PM, Ray Ryan rj...@google.com wrote: On Tue, Oct 6, 2009 at 8:43 AM, Thomas Broyer t.bro...@gmail.com wrote: If I understand correctly how UiBinder works, for widgets, I'd still have to inject the ID myself using theWidget.getElement().setId(bundle.a().toString()) ? That's a very bad idea. You're relying on the widget not to be using id for its own purposes, now and in the future. Is it really different from ensureDebugId? That being said, I've thought a bit more about it and started reading the UiBinder code to (try to) understand how it works. An IdResource as implemented by Bob isn't what I want/need; actually, as I said in the second part of my second message, the id resource would need to be a distinct instance for each call to createAndBindUi. It loks like I could do something similar using an ui:with and providing my own IdResource implementation; but one of the goal of my original proposal was also to reuse the IDs that are created by UiBinder for its internal HTMLPanel implementation detail (UiBinder mints IDs, but even if I use @UiField InputElement for instance, I won't have the ID, as UiBinder also generates code that removes the id= attribute when injecting a DOM element field; so I'd have to generate new IDs in my own code; that's just wasted computations...) I'll try to write a clear and detailed proposal *and* provide a patch. In the mean time, here's another use case (hopefully self-explanatory, yet not totally realistic wrt the markup; imagine how many times this could be instantiated within the same app, IDs need to be unique for each instance; note that in this case, I could very well use SpanElement but that'd mean doing getElementById and comparing element's identity where I could just compare IDs): ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' ui:id-generator type='com.my.app.PanelButtons.MyIdentifiers' / span span aria-role=button id={id.minimize}' class={style.minimizeSprite} / span aria-role=button id={id.maximize}' class={style.maximizeSprite} / span aria-role=button id={id.close}' class={style.closeSprite} / /span /ui:UiBinder class PanelButtons extends Widget { interface MyIdentifiers extends IdGenerator { String minimize(); String maximize(); String close(); } interface MyUiBinder extends UiBinderSpanElement,PanelButton { } private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class); @UiField MyIdentifiers id; public PanelButtons() { setElement(uiBinder.createAndBindUi(this)); sinkEvents(Event.ONCLICK); } public void onBrowserEvent(Event event) { super.onBrowserevent(event); if (event.getTypeInt() == Event.ONCLICK) { Element target = event.getEventTarget(); if (target != getElement()) { // TODO: check parent nodes until getElement(), à laisOrHasChild() String id = target.getId(); if (this.id.minimize().equals(id)) { // minimize clicked } else if (this.id.maximize().equals(id)) { // maximize clicked } else if (this.id.close().equals(id)) { // close clicked } } } } ... } -- Thomas Broyer /tɔ.ma.bʁwa.je/ --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Comment on UsingOOPHM in google-web-toolkit
Comment by innusius: I had also problems with getting latest plugins to work . We used old trunk build at work so this was problem , I build latest , recompile application and it works again for me . For more information: http://code.google.com/p/google-web-toolkit/wiki/UsingOOPHM --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Moving PagingScrollTable Friends to Trunk
Reviving this old thread .. Has there been a decision on this yet? Just want to know if PagingScrollTable is likely to make it to trunk in a future release. --Sri 2009/10/9 Sri sripathikrish...@gmail.com -- Forwarded message -- From: Bruce Johnson br...@google.com Date: Jul 16, 3:57 pm Subject: Moving PagingScrollTable Friends to Trunk To: Google Web Toolkit Contributors Frankly, we've vacillated on it. The problem is that the currently implementation, though full-featured, really doesn't scale especially well even to medium-sized numbers of rows. Trees have the same problem, as does any similar sort of compound widget. Increasingly, we're thinking that we should redefine the whole effort into designing a family of MVC-style complex widgets. This will require a lot of design work, and we're pretty sure we won't be able to get it done properly in the 2.0 timeframe. So, in terms of your planning, I'd say plan for it *not* to ship with 2.0. On Thu, Jul 16, 2009 at 2:15 PM, jay jay.gin...@gmail.com wrote: I was under the impression (based on conversations with GWT team members) at Google I/O in May), that moving this into trunk for 2.0 was a sure thing. Has something changed? I'll live if this has changed, I'd just like to know. Please...keep us informed... thanks, jay On Jul 16, 8:07 am, Isaac Truett itru...@gmail.com wrote: Issue #188 has 40 stars, making it number seven in the issue list (when sorted appropriately). Let's shoot for number one before John gets back to working on it. ;-) So if you're anxious for PST to leave the incubator, star this issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=188 - Isaac On Thu, Jul 16, 2009 at 10:58 AM, John LaBancajlaba...@google.com wrote: We probably won't decide what to move into trunk until we get closer to the next release. I'm working on improving our unit test coverage to make GWT more stable, and most of the other UI developers are busy on their own tasks. Sorry I don't have a better answer, but I'll escalate the fact that quite a few people have been asking about the table and would like to see it in trunk. Thanks, John LaBanca jlaba...@google.com On Wed, Jul 15, 2009 at 6:31 PM, jay jay.gin...@gmail.com wrote: Bump again? Any status? thanks... jay On Jul 7, 8:40 am, jay jay.gin...@gmail.com wrote: bump. Anything? On Jun 24, 10:31 am, jay jay.gin...@gmail.com wrote: Just curious if the effort has been resumed? Regardless, is there anyway for you to commit what you do have somewhere we could look and provide feedback? thanks, jay On Jun 10, 8:28 am, John LaBanca jlaba...@google.com wrote: @jay - I got side tracked with other tasks, but I'll pick up the PagingScrollTable effort within a couple of weeks. The main goal when we transfer the PagingScrollTable to GWT trunk is to separate the concept of scrolling (with three distinct tables) from the rest of the code. That way, we can bulk render a single table element that includes the header,data, and footer and have it layout naturally. @dflorey - I definitely plan to include all three of your points into the scroll table. Thanks again for all your contributions. I don't know exactly how long it will take to integrate everything into the GWT trunk, but its one of my highest priorities. Thanks, John LaBanca jlaba...@google.com On Wed, Jun 10, 2009 at 10:15 AM, dflorey daniel.flo...@gmail.com wrote: Hi, I'd like to support this effort and would be glad if some of my changes would make it into trunk: - filters - column types for most frequently used column types (numbers,dates,text) including proper filtering, editing and sorting capabilities - simplified table generation ( see http://code.google.com/p/google-web-toolkit-incubator/wiki/TreeTable ) (TreeTable is not ready for prime time yet) Daniel On 10 Jun., 05:34, jay jay.gin...@gmail.com wrote: I saw the initial commit of these classes into your branch, but I haven't seen any additional commits. I'd love to take a look at the current direction, and see what other input I can provide. jay On Jun 9, 7:12 am, John LaBanca jlaba...@google.com wrote: We'll definitely keep these things in mind when moving stuff over to GWT trunk. We've also found a lot of general usability problems, such as the fact the the table doesn't layout naturally, which means apps require active layout. During
[gwt-contrib] Re: Introduces ui:image--ImageResource in UiBinder
LGTM http://gwt-code-reviews.appspot.com/77805/diff/1/4 File user/src/com/google/gwt/uibinder/rebind/BundleWriter.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/4#newcode41 Line 41: private final JClassType strictAnnotationType; Not strictly necessary after I integrate the spate of CssResource patches. http://gwt-code-reviews.appspot.com/77805/diff/1/4#newcode82 Line 82: writer.write(import %s;, strictAnnotationType.getQualifiedSourceName()); If you were to add additional imports, it would probably be cleaner to have an array or Arrays.asList() over which you iterate to set up the imports. http://gwt-code-reviews.appspot.com/77805/diff/1/4#newcode111 Line 111: writeImageOptionsAnnotation(image.getFlipRtl(), image.getRepeatStyle()); Is there a way to make this more resilient to adding new image options? I was thinking about adding compile-time scaling to ImageOptions, for instance. http://gwt-code-reviews.appspot.com/77805/diff/1/5 File user/src/com/google/gwt/uibinder/rebind/GetEscapedInnerTextVisitor.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/5#newcode52 Line 52: // TODO(jgw): write this back just as it came in. Is this TODO important? http://gwt-code-reviews.appspot.com/77805/diff/1/5#newcode75 Line 75: parent != null pre.equals(parent.getTagName()); Would this ever operate on a script element? http://gwt-code-reviews.appspot.com/77805/diff/1/8 File user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/8#newcode121 Line 121: if (elem.hasAttribute(FLIP_RTL_ATTRIBUTE)) { Can this extraction be made dynamic? http://gwt-code-reviews.appspot.com/77805/diff/1/9 File user/src/com/google/gwt/uibinder/rebind/XMLElement.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/9#newcode347 Line 347: writer.die(%s must contain only text, this); Is it possible to have a degenerate case with multiple sibling text nodes? http://gwt-code-reviews.appspot.com/77805/diff/1/10 File user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/10#newcode73 Line 73: * Called to declare a new CssResource accessor on this bundle. CssResource? http://gwt-code-reviews.appspot.com/77805/diff/1/14 File user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml (right): http://gwt-code-reviews.appspot.com/77805/diff/1/14#newcode187 Line 187: Well of course you do. Who wouldn't? Creepy. http://gwt-code-reviews.appspot.com/77805/diff/1/16 File user/test/com/google/gwt/uibinder/rebind/XMLElementTest.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/16#newcode73 Line 73: // TODO(rjrjr) Can't test this until die() is factored out of UiBinderWriter Didn't I see you use .die() elsewhere in this patch? http://gwt-code-reviews.appspot.com/77805 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Introduces ui:image--ImageResource in UiBinder
Thanks, replies inline below. I'll duck all the hard suggestions, do the easy ones and submit. http://gwt-code-reviews.appspot.com/77805/diff/1/4 File user/src/com/google/gwt/uibinder/rebind/BundleWriter.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/4#newcode41 Line 41: private final JClassType strictAnnotationType; Yup. But I'm hoping to beat you in. http://gwt-code-reviews.appspot.com/77805/diff/1/4#newcode82 Line 82: writer.write(import %s;, strictAnnotationType.getQualifiedSourceName()); Agree, not quite there yet though. http://gwt-code-reviews.appspot.com/77805/diff/1/4#newcode111 Line 111: writeImageOptionsAnnotation(image.getFlipRtl(), image.getRepeatStyle()); Not off the top of my head, unless we adopt some kind of convention of annotations on your annotations--seems like a lot of bother. Unless the pace of change there gets pretty rapid, I'm comfortable maintaining this by hand. http://gwt-code-reviews.appspot.com/77805/diff/1/5 File user/src/com/google/gwt/uibinder/rebind/GetEscapedInnerTextVisitor.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/5#newcode52 Line 52: // TODO(jgw): write this back just as it came in. Not so far. http://gwt-code-reviews.appspot.com/77805/diff/1/5#newcode75 Line 75: parent != null pre.equals(parent.getTagName()); Interesting question. If it did I think they'd be no-ops--scripts don't fire as a side effect of setting innerHTML as I recall. Still, you could imagine someone putting a script here and fishing it out for later use. Anyway, this whole escaping mechanism is a disaster, and I'll have to rewrite it soon (post MS2) to fix a few bugs. I'll add a todo here to think about the script case at rewrite time. http://gwt-code-reviews.appspot.com/77805/diff/1/8 File user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/8#newcode121 Line 121: if (elem.hasAttribute(FLIP_RTL_ATTRIBUTE)) { See above. I'd rather not deal with that right now unless you see a quick and simple approach I'm missing. http://gwt-code-reviews.appspot.com/77805/diff/1/9 File user/src/com/google/gwt/uibinder/rebind/XMLElement.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/9#newcode347 Line 347: writer.die(%s must contain only text, this); Not that I've encountered. http://gwt-code-reviews.appspot.com/77805/diff/1/10 File user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/10#newcode73 Line 73: * Called to declare a new CssResource accessor on this bundle. Mmmm, copy paste. Fixed, thanks. http://gwt-code-reviews.appspot.com/77805/diff/1/14 File user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml (right): http://gwt-code-reviews.appspot.com/77805/diff/1/14#newcode187 Line 187: Well of course you do. Who wouldn't? Looks good to me too! http://gwt-code-reviews.appspot.com/77805/diff/1/16 File user/test/com/google/gwt/uibinder/rebind/XMLElementTest.java (right): http://gwt-code-reviews.appspot.com/77805/diff/1/16#newcode73 Line 73: // TODO(rjrjr) Can't test this until die() is factored out of UiBinderWriter Yes, the TODO is a bit misleading. I've refactored die out of the way, but XMLElement will still depend upon UiBinderWriter and I still can't mock that effectively. Will update the TODO http://gwt-code-reviews.appspot.com/77805 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit] r6337 committed - Introduces ui:image--ImageResource in UiBinder...
Revision: 6337 Author: rj...@google.com Date: Fri Oct 9 11:55:53 2009 Log: Introduces ui:image--ImageResource in UiBinder Review by: bobv http://code.google.com/p/google-web-toolkit/source/detail?r=6337 Added: /trunk/user/src/com/google/gwt/uibinder/rebind/GetEscapedInnerTextVisitor.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitImageResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/prettyImage.png Deleted: /trunk/user/src/com/google/gwt/uibinder/rebind/GetInnerTextVisitor.java Modified: /trunk/user/src/com/google/gwt/uibinder/parsers/HasTextParser.java /trunk/user/src/com/google/gwt/uibinder/parsers/TextPlaceholderInterpreter.java /trunk/user/src/com/google/gwt/uibinder/rebind/BundleWriter.java /trunk/user/src/com/google/gwt/uibinder/rebind/GetInnerHtmlVisitor.java /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java /trunk/user/src/com/google/gwt/uibinder/rebind/XMLElement.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml /trunk/user/test/com/google/gwt/uibinder/rebind/XMLElementTest.java /trunk/user/test/com/google/gwt/uibinder/sample/client/UiBinderTest.java === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/rebind/GetEscapedInnerTextVisitor.java Fri Oct 9 11:55:53 2009 @@ -0,0 +1,79 @@ +/* + * 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.uibinder.rebind; + +import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.uibinder.rebind.XMLElement.Interpreter; + +import org.w3c.dom.CDATASection; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +class GetEscapedInnerTextVisitor implements NodeVisitor { + + /** + * Gathers a text representation of the children of the given Elem, and stuffs + * it into the given StringBuffer. Applies the interpreter to each descendant, + * and uses the writer to report errors. + */ + public static void getEscapedInnerText(Element elem, StringBuffer buffer, + InterpreterString interpreter, UiBinderWriter writer) + throws UnableToCompleteException { +new ChildWalker().accept(elem, new GetEscapedInnerTextVisitor(buffer, interpreter, +writer)); + } + + protected final StringBuffer buffer; + protected final InterpreterString interpreter; + protected final UiBinderWriter writer; + + protected GetEscapedInnerTextVisitor(StringBuffer buffer, + InterpreterString interpreter, UiBinderWriter writer) { +this.buffer = buffer; +this.interpreter = interpreter; +this.writer = writer; + } + + public void visitCData(CDATASection d) { +// TODO(jgw): write this back just as it came in. + } + + public void visitElement(Element e) throws UnableToCompleteException { +String replacement = +interpreter.interpretElement(new XMLElement(e, writer)); + +if (replacement != null) { + buffer.append(replacement); +} + } + + public void visitText(Text t) { +String escaped = +UiBinderWriter.escapeText(t.getTextContent(), preserveWhiteSpace(t)); +buffer.append(escaped); + } + + private boolean preserveWhiteSpace(Text t) { +Element parent = Node.ELEMENT_NODE == t.getParentNode().getNodeType() + ? (Element) t.getParentNode() : null; + +boolean preserveWhitespace = +parent != null pre.equals(parent.getTagName()); +// TODO(rjrjr) What about script blocks? +return preserveWhitespace; + } +} === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitImageResource.java Fri Oct 9 11:55:53 2009 @@ -0,0 +1,52 @@ +/* + * 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
[gwt-contrib] Re: Introduces ui:image--ImageResource in UiBinder
Committed r6337 http://gwt-code-reviews.appspot.com/77805 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Proposed API Addition - @WithModuleParameters on test cases
I have updated the patch set to also have the benchmark test cases use the new strategy. Please review it. When do you think this will make it into the trunk? Thanks. On Fri, Sep 25, 2009 at 4:36 PM, Pascal Muetschard pmuetsch...@google.comwrote: FYI, I've uploaded another patch to http://gwt-code-reviews.appspot.com/71801 with the rename. Thanks for the feedback! On Fri, Sep 25, 2009 at 2:09 PM, Bruce Johnson br...@google.com wrote: I dig @WithProperties to the max. On Fri, Sep 25, 2009 at 2:16 PM, Pascal Muetschard pmuetsch...@google.com wrote: How about @WithProperties or @WithModuleProperty? Since the module XML files use define-property, set-property, property-provider, and when-property-is. On Fri, Sep 25, 2009 at 11:01 AM, John LaBanca jlaba...@google.comwrote: @WithClientProperties is fine with me. I thought we used the term binding somewhere, but creating a DeferredBinding doesn't actual require the use of the term binding. The gwt.xml files just refer to these as properties. Thanks, John LaBanca jlaba...@google.com On Fri, Sep 25, 2009 at 1:57 PM, Bruce Johnson br...@google.comwrote: On Fri, Sep 25, 2009 at 1:51 PM, John LaBanca jlaba...@google.comwrote: I vote for @WithBindingProperties for the annotation name. Is that a vote that we should start using the term binding properties in general? I think that's not quite the right term (perhaps this should be a separate thread) because increasingly, those properties will affect things like compiler optimization behavior, code splitting, etc. That is, they don't only affect how GWT.create() calls get bound. How about the term client property? It is a property that affects what the client receives and is in every case somehow a function of the client that is requesting the script. -- Bruce --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Teach Image about DataResource
Reviewers: bobv, Message: Here come data resources and with them custom cursors, tastefully applied to the UiBinder test app. Also tightened up access to constructors on the so called model objects. Tested manually, no idea how to automate. Please review this at http://gwt-code-reviews.appspot.com/77808 Affected files: M user/src/com/google/gwt/uibinder/rebind/BundleWriter.java M user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java M user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java M user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java A user/src/com/google/gwt/uibinder/rebind/model/ImplicitDataResource.java M user/src/com/google/gwt/uibinder/rebind/model/ImplicitImageResource.java M user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml A user/src/com/google/gwt/uibinder/sample/client/heart.cur --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Teach Image about DataResource
LGTM. You could add an automatic test to at least verify that the DataResource returns something for getUrl(). http://gwt-code-reviews.appspot.com/77808/diff/1/2 File user/src/com/google/gwt/uibinder/rebind/BundleWriter.java (right): http://gwt-code-reviews.appspot.com/77808/diff/1/2#newcode63 Line 63: strictAnnotationType = oracle.findType(Strict.class.getCanonicalName()); Diff/merge problems? http://gwt-code-reviews.appspot.com/77808/diff/1/3 File user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java (right): http://gwt-code-reviews.appspot.com/77808/diff/1/3#newcode55 Line 55: private final JClassType dataResourceType; Sort order http://gwt-code-reviews.appspot.com/77808/diff/1/3#newcode134 Line 134: // @source is optional on ImageResource Swap comment and assignment http://gwt-code-reviews.appspot.com/77808/diff/1/4 File user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java (right): http://gwt-code-reviews.appspot.com/77808/diff/1/4#newcode116 Line 116: * Called to declare a new ImageResource accessor on this bundle. Copy-and-paste. http://gwt-code-reviews.appspot.com/77808/diff/1/4#newcode123 Line 123: public ImplicitDataResource createDataResource(String name, String source) { Sort order. Did you run checkstyle? http://gwt-code-reviews.appspot.com/77808/diff/1/6 File user/src/com/google/gwt/uibinder/rebind/model/ImplicitDataResource.java (right): http://gwt-code-reviews.appspot.com/77808/diff/1/6#newcode19 Line 19: * Models a method returning an DataResource on a generated ClientBundle. s/an/a/ http://gwt-code-reviews.appspot.com/77808 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Allow ExtractClassNamesVisitor to ignore imported prefixes
+ contrib http://gwt-code-reviews.appspot.com/77807 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Allow ExtractClassNamesVisitor to ignore imported prefixes
Reviewers: Ray Ryan, Message: Is there a file missing from the patch? Where is this method called? This is where UiBinder would call into. Please review this at http://gwt-code-reviews.appspot.com/77807 Affected files: M user/src/com/google/gwt/resources/css/ExtractClassNamesVisitor.java M user/src/com/google/gwt/resources/rg/CssResourceGenerator.java M user/test/com/google/gwt/resources/css/ExtractClassNamesVisitorTest.java M user/test/com/google/gwt/resources/css/extractClassNames_expected.css M user/test/com/google/gwt/resources/css/extractClassNames_test.css --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Allow ExtractClassNamesVisitor to ignore imported prefixes
LGTM Ah, of course. I *know* the imports, I put them there. http://gwt-code-reviews.appspot.com/77807 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit] r6338 committed - Revert Introduces ui:image--ImageResource in UiBinder...
Revision: 6338 Author: rj...@google.com Date: Fri Oct 9 14:04:11 2009 Log: Revert Introduces ui:image--ImageResource in UiBinder due to checkstyle failures. Yes, I am an ass. This reverts tr...@6337 http://code.google.com/p/google-web-toolkit/source/detail?r=6338 Added: /trunk/user/src/com/google/gwt/uibinder/rebind/GetInnerTextVisitor.java Deleted: /trunk/user/src/com/google/gwt/uibinder/rebind/GetEscapedInnerTextVisitor.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitImageResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/prettyImage.png Modified: /trunk/user/src/com/google/gwt/uibinder/parsers/HasTextParser.java /trunk/user/src/com/google/gwt/uibinder/parsers/TextPlaceholderInterpreter.java /trunk/user/src/com/google/gwt/uibinder/rebind/BundleWriter.java /trunk/user/src/com/google/gwt/uibinder/rebind/GetInnerHtmlVisitor.java /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java /trunk/user/src/com/google/gwt/uibinder/rebind/XMLElement.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml /trunk/user/test/com/google/gwt/uibinder/rebind/XMLElementTest.java /trunk/user/test/com/google/gwt/uibinder/sample/client/UiBinderTest.java === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/rebind/GetInnerTextVisitor.java Fri Oct 9 14:04:11 2009 @@ -0,0 +1,78 @@ +/* + * 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.uibinder.rebind; + +import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.uibinder.rebind.XMLElement.Interpreter; + +import org.w3c.dom.CDATASection; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +class GetInnerTextVisitor implements NodeVisitor { + + /** + * Gathers a text representation of the children of the given Elem, and stuffs + * it into the given StringBuffer. Applies the interpreter to each descendant, + * and uses the writer to report errors. + */ + public static void getEscapedInnerText(Element elem, StringBuffer buffer, + InterpreterString interpreter, UiBinderWriter writer) + throws UnableToCompleteException { +new ChildWalker().accept(elem, new GetInnerTextVisitor(buffer, interpreter, +writer)); + } + + protected final StringBuffer buffer; + protected final InterpreterString interpreter; + protected final UiBinderWriter writer; + + protected GetInnerTextVisitor(StringBuffer buffer, + InterpreterString interpreter, UiBinderWriter writer) { +this.buffer = buffer; +this.interpreter = interpreter; +this.writer = writer; + } + + public void visitCData(CDATASection d) { +// TODO(jgw): write this back just as it came in. + } + + public void visitElement(Element e) throws UnableToCompleteException { +String replacement = +interpreter.interpretElement(new XMLElement(e, writer)); + +if (replacement != null) { + buffer.append(replacement); +} + } + + public void visitText(Text t) { +String escaped = +UiBinderWriter.escapeText(t.getTextContent(), preserveWhiteSpace(t)); +buffer.append(escaped); + } + + private boolean preserveWhiteSpace(Text t) { +Element parent = Node.ELEMENT_NODE == t.getParentNode().getNodeType() + ? (Element) t.getParentNode() : null; + +boolean preserveWhitespace = +parent != null pre.equals(parent.getTagName()); +return preserveWhitespace; + } +} === --- /trunk/user/src/com/google/gwt/uibinder/rebind/GetEscapedInnerTextVisitor.java Fri Oct 9 11:55:53 2009 +++ /dev/null @@ -1,79 +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
[gwt-contrib] [google-web-toolkit] r6339 committed - Restore Introduces ui:image--ImageResource in UiBinder,...
Revision: 6339 Author: rj...@google.com Date: Fri Oct 9 14:47:58 2009 Log: Restore Introduces ui:image--ImageResource in UiBinder, this time without breaking checkstyle (sorry). Review by: bobv http://code.google.com/p/google-web-toolkit/source/detail?r=6339 Added: /trunk/user/src/com/google/gwt/uibinder/rebind/GetEscapedInnerTextVisitor.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitImageResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/prettyImage.png Deleted: /trunk/user/src/com/google/gwt/uibinder/rebind/GetInnerTextVisitor.java Modified: /trunk/user/src/com/google/gwt/uibinder/parsers/HasTextParser.java /trunk/user/src/com/google/gwt/uibinder/parsers/TextPlaceholderInterpreter.java /trunk/user/src/com/google/gwt/uibinder/rebind/BundleWriter.java /trunk/user/src/com/google/gwt/uibinder/rebind/GetInnerHtmlVisitor.java /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java /trunk/user/src/com/google/gwt/uibinder/rebind/XMLElement.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml /trunk/user/test/com/google/gwt/uibinder/rebind/XMLElementTest.java /trunk/user/test/com/google/gwt/uibinder/sample/client/UiBinderTest.java === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/rebind/GetEscapedInnerTextVisitor.java Fri Oct 9 14:47:58 2009 @@ -0,0 +1,79 @@ +/* + * 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.uibinder.rebind; + +import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.uibinder.rebind.XMLElement.Interpreter; + +import org.w3c.dom.CDATASection; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +class GetEscapedInnerTextVisitor implements NodeVisitor { + + /** + * Gathers a text representation of the children of the given Elem, and stuffs + * it into the given StringBuffer. Applies the interpreter to each descendant, + * and uses the writer to report errors. + */ + public static void getEscapedInnerText(Element elem, StringBuffer buffer, + InterpreterString interpreter, UiBinderWriter writer) + throws UnableToCompleteException { +new ChildWalker().accept(elem, new GetEscapedInnerTextVisitor(buffer, interpreter, +writer)); + } + + protected final StringBuffer buffer; + protected final InterpreterString interpreter; + protected final UiBinderWriter writer; + + protected GetEscapedInnerTextVisitor(StringBuffer buffer, + InterpreterString interpreter, UiBinderWriter writer) { +this.buffer = buffer; +this.interpreter = interpreter; +this.writer = writer; + } + + public void visitCData(CDATASection d) { +// TODO(jgw): write this back just as it came in. + } + + public void visitElement(Element e) throws UnableToCompleteException { +String replacement = +interpreter.interpretElement(new XMLElement(e, writer)); + +if (replacement != null) { + buffer.append(replacement); +} + } + + public void visitText(Text t) { +String escaped = +UiBinderWriter.escapeText(t.getTextContent(), preserveWhiteSpace(t)); +buffer.append(escaped); + } + + private boolean preserveWhiteSpace(Text t) { +Element parent = Node.ELEMENT_NODE == t.getParentNode().getNodeType() + ? (Element) t.getParentNode() : null; + +boolean preserveWhitespace = +parent != null pre.equals(parent.getTagName()); +// TODO(rjrjr) What about script blocks? +return preserveWhitespace; + } +} === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitImageResource.java Fri Oct 9 14:47:58 2009 @@ -0,0 +1,52 @@ +/* + * 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,
[gwt-contrib] Re: Teach Image about DataResource
Test added, checkstyle embarrassment fixed. I'll submit once the build has turned green. http://gwt-code-reviews.appspot.com/77808/diff/1/2 File user/src/com/google/gwt/uibinder/rebind/BundleWriter.java (right): http://gwt-code-reviews.appspot.com/77808/diff/1/2#newcode63 Line 63: strictAnnotationType = oracle.findType(Strict.class.getCanonicalName()); No, just a bit of sorting. http://gwt-code-reviews.appspot.com/77808/diff/1/3 File user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java (right): http://gwt-code-reviews.appspot.com/77808/diff/1/3#newcode55 Line 55: private final JClassType dataResourceType; On 2009/10/09 20:07:43, bobv wrote: Sort order Done. http://gwt-code-reviews.appspot.com/77808/diff/1/3#newcode134 Line 134: // @source is optional on ImageResource On 2009/10/09 20:07:43, bobv wrote: Swap comment and assignment Done. http://gwt-code-reviews.appspot.com/77808/diff/1/4 File user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java (right): http://gwt-code-reviews.appspot.com/77808/diff/1/4#newcode116 Line 116: * Called to declare a new ImageResource accessor on this bundle. On 2009/10/09 20:07:43, bobv wrote: Copy-and-paste. Done. http://gwt-code-reviews.appspot.com/77808/diff/1/4#newcode123 Line 123: public ImplicitDataResource createDataResource(String name, String source) { On 2009/10/09 20:07:43, bobv wrote: Sort order. Did you run checkstyle? Done. http://gwt-code-reviews.appspot.com/77808/diff/1/6 File user/src/com/google/gwt/uibinder/rebind/model/ImplicitDataResource.java (right): http://gwt-code-reviews.appspot.com/77808/diff/1/6#newcode19 Line 19: * Models a method returning an DataResource on a generated ClientBundle. On 2009/10/09 20:07:43, bobv wrote: s/an/a/ Done. http://gwt-code-reviews.appspot.com/77808 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit] r6340 committed - Add List.subList and implementations....
Revision: 6340 Author: j...@google.com Date: Fri Oct 9 15:22:16 2009 Log: Add List.subList and implementations. Patch by: w...@google.com Review by: jat http://code.google.com/p/google-web-toolkit/source/detail?r=6340 Modified: /trunk/user/super/com/google/gwt/emul/java/util/AbstractList.java /trunk/user/super/com/google/gwt/emul/java/util/ArrayList.java /trunk/user/super/com/google/gwt/emul/java/util/Collections.java /trunk/user/super/com/google/gwt/emul/java/util/LinkedList.java /trunk/user/super/com/google/gwt/emul/java/util/List.java /trunk/user/super/com/google/gwt/emul/java/util/Vector.java /trunk/user/test/com/google/gwt/emultest/java/util/ListTestBase.java === --- /trunk/user/super/com/google/gwt/emul/java/util/AbstractList.java Wed May 13 14:30:29 2009 +++ /trunk/user/super/com/google/gwt/emul/java/util/AbstractList.java Fri Oct 9 15:22:16 2009 @@ -109,6 +109,74 @@ AbstractList.this.set(last, o); } } + + private static class SubListE extends AbstractListE { +private final ListE wrapped; +private final int fromIndex; +private int size; + +public SubList(ListE wrapped, int fromIndex, int toIndex) { + this.wrapped = wrapped; + this.fromIndex = fromIndex; + size = getSize(fromIndex, toIndex); + if (fromIndex toIndex) { +throw new IllegalArgumentException(fromIndex: + fromIndex + + toIndex: + toIndex); + } + if (fromIndex 0) { +throw new IndexOutOfBoundsException(fromIndex: + fromIndex + + 0); + } + if (toIndex wrapped.size()) { +throw new IndexOutOfBoundsException(toIndex: + toIndex + + wrapped.size() + wrapped.size()); + } +} + +@Override +public void add(int index, E element) { + checkIndexForAdd(index); + size++; + wrapped.add(fromIndex + index, element); +} + +@Override +public E get(int index) { + checkIndex(index); + return wrapped.get(fromIndex + index); +} + +@Override +public E remove(int index) { + checkIndex(index); + E result = wrapped.remove(fromIndex + index); + size--; + return result; +} + +@Override +public E set(int index, E element) { + checkIndex(index); + return wrapped.set(fromIndex + index, element); +} + +@Override +public int size() { + return size; +} + +private void checkIndex(int index) { + checkIndex(index, size); +} + +private void checkIndexForAdd(int index) { + checkIndex(index, size - 1); +} + +private int getSize(int fromIndex, int toIndex) { + return toIndex - fromIndex; +} + } protected static void checkIndex(int index, int size) { if (index 0 || index = size) { @@ -233,9 +301,9 @@ throw new UnsupportedOperationException(Set not supported on this list); } - // TODO(jat): implement -// public ListE subList(int fromIndex, int toIndex) { -// } + public ListE subList(int fromIndex, int toIndex) { +return new SubListE(this, fromIndex, toIndex); + } protected void removeRange(int fromIndex, int endIndex) { ListIteratorE iter = listIterator(fromIndex); === --- /trunk/user/super/com/google/gwt/emul/java/util/ArrayList.java Fri Jun 13 17:45:25 2008 +++ /trunk/user/super/com/google/gwt/emul/java/util/ArrayList.java Fri Oct 9 15:22:16 2009 @@ -275,11 +275,6 @@ setCapacity(array, newSize); size = newSize; } - - // TODO(jat): implement -// @Override -// ListE subList(int fromIndex, int toIndex) { -// } @SuppressWarnings(unchecked) private void clearImpl() { === --- /trunk/user/super/com/google/gwt/emul/java/util/Collections.javaTue Aug 4 10:48:23 2009 +++ /trunk/user/super/com/google/gwt/emul/java/util/Collections.javaFri Oct 9 15:22:16 2009 @@ -148,6 +148,10 @@ public T set(int index, T element) { throw new UnsupportedOperationException(); } + +public ListT subList(int fromIndex, int toIndex) { + return new UnmodifiableListT(list.subList(fromIndex, toIndex)); +} } static class UnmodifiableMapK, V implements MapK, V { === --- /trunk/user/super/com/google/gwt/emul/java/util/LinkedList.java Fri Jun 13 17:45:25 2008 +++ /trunk/user/super/com/google/gwt/emul/java/util/LinkedList.java Fri Oct 9 15:22:16 2009 @@ -28,6 +28,8 @@ ListE, QueueE, Serializable { /* * This implementation uses a doubly-linked circular list with a header node. + * + * TODO(jat): add more efficient subList implementation. */ /** @@ -301,11 +303,6 @@ public int size() { return size; } - - // TODO(jat): implement -// @Override -// ListE subList(final int fromIndex, final int toIndex) { -// } private void addBefore(E o,
[gwt-contrib] Comment on UiBinder in google-web-toolkit
Comment by gal.dolber: Thanks!! For more information: http://code.google.com/p/google-web-toolkit/wiki/UiBinder --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit] r6341 committed - Introduces support for DataResource to UiBinder, and you know what...
Revision: 6341 Author: rj...@google.com Date: Fri Oct 9 17:08:00 2009 Log: Introduces support for DataResource to UiBinder, and you know what that means: custom mouse cursors! Shaped like hearts! Review by b...@google.com http://gwt-code-reviews.appspot.com/77808 http://code.google.com/p/google-web-toolkit/source/detail?r=6341 Added: /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitDataResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/heart.cur Modified: /trunk/user/src/com/google/gwt/uibinder/rebind/BundleWriter.java /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitImageResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml /trunk/user/test/com/google/gwt/uibinder/sample/client/UiBinderTest.java === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitDataResource.java Fri Oct 9 17:08:00 2009 @@ -0,0 +1,37 @@ +/* + * 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.uibinder.rebind.model; + +/** + * Models a method returning a DataResource on a generated ClientBundle. + */ +public class ImplicitDataResource { + private final String name; + private final String source; + + ImplicitDataResource(String name, String source) { +this.name = name; +this.source = source; + } + + public String getName() { +return name; + } + + public String getSource() { +return source; + } +} === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/sample/client/heart.cur Fri Oct 9 17:08:00 2009 Binary file, no diff available. === --- /trunk/user/src/com/google/gwt/uibinder/rebind/BundleWriter.javaFri Oct 9 14:47:58 2009 +++ /trunk/user/src/com/google/gwt/uibinder/rebind/BundleWriter.javaFri Oct 9 17:08:00 2009 @@ -19,12 +19,14 @@ import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.TypeOracle; import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.DataResource; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.resources.client.CssResource.Strict; import com.google.gwt.resources.client.ImageResource.ImageOptions; import com.google.gwt.resources.client.ImageResource.RepeatStyle; import com.google.gwt.uibinder.rebind.model.ImplicitClientBundle; import com.google.gwt.uibinder.rebind.model.ImplicitCssResource; +import com.google.gwt.uibinder.rebind.model.ImplicitDataResource; import com.google.gwt.uibinder.rebind.model.ImplicitImageResource; /** @@ -38,10 +40,11 @@ private final TypeOracle oracle; private final JClassType clientBundleType; - private final JClassType strictAnnotationType; + private final JClassType dataResourceType; private final JClassType imageOptionType; private final JClassType imageResourceType; private final JClassType repeatStyleType; + private final JClassType strictAnnotationType; public BundleWriter(ImplicitClientBundle bundleClass, PrintWriterManager writerManager, TypeOracle oracle, @@ -53,10 +56,11 @@ this.oracle = oracle; clientBundleType = oracle.findType(ClientBundle.class.getName()); -strictAnnotationType = oracle.findType(Strict.class.getCanonicalName()); +dataResourceType = oracle.findType(DataResource.class.getCanonicalName()); imageOptionType = oracle.findType(ImageOptions.class.getCanonicalName()); imageResourceType = oracle.findType(ImageResource.class.getCanonicalName()); repeatStyleType = oracle.findType(RepeatStyle.class.getCanonicalName()); +strictAnnotationType = oracle.findType(Strict.class.getCanonicalName()); } public void write() throws UnableToCompleteException { @@ -76,25 +80,34 @@ } // Imports -writer.write(import %s;, imageResourceType.getQualifiedSourceName()); -writer.write(import %s;, imageOptionType.getQualifiedSourceName()); writer.write(import %s;,
[gwt-contrib] Re: Teach Image about DataResource
Committed r6341 http://gwt-code-reviews.appspot.com/77808 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Fix for issue 4067 (make UiBinderGenerator stable)
Reviewers: Ray Ryan, jgw, mmendez, Description: Instead of using a monotonically increasing number in UiBinderWriter.declareDomIdHolder(), makes the field name related to the field the element will be injected in (in most cases). For the case where there's a need to generate a field name (WidgetInterpreter), uses a monotonically increasing 'serial' non-static field (just like WidgetPlaceholderInterpreter does already). I'm really not sure it really fixes the issue (I don't know enough about UiBinderGenerator yet), but it'll a priori help me in implementing an id generator interface. I've only run the UiBinder test cases, and they still pass with the patch applied, so at least it seems I didn't break anything. Please review this at http://gwt-code-reviews.appspot.com/78806 Affected files: user/src/com/google/gwt/uibinder/parsers/WidgetInterpreter.java user/src/com/google/gwt/uibinder/parsers/WidgetPlaceholderInterpreter.java user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java Index: user/src/com/google/gwt/uibinder/parsers/WidgetInterpreter.java === --- user/src/com/google/gwt/uibinder/parsers/WidgetInterpreter.java (revision 6341) +++ user/src/com/google/gwt/uibinder/parsers/WidgetInterpreter.java (working copy) @@ -57,6 +57,7 @@ return tag; } + private int serial; private final String fieldName; private final UiBinderWriter uiWriter; @@ -73,7 +74,7 @@ // that idHolder is a local variable reference, not a string id. We // have to generate the ids at runtime, not compile time, or else // we'll reuse ids for any template rendered more than once. - String idHolder = uiWriter.declareDomIdHolder(); + String idHolder = uiWriter.declareDomIdHolder(fieldName + _child + (serial++)); String childField = uiWriter.parseElementToField(elem); uiWriter.ensureFieldAttached(fieldName); Index: user/src/com/google/gwt/uibinder/parsers/WidgetPlaceholderInterpreter.java === --- user/src/com/google/gwt/uibinder/parsers/WidgetPlaceholderInterpreter.java (revision 6341) +++ user/src/com/google/gwt/uibinder/parsers/WidgetPlaceholderInterpreter.java (working copy) @@ -90,7 +90,7 @@ name = widget + (++serial); } -String idHolder = uiWriter.declareDomIdHolder(); +String idHolder = uiWriter.declareDomIdHolder(name); idToWidgetElement.put(idHolder, elem); if (oracle.findType(HasHTML.class.getName()).isAssignableFrom(type)) { Index: user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java === --- user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (revision 6341) +++ user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (working copy) @@ -72,8 +72,6 @@ private static final String BUNDLE_URI_SCHEME = urn:with:; private static final String PACKAGE_URI_SCHEME = urn:import:; - private static int domId = 0; - // TODO(rjrjr) Another place that we need a general anonymous field // mechanism private static final String CLIENT_BUNDLE_FIELD = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay; @@ -339,7 +337,7 @@ public String declareDomField(String fieldName, String parentElementExpression) throws UnableToCompleteException { ensureAttached(parentElementExpression); -String name = declareDomIdHolder(); +String name = declareDomIdHolder(fieldName); setFieldInitializer(fieldName, null); addInitStatement( %s = com.google.gwt.dom.client.Document.get().getElementById(%s).cast();, @@ -354,8 +352,8 @@ * * @return that variable's name. */ - public String declareDomIdHolder() throws UnableToCompleteException { -String domHolderName = domId + domId++; + public String declareDomIdHolder(String fieldName) throws UnableToCompleteException { +String domHolderName = __gwt_domId_ + fieldName; FieldWriter domField = fieldManager.registerField( oracle.findType(String.class.getName()), domHolderName); domField.setInitializer(com.google.gwt.dom.client.Document.get().createUniqueId()); --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] HTMLPanel and UiBinder limitations
HTMLPanel's ability to mimic other tags is limited in that it can't become a TR or TD. Following the implementation, it's clear why: placing these elements without their requried parent tags into a DIV is invalid so the browser never creates the DOM element that HTMLPanel requires. UiBinder is similarly limited: the top level tag cannot be a TR or TD, since UiBinder.attachToDomAndGetChild copies HTMLPanel's logic. As a result, it's near impossible to create a TABLE in UiBinder that has a dynamic number of rows, a very common use case. The obvious approach is to create MyTable.ui.xml that contains a bound TABLE element. Then, in a separate file, MyTableRow.ui.xml, define the contents of each row with the root element being a TR. This doesn't work for the reason mentioned above. A simple workaround is to have MyTableRow.ui.xml have TABLE as it's root element, then bind its TR (or retrieve it with getFirstChild) and appendChild the row to the TABLE element from MyTable. This breaks down as soon as you want a widget within the rows of a table, however. As far as I can tell, the only way around this is to use a FlexTable or Grid. These work great, except that you lose the ability to define a row with complex markup in an XML file. Unless I'm really missing something, I don't see a good solution here. I have some rough idea of how this could be solved with a new table widget that can define its rows separately from the outer table, but it's not hashed out and probably doesn't fall under the good idea category. Thoughts? - Amir --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: HTMLPanel and UiBinder limitations
HTMLPanel handles this case just fine. (See HTMLPanelTest.) But yes, UiBinder probably doesn't. I suppose it could do the same trick HTMLPanel does--you mind filing an issue? But allocating a widget per row isn't a great plan anyway, it won't scale. UiBinder is not a renderer--it's for laying out assemblies of widgets, not iterating over data to build them. We don't yet have a tool for that. (Or were you thinking in terms of pure DOM objects?) Besides FlexTable you might also look at the incubator's PagingScrollTable. On Oct 9, 2009 6:23 PM, Amir Kashani amirkash...@gmail.com wrote: HTMLPanel's ability to mimic other tags is limited in that it can't become a TR or TD. Following the implementation, it's clear why: placing these elements without their requried parent tags into a DIV is invalid so the browser never creates the DOM element that HTMLPanel requires. UiBinder is similarly limited: the top level tag cannot be a TR or TD, since UiBinder.attachToDomAndGetChild copies HTMLPanel's logic. As a result, it's near impossible to create a TABLE in UiBinder that has a dynamic number of rows, a very common use case. The obvious approach is to create MyTable.ui.xml that contains a bound TABLE element. Then, in a separate file, MyTableRow.ui.xml, define the contents of each row with the root element being a TR. This doesn't work for the reason mentioned above. A simple workaround is to have MyTableRow.ui.xml have TABLE as it's root element, then bind its TR (or retrieve it with getFirstChild) and appendChild the row to the TABLE element from MyTable. This breaks down as soon as you want a widget within the rows of a table, however. As far as I can tell, the only way around this is to use a FlexTable or Grid. These work great, except that you lose the ability to define a row with complex markup in an XML file. Unless I'm really missing something, I don't see a good solution here. I have some rough idea of how this could be solved with a new table widget that can define its rows separately from the outer table, but it's not hashed out and probably doesn't fall under the good idea category. Thoughts? - Amir --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit] r6342 committed - Revert Introduces support for DataResource to UiBinder......
Revision: 6342 Author: rj...@google.com Date: Fri Oct 9 22:09:58 2009 Log: Revert Introduces support for DataResource to UiBinder... due to IE failure of com.google.gwt.uibinder.sample.client.UiBinderTest.testDataResource: expected=mhtml:http://localhost:62089/com.google.gwt.uibinder.UiBinderTestModule.JUnit/C0B555CDF59C4436E62D0BA9138EA19D.cache.txt!cid:r0 actual=mhtml:http://localhost:62089/com.google.gwt.uibinder.UiBinderTestModule.JUnit/60B9FC4B7AA15D5532DD6DDA166E77D4.cache.txt!cid:r3 This reverts tr...@6341 http://code.google.com/p/google-web-toolkit/source/detail?r=6342 Deleted: /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitDataResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/heart.cur Modified: /trunk/user/src/com/google/gwt/uibinder/rebind/BundleWriter.java /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderParser.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitClientBundle.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitImageResource.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.java /trunk/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml /trunk/user/test/com/google/gwt/uibinder/sample/client/UiBinderTest.java === --- /trunk/user/src/com/google/gwt/uibinder/rebind/model/ImplicitDataResource.java Fri Oct 9 17:08:00 2009 +++ /dev/null @@ -1,37 +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.uibinder.rebind.model; - -/** - * Models a method returning a DataResource on a generated ClientBundle. - */ -public class ImplicitDataResource { - private final String name; - private final String source; - - ImplicitDataResource(String name, String source) { -this.name = name; -this.source = source; - } - - public String getName() { -return name; - } - - public String getSource() { -return source; - } -} === --- /trunk/user/src/com/google/gwt/uibinder/sample/client/heart.cur Fri Oct 9 17:08:00 2009 +++ /dev/null Binary file, no diff available. === --- /trunk/user/src/com/google/gwt/uibinder/rebind/BundleWriter.javaFri Oct 9 17:08:00 2009 +++ /trunk/user/src/com/google/gwt/uibinder/rebind/BundleWriter.javaFri Oct 9 22:09:58 2009 @@ -19,14 +19,12 @@ import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.TypeOracle; import com.google.gwt.resources.client.ClientBundle; -import com.google.gwt.resources.client.DataResource; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.resources.client.CssResource.Strict; import com.google.gwt.resources.client.ImageResource.ImageOptions; import com.google.gwt.resources.client.ImageResource.RepeatStyle; import com.google.gwt.uibinder.rebind.model.ImplicitClientBundle; import com.google.gwt.uibinder.rebind.model.ImplicitCssResource; -import com.google.gwt.uibinder.rebind.model.ImplicitDataResource; import com.google.gwt.uibinder.rebind.model.ImplicitImageResource; /** @@ -40,11 +38,10 @@ private final TypeOracle oracle; private final JClassType clientBundleType; - private final JClassType dataResourceType; + private final JClassType strictAnnotationType; private final JClassType imageOptionType; private final JClassType imageResourceType; private final JClassType repeatStyleType; - private final JClassType strictAnnotationType; public BundleWriter(ImplicitClientBundle bundleClass, PrintWriterManager writerManager, TypeOracle oracle, @@ -56,11 +53,10 @@ this.oracle = oracle; clientBundleType = oracle.findType(ClientBundle.class.getName()); -dataResourceType = oracle.findType(DataResource.class.getCanonicalName()); +strictAnnotationType = oracle.findType(Strict.class.getCanonicalName()); imageOptionType = oracle.findType(ImageOptions.class.getCanonicalName()); imageResourceType = oracle.findType(ImageResource.class.getCanonicalName()); repeatStyleType = oracle.findType(RepeatStyle.class.getCanonicalName()); -strictAnnotationType = oracle.findType(Strict.class.getCanonicalName()); } public void write() throws