Revision: 6527
Author: rj...@google.com
Date: Wed Oct 28 14:57:48 2009
Log: Merge tr...@6524 into releases/2.0
   Deprecate panels that have LayoutPanel alternatives
     svn merge --ignore-ancestry -c 6524  
https://google-web-toolkit.googlecode.com/svn/trunk .


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

Modified:
  /releases/2.0/branch-info.txt
  /releases/2.0/user/src/com/google/gwt/uibinder/parsers/CellPanelParser.java
  /releases/2.0/user/src/com/google/gwt/uibinder/parsers/DockPanelParser.java
   
/releases/2.0/user/src/com/google/gwt/uibinder/parsers/StackPanelParser.java
  /releases/2.0/user/src/com/google/gwt/uibinder/parsers/TabPanelParser.java
   
/releases/2.0/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml

=======================================
--- /releases/2.0/branch-info.txt       Wed Oct 28 13:23:35 2009
+++ /releases/2.0/branch-info.txt       Wed Oct 28 14:57:48 2009
@@ -97,3 +97,6 @@
    Flipping DisclosurePanel image in RTL
      svn merge --ignore-ancestry -c 6519  
http://google-web-toolkit.googlecode.com/svn/trunk/ .

+tr...@6524 was merged into this branch
+  Deprecate panels that have LayoutPanel alternatives
+    svn merge --ignore-ancestry -c 6524  
https://google-web-toolkit.googlecode.com/svn/trunk .
=======================================
---  
/releases/2.0/user/src/com/google/gwt/uibinder/parsers/CellPanelParser.java     
 
Tue Oct 13 10:44:52 2009
+++  
/releases/2.0/user/src/com/google/gwt/uibinder/parsers/CellPanelParser.java     
 
Wed Oct 28 14:57:48 2009
@@ -1,12 +1,12 @@
  /*
   * Copyright 2007 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
@@ -31,51 +31,50 @@
    private static final String HEIGHT_ATTR = "height";
    private static final String CELL_TAG = "Cell";

-  private static HorizontalAlignmentConstantParser halignParser =
-      new HorizontalAlignmentConstantParser();
-  private static VerticalAlignmentConstantParser valignParser =
-      new VerticalAlignmentConstantParser();
-  private static StringAttributeParser stringParser =
-      new StringAttributeParser();
+  private static HorizontalAlignmentConstantParser halignParser = new  
HorizontalAlignmentConstantParser();
+  private static VerticalAlignmentConstantParser valignParser = new  
VerticalAlignmentConstantParser();
+  private static StringAttributeParser stringParser = new  
StringAttributeParser();

    /**
     * Parses the alignment and size attributes common to all CellPanels.
-   *
+   *
     * This is exposed publicly because there is a DockPanelParser that  
overrides
     * the default behavior, but still needs to parse these attributes.
-   *
+   *
     * @throws UnableToCompleteException
     */
-  public static void parseCellAttributes(XMLElement cellElem, String  
fieldName,
-      String childFieldName, UiBinderWriter writer) throws  
UnableToCompleteException {
+  static void parseCellAttributes(XMLElement cellElem, String fieldName,
+      String childFieldName, UiBinderWriter writer)
+      throws UnableToCompleteException {
+
      // Parse horizontal and vertical alignment attributes.
      if (cellElem.hasAttribute(HALIGN_ATTR)) {
-      String value =
-          halignParser.parse(cellElem.consumeAttribute(HALIGN_ATTR),  
writer);
-      writer.addStatement("%1$s.setCellHorizontalAlignment(%2$s, %3$s);",  
fieldName,
-          childFieldName, value);
+      String value =  
halignParser.parse(cellElem.consumeAttribute(HALIGN_ATTR),
+          writer);
+      writer.addStatement("%1$s.setCellHorizontalAlignment(%2$s, %3$s);",
+          fieldName, childFieldName, value);
      }

      if (cellElem.hasAttribute(VALIGN_ATTR)) {
-      String value =
-          valignParser.parse(cellElem.consumeAttribute(VALIGN_ATTR),  
writer);
-      writer.addStatement("%1$s.setCellVerticalAlignment(%2$s, %3$s);",  
fieldName,
-          childFieldName, value);
+      String value =  
valignParser.parse(cellElem.consumeAttribute(VALIGN_ATTR),
+          writer);
+      writer.addStatement("%1$s.setCellVerticalAlignment(%2$s, %3$s);",
+          fieldName, childFieldName, value);
      }

      // Parse width and height attributes.
      if (cellElem.hasAttribute(WIDTH_ATTR)) {
-      String value =
-          stringParser.parse(cellElem.consumeAttribute(WIDTH_ATTR),  
writer);
-      writer.addStatement("%1$s.setCellWidth(%2$s, %3$s);", fieldName,  
childFieldName,
-          value);
+      String value =  
stringParser.parse(cellElem.consumeAttribute(WIDTH_ATTR),
+          writer);
+      writer.addStatement("%1$s.setCellWidth(%2$s, %3$s);", fieldName,
+          childFieldName, value);
      }

      if (cellElem.hasAttribute(HEIGHT_ATTR)) {
-      String value =
-          stringParser.parse(cellElem.consumeAttribute(HEIGHT_ATTR),  
writer);
-      writer.addStatement("%1$s.setCellHeight(%2$s, %3$s);", fieldName,  
childFieldName,
-          value);
+      String value =  
stringParser.parse(cellElem.consumeAttribute(HEIGHT_ATTR),
+          writer);
+      writer.addStatement("%1$s.setCellHeight(%2$s, %3$s);", fieldName,
+          childFieldName, value);
      }
    }

@@ -84,7 +83,8 @@
      for (XMLElement child : elem.consumeChildElements()) {
        String ns = child.getNamespaceUri();
        String tagName = child.getLocalName();
-      if (ns.equals(elem.getNamespaceUri()) && tagName.equals(CELL_TAG)) {
+
+      if (ns.equals(elem.getNamespaceUri()) &&  
localTagNameIsCell(tagName)) {
          // It's a cell element, so parse its single child as a widget.
          XMLElement widget = child.consumeSingleChildElement();
          String childFieldName = writer.parseElementToField(widget);
@@ -99,4 +99,9 @@
        }
      }
    }
-}
+
+  private boolean localTagNameIsCell(String tagName) {
+    // Older templates had this as "Cell", but now we prefer "cell"
+    return tagName.equals(CELL_TAG) ||  
tagName.equals(CELL_TAG.toLowerCase());
+  }
+}
=======================================
---  
/releases/2.0/user/src/com/google/gwt/uibinder/parsers/DockPanelParser.java     
 
Tue Oct 13 10:44:52 2009
+++  
/releases/2.0/user/src/com/google/gwt/uibinder/parsers/DockPanelParser.java     
 
Wed Oct 28 14:57:48 2009
@@ -43,6 +43,9 @@

    public void parse(XMLElement elem, String fieldName, JClassType type,
        UiBinderWriter writer) throws UnableToCompleteException {
+    writer.warn(
+        "%1$s:%2$s is deprecated. Use the %1$s:DockLayoutPanel instead.",
+        elem.getPrefix(), elem.getLocalName());
      // Parse children.
      for (XMLElement child : elem.consumeChildElements()) {
        // DockPanel can only contain Dock elements.
=======================================
---  
/releases/2.0/user/src/com/google/gwt/uibinder/parsers/StackPanelParser.java    
 
Tue Sep  1 15:14:29 2009
+++  
/releases/2.0/user/src/com/google/gwt/uibinder/parsers/StackPanelParser.java    
 
Wed Oct 28 14:57:48 2009
@@ -29,6 +29,9 @@

    public void parse(XMLElement elem, String fieldName, JClassType type,
        UiBinderWriter writer) throws UnableToCompleteException {
+    writer.warn(
+        "%1$s:%2$s is deprecated. Use the %1$s:StackLayoutPanel instead.",
+        elem.getPrefix(), elem.getLocalName());
      // Parse children.
      for (XMLElement child : elem.consumeChildElements()) {

=======================================
---  
/releases/2.0/user/src/com/google/gwt/uibinder/parsers/TabPanelParser.java      
 
Tue Sep  1 15:14:29 2009
+++  
/releases/2.0/user/src/com/google/gwt/uibinder/parsers/TabPanelParser.java      
 
Wed Oct 28 14:57:48 2009
@@ -1,12 +1,12 @@
  /*
   * Copyright 2007 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
@@ -30,6 +30,9 @@

    public void parse(XMLElement elem, String fieldName, JClassType type,
        UiBinderWriter writer) throws UnableToCompleteException {
+    writer.warn(
+        "%1$s:%2$s is deprecated. Use the %1$s:TabLayoutPanel instead.",
+        elem.getPrefix(), elem.getLocalName());
      // Parse children.
      for (XMLElement child : elem.consumeChildElements()) {
        // TabPanel can only contain Tab elements.
@@ -54,16 +57,20 @@
        String childFieldName = null;
        for (XMLElement tabChild : child.consumeChildElements()) {
          if (tabChild.getLocalName().equals(TAG_TABHTML)) {
-          HtmlInterpreter interpreter =
-            HtmlInterpreter.newInterpreterForUiObject(writer, fieldName);
+          HtmlInterpreter interpreter =  
HtmlInterpreter.newInterpreterForUiObject(
+              writer, fieldName);
            tabHTML = tabChild.consumeInnerHtml(interpreter);
          } else {
            if (childFieldName != null) {
-            writer.die("gwt:Tab may only have a single child widget");
+            writer.die("%s may only have a single child widget", child);
            }
            childFieldName = writer.parseElementToField(tabChild);
          }
        }
+
+      if (childFieldName == null) {
+        writer.die("%s must have a child widget", child);
+      }

        if (tabHTML != null) {
          writer.addStatement("%1$s.add(%2$s, \"%3$s\", true);", fieldName,
=======================================
---  
/releases/2.0/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml
        
Tue Oct 27 00:00:07 2009
+++  
/releases/2.0/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml
        
Wed Oct 28 14:57:48 2009
@@ -278,6 +278,8 @@
          <ui:attribute name="text" description="radio button name"/>
        </demo:PointlessRadioButtonSubclass>

+       <gwt:HorizontalPanel>
+         <gwt:Cell><gwt:HTMLPanel>
        <p> ... a StackPanel ... </p>

        <gwt:StackPanel stylePrimaryName="myStyle" width="280px"  
ui:field='myStackPanel'>
@@ -296,6 +298,21 @@
          </gwt:HTMLPanel>
          <gwt:Label text="Stack Three Text"  gwt:StackPanel-text="Stack  
Three" />
        </gwt:StackPanel>
+      </gwt:HTMLPanel></gwt:Cell>
+
+      <gwt:cell><gwt:HTMLPanel>
+        <p> ... a TabPanel </p>
+
+        <gwt:TabPanel>
+          <gwt:Tab text='Able'><gwt:Label>Able Widget</gwt:Label></gwt:Tab>
+          <gwt:Tab><gwt:TabHTML><b>B</b>aker</gwt:TabHTML>
+            <gwt:Label>Baker widget</gwt:Label>
+          </gwt:Tab>
+        </gwt:TabPanel>
+      </gwt:HTMLPanel></gwt:cell>
+
+      </gwt:HorizontalPanel>
+

        <p> ... a DisclosurePanel with a text header ... </p>


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

Reply via email to