Class FormLayoutUtils.ConstraintIterator

  • Enclosing class:
    FormLayoutUtils

    public static final class FormLayoutUtils.ConstraintIterator
    extends java.lang.Object
    Iterates over a FormLayout container's CellConstraints. The container's child component collection and the layout's constraints collection must not be changed during the iteration; otherwise the behavior of this iterator is unspecified and unsafe.
    See Also:
    FormLayout, CellConstraints
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.Component[] components
      Holds a copy of the container's components.
      private int index
      The current index in the component array.
      private FormLayout layout
      Refers to the FormLayout instance used to look up constraints.
    • Constructor Summary

      Constructors 
      Constructor Description
      ConstraintIterator​(java.awt.Container container)
      Constructs a ConstraintIterator for the given FormLayout container.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Returns true if the iteration has more elements.
      CellConstraints nextConstraints()
      Returns the next element in the iteration.
      • Methods inherited from class java.lang.Object

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

      • layout

        private final FormLayout layout
        Refers to the FormLayout instance used to look up constraints.
      • components

        private final java.awt.Component[] components
        Holds a copy of the container's components.
      • index

        private int index
        The current index in the component array. Used to determine whether there are more elements and to look up the next constraints.
    • Constructor Detail

      • ConstraintIterator

        public ConstraintIterator​(java.awt.Container container)
        Constructs a ConstraintIterator for the given FormLayout container. Useful to iterate over the container's CellConstraints.
        Parameters:
        container - the layout container
        Throws:
        java.lang.IllegalArgumentException - if the container's layout is not a FormLayout
    • Method Detail

      • hasNext

        public boolean hasNext()
        Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)
        Returns:
        true if the iterator has more elements.
      • nextConstraints

        public CellConstraints nextConstraints()
        Returns the next element in the iteration.
        Returns:
        the next element in the iteration.
        Throws:
        java.util.NoSuchElementException - iteration has no more elements.