Class TwoColumnData


  • public final class TwoColumnData
    extends Object
    A grid data for TwoColumnLayout.

    Copy-pasted from GridData

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BEGINNING
      Value for horizontalAlignment or verticalAlignment.
      static int CENTER
      Value for horizontalAlignment or verticalAlignment.
      static int END
      Value for horizontalAlignment or verticalAlignment.
      boolean exclude
      exclude informs the layout to ignore this control when sizing and positioning controls.
      static int FILL
      Value for horizontalAlignment or verticalAlignment.
      static int FILL_BOTH
      Style bit for new SWTRendererGridData(int) to resize the control to fill the cell horizontally and vertically and to fit the remaining horizontal and vertical space.
      static int FILL_HORIZONTAL
      Style bit for new SWTRendererGridData(int) to resize the control to fill the cell horizontally and to fit the remaining horizontal space.
      static int FILL_VERTICAL
      Style bit for new SWTRendererGridData(int) to resize the control to fill the cell vertically and to fit the remaining vertical space.
      static int GRAB_HORIZONTAL
      Style bit for new SWTRendererGridData(int) to resize the control to fit the remaining horizontal space.
      static int GRAB_VERTICAL
      Style bit for new SWTRendererGridData(int) to resize the control to fit the remaining vertical space.
      boolean grabExcessHorizontalSpace
      grabExcessHorizontalSpace specifies whether the width of the cell changes depending on the size of the parent Composite.
      boolean grabExcessVerticalSpace
      grabExcessVerticalSpace specifies whether the height of the cell changes depending on the size of the parent Composite.
      int heightHint
      heightHint specifies the preferred height in pixels.
      static int HORIZONTAL_ALIGN_BEGINNING
      Style bit for new SWTRendererGridData(int) to position the control at the left of the cell.
      static int HORIZONTAL_ALIGN_CENTER
      Style bit for new SWTRendererGridData(int) to position the control in the horizontal center of the cell.
      static int HORIZONTAL_ALIGN_END
      Style bit for new SWTRendererGridData(int) to position the control at the right of the cell.
      static int HORIZONTAL_ALIGN_FILL
      Style bit for new SWTRendererGridData(int) to resize the control to fill the cell horizontally.
      int horizontalAlignment
      horizontalAlignment specifies how controls will be positioned horizontally within a cell.
      int horizontalIndent
      horizontalIndent specifies the number of pixels of indentation that will be placed along the left side of the cell.
      int horizontalSpan
      horizontalSpan specifies the number of column cells that the control will take up.
      int minimumHeight
      minimumHeight specifies the minimum height in pixels.
      int minimumWidth
      minimumWidth specifies the minimum width in pixels.
      static int VERTICAL_ALIGN_BEGINNING
      Style bit for new SWTRendererGridData(int).
      static int VERTICAL_ALIGN_CENTER
      Style bit for new SWTRendererGridData(int) to position the control in the vertical center of the cell.
      static int VERTICAL_ALIGN_END
      Style bit for new SWTRendererGridData(int) to position the control at the bottom of the cell.
      static int VERTICAL_ALIGN_FILL
      Style bit for new SWTRendererGridData(int) to resize the control to fill the cell vertically.
      int verticalAlignment
      verticalAlignment specifies how controls will be positioned vertically within a cell.
      int verticalIndent
      verticalIndent specifies the number of pixels of indentation that will be placed along the top side of the cell.
      int verticalSpan
      verticalSpan specifies the number of row cells that the control will take up.
      int widthHint
      widthHint specifies the preferred width in pixels.
    • Constructor Summary

      Constructors 
      Constructor Description
      TwoColumnData()
      Constructs a new instance of SWTRendererGridData using default values.
      TwoColumnData​(int style)
      Constructs a new instance based on the SWTRendererGridData style.
      TwoColumnData​(int width, int height)
      Constructs a new instance of SWTRendererGridData according to the parameters.
      TwoColumnData​(int horizontalAlignment, int verticalAlignment, boolean grabExcessHorizontalSpace, boolean grabExcessVerticalSpace)
      Constructs a new instance of SWTRendererGridData according to the parameters.
      TwoColumnData​(int horizontalAlignment, int verticalAlignment, boolean grabExcessHorizontalSpace, boolean grabExcessVerticalSpace, int horizontalSpan, int verticalSpan)
      Constructs a new instance of SWTRendererGridData according to the parameters.
    • Field Detail

      • verticalAlignment

        public int verticalAlignment
        verticalAlignment specifies how controls will be positioned vertically within a cell. The default value is CENTER. Possible values are:
        • SWT.BEGINNING (or SWT.TOP): Position the control at the top of the cell
        • SWT.CENTER: Position the control in the vertical center of the cell
        • SWT.END (or SWT.BOTTOM): Position the control at the bottom of the cell
        • SWT.FILL: Resize the control to fill the cell vertically
      • horizontalAlignment

        public int horizontalAlignment
        horizontalAlignment specifies how controls will be positioned horizontally within a cell. The default value is BEGINNING. Possible values are:
        • SWT.BEGINNING (or SWT.LEFT): Position the control at the left of the cell
        • SWT.CENTER: Position the control in the horizontal center of the cell
        • SWT.END (or SWT.RIGHT): Position the control at the right of the cell
        • SWT.FILL: Resize the control to fill the cell horizontally
      • widthHint

        public int widthHint
        widthHint specifies the preferred width in pixels. This value is the wHint passed into Control.computeSize(int, int, boolean) to determine the preferred size of the control. The default value is SWT.DEFAULT.
        See Also:
        Control.computeSize(int, int, boolean)
      • heightHint

        public int heightHint
        heightHint specifies the preferred height in pixels. This value is the hHint passed into Control.computeSize(int, int, boolean) to determine the preferred size of the control. The default value is SWT.DEFAULT.
        See Also:
        Control.computeSize(int, int, boolean)
      • horizontalIndent

        public int horizontalIndent
        horizontalIndent specifies the number of pixels of indentation that will be placed along the left side of the cell. The default value is 0.
      • verticalIndent

        public int verticalIndent
        verticalIndent specifies the number of pixels of indentation that will be placed along the top side of the cell. The default value is 0.
        Since:
        3.1
      • horizontalSpan

        public int horizontalSpan
        horizontalSpan specifies the number of column cells that the control will take up. The default value is 1.
      • verticalSpan

        public int verticalSpan
        verticalSpan specifies the number of row cells that the control will take up. The default value is 1.
      • grabExcessHorizontalSpace

        public boolean grabExcessHorizontalSpace

        grabExcessHorizontalSpace specifies whether the width of the cell changes depending on the size of the parent Composite. If grabExcessHorizontalSpace is true, the following rules apply to the width of the cell:

        • If extra horizontal space is available in the parent, the cell will grow to be wider than its preferred width. The new width will be "preferred width + delta" where delta is the extra horizontal space divided by the number of grabbing columns.
        • If there is not enough horizontal space available in the parent, the cell will shrink until it reaches its minimum width as specified by SWTRendererGridData.minimumWidth. The new width will be the maximum of "minimumWidth" and "preferred width - delta", where delta is the amount of space missing divided by the number of grabbing columns.
        • If the parent is packed, the cell will be its preferred width as specified by SWTRendererGridData.widthHint.
        • If the control spans multiple columns and there are no other grabbing controls in any of the spanned columns, the last column in the span will grab the extra space. If there is at least one other grabbing control in the span, the grabbing will be spread over the columns already marked as grabExcessHorizontalSpace.

        The default value is false.

        See Also:
        minimumWidth, widthHint
      • grabExcessVerticalSpace

        public boolean grabExcessVerticalSpace

        grabExcessVerticalSpace specifies whether the height of the cell changes depending on the size of the parent Composite. If grabExcessVerticalSpace is true, the following rules apply to the height of the cell:

        • If extra vertical space is available in the parent, the cell will grow to be taller than its preferred height. The new height will be "preferred height + delta" where delta is the extra vertical space divided by the number of grabbing rows.
        • If there is not enough vertical space available in the parent, the cell will shrink until it reaches its minimum height as specified by SWTRendererGridData.minimumHeight. The new height will be the maximum of "minimumHeight" and "preferred height - delta", where delta is the amount of space missing divided by the number of grabbing rows.
        • If the parent is packed, the cell will be its preferred height as specified by SWTRendererGridData.heightHint.
        • If the control spans multiple rows and there are no other grabbing controls in any of the spanned rows, the last row in the span will grab the extra space. If there is at least one other grabbing control in the span, the grabbing will be spread over the rows already marked as grabExcessVerticalSpace.

        The default value is false.

        See Also:
        minimumHeight, heightHint
      • minimumWidth

        public int minimumWidth
        minimumWidth specifies the minimum width in pixels. This value applies only if grabExcessHorizontalSpace is true. A value of SWT.DEFAULT means that the minimum width will be the result of Control.computeSize(int, int, boolean) where wHint is determined by SWTRendererGridData.widthHint. The default value is 0.
        Since:
        3.1
        See Also:
        Control.computeSize(int, int, boolean), widthHint
      • minimumHeight

        public int minimumHeight
        minimumHeight specifies the minimum height in pixels. This value applies only if grabExcessVerticalSpace is true. A value of SWT.DEFAULT means that the minimum height will be the result of Control.computeSize(int, int, boolean) where hHint is determined by SWTRendererGridData.heightHint. The default value is 0.
        Since:
        3.1
        See Also:
        Control.computeSize(int, int, boolean), heightHint
      • exclude

        public boolean exclude
        exclude informs the layout to ignore this control when sizing and positioning controls. If this value is true, the size and position of the control will not be managed by the layout. If this value is false, the size and position of the control will be computed and assigned. The default value is false.
        Since:
        3.1
      • BEGINNING

        public static final int BEGINNING
        Value for horizontalAlignment or verticalAlignment. Position the control at the top or left of the cell. Not recommended. Use SWT.BEGINNING, SWT.TOP or SWT.LEFT instead.
        See Also:
        Constant Field Values
      • CENTER

        public static final int CENTER
        Value for horizontalAlignment or verticalAlignment. Position the control in the vertical or horizontal center of the cell Not recommended. Use SWT.CENTER instead.
        See Also:
        Constant Field Values
      • END

        public static final int END
        Value for horizontalAlignment or verticalAlignment. Position the control at the bottom or right of the cell Not recommended. Use SWT.END, SWT.BOTTOM or SWT.RIGHT instead.
        See Also:
        Constant Field Values
      • FILL

        public static final int FILL
        Value for horizontalAlignment or verticalAlignment. Resize the control to fill the cell horizontally or vertically. Not recommended. Use SWT.FILL instead.
        See Also:
        Constant Field Values
      • VERTICAL_ALIGN_BEGINNING

        public static final int VERTICAL_ALIGN_BEGINNING
        Style bit for new SWTRendererGridData(int). Position the control at the top of the cell. Not recommended. Use new SWTRendererGridData(int, SWT.BEGINNING, boolean, boolean) instead.
        See Also:
        Constant Field Values
      • VERTICAL_ALIGN_CENTER

        public static final int VERTICAL_ALIGN_CENTER
        Style bit for new SWTRendererGridData(int) to position the control in the vertical center of the cell. Not recommended. Use new SWTRendererGridData(int, SWT.CENTER, boolean, boolean) instead.
        See Also:
        Constant Field Values
      • VERTICAL_ALIGN_END

        public static final int VERTICAL_ALIGN_END
        Style bit for new SWTRendererGridData(int) to position the control at the bottom of the cell. Not recommended. Use new SWTRendererGridData(int, SWT.END, boolean, boolean) instead.
        See Also:
        Constant Field Values
      • VERTICAL_ALIGN_FILL

        public static final int VERTICAL_ALIGN_FILL
        Style bit for new SWTRendererGridData(int) to resize the control to fill the cell vertically. Not recommended. Use new SWTRendererGridData(int, SWT.FILL, boolean, boolean) instead
        See Also:
        Constant Field Values
      • HORIZONTAL_ALIGN_BEGINNING

        public static final int HORIZONTAL_ALIGN_BEGINNING
        Style bit for new SWTRendererGridData(int) to position the control at the left of the cell. Not recommended. Use new SWTRendererGridData(SWT.BEGINNING, int, boolean, boolean) instead.
        See Also:
        Constant Field Values
      • HORIZONTAL_ALIGN_CENTER

        public static final int HORIZONTAL_ALIGN_CENTER
        Style bit for new SWTRendererGridData(int) to position the control in the horizontal center of the cell. Not recommended. Use new SWTRendererGridData(SWT.CENTER, int, boolean, boolean) instead.
        See Also:
        Constant Field Values
      • HORIZONTAL_ALIGN_END

        public static final int HORIZONTAL_ALIGN_END
        Style bit for new SWTRendererGridData(int) to position the control at the right of the cell. Not recommended. Use new SWTRendererGridData(SWT.END, int, boolean, boolean) instead.
        See Also:
        Constant Field Values
      • HORIZONTAL_ALIGN_FILL

        public static final int HORIZONTAL_ALIGN_FILL
        Style bit for new SWTRendererGridData(int) to resize the control to fill the cell horizontally. Not recommended. Use new SWTRendererGridData(SWT.FILL, int, boolean, boolean) instead.
        See Also:
        Constant Field Values
      • GRAB_HORIZONTAL

        public static final int GRAB_HORIZONTAL
        Style bit for new SWTRendererGridData(int) to resize the control to fit the remaining horizontal space. Not recommended. Use new SWTRendererGridData(int, int, true, boolean) instead.
        See Also:
        Constant Field Values
      • GRAB_VERTICAL

        public static final int GRAB_VERTICAL
        Style bit for new SWTRendererGridData(int) to resize the control to fit the remaining vertical space. Not recommended. Use new SWTRendererGridData(int, int, boolean, true) instead.
        See Also:
        Constant Field Values
      • FILL_VERTICAL

        public static final int FILL_VERTICAL
        Style bit for new SWTRendererGridData(int) to resize the control to fill the cell vertically and to fit the remaining vertical space. FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL Not recommended. Use new SWTRendererGridData(int, SWT.FILL, boolean, true) instead.
        See Also:
        Constant Field Values
      • FILL_HORIZONTAL

        public static final int FILL_HORIZONTAL
        Style bit for new SWTRendererGridData(int) to resize the control to fill the cell horizontally and to fit the remaining horizontal space. FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL Not recommended. Use new SWTRendererGridData(SWT.FILL, int, true, boolean) instead.
        See Also:
        Constant Field Values
      • FILL_BOTH

        public static final int FILL_BOTH
        Style bit for new SWTRendererGridData(int) to resize the control to fill the cell horizontally and vertically and to fit the remaining horizontal and vertical space. FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL Not recommended. Use new SWTRendererGridData(SWT.FILL, SWT.FILL, true, true) instead.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TwoColumnData

        public TwoColumnData()
        Constructs a new instance of SWTRendererGridData using default values.
      • TwoColumnData

        public TwoColumnData​(int style)
        Constructs a new instance based on the SWTRendererGridData style. This constructor is not recommended.
        Parameters:
        style - the SWTRendererGridData style
      • TwoColumnData

        public TwoColumnData​(int horizontalAlignment,
                             int verticalAlignment,
                             boolean grabExcessHorizontalSpace,
                             boolean grabExcessVerticalSpace)
        Constructs a new instance of SWTRendererGridData according to the parameters.
        Parameters:
        horizontalAlignment - how control will be positioned horizontally within a cell, one of: SWT.BEGINNING (or SWT.LEFT), SWT.CENTER, SWT.END (or SWT.RIGHT), or SWT.FILL
        verticalAlignment - how control will be positioned vertically within a cell, one of: SWT.BEGINNING (or SWT.TOP), SWT.CENTER, SWT.END (or SWT.BOTTOM), or SWT.FILL
        grabExcessHorizontalSpace - whether cell will be made wide enough to fit the remaining horizontal space
        grabExcessVerticalSpace - whether cell will be made high enough to fit the remaining vertical space
        Since:
        3.0
      • TwoColumnData

        public TwoColumnData​(int horizontalAlignment,
                             int verticalAlignment,
                             boolean grabExcessHorizontalSpace,
                             boolean grabExcessVerticalSpace,
                             int horizontalSpan,
                             int verticalSpan)
        Constructs a new instance of SWTRendererGridData according to the parameters.
        Parameters:
        horizontalAlignment - how control will be positioned horizontally within a cell, one of: SWT.BEGINNING (or SWT.LEFT), SWT.CENTER, SWT.END (or SWT.RIGHT), or SWT.FILL
        verticalAlignment - how control will be positioned vertically within a cell, one of: SWT.BEGINNING (or SWT.TOP), SWT.CENTER, SWT.END (or SWT.BOTTOM), or SWT.FILL
        grabExcessHorizontalSpace - whether cell will be made wide enough to fit the remaining horizontal space
        grabExcessVerticalSpace - whether cell will be made high enough to fit the remaining vertical space
        horizontalSpan - the number of column cells that the control will take up
        verticalSpan - the number of row cells that the control will take up
        Since:
        3.0
      • TwoColumnData

        public TwoColumnData​(int width,
                             int height)
        Constructs a new instance of SWTRendererGridData according to the parameters. A value of SWT.DEFAULT indicates that no minimum width or no minimum height is specified.
        Parameters:
        width - a minimum width for the column
        height - a minimum height for the row
        Since:
        3.0
    • Method Detail

      • setWide

        public static TwoColumnData setWide​(org.eclipse.swt.widgets.Control control)
        Creates TwoColumnData object and initializes it to values suitable for elements that span both columns: the one for label and the one for field control. Eventually, sets layout of the given control to the created grid data.
        Parameters:
        control - a Control to set layout for
      • setLeft

        public static void setLeft​(org.eclipse.swt.widgets.Control control)
        Creates TwoColumnData object and initializes it to values suitable for elements that are placed in the 'labels' column of the grid.
        Parameters:
        control - a Control to set layout for
      • setRight

        public static TwoColumnData setRight​(org.eclipse.swt.widgets.Control control)
        Creates TwoColumnData object and initializes it to values suitable for elements that are placed in the 'fields' column of the grid.
        Parameters:
        control - a Control to set layout for
      • toString

        public String toString()
        Returns a string containing a concise, human-readable description of the receiver.
        Overrides:
        toString in class Object
        Returns:
        a string representation of the SWTRendererGridData object