Class LightColumnLayout

  • All Implemented Interfaces:
    ILightLayout

    public final class LightColumnLayout
    extends Object
    implements ILightLayout
    This layout manager arranges children of the composite parent in vertical columns. All the columns are identical size and children are stretched horizontally to fill the column width. The goal is to give layout some reasonable range of column numbers to allow it to handle various parent widths. That way, column number will drop to the lowest number in the range when width decreases, and grow up to the highest number in the range when allowed by the parent width.

    In addition, the layout attempts to 'fill the space' equally i.e. to avoid large gaps at the and of the last column.

    Child controls are layed out according to their 'natural' (preferred) size. For 'stretchy' controls that do not have natural preferred size, it is possible to set width and/or height hints using ColumnLayoutData objects.

    Since:
    3.0
    See Also:
    ColumnLayoutData
    • Field Detail

      • minNumColumns

        public int minNumColumns
        Minimum number of columns (default is 1).
      • maxNumColumns

        public int maxNumColumns
        Maximum number of columns (default is 3).
      • horizontalSpacing

        public int horizontalSpacing
        Horizontal spacing between columns (default is 5).
      • verticalSpacing

        public int verticalSpacing
        Vertical spacing between controls (default is 5).
      • topMargin

        public int topMargin
        Top margin (default is 5).
      • leftMargin

        public int leftMargin
        Left margin (default is 5).
      • bottomMargin

        public int bottomMargin
        Bottom margin (default is 5).
      • rightMargin

        public int rightMargin
        Right margin (default is 5).
    • Constructor Detail

      • LightColumnLayout

        public LightColumnLayout()
        Creates a new instance of the column layout.
    • Method Detail

      • computeSize

        public org.eclipse.swt.graphics.Point computeSize​(ILightComposite composite,
                                                          org.eclipse.swt.graphics.GC gc,
                                                          int wHint,
                                                          int hHint,
                                                          boolean flushCache)
        Description copied from interface: ILightLayout
        Computes the size of the given composite.
        Specified by:
        computeSize in interface ILightLayout
        Parameters:
        composite - the composite to compute the size of.
        gc - the GC to do the measurements with.
        wHint - the width hint.
        hHint - the height hint.
        flushCache - the flush cache flag, instructs the layout to reset all its caches, if any.
        Returns:
      • layout

        public void layout​(ILightComposite parent,
                           org.eclipse.swt.graphics.GC gc,
                           boolean flushCache)
        Description copied from interface: ILightLayout
        Layouts the given composite.
        Specified by:
        layout in interface ILightLayout
        Parameters:
        parent - the composite to layout.
        gc - the GC to do the measurements with.
        flushCache - the flush cache flag, instructs the layout to reset all its caches, if any.
      • computeMaximumWidth

        public int computeMaximumWidth​(ILightComposite parent,
                                       org.eclipse.swt.graphics.GC gc,
                                       boolean changed)
      • computeMinimumWidth

        public int computeMinimumWidth​(ILightComposite parent,
                                       org.eclipse.swt.graphics.GC gc,
                                       boolean changed)
      • flushCache

        public boolean flushCache​(ILightControl control)
        Description copied from interface: ILightLayout
        Flushes the layout cache for the given control.
        Specified by:
        flushCache in interface ILightLayout
        Parameters:
        control - the control to flush the cache for.
        Returns:
        true if the layout has flushed the cache, false otherwise.