## com.google.gwt.user.client.ui
Class HorizontalSplitPanel

    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.HorizontalSplitPanel

All Implemented Interfaces:
  EventListener, HasWidgets, java.lang.Iterable<Widget>

    public final class HorizontalSplitPanel

extends Panel

A panel that arranges two widgets in a single horizontal row and allows the user to interactively change the proportion of the width dedicated to each of the two widgets. Widgets contained within a `HorizontalSplitPanel` will be automatically decorated with scrollbars when necessary.

### CSS Style Rules

- .gwt-HorizontalSplitPanel { the panel itself }
- .gwt-HorizontalSplitPanel hsplitter { the splitter }

Nested Class Summary

Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
`UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Constructor Summary
`HorizontalSplitPanel()`
`HorizontalSplitPanel(HorizontalSplitPanelImages images)` Creates an empty horizontal split panel.

Method Summary
`void` `add(Widget w)` Adds a widget to a pane in the HorizontalSplitPanel.
`protected Element` `getElement(int index)` Gets the content element for the given index.
`Widget` `getEndOfLineWidget()` Gets the widget in the pane that is at the end of the line direction for the layout.
`Widget` `getLeftWidget()` Gets the widget in the left side of the panel.
`Widget` `getRightWidget()` Gets the widget in the right side of the panel.
`protected Element` `getSplitElement()` Gets the element that is acting as the splitter.
`Widget` `getStartOfLineWidget()` Gets the widget in the pane that is at the start of the line direction for the layout.
`protected Widget` `getWidget(int index)` Gets one of the contained widgets.
`boolean` `isResizing()` Indicates whether the split panel is being resized.
`java.util.Iterator<Widget>` `iterator()` Gets an iterator for the contained widgets.
`void` `onBrowserEvent(Event event)` Fired whenever a browser event is received.
`protected void` `onEnsureDebugId(java.lang.String baseID)` Affected Elements: -splitter = the container containing the splitter element. -right = the container on the right side of the splitter. -left = the container on the left side of the splitter.
`protected void` `onLoad()` A Panel's onLoad method will be called after all of its children are attached.
`protected void` `onUnload()` A Panel's onUnload method will be called before its children become detached themselves.
`boolean` `remove(Widget widget)` Removes a child widget.
`void` `setEndOfLineWidget(Widget w)` Sets the widget in the pane that is at the end of the line direction for the layout.
`void` `setLeftWidget(Widget w)` Sets the widget in the left side of the panel.
`void` `setRightWidget(Widget w)` Sets the widget in the right side of the panel.
`void` `setSplitPosition(java.lang.String pos)` Moves the position of the splitter.
`void` `setStartOfLineWidget(Widget w)` Sets the widget in the pane that is at the start of the line direction for the layout.
`protected void` `setWidget(int index, Widget w)` Sets one of the contained widgets.

Methods inherited from class com.google.gwt.user.client.ui.Panel
`adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`getParent, isAttached, onAttach, onDetach, removeFromParent`

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, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### HorizontalSplitPanel

    public HorizontalSplitPanel()

### HorizontalSplitPanel

    public HorizontalSplitPanel(HorizontalSplitPanelImages images)

  Creates an empty horizontal split panel.

  Parameters:
    `images` - ImageBundle containing an image for the splitter's drag thumb

Method Detail

### add

    public void add(Widget w)

  Adds a widget to a pane in the HorizontalSplitPanel. The method will first attempt to add the widget to the left pane. If a widget is already in that position, it will attempt to add the widget to the right pane. If a widget is already in that position, an exception will be thrown, as a HorizontalSplitPanel can contain at most two widgets. Note that this method is bidi-sensitive. In an RTL environment, this method will first attempt to add the widget to the right pane, and if a widget is already in that position, it will attempt to add the widget to the left pane.

  Specified by:
    `add` in interface `HasWidgets`
  Parameters:
    `w` - the widget to be added
  Throws:
    `java.lang.IllegalStateException`
  See Also:
    `HasWidgets.add(Widget)`

### getEndOfLineWidget

    public Widget getEndOfLineWidget()

  Gets the widget in the pane that is at the end of the line direction for the layout. That is, in an RTL layout, gets the widget in the left pane, and in an LTR layout, gets the widget in the right pane.

  Returns:
    the widget, `null` if there is not one.

### getLeftWidget

    public Widget getLeftWidget()

  Gets the widget in the left side of the panel.

  Returns:
    the widget, `null` if there is not one.

### getRightWidget

    public Widget getRightWidget()

  Gets the widget in the right side of the panel.

  Returns:
    the widget, `null` if there is not one.

### getStartOfLineWidget

    public Widget getStartOfLineWidget()

  Gets the widget in the pane that is at the start of the line direction for the layout. That is, in an RTL environment, gets the widget in the right pane, and in an LTR environment, gets the widget in the left pane.

  Returns:
    the widget, `null` if there is not one.

### setEndOfLineWidget

    public void setEndOfLineWidget(Widget w)

  Sets the widget in the pane that is at the end of the line direction for the layout. That is, in an RTL layout, sets the widget in the left pane, and in and RTL layout, sets the widget in the right pane.

  Parameters:
    `w` - the widget

### setLeftWidget

    public void setLeftWidget(Widget w)

  Sets the widget in the left side of the panel.

  Parameters:
    `w` - the widget

### setRightWidget

    public void setRightWidget(Widget w)

  Sets the widget in the right side of the panel.

  Parameters:
    `w` - the widget

### setSplitPosition

    public final void setSplitPosition(java.lang.String pos)

  Moves the position of the splitter. This method is not bidi-sensitive. The size specified is always the size of the left region, regardless of directionality.

  Parameters:
    `pos` - the new size of the left region in CSS units (e.g. "10px", "1em")

### setStartOfLineWidget

    public void setStartOfLineWidget(Widget w)

  Sets the widget in the pane that is at the start of the line direction for the layout. That is, in an RTL layout, sets the widget in the right pane, and in and RTL layout, sets the widget in the left pane.

  Parameters:
    `w` - the widget

### onEnsureDebugId

    protected void onEnsureDebugId(java.lang.String baseID)

  Affected Elements:
  - -splitter = the container containing the splitter element.
  - -right = the container on the right side of the splitter.
  - -left = the container on the left side of the splitter.

  Parameters:
    `baseID` - the base ID used by the main element
  See Also:
    `UIObject.onEnsureDebugId(String)`

### onLoad

    protected void onLoad()

  Description copied from class: `Panel`
  A Panel's onLoad method will be called after all of its children are attached.

  Overrides:
    `onLoad` in class `Panel`
  See Also:
    `Widget.onLoad()`

### onUnload

    protected void onUnload()

  Description copied from class: `Panel`
  A Panel's onUnload method will be called before its children become detached themselves.

  Overrides:
    `onUnload` in class `Panel`
  See Also:
    `Widget.onLoad()`

### isResizing

    public boolean isResizing()

  Indicates whether the split panel is being resized.

  Returns:
    `true` if the user is dragging the splitter, `false` otherwise

### iterator

    public java.util.Iterator<Widget> iterator()

  Description copied from interface: `HasWidgets`
  Gets an iterator for the contained widgets. This iterator is required to implement `Iterator.remove()`.

### onBrowserEvent

    public void onBrowserEvent(Event event)

  Description copied from interface: `EventListener`
  Fired whenever a browser event is received.

  Specified by:
    `onBrowserEvent` in interface `EventListener`
  Overrides:
    `onBrowserEvent` in class `Widget`
  Parameters:
    `event` - the event received

### remove

    public boolean remove(Widget widget)

  Description copied from class: `Panel`
  Removes a child widget.

  How to Override this Method

  There are several important things that must take place in the correct order to properly remove a Widget from a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.

  1. Validate: Make sure this Panel is actually the parent of the child Widget; return `false` if it is not.
  2. Orphan: Call `Panel.orphan(Widget)` first while the child Widget is still attached.
  3. Physical Detach: Adjust the DOM to account for the removal of the child Widget. The Widget's Element must be physically removed from the DOM.
  4. Logical Detach: Update the Panel's state variables to reflect the removal of the child Widget. Example: the Widget is removed from the Panel's `WidgetCollection`.

  Specified by:
    `remove` in interface `HasWidgets`
  Specified by:
    `remove` in class `Panel`
  Parameters:
    `widget` - the widget to be removed
  Returns:
    `true` if the child was present

### getElement

    protected Element getElement(int index)

  Gets the content element for the given index.

  Parameters:
    `index` - the index of the element, only 0 and 1 are valid.
  Returns:
    the element

### getSplitElement

    protected Element getSplitElement()

  Gets the element that is acting as the splitter.

  Returns:
    the element

### getWidget

    protected Widget getWidget(int index)

  Gets one of the contained widgets.

  Parameters:
    `index` - the index of the widget, only 0 and 1 are valid.
  Returns:
    the widget

### setWidget

    protected final void setWidget(int index,
                                   Widget w)

  Sets one of the contained widgets.

  Parameters:
    `index` - the index, only 0 and 1 are valid
    `w` - the widget