Class AefGridLayoutDataFactory


  • public final class AefGridLayoutDataFactory
    extends Object
    Aef grid layout data factory. Helps to build AefGridLayoutData objects.
    • Method Detail

      • createFrom

        public static AefGridLayoutDataFactory createFrom​(AefGridLayoutData data)
        Creates a new AefGridLayoutDataFactory that creates copies of the given AefGridLayoutData by default.
        Parameters:
        data - AefGridLayoutData to copy
        Returns:
        a new AefGridLayoutDataFactory that creates copies of the argument by default
      • fillDefaults

        public static AefGridLayoutDataFactory fillDefaults()
        Creates a AefGridLayoutDataFactory initialized with default values.
        Returns:
        a AefGridLayoutDataFactory that makes controls fill their grid by default
      • span

        public AefGridLayoutDataFactory span​(int hSpan,
                                             int vSpan)
        Sets the AefGridLayoutData span. The span controls how many cells are filled by the control.
        Parameters:
        hSpan - number of columns spanned by the control
        vSpan - number of rows spanned by the control
        Returns:
        this
      • hint

        public AefGridLayoutDataFactory hint​(int xHint,
                                             int yHint)
        Sets the width and height hints. The width and height hints override the control's preferred size. If either hint is set to SWT.DEFAULT, the control's preferred size is used.
        Parameters:
        xHint - horizontal hint (pixels), or SWT.DEFAULT to use the control's preferred size
        yHint - vertical hint (pixels), or SWT.DEFAULT to use the control's preferred size
        Returns:
        this
      • align

        public AefGridLayoutDataFactory align​(int hAlign,
                                              int vAlign)
        Sets the alignment of the control within its cell.
        Parameters:
        hAlign - horizontal alignment. One of SWT.BEGINNING, SWT.CENTER, SWT.END, or SWT.FILL.
        vAlign - vertical alignment. One of SWT.BEGINNING, SWT.CENTER, SWT.END, or SWT.FILL.
        Returns:
        this
      • indent

        public AefGridLayoutDataFactory indent​(int hIndent,
                                               int vIndent)
        Sets the indent of the control within the cell. Moves the position of the control by the given number of pixels. Positive values move toward the lower-right, negative values move toward the upper-left.
        Parameters:
        hIndent - distance to move to the right (negative values move left)
        vIndent - distance to move down (negative values move up)
        Returns:
        this
      • grab

        public AefGridLayoutDataFactory grab​(boolean horizontal,
                                             boolean vertical)
        Determines whether extra horizontal or vertical space should be allocated to this control's column when the layout resizes. If any control in the column is set to grab horizontal then the whole column will grab horizontal space. If any control in the row is set to grab vertical then the whole row will grab vertical space.
        Parameters:
        horizontal - true if the control's column should grow horizontally
        vertical - true if the control's row should grow vertically
        Returns:
        this
      • minSize

        public AefGridLayoutDataFactory minSize​(int minX,
                                                int minY)
        Sets the minimum size for the control. The control will not be permitted to shrink below this size. Note: AefGridLayout treats a minimum size of 0 as an undocumented special value, so the smallest possible minimum size is a size of 1. A minimum size of SWT.DEFAULT indicates that the result of computeSize(int, int, boolean) should be used as the control's minimum size.
        Parameters:
        minX - minimum a value of 1 or more is a horizontal size of the control (pixels). SWT.DEFAULT indicates that the control's preferred size should be used. A size of 0 has special semantics defined by AefGridLayout.
        minY - minimum a value of 1 or more is a vertical size of the control (pixels). SWT.DEFAULT indicates that the control's preferred size should be used. A size of 0 has special semantics defined by AefGridLayout.
        Returns:
        this
      • exclude

        public AefGridLayoutDataFactory exclude​(boolean shouldExclude)
        Instructs the AefGridLayout to ignore this control when performing layouts.
        Parameters:
        shouldExclude - true iff the control should be excluded from layouts
        Returns:
        this
      • create

        public AefGridLayoutData create()
        Creates a new AefGridLayoutData instance. All attributes of the AefGridLayoutData instance will be initialized by the factory.
        Returns:
        a new AefGridLayoutData instance
      • applyTo

        public void applyTo​(ControlViewModel viewModel)
        Sets the layout data on the given control. Creates a new AefGridLayoutData instance and assigns it to the control view model.
        Parameters:
        viewModel - control view model whose layout data will be initialized
      • applyTo

        public AefGridLayoutDataFactory applyTo​(StandardComponent<?,​?>... components)
        Creates a new AefGridLayoutData instance and assigns it to the specified components.
        Parameters:
        components - the components to set layout data to
        Returns:
        this for chaining