Class Avatar.Builder<B extends Avatar.Builder<B>>

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

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

    • Builder

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

    • build

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

      public B setCustomImage(Paintable customImage)

      A custom image paintable.

      Custom image is displayed instead of initials or icon.

      Parameters:
      customImage - the value for the custom-image property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setIconName

      public B setIconName(String iconName)

      The name of an icon to use as a fallback.

      If no name is set, adw-avatar-default-symbolic will be used.

      Parameters:
      iconName - the value for the icon-name property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setShowInitials

      public B setShowInitials(boolean showInitials)

      Whether initials are used instead of an icon on the fallback avatar.

      See Avatar:icon-name for how to change the fallback icon.

      Parameters:
      showInitials - the value for the show-initials property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSize

      public B setSize(int size)
      The size of the avatar.
      Parameters:
      size - the value for the size property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setText

      public B setText(String text)

      Sets the text used to generate the fallback initials and color.

      It's only used to generate the color if Avatar:show-initials is FALSE.

      Parameters:
      text - the value for the text property
      Returns:
      the Builder instance is returned, to allow method chaining