Re: [gwt-contrib] Re: Adds Java classes for JSON serialization/deserialization to complement (issue696801)
It could still be useful to RequestFactoryServlet as-is, so landing it in gwt-servlet might be the thing to do. Ray, can you weigh in? On Jul 15, 2010 8:12 PM, Scott Blum sco...@google.com wrote: The goal of sharing a JSON lib across client-server seems great to me. I think super-source is the way to really make that go. However, for present purposes this is for gwt-dev to use, so I think it's fine landing this without respect to the future uber user lib we want to build. We could always update the dev code in the future to use the uber user lib. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: small changes to AjaxSampleLoader (issue697801)
The SimpleAjaxloader.html file is still needed for the 'mvn install' goal - it get put inside the .war file. http://gwt-code-reviews.appspot.com/697801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Puts PlaceController in the business of showing the user (issue698801)
http://gwt-code-reviews.appspot.com/698801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Puts PlaceController in the business of showing the user (issue698801)
http://gwt-code-reviews.appspot.com/698801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Puts PlaceController in the business of showing the user (issue698801)
http://gwt-code-reviews.appspot.com/698801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Puts PlaceController in the business of showing the user (issue698801)
LGTM (awesome! next step: integration with History ;-) ) http://gwt-code-reviews.appspot.com/698801/diff/8001/9002 File user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java (right): http://gwt-code-reviews.appspot.com/698801/diff/8001/9002#newcode62 user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java:62: deltas = null; // silence the next willStop() call when place changes silence the next willStop() should read silence the next mayStop() http://gwt-code-reviews.appspot.com/698801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] RR: Customization of child element handling in UiBinder
Details in this Wave: https://wave.google.com/wave/waveref/googlewave.com/w+WIuSfOKhA rjrjr -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Puts PlaceController in the business of showing the user (issue698801)
Couple of questions. http://gwt-code-reviews.appspot.com/698801/diff/8001/9002 File user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java (right): http://gwt-code-reviews.appspot.com/698801/diff/8001/9002#newcode73 user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java:73: return Are you sure you want to abandon your changes?; Extract this string to a protected method? http://gwt-code-reviews.appspot.com/698801/diff/8001/9006 File user/src/com/google/gwt/app/place/PlaceChangeRequestedEvent.java (right): http://gwt-code-reviews.appspot.com/698801/diff/8001/9006#newcode88 user/src/com/google/gwt/app/place/PlaceChangeRequestedEvent.java:88: public void setWarning(String warning) { Are multiple warnings something that needs to be supported? http://gwt-code-reviews.appspot.com/698801/diff/8001/9007 File user/src/com/google/gwt/app/place/PlaceController.java (right): http://gwt-code-reviews.appspot.com/698801/diff/8001/9007#newcode45 user/src/com/google/gwt/app/place/PlaceController.java:45: return Window.confirm(message); Is there something that can be done to prevent the default implementation from arbitrarily hanging a test? Maybe a rebind rule in JUnit.gwt.xml? http://gwt-code-reviews.appspot.com/698801/diff/8001/9007#newcode69 user/src/com/google/gwt/app/place/PlaceController.java:69: this(eventBus, new DefaultDelegate()); GWT.create() ? http://gwt-code-reviews.appspot.com/698801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8384 committed - Adds design time hooks to UiBinder for GWT Designer, or any other tool...
Revision: 8384 Author: rj...@google.com Date: Thu Jul 15 04:01:13 2010 Log: Adds design time hooks to UiBinder for GWT Designer, or any other tool that can find a use for them. See discussion in http://groups.google.com/group/google-web-toolkit-contributors/browse_thread/thread/3e9b2193531fb0b4/69829d19f0573be1 Patch by konstantin.scheg...@gmail.com Review by rj...@google.com http://gwt-code-reviews.appspot.com/693801/show Review by: robertvaw...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8384 Added: /trunk/user/src/com/google/gwt/uibinder/rebind/DesignTimeUtils.java /trunk/user/src/com/google/gwt/uibinder/rebind/Statements.java /trunk/user/test/com/google/gwt/uibinder/rebind/DesignTimeUtilsTest.java Modified: /trunk/user/src/com/google/gwt/uibinder/elementparsers/BeanParser.java /trunk/user/src/com/google/gwt/uibinder/elementparsers/CellPanelParser.java /trunk/user/src/com/google/gwt/uibinder/elementparsers/UIObjectParser.java /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java /trunk/user/src/com/google/gwt/uibinder/rebind/XMLElement.java /trunk/user/test/com/google/gwt/uibinder/UiBinderJreSuite.java === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/rebind/DesignTimeUtils.java Thu Jul 15 04:01:13 2010 @@ -0,0 +1,133 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the License); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.uibinder.rebind; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.beans.Beans; +import java.util.WeakHashMap; + +/** + * Utilities used for implementing design time support of UiBinder. + */ +public class DesignTimeUtils { + private static final WeakHashMapElement, String elementPaths = new WeakHashMapElement, String(); + + /** + * Adds declarations for design time artifacts. + */ + public static void addDeclarations(IndentedWriter w) { +if (!isDesignTime()) { + return; +} +w.write(public static interface DTObjectHandler {void handle(String path, Object object);}); +w.write(public DTObjectHandler dtObjectHandler;); +w.write(public final java.util.Map dtAttributes = new java.util.HashMap();); + } + + /** + * @return the name of Impl, unique each time if it is design time. + */ + public static String getImplName(String implName) { +if (isDesignTime()) { + implName += _designTime + System.currentTimeMillis(); +} +return implName; + } + + /** + * @return the path of given {...@link Element}. + */ + public static String getPath(Element element) { +return elementPaths.get(element); + } + + /** + * @return the design time content of code*.ui.xml/code template to parse, + * or codenull/code if not design time, or this template is not + * under design. + */ + public static String getTemplateContent(String path) { +if (DesignTimeUtils.isDesignTime()) { + return System.getProperty(gwt.UiBinder.designTime + path); +} +return null; + } + + /** + * Notifies tool about codeUIObject/code creation. + */ + public static void handleUIObject(Statements writer, + XMLElement elem, String fieldName) { +if (!isDesignTime()) { + return; +} +writer.addStatement( +if (dtObjectHandler != null) dtObjectHandler.handle(\%s\, %s);, +elem.getDesignTimePath(), fieldName); + } + + /** + * @return codetrue/code if UiBinder works now in design time, so + * additional information should be provided in generated classes. + */ + public static boolean isDesignTime() { +return Beans.isDesignTime(); + } + + /** + * Remembers value of attribute, for given {...@link XMLElement}. + */ + public static void putAttribute(Statements writer, + XMLElement elem, String name, String value) { +if (!isDesignTime()) { + return; +} +String path = elem.getDesignTimePath(); +String key = path + + name; +writer.addStatement(dtAttributes.put(\%s\, %s);, key, value); + } + + /** + * Fills {...@value #elementPaths} with paths for given and child {...@link Element} + * s. + */ + public static void rememberPathForElements(Document doc) { +if (!isDesignTime()) { + return; +} +
[gwt-contrib] Re: Puts PlaceController in the business of showing the user (issue698801)
http://gwt-code-reviews.appspot.com/698801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Puts PlaceController in the business of showing the user (issue698801)
http://gwt-code-reviews.appspot.com/698801/diff/8001/9002 File user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java (right): http://gwt-code-reviews.appspot.com/698801/diff/8001/9002#newcode62 user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java:62: deltas = null; // silence the next willStop() call when place changes On 2010/07/16 15:57:22, tbroyer wrote: silence the next willStop() should read silence the next mayStop() Done. http://gwt-code-reviews.appspot.com/698801/diff/8001/9002#newcode73 user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java:73: return Are you sure you want to abandon your changes?; An i18n pass over this stuff is already on the list, out of scope for this patch. http://gwt-code-reviews.appspot.com/698801/diff/8001/9006 File user/src/com/google/gwt/app/place/PlaceChangeRequestedEvent.java (right): http://gwt-code-reviews.appspot.com/698801/diff/8001/9006#newcode88 user/src/com/google/gwt/app/place/PlaceChangeRequestedEvent.java:88: public void setWarning(String warning) { Not in my opinion. And anyway, they aren't feasible for the window closing case, unless we do something awful like appending them. Which I suppose we could do… I'm inclined to say that the multiple cancels case results in arbitrary output, since that's all we've offered internally for quite a while and no one has complained. http://gwt-code-reviews.appspot.com/698801/diff/8001/9007 File user/src/com/google/gwt/app/place/PlaceController.java (right): http://gwt-code-reviews.appspot.com/698801/diff/8001/9007#newcode45 user/src/com/google/gwt/app/place/PlaceController.java:45: return Window.confirm(message); Seems like following your GWT.create suggestion, and the existence of the delegate hook itself are enough protection. Adding the rebind rule seems like belts, suspenders *and* sansa-belt pants. http://gwt-code-reviews.appspot.com/698801/diff/8001/9007#newcode69 user/src/com/google/gwt/app/place/PlaceController.java:69: this(eventBus, new DefaultDelegate()); On 2010/07/16 15:58:45, bobv wrote: GWT.create() ? Done, with this JavaDoc: * Create a new PlaceController with a {...@link DefaultDelegate}. * The DefaultDelegate is created via a call to GWT.create(), so * an alternative default implementation can be provided * lt;replace-with rules in a gwt.xml file. http://gwt-code-reviews.appspot.com/698801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Puts PlaceController in the business of showing the user (issue698801)
LGTM I'm inclined to say that the multiple cancels case results in arbitrary output, since that's all we've offered internally for quite a while and no one has complained. Ok. Seems like following your GWT.create suggestion, and the existence of the delegate hook itself are enough protection. Adding the rebind rule seems like belts, suspenders *and* sansa-belt pants. You can never have too many ways of keeping your pants where they belong. * Create a new PlaceController with a {...@link DefaultDelegate}. * The DefaultDelegate is created via a call to GWT.create(), so * an alternative default implementation can be provided * lt;replace-with rules in a gwt.xml file. SGTM. http://gwt-code-reviews.appspot.com/698801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Passing a ViewDataUpdater into Cell#onBrowserEvent so that cells can update view data after the ... (issue689801)
committed as r8383 http://gwt-code-reviews.appspot.com/689801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: CellTable#onBrowserEvent finds the TD element in which an event occurred, and then assumes that ... (issue695801)
LGTM http://gwt-code-reviews.appspot.com/695801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Adds Java classes for JSON serialization/deserialization to complement (issue696801)
http://gwt-code-reviews.appspot.com/696801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Adds Java classes for JSON serialization/deserialization to complement (issue696801)
Here is the API moved to a new package. I updated some javadoc too. http://gwt-code-reviews.appspot.com/696801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8385 committed - CellTable#onBrowserEvent finds the TD element in which an event occurr...
Revision: 8385 Author: jlaba...@google.com Date: Fri Jul 16 07:18:14 2010 Log: CellTable#onBrowserEvent finds the TD element in which an event occurred, and then assumes that the TD has a parent TR and TBODY. This is normally a safe assumption because browsers only fire native events on elements that are attached to the page, which means a TR and TBODY is present. However, if a the user selects a new value in a select element inside the table, a change and mouseup event both fire, even if the table is refreshed on the change event. In practice, if a user changes a value onchange and refreshes the table, the mouseup event will fire on the old TD, which is no longer connected to the table. As a result... this patch checks that both the TR and TBODY are not null. Review at http://gwt-code-reviews.appspot.com/695801 Review by: rj...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8385 Modified: /trunk/user/src/com/google/gwt/user/cellview/client/CellTable.java === --- /trunk/user/src/com/google/gwt/user/cellview/client/CellTable.java Thu Jul 15 03:48:34 2010 +++ /trunk/user/src/com/google/gwt/user/cellview/client/CellTable.java Fri Jul 16 07:18:14 2010 @@ -634,10 +634,23 @@ if (cell == null) { return; } + +// Determine if we are in the header, footer, or body. Its possible that +// the table has been refreshed before the current event fired (ex. change +// event refreshes before mouseup fires), so we need to check each parent +// element. +Element trElem = cell.getParentElement(); +if (trElem == null) { + return; +} +TableRowElement tr = TableRowElement.as(trElem); +Element sectionElem = tr.getParentElement(); +if (sectionElem == null) { + return; +} +TableSectionElement section = TableSectionElement.as(sectionElem); // Forward the event to the associated header, footer, or column. -TableRowElement tr = TableRowElement.as(cell.getParentElement()); -TableSectionElement section = TableSectionElement.as(tr.getParentElement()); int col = cell.getCellIndex(); if (section == thead) { Header? header = headers.get(col); -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: CellTable#onBrowserEvent finds the TD element in which an event occurred, and then assumes that ... (issue695801)
committed as r8385 http://gwt-code-reviews.appspot.com/695801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8386 committed - Puts PlaceController in the business of showing the user...
Revision: 8386 Author: rj...@google.com Date: Fri Jul 16 07:47:49 2010 Log: Puts PlaceController in the business of showing the user Are you sure prompts on place change cancellation, per Thomas Broyer's suggestion http://groups.google.com/group/google-web-toolkit-contributors/browse_thread/thread/7d96ce234abe67cd This is the only generalized way I can see to keep the user from losing changes on window close, etc. Review at http://gwt-code-reviews.appspot.com/698801 Review by: robertvaw...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8386 Added: /trunk/user/test/com/google/gwt/app/AppJreSuite.java /trunk/user/test/com/google/gwt/app/place/PlaceChangeRequestedEventTest.java /trunk/user/test/com/google/gwt/app/place/PlaceControllerTest.java Modified: /trunk/user/src/com/google/gwt/app/place/AbstractActivity.java /trunk/user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java /trunk/user/src/com/google/gwt/app/place/AbstractRecordListActivity.java /trunk/user/src/com/google/gwt/app/place/Activity.java /trunk/user/src/com/google/gwt/app/place/ActivityManager.java /trunk/user/src/com/google/gwt/app/place/PlaceChangeRequestedEvent.java /trunk/user/src/com/google/gwt/app/place/PlaceController.java /trunk/user/test/com/google/gwt/app/place/ActivityManagerTest.java === --- /dev/null +++ /trunk/user/test/com/google/gwt/app/AppJreSuite.java Fri Jul 16 07:47:49 2010 @@ -0,0 +1,34 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the License); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.app; + +import com.google.gwt.app.place.PlaceChangeRequestedEventTest; +import com.google.gwt.app.place.PlaceControllerTest; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Suite of UiBinder tests that require the JRE. + */ +public class AppJreSuite { + public static Test suite() { +TestSuite suite = new TestSuite(app package tests that require the JRE); +suite.addTestSuite(PlaceControllerTest.class); +suite.addTestSuite(PlaceChangeRequestedEventTest.class); +return suite; + } +} === --- /dev/null +++ /trunk/user/test/com/google/gwt/app/place/PlaceChangeRequestedEventTest.java Fri Jul 16 07:47:49 2010 @@ -0,0 +1,39 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the License); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.app.place; + +import junit.framework.TestCase; + +/** + * Eponymous test class. + */ +public class PlaceChangeRequestedEventTest extends TestCase { + private static final String W1 = foo; + + public void testNoClobberWarning() { +PlaceChangeRequestedEventPlace e = new PlaceChangeRequestedEventPlace( +new Place() { +}); + +assertNull(e.getWarning()); +e.setWarning(W1); +assertEquals(W1, e.getWarning()); +e.setWarning(bar); +assertEquals(W1, e.getWarning()); +e.setWarning(null); +assertEquals(W1, e.getWarning()); + } +} === --- /dev/null +++ /trunk/user/test/com/google/gwt/app/place/PlaceControllerTest.java Fri Jul 16 07:47:49 2010 @@ -0,0 +1,127 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the License); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.app.place; + +import com.google.gwt.event.shared.HandlerManager; +import com.google.gwt.event.shared.HandlerRegistration; +import
[gwt-contrib] [google-web-toolkit] r8387 committed - Adds UiBinder support for Grid...
Revision: 8387 Author: rj...@google.com Date: Fri Jul 16 08:13:31 2010 Log: Adds UiBinder support for Grid Patch by markovuksano...@gmail.com Review by rj...@google.com http://gwt-code-reviews.appspot.com/154810 Review by: robertvaw...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8387 Added: /trunk/user/src/com/google/gwt/uibinder/elementparsers/GridParser.java /trunk/user/test/com/google/gwt/uibinder/elementparsers/GridParserTest.java /trunk/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.java.rej Modified: /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java /trunk/user/src/com/google/gwt/user/client/ui/Grid.java /trunk/user/test/com/google/gwt/uibinder/UiBinderJreSuite.java /trunk/user/test/com/google/gwt/uibinder/test/UiJavaResources.java /trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java /trunk/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.java /trunk/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/elementparsers/GridParser.java Fri Jul 16 08:13:31 2010 @@ -0,0 +1,167 @@ +/* + * 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.elementparsers; + +import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.core.ext.typeinfo.JClassType; +import com.google.gwt.uibinder.rebind.UiBinderWriter; +import com.google.gwt.uibinder.rebind.XMLElement; +import com.google.gwt.user.client.ui.Grid; + +import java.util.Vector; + +/** + * A parser for Grid rows and cells. + */ +public class GridParser implements ElementParser { + + private static class CellContent { +private String tagName; +private String content; + +public CellContent(String tagName, String content) { + this.tagName = tagName; + this.content = content; +} + +public String getConent() { + return this.content; +} + +public String getTagName() { + return this.tagName; +} + } + + private static class Size { +private int rows; +private int columns; + +public Size() { + this.rows = 0; + this.columns = 0; +} + +public int getColumns() { + return this.columns; +} + +public int getRows() { + return this.rows; +} + +public void setColumns(int cols) { + this.columns = cols; +} + +public void setRows(int rows) { + this.rows = rows; +} + } + + private static final String ROW_TAG = row; + + private static final String CELL_TAG = cell; + + private static final String CUSTOMCELL_TAG = customCell; + + public void parse(XMLElement elem, String fieldName, JClassType type, + UiBinderWriter writer) throws UnableToCompleteException { + +VectorVectorCellContent matrix = new VectorVectorCellContent(); + +parseRows(elem, fieldName, writer, matrix); + +Size size = getMatrixSize(matrix); + +writer.setFieldInitializerAsConstructor(fieldName, +writer.getOracle().findType(Grid.class.getName()), +Integer.toString(size.getRows()), Integer.toString(size.getColumns())); +for (VectorCellContent row : matrix) { + for (CellContent column : row) { +if (column.getTagName().equals(CELL_TAG)) { + writer.addStatement(%s.setHTML(%s, %s, \%s\);, fieldName, + Integer.toString(matrix.indexOf(row)), + Integer.toString(row.indexOf(column)), column.getConent()); +} +if (column.getTagName().equals(CUSTOMCELL_TAG)) { + writer.addStatement(%s.setWidget(%s, %s, %s);, fieldName, + Integer.toString(matrix.indexOf(row)), + Integer.toString(row.indexOf(column)), column.getConent()); +} + } +} + } + + private Size getMatrixSize(VectorVectorCellContent matrix) { +Size size = new Size(); + +size.setRows(matrix.size()); + +int maxColumns = 0; +for (VectorCellContent column : matrix) { + maxColumns = (column.size() maxColumns) ? column.size() : maxColumns; +} +size.setColumns(maxColumns); + +return size; + } + + private void parseColumns(String fieldName, UiBinderWriter writer, + VectorVectorCellContent matrix, XMLElement child) + throws UnableToCompleteException { + +String tagName; +for (XMLElement cell : child.consumeChildElements()) { +
[gwt-contrib] Re: UiBinder tweaks for GWT Designer (issue693801)
r8384 On Fri, Jul 16, 2010 at 11:59 AM, Ray Ryan rj...@google.com wrote: Yup, the svn mirror broke. We're fixing it right now. On Thu, Jul 15, 2010 at 7:48 PM, Ray Ryan rj...@google.com wrote: It was committed, and should have hit svn by now. I can't check that system right now, but can look in the morning if it's still wonky. On Jul 15, 2010 5:41 PM, Konstantin Scheglov konstantin.scheg...@gmail.com wrote: The most natural spot to hook in would be com.google.gwt.uibinder.rebind.XMLElement.consumeAttributeWithDefault(String, String, JType[]), which I believe is the only way to get the value of an attribute from the parsed XML. Aha! Yes, using XMLElement.consumeX() methods also will work and even better, because of support all parsers, even custom ones (if/when they will be added into UiBinder). I've implemented such approach and it seems to work. So, I can post new patch (tomorrow). I'm only now sure how to do this. Should I wait to commit of previous patch (I don't see it yet in SVN)? Or you have not committed it yet? Should I post new patch as new patch set in same issue, or open new one? On Thu, Jul 15, 2010 at 10:29 AM, Ray Ryan rj...@google.com wrote: Konstantin, I just submitted this but I'm starting to wonder about it. There are lots of custom parsers that consume lots of attributes (e.g. the various layout panel parsers). Why don't they need to call putAttribute explicitly the way CellPanelParser did? If they do, and leaving them out was an oversight, we need a more general mechanism that will just keep working as new parsers are written, or this kind of mistake will plague us. On Thu, Jul 15, 2010 at 8:49 AM, rj...@google.com wrote: LGTM Thanks for the interface on UiBinderWriter, should have done that a long time ago. I'll probably tweak it's name while submitting. http://gwt-code-reviews.appspot.com/693801/show -- Konstantin Scheglov, Instantiations, Inc. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8388 committed - Fixing CFG handling of labelled breaks inside the switch....
Revision: 8388 Author: gwt.mirror...@gmail.com Date: Fri Jul 16 11:42:23 2010 Log: Fixing CFG handling of labelled breaks inside the switch. Review by: sp...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=8388 Modified: /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/cfg/CfgBuilder.java /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/cfg/CfgBuilderTest.java === --- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/cfg/CfgBuilder.java Mon Jun 14 16:52:09 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/gflow/cfg/CfgBuilder.java Fri Jul 16 11:42:23 2010 @@ -627,7 +627,7 @@ // We don't want to mess with other case exits here ListExit oldCaseElseExits = removeExits(Exit.Reason.CASE_ELSE); ListExit oldCaseThenExits = removeExits(Exit.Reason.CASE_THEN); - ListExit oldBreakExits = removeExits(Exit.Reason.BREAK); + ListExit oldBreakExits = removeUnlabeledBreaks(); switchStatement = x; // Goto to the first non-default node. @@ -673,7 +673,7 @@ } } accept(s); -breakExits.addAll(removeExits(Exit.Reason.BREAK)); +breakExits.addAll(removeUnlabeledBreaks()); } if (gotoExit != null) { @@ -1106,7 +1106,7 @@ private ListExit removeExits(Exit.Reason reason) { return currentExitsByReason.put(reason, new ArrayListExit()); } - + private ListExit removeExits(ListExit exits, Exit.Reason reason) { ListExit result = new ArrayListExit(); for (IteratorExit i = exits.iterator(); i.hasNext();) { @@ -1148,6 +1148,21 @@ private ListExit removeNormalExits(ListExit exits) { return removeExits(exits, Exit.Reason.NORMAL); } + +private ListExit removeUnlabeledBreaks() { + ListExit breakExits = removeExits(Exit.Reason.BREAK); + ListExit labeledBreaks = new ArrayListExit(); + + for (IteratorExit i = breakExits.iterator(); i.hasNext();) { +Exit exit = i.next(); +if (exit.getLabel() != null) { + i.remove(); + labeledBreaks.add(exit); +} + } + addExits(labeledBreaks); + return breakExits; +} } /** === --- /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/cfg/CfgBuilderTest.java Fri Jun 4 12:47:18 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/gflow/cfg/CfgBuilderTest.java Fri Jul 16 11:42:23 2010 @@ -1428,6 +1428,62 @@ WRITE(i, 2) - [*], 3: END); } + + public void testBreakLoopAndSwitch() throws Exception { +assertCfg(void, +loop: while (b) {, + switch (i) {, +case 1: , + if (j == 1) {, +break loop;, + }, + break;, +default: , + return;, +case 2: , + break loop;, +case 3: , + break;, + }, + i++;, +}, +k++; +).is( +BLOCK - [*], +STMT - [*], +1: READ(b) - [*], +COND (EntryPoint.b) - [THEN=*, ELSE=7], +BLOCK - [*], +STMT - [*], +READ(i) - [*], +GOTO - [*], +STMT - [*], +COND (EntryPoint.i == 1) - [THEN=*, ELSE=4], +STMT - [*], +READ(j) - [*], +COND (EntryPoint.j == 1) - [THEN=*, ELSE=2], +BLOCK - [*], +STMT - [*], +GOTO - [7], +2: STMT - [*], +GOTO - [6], +3: STMT - [*], +STMT - [*], +GOTO - [8], +4: STMT - [*], +COND (EntryPoint.i == 2) - [THEN=*, ELSE=5], +STMT - [*], +GOTO - [7], +5: STMT - [*], +COND (EntryPoint.i == 3) - [THEN=*, ELSE=3], +STMT - [*], +GOTO - [*], +6: STMT - [*], +READWRITE(i, null) - [1], +7: STMT - [*], +READWRITE(k, null) - [*], +8: END); + } private CfgBuilderResult assertCfg(String returnType, String ...codeSnippet) throws UnableToCompleteException { -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add support for creating Grid elements using UiBinder. (issue154810)
r8387 On Wed, Jul 14, 2010 at 12:32 PM, rj...@google.com wrote: Looks good, will submit On 2010/07/12 20:14:38, markovuksanovic wrote: Some error checking changes... http://gwt-code-reviews.appspot.com/154810/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Puts PlaceController in the business of showing the user (issue698801)
r8386 http://gwt-code-reviews.appspot.com/698801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r8389 committed - Reverts r8387 Adds UiBinder support for Grid
Revision: 8389 Author: rj...@google.com Date: Fri Jul 16 09:26:04 2010 Log: Reverts r8387 Adds UiBinder support for Grid http://code.google.com/p/google-web-toolkit/source/detail?r=8389 Deleted: /trunk/user/src/com/google/gwt/uibinder/elementparsers/GridParser.java /trunk/user/test/com/google/gwt/uibinder/elementparsers/GridParserTest.java /trunk/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.java.rej Modified: /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java /trunk/user/src/com/google/gwt/user/client/ui/Grid.java /trunk/user/test/com/google/gwt/uibinder/UiBinderJreSuite.java /trunk/user/test/com/google/gwt/uibinder/test/UiJavaResources.java /trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java /trunk/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.java /trunk/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml === --- /trunk/user/src/com/google/gwt/uibinder/elementparsers/GridParser.java Fri Jul 16 08:13:31 2010 +++ /dev/null @@ -1,167 +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.elementparsers; - -import com.google.gwt.core.ext.UnableToCompleteException; -import com.google.gwt.core.ext.typeinfo.JClassType; -import com.google.gwt.uibinder.rebind.UiBinderWriter; -import com.google.gwt.uibinder.rebind.XMLElement; -import com.google.gwt.user.client.ui.Grid; - -import java.util.Vector; - -/** - * A parser for Grid rows and cells. - */ -public class GridParser implements ElementParser { - - private static class CellContent { -private String tagName; -private String content; - -public CellContent(String tagName, String content) { - this.tagName = tagName; - this.content = content; -} - -public String getConent() { - return this.content; -} - -public String getTagName() { - return this.tagName; -} - } - - private static class Size { -private int rows; -private int columns; - -public Size() { - this.rows = 0; - this.columns = 0; -} - -public int getColumns() { - return this.columns; -} - -public int getRows() { - return this.rows; -} - -public void setColumns(int cols) { - this.columns = cols; -} - -public void setRows(int rows) { - this.rows = rows; -} - } - - private static final String ROW_TAG = row; - - private static final String CELL_TAG = cell; - - private static final String CUSTOMCELL_TAG = customCell; - - public void parse(XMLElement elem, String fieldName, JClassType type, - UiBinderWriter writer) throws UnableToCompleteException { - -VectorVectorCellContent matrix = new VectorVectorCellContent(); - -parseRows(elem, fieldName, writer, matrix); - -Size size = getMatrixSize(matrix); - -writer.setFieldInitializerAsConstructor(fieldName, -writer.getOracle().findType(Grid.class.getName()), -Integer.toString(size.getRows()), Integer.toString(size.getColumns())); -for (VectorCellContent row : matrix) { - for (CellContent column : row) { -if (column.getTagName().equals(CELL_TAG)) { - writer.addStatement(%s.setHTML(%s, %s, \%s\);, fieldName, - Integer.toString(matrix.indexOf(row)), - Integer.toString(row.indexOf(column)), column.getConent()); -} -if (column.getTagName().equals(CUSTOMCELL_TAG)) { - writer.addStatement(%s.setWidget(%s, %s, %s);, fieldName, - Integer.toString(matrix.indexOf(row)), - Integer.toString(row.indexOf(column)), column.getConent()); -} - } -} - } - - private Size getMatrixSize(VectorVectorCellContent matrix) { -Size size = new Size(); - -size.setRows(matrix.size()); - -int maxColumns = 0; -for (VectorCellContent column : matrix) { - maxColumns = (column.size() maxColumns) ? column.size() : maxColumns; -} -size.setColumns(maxColumns); - -return size; - } - - private void parseColumns(String fieldName, UiBinderWriter writer, - VectorVectorCellContent matrix, XMLElement child) - throws UnableToCompleteException { - -String tagName; -for (XMLElement cell : child.consumeChildElements()) { - tagName = cell.getLocalName(); - if (!tagName.equals(CELL_TAG) !tagName.equals(CUSTOMCELL_TAG) - ||
[gwt-contrib] Re: Add support for creating Grid elements using UiBinder. (issue154810)
Reverted, breaks Grid subclasses. Oops, working on the fix. On Fri, Jul 16, 2010 at 2:42 PM, Ray Ryan rj...@google.com wrote: r8387 On Wed, Jul 14, 2010 at 12:32 PM, rj...@google.com wrote: Looks good, will submit On 2010/07/12 20:14:38, markovuksanovic wrote: Some error checking changes... http://gwt-code-reviews.appspot.com/154810/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors