Class Clamp.Builder<B extends Clamp.Builder<B>>

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

public static class Clamp.Builder<B extends Clamp.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>, Orientable.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 Clamp build()
      Finish building the Clamp object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Clamp.
      Overrides:
      build in class Widget.Builder<B extends Clamp.Builder<B>>
      Returns:
      a new instance of Clamp with the properties that were set in the Builder object.
    • setChild

      public B setChild(Widget child)
      The child widget of the AdwClamp.
      Parameters:
      child - the value for the child property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMaximumSize

      public B setMaximumSize(int maximumSize)

      The maximum size allocated to the child.

      It is the width if the clamp is horizontal, or the height if it is vertical.

      Parameters:
      maximumSize - the value for the maximum-size property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTighteningThreshold

      public B setTighteningThreshold(int tighteningThreshold)

      The size above which the child is clamped.

      Starting from this size, the clamp will tighten its grip on the child, slowly allocating less and less of the available size up to the maximum allocated size. Below that threshold and below the maximum size, the child will be allocated all the available size.

      If the threshold is greater than the maximum size to allocate to the child, the child will be allocated all the size up to the maximum. If the threshold is lower than the minimum size to allocate to the child, that size will be used as the tightening threshold.

      Effectively, tightening the grip on the child before it reaches its maximum size makes transitions to and from the maximum size smoother when resizing.

      Parameters:
      tighteningThreshold - the value for the tightening-threshold property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setUnit

      public B setUnit(LengthUnit unit)

      The length unit for maximum size and tightening threshold.

      Allows the sizes to vary depending on the text scale factor.

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