Class WPopupWidget

Direct Known Subclasses:
WDialog, WSuggestionPopup

public class WPopupWidget extends WCompositeWidget
Base class for popup widgets.

A popup widget anchors to another widget, for which it usually provides additional information or assists in editing, etc...

The popup widget will position itself relative to the anchor widget by taking into account available space, and switching sides if necessary to fit the widget into the current window. For example, a vertically anchored widget will by default be a "drop-down", positioning itself under the anchor widget, but it may also choose to position itself above the anchor widget if space is lacking below.

  • Constructor Details

    • WPopupWidget

      public WPopupWidget(WWidget impl)
      Constructor.

      You need to pass in a widget that provides the main contents of the widget (e.g. a WTemplate or WContainerWidget).

      Unlike other widgets, a popup widget is a top-level widget that should not be added to another container.

  • Method Details

    • remove

      public void remove()
      Destructor.
      Overrides:
      remove in class WCompositeWidget
      See Also:
    • setAnchorWidget

      public void setAnchorWidget(WWidget anchorWidget, Orientation orientation)
      Sets an anchor widget.

      A vertical popup will show below (or above) the widget, while a horizontal popup will show right (or left) of the widget.

    • setAnchorWidget

      public final void setAnchorWidget(WWidget anchorWidget)
    • getAnchorWidget

      public WWidget getAnchorWidget()
    • getOrientation

      public Orientation getOrientation()
      Returns the orientation.
    • setTransient

      public void setTransient(boolean isTransient, int autoHideDelay)
      Sets transient property.

      A transient popup will automatically hide when the user clicks outside of the popup. When autoHideDelay is not 0, then it will also automatically hide when the user moves the mouse outside the widget for longer than this delay (in ms).

    • setTransient

      public final void setTransient(boolean isTransient)
      Sets transient property.

      Calls setTransient(isTransient, 0)

    • isTransient

      public boolean isTransient()
      Returns whether the popup is transient.

      See Also:
    • getAutoHideDelay

      public int getAutoHideDelay()
      Returns the auto-hide delay.

      See Also:
    • setHidden

      public void setHidden(boolean hidden, WAnimation animation)
      Description copied from class: WWidget
      Hides or shows the widget.

      Hides or show the widget (including all its descendant widgets). When setting hidden = false, this widget and all descendant widgets that are not hidden will be shown. A widget is only visible if it and all its ancestors in the widget tree are visible, which may be checked using isVisible().

      Overrides:
      setHidden in class WCompositeWidget
    • hidden

      public Signal hidden()
      Signal emitted when the popup is hidden.

      This signal is emitted when the popup is being hidden because of a client-side event (not when setHidden() or WWidget.hide() is called).

    • shown

      public Signal shown()
      Signal emitted when the popup is shown.

      This signal is emitted when the popup is being shown because of a client-side event (not when setHidden() or WWidget.show() is called).

    • render

      protected void render(EnumSet<RenderFlag> flags)
      Description copied from class: WWidget
      Renders the widget.

      This function renders the widget (or an update for the widget), after this has been scheduled using scheduleRender().

      The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.

      Overrides:
      render in class WCompositeWidget
    • onPathChange

      protected void onPathChange()