Added protected access to composite's widget
Patch by:ecc
Review by: bruce


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@730 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/Composite.java b/user/src/com/google/gwt/user/client/ui/Composite.java
index cede50d..2e63f11 100644
--- a/user/src/com/google/gwt/user/client/ui/Composite.java
+++ b/user/src/com/google/gwt/user/client/ui/Composite.java
@@ -29,7 +29,8 @@
  * </p>
  * 
  * <p>
- * <h3>Example</h3> {@example com.google.gwt.examples.CompositeExample}
+ * <h3>Example</h3>
+ * {@example com.google.gwt.examples.CompositeExample}
  * </p>
  */
 public abstract class Composite extends Widget {
@@ -42,12 +43,22 @@
   public Element getElement() {
     if (widget == null) {
       throw new IllegalStateException("initWidget() was never called in "
-        + GWT.getTypeName(this));
+          + GWT.getTypeName(this));
     }
     return super.getElement();
   }
 
   /**
+   * Provides subclasses access to the topmost widget that defines this
+   * composite.
+   * 
+   * @return the widget
+   */
+  protected Widget getWidget() {
+    return widget;
+  }
+
+  /**
    * Sets the widget to be wrapped by the composite. The wrapped widget must be
    * set before calling any {@link Widget} methods on this object, or adding it
    * to a panel. This method may only be called once for a given composite.
@@ -58,7 +69,7 @@
     // Make sure the widget is not being set twice.
     if (this.widget != null) {
       throw new IllegalStateException("Composite.initWidget() may only be "
-        + "called once.");
+          + "called once.");
     }
 
     widget.removeFromParent();