com.google.gwt.user.client.ui

## Class RootLayoutPanel

- java.lang.Object
- - com.google.gwt.user.client.ui.UIObject
  - - com.google.gwt.user.client.ui.Widget
    - - com.google.gwt.user.client.ui.Panel
      - - com.google.gwt.user.client.ui.ComplexPanel
        - - com.google.gwt.user.client.ui.LayoutPanel
          - - com.google.gwt.user.client.ui.RootLayoutPanel

- All Implemented Interfaces:
    HasAttachHandlers, HasHandlers, EventListener, AnimatedLayout, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, ProvidesResize, RequiresResize, java.lang.Iterable<Widget>

      public class RootLayoutPanel
      extends LayoutPanel

  A singleton implementation of `LayoutPanel` that always attaches itself to the document body (i.e. `RootPanel.get()`).

  This panel automatically calls `RequiresResize.onResize()` on itself when initially created, and whenever the window is resized.

  NOTE: This widget will only work in standards mode, which requires that the HTML page in which it is run have an explicit <!DOCTYPE> declaration.

  ### Example

  >     public class LayoutPanelExample implements EntryPoint {

  >       public void onModuleLoad() {
  >         // Attach two child widgets to a LayoutPanel, laying them out horizontally,
  >         // splitting at 50%.
  >         Widget childOne = new HTML("left"), childTwo = new HTML("right");
  >         LayoutPanel p = new LayoutPanel();
  >         p.add(childOne);
  >         p.add(childTwo);

  >         p.setWidgetLeftWidth(childOne, 0, PCT, 50, PCT);
  >         p.setWidgetRightWidth(childTwo, 0, PCT, 50, PCT);

  >         // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
  >         // resize events on the window to ensure that its children are informed of
  >         // possible size changes.
  >         RootLayoutPanel rp = RootLayoutPanel.get();
  >         rp.add(p);
  >       }
  >     }

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

      `UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

    - ### Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel

      `IndexedPanel.ForIsWidget`

    - ### Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets

      `HasWidgets.ForIsWidget`

  - ### Field Summary

    - ### Fields inherited from class com.google.gwt.user.client.ui.Widget

      `eventsToSink`

    - ### Fields inherited from class com.google.gwt.user.client.ui.UIObject

      `DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static RootLayoutPanel` | `get()` Gets the singleton instance of RootLayoutPanel.
    `protected void` | `onLoad()` This method is called immediately after a widget becomes attached to the browser's document.

    - ### Methods inherited from class com.google.gwt.user.client.ui.LayoutPanel

      `add, animate, animate, forceLayout, getLayout, getWidgetContainerElement, insert, onAttach, onDetach, onResize, remove, setWidgetBottomHeight, setWidgetBottomHeight, setWidgetHorizontalPosition, setWidgetLeftRight, setWidgetLeftRight, setWidgetLeftWidth, setWidgetLeftWidth, setWidgetRightWidth, setWidgetRightWidth, setWidgetTopBottom, setWidgetTopBottom, setWidgetTopHeight, setWidgetTopHeight, setWidgetVerticalPosition, setWidgetVisible`

    - ### Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel

      `add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, doLogicalClear, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove`

    - ### Methods inherited from class com.google.gwt.user.client.ui.Panel

      `add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove`

    - ### Methods inherited from class com.google.gwt.user.client.ui.Widget

      `addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents`

    - ### Methods inherited from class com.google.gwt.user.client.ui.UIObject

      `addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### get

          public static RootLayoutPanel get()

      Gets the singleton instance of RootLayoutPanel. This instance will always be attached to the document body via `RootPanel.get()`.

      Note that, unlike `RootPanel.get(String)`, this class provides no way to get an instance for any element on the page other than the document body. This is because we know of no way to get resize events for anything but the window.

    - #### onLoad

          protected void onLoad()

      Description copied from class: `Widget`
      This method is called immediately after a widget becomes attached to the browser's document.
      Overrides:
        `onLoad` in class `Widget`