Class BottomSheet.Builder<B extends BottomSheet.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, BuilderInterface
Enclosing class:
BottomSheet

public static class BottomSheet.Builder<B extends BottomSheet.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
1.6
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public BottomSheet build()
      Finish building the BottomSheet object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to BottomSheet.
      Overrides:
      build in class Widget.Builder<B extends BottomSheet.Builder<B>>
      Returns:
      a new instance of BottomSheet with the properties that were set in the Builder object.
    • setAlign

      public B setAlign(float align)

      Horizontal alignment of the bottom sheet.

      0 means the bottom sheet is flush with the start edge, 1 means it's flush with the end edge. 0.5 means it's centered.

      Only used when BottomSheet:full-width is set to FALSE.

      Parameters:
      align - the value for the align property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • setBottomBar

      public B setBottomBar(Widget bottomBar)

      The bottom bar widget.

      Shown when BottomSheet:open is FALSE. When open, morphs into the BottomSheet:sheet.

      Bottom bar can be temporarily hidden using the BottomSheet:reveal-bottom-bar property.

      Parameters:
      bottomBar - the value for the bottom-bar property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • setCanClose

      public B setCanClose(boolean canClose)

      Whether the bottom sheet can be closed by user.

      It can be closed via the close button, swiping down, pressing Escape or clicking the content dimming (when modal).

      Bottom sheet can still be closed using BottomSheet:open.

      Parameters:
      canClose - the value for the can-close property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • setCanOpen

      public B setCanOpen(boolean canOpen)

      Whether the bottom sheet can be opened by user.

      It can be opened via clicking or swiping up from the bottom bar.

      Does nothing if BottomSheet:bottom-bar is not set.

      Bottom sheet can still be opened using BottomSheet:open.

      Parameters:
      canOpen - the value for the can-open property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • setContent

      public B setContent(Widget content)

      The content widget.

      It's always shown, and the bottom sheet is overlaid over it.

      Parameters:
      content - the value for the content property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • setFullWidth

      public B setFullWidth(boolean fullWidth)

      Whether the bottom sheet takes the full width.

      When full width, BottomSheet:align is ignored.

      Parameters:
      fullWidth - the value for the full-width property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • setModal

      public B setModal(boolean modal)

      Whether the bottom sheet is modal.

      When modal, BottomSheet:content will be dimmed when the bottom sheet is open, and clicking it will close the bottom sheet. It also cannot be focused with keyboard.

      Otherwise, the content is accessible even when the bottom sheet is open.

      Parameters:
      modal - the value for the modal property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • setOpen

      public B setOpen(boolean open)
      Whether the bottom sheet is open.
      Parameters:
      open - the value for the open property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • setRevealBottomBar

      public B setRevealBottomBar(boolean revealBottomBar)

      Whether to reveal the bottom bar.

      The transition will be animated.

      See BottomSheet:bottom-bar and BottomSheet:bottom-bar-height.

      Parameters:
      revealBottomBar - the value for the reveal-bottom-bar property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setSheet

      public B setSheet(Widget sheet)

      The bottom sheet widget.

      Only shown when BottomSheet:open is TRUE.

      Parameters:
      sheet - the value for the sheet property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • setShowDragHandle

      public B setShowDragHandle(boolean showDragHandle)

      Whether to overlay a drag handle in the bottom sheet.

      The handle will be overlaid over BottomSheet:sheet.

      When the handle is shown, HeaderBar will hide its default title, and ToolbarView will reserve space if there are no top bars.

      Showing drag handle also allows to swipe the bottom sheet down (and to swipe the bottom bar up) with a pointer, instead of just touchscreen.

      Parameters:
      showDragHandle - the value for the show-drag-handle property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
    • onCloseAttempt

      public B onCloseAttempt(BottomSheet.CloseAttemptCallback handler)
      Emitted when the close button or shortcut is used while Dialog:can-close is set to FALSE.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.6
      See Also: