Class WPanel


public class WPanel
extends WCompositeWidget
A WPanel provides a container with a title bar.

The panel provides a container with an optional title bar, and an optional collapse icon.

Two panels: one collapsed and one expanded (default theme)

Two panels: one collapsed and one expanded (polished theme)

  • Constructor Details

  • Method Details

    • setTitle

      public void setTitle​(java.lang.CharSequence title)
      Sets a title.

      The panel title is set in the title bar. This method also makes the title bar visible by calling setTitleBar(true).

      The default value is "" (no title).

      See Also:
      getTitle(), setTitleBar(boolean enable)
    • getTitle

      public WString getTitle()
      Returns the title.

      See Also:
      setTitle(CharSequence title)
    • setTitleBar

      public void setTitleBar​(boolean enable)
      Shows or hides the title bar for the panel.

      The title bar appears at the top of the panel.

      The default value is false: the title bar is not shown unless a title is set or the panel is made collapsible.

      See Also:
      setTitle(CharSequence title), setCollapsible(boolean on)
    • isTitleBar

      public boolean isTitleBar()
      Returns if a title bar is set.

      See Also:
      setTitleBar(boolean enable)
    • getTitleBarWidget

      public WContainerWidget getTitleBarWidget()
      Returns the title bar widget.

      The title bar widget contains the collapse/expand icon (if the panel isCollapsible()), and the title text (if a title was set using setTitle()). You can access the title bar widget to customize the contents of the title.

      The method returns null if isTitleBar() is false. You need to call setTitleBar() first.

      See Also:
      setTitleBar(boolean enable)
    • setCollapsible

      public void setCollapsible​(boolean on)
      Makes the panel collapsible.

      When on is true, a collapse/expand icon is added to the title bar. This also calls setTitleBar(true) to enable the title bar.

      The default value is false.

      See Also:
      setTitleBar(boolean enable), setCollapsed(boolean on), isCollapsed()
    • isCollapsible

      public boolean isCollapsible()
      Returns if the panel can be collapsed by the user.

      See Also:
      setCollapsible(boolean on)
    • setCollapsed

      public void setCollapsed​(boolean on)
      Sets the panel expanded or collapsed.

      When on is true, equivalent to collapse(), otherwise to expand().

      The default value is false.

      See Also:
      setCollapsible(boolean on)
    • isCollapsed

      public boolean isCollapsed()
      Returns if the panel is collapsed.

      See Also:
      setCollapsed(boolean on), collapsed(), expanded()
    • collapse

      public void collapse()
      Collapses the panel.

      When isCollapsible() is true, the panel is collapsed to minimize screen real-estate.

      See Also:
      setCollapsible(boolean on), expand()
    • expand

      public void expand()
      Collapses the panel.

      When isCollapsible() is true, the panel is expanded to its original state.

      See Also:
      setCollapsible(boolean on), expand()
    • setAnimation

      public void setAnimation​(WAnimation transition)
      Sets an animation.

      The animation is used when collapsing or expanding the panel.

    • setCentralWidget

      public void setCentralWidget​(WWidget w)
      Sets the central widget.

      Sets the widget that is the contents of the panel. When a widget was previously set, the old widget is deleted first.

      The default value is null (no widget set).

    • getCentralWidget

      public WWidget getCentralWidget()
      Returns the central widget.

      See Also:
      setCentralWidget(WWidget w)
    • collapsed

      public Signal collapsed()
      Signal emitted when the panel is collapsed.

      Signal emitted when the panel is collapsed. The signal is only emitted when the panel is collapsed by the user using the collapse icon in the tible bar, not when calling setCollapsed().

      See Also:
      expanded()
    • expanded

      public Signal expanded()
      Signal emitted when the panel is expanded.

      Signal emitted when the panel is expanded. The signal is only emitted when the panel is expanded by the user using the expand icon in the title bar, not when calling setCollapsed().

      See Also:
      collapsed()