Interface ComponentBuilder<T,​C extends JComponent,​B extends ComponentBuilder<T,​C,​B>>

    • Field Detail

      • TRANSFER_FOCUS_ON_ENTER

        static final PropertyValue<Boolean> TRANSFER_FOCUS_ON_ENTER
        Specifies whether focus should be transferred from components on enter.
        Note that for JTextArea CTRL is added to move focus forward and CTRL + SHIFT to move it backwards
        Value type: Boolean
        Default value: false
    • Method Detail

      • focusable

        B focusable​(boolean focusable)
        Parameters:
        focusable - false if the component should not be focusable
        Returns:
        this builder instance
        See Also:
        Component.setFocusable(boolean)
      • preferredHeight

        B preferredHeight​(int preferredHeight)
        Parameters:
        preferredHeight - the preferred component height
        Returns:
        this builder instance
      • preferredWidth

        B preferredWidth​(int preferredWidth)
        Parameters:
        preferredWidth - the preferred component width
        Returns:
        this builder instance
      • maximumHeight

        B maximumHeight​(int maximumHeight)
        Parameters:
        maximumHeight - the maximum component height
        Returns:
        this builder instance
      • maximumWidth

        B maximumWidth​(int maximumWidth)
        Parameters:
        maximumWidth - the maximum component width
        Returns:
        this builder instance
      • minimumHeight

        B minimumHeight​(int minimumHeight)
        Parameters:
        minimumHeight - the minimum component height
        Returns:
        this builder instance
      • minimumWidth

        B minimumWidth​(int minimumWidth)
        Parameters:
        minimumWidth - the minimum component width
        Returns:
        this builder instance
      • transferFocusOnEnter

        B transferFocusOnEnter​(boolean transferFocusOnEnter)
        Note that for JTextArea CTRL is added to move focus forward and CTRL + SHIFT to move it backwards
        Parameters:
        transferFocusOnEnter - if true then the text field transfer focus on enter (shift-enter for backwards)
        Returns:
        this builder instance
      • enabledState

        B enabledState​(StateObserver enabledState)
        Parameters:
        enabledState - the state controlling the component enabled status
        Returns:
        this builder instance
      • popupMenuControl

        B popupMenuControl​(Control popupMenuControl)
        Parameters:
        popupMenuControl - the control to base a popup menu on
        Returns:
        this builder instance
      • popupMenuControls

        B popupMenuControls​(Controls popupMenuControls)
        Parameters:
        popupMenuControls - the controls to base a popup menu on
        Returns:
        this builder instance
      • opaque

        B opaque​(boolean opaque)
        Parameters:
        opaque - true if the component should be opaque
        Returns:
        this builder instance
        See Also:
        JComponent.setOpaque(boolean)
      • validator

        B validator​(Value.Validator<T> validator)
        Parameters:
        validator - the validator to use
        Returns:
        this builder instance
      • onSetVisible

        B onSetVisible​(Consumer<C> onSetVisible)
        Parameters:
        onSetVisible - called when the component is made visible for the first time
        Returns:
        this builder instance
      • linkedValue

        B linkedValue​(Value<T> linkedValue)
        Creates a bidirectional link to the given value. Overrides any initial value set.
        Parameters:
        linkedValue - a value to link to the component value
        Returns:
        this builder instance
      • linkedValueObserver

        B linkedValueObserver​(ValueObserver<T> linkedValueObserver)
        Creates a read-only link to the given ValueObserver.
        Parameters:
        linkedValueObserver - a value to link to the component value
        Returns:
        this builder instance
      • initialValue

        B initialValue​(T initialValue)
        Sets the initial value for the component, overridden by linkedValue(Value). Note that null is not explicitely set, the component is assumed to represent the null value right after it's been created.
        Parameters:
        initialValue - the initial value
        Returns:
        this builder instance
      • onBuild

        B onBuild​(Consumer<C> onBuild)
        Parameters:
        onBuild - called when the component has been built, before any values are linked, not called on subsequent calls until clear() has been called.
        Returns:
        this builder instance
      • build

        C build()
        Builds and returns the component, note that subsequent calls return the same component until clear() has been called.
        Returns:
        the component
      • build

        C build​(Consumer<C> onBuild)
        Builds and returns the component, note that subsequent calls return the same component until clear() has been called.
        Parameters:
        onBuild - called after the first call when the component is built, before any values are linked, not called on subsequent calls.
        Returns:
        the component
      • clear

        B clear()
        Clears this builder so that it builds a new instance on next call to build() or buildValue().
        Returns:
        this builder instance
      • buildValue

        ComponentValue<T,​C> buildValue()
        Builds and returns the component value, note that subsequent calls return the same component value until clear() has been called.
        Returns:
        the component value