Class GridFlowLayout

java.lang.Object
org.nuiton.jaxx.widgets.extra.GridFlowLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2

public class GridFlowLayout
extends java.lang.Object
implements java.awt.LayoutManager2
Ce layout place les composants de gauche à droite ou de droite à gauche selon la valeur de Component.getComponentOrientation(). Si un composant n'a pas assez de place pour se mettre sur la ligne courant, il est mis sur la ligne suivante et les composants sont redimensionnés pour prendre le maximum de place disponible sur la ligne. Si le container est dans un JViewport (ou JScrollPane), ce layout essai de ne jamais faire apparaitre le ScrollBar horizontal.

Tous les composants ont la même taille.

  • Field Summary

    Fields
    Modifier and Type Field Description
    protected java.util.Map<java.awt.Component,​java.lang.Object> positions  
  • Constructor Summary

    Constructors
    Constructor Description
    GridFlowLayout()
    GridFlowLayout constructor make a GridFlowLayout with default value (1) for gap
    GridFlowLayout​(int hgap, int vgap)
    GridFlowLayout constructor
  • Method Summary

    Modifier and Type Method Description
    void addLayoutComponent​(java.awt.Component comp, java.lang.Object constraints)
    Method addLayoutComponent
    void addLayoutComponent​(java.lang.String name, java.awt.Component comp)
    Method addLayoutComponent
    java.awt.Component[] computeOrder​(java.awt.Component[] components)
    Method []
    protected int getComponentVisibleCount​(java.awt.Container parent)
    Method getComponentVisibleCount
    java.lang.Number getConstraints​(java.awt.Component comp)
    Method getConstraints
    int getHgap()
    Gets the horizontal gap between components.
    float getLayoutAlignmentX​(java.awt.Container target)
    Method getLayoutAlignmentX
    float getLayoutAlignmentY​(java.awt.Container target)
    Method getLayoutAlignmentY
    protected java.awt.Dimension getMaxWidthHeight​(java.awt.Container parent)
    Method getMaxWidthHeight
    protected java.awt.Dimension getMinWidthHeight​(java.awt.Container parent)
    Method getMinWidthHeight
    int getVgap()
    Gets the vertical gap between components.
    void invalidateLayout​(java.awt.Container target)
    Method invalidateLayout
    void layoutContainer​(java.awt.Container parent)
    Method layoutContainer
    static void main​(java.lang.String[] args)  
    java.awt.Dimension maximumLayoutSize​(java.awt.Container target)
    Method maximumLayoutSize
    java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)
    Method minimumLayoutSize
    java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)
    Method preferredLayoutSize
    void removeLayoutComponent​(java.awt.Component comp)
    Method removeLayoutComponent
    void setConstraints​(java.awt.Component comp, java.lang.Number constraints)
    Method setConstraints
    void setHgap​(int hgap)
    Sets the horizontal gap between components.
    void setVgap​(int vgap)
    Sets the vertical gap between components.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • positions

      protected java.util.Map<java.awt.Component,​java.lang.Object> positions
  • Constructor Details

    • GridFlowLayout

      public GridFlowLayout()
      GridFlowLayout constructor make a GridFlowLayout with default value (1) for gap
    • GridFlowLayout

      public GridFlowLayout​(int hgap, int vgap)
      GridFlowLayout constructor
      Parameters:
      hgap - the horizontal gap between two components
      vgap - the vertical gap between two components
  • Method Details

    • getHgap

      public int getHgap()
      Gets the horizontal gap between components.
      Returns:
      the horizontal gap between components
      See Also:
      setHgap(int)
    • setHgap

      public void setHgap​(int hgap)
      Sets the horizontal gap between components.
      Parameters:
      hgap - the horizontal gap between components
      See Also:
      getHgap()
    • getVgap

      public int getVgap()
      Gets the vertical gap between components.
      Returns:
      the vertical gap between components
      See Also:
      setVgap(int)
    • setVgap

      public void setVgap​(int vgap)
      Sets the vertical gap between components.
      Parameters:
      vgap - the vertical gap between components
      See Also:
      getVgap()
    • addLayoutComponent

      public void addLayoutComponent​(java.awt.Component comp, java.lang.Object constraints)
      Method addLayoutComponent
      Specified by:
      addLayoutComponent in interface java.awt.LayoutManager2
      Parameters:
      comp - the component to add
      constraints - a constraint which is a Number (position)
    • setConstraints

      public void setConstraints​(java.awt.Component comp, java.lang.Number constraints)
      Method setConstraints
      Parameters:
      comp - the compoenent
      constraints -
    • getConstraints

      public java.lang.Number getConstraints​(java.awt.Component comp)
      Method getConstraints
      Parameters:
      comp -
      Returns:
      a number that corresponding to the constraint
    • getLayoutAlignmentX

      public float getLayoutAlignmentX​(java.awt.Container target)
      Method getLayoutAlignmentX
      Specified by:
      getLayoutAlignmentX in interface java.awt.LayoutManager2
      Parameters:
      target -
      Returns:
      the X layout alignement
    • getLayoutAlignmentY

      public float getLayoutAlignmentY​(java.awt.Container target)
      Method getLayoutAlignmentY
      Specified by:
      getLayoutAlignmentY in interface java.awt.LayoutManager2
      Parameters:
      target -
      Returns:
      the Y layout alignement
    • invalidateLayout

      public void invalidateLayout​(java.awt.Container target)
      Method invalidateLayout
      Specified by:
      invalidateLayout in interface java.awt.LayoutManager2
      Parameters:
      target -
    • addLayoutComponent

      public void addLayoutComponent​(java.lang.String name, java.awt.Component comp)
      Method addLayoutComponent
      Specified by:
      addLayoutComponent in interface java.awt.LayoutManager
      Parameters:
      name -
      comp -
    • minimumLayoutSize

      public java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)
      Method minimumLayoutSize
      Specified by:
      minimumLayoutSize in interface java.awt.LayoutManager
      Parameters:
      parent -
      Returns:
      the minimum dimension of the layout
    • preferredLayoutSize

      public java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)
      Method preferredLayoutSize
      Specified by:
      preferredLayoutSize in interface java.awt.LayoutManager
      Parameters:
      parent -
      Returns:
      the preferred dimension of the layout
    • maximumLayoutSize

      public java.awt.Dimension maximumLayoutSize​(java.awt.Container target)
      Method maximumLayoutSize
      Specified by:
      maximumLayoutSize in interface java.awt.LayoutManager2
      Parameters:
      target -
      Returns:
      the max dimension of the layout
    • removeLayoutComponent

      public void removeLayoutComponent​(java.awt.Component comp)
      Method removeLayoutComponent
      Specified by:
      removeLayoutComponent in interface java.awt.LayoutManager
      Parameters:
      comp -
    • layoutContainer

      public void layoutContainer​(java.awt.Container parent)
      Method layoutContainer
      Specified by:
      layoutContainer in interface java.awt.LayoutManager
      Parameters:
      parent -
    • getComponentVisibleCount

      protected int getComponentVisibleCount​(java.awt.Container parent)
      Method getComponentVisibleCount
      Parameters:
      parent -
      Returns:
      an integer that corresponding to the number of visible components
    • getMaxWidthHeight

      protected java.awt.Dimension getMaxWidthHeight​(java.awt.Container parent)
      Method getMaxWidthHeight
      Parameters:
      parent -
      Returns:
      the max size
    • getMinWidthHeight

      protected java.awt.Dimension getMinWidthHeight​(java.awt.Container parent)
      Method getMinWidthHeight
      Parameters:
      parent -
      Returns:
      the dimension of this layout
    • computeOrder

      public java.awt.Component[] computeOrder​(java.awt.Component[] components)
      Method []
      Parameters:
      components -
      Returns:
      une tablean de composants contenus dans le layout
    • main

      public static void main​(java.lang.String[] args)