Interface LayoutBuilder


  • public interface LayoutBuilder
    A LayoutBuilder provides a specific Layout instance. The Builder pattern is more suitable for the Layout instantiation to allow simpler reusability of Layout's code.

    Only the LayoutBuilder of a given layout algorithm is exposed, this way, one can devise different layout algorithms (represented by their respective LayoutBuilder) that uses a same underlying Layout implementation, but that differs only by an aggregation, composition or a property that is set only during instantiation time.

    See ClockwiseRotate and CounterClockwiseRotate for a simple example of this pattern. Both are LayoutBuilders that instanciate Layouts with a different behaviour (the direction of rotation), but both uses the RotateLayout class. The only difference is the angle provided by the LayoutBuilder on the time of instantiation of the RotateLayout object.

    Author:
    Helder Suzuki
    • Method Detail

      • getName

        String getName()
        The name of the behaviour of the Layout's provided by this Builder.
        Returns:
        the display neame of the layout algorithm
      • getUI

        LayoutUI getUI()
        User interface attributes (name, description, icon...) for all Layouts built by this builder.
        Returns:
        a LayoutUI instance
      • buildLayout

        Layout buildLayout()
        Builds an instance of the Layout.
        Returns:
        a new Layout instance