Class Sizes.ComponentSize

java.lang.Object
com.jgoodies.forms.layout.Sizes.ComponentSize
All Implemented Interfaces:
Size, Serializable
Enclosing class:
Sizes

static final class Sizes.ComponentSize extends Object implements Size, Serializable
An ordinal-based serializable typesafe enumeration that implements the Size interface for the component sizes: min, pref, default.
  • Field Details

    • name

      private final transient String name
    • nextOrdinal

      private static int nextOrdinal
    • ordinal

      private final int ordinal
  • Constructor Details

    • ComponentSize

      private ComponentSize(String name)
  • Method Details

    • valueOf

      static Sizes.ComponentSize valueOf(String str)
      Returns an instance of ComponentSize that corresponds to the specified string.
      Parameters:
      str - the encoded component size
      Returns:
      the corresponding ComponentSize or null if none matches
    • maximumSize

      public int maximumSize(Container container, List components, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, FormLayout.Measure defaultMeasure)
      Computes the maximum size for the given list of components, using this form spec and the specified measure.

      Invoked by FormLayout to determine the size of one of my elements

      Specified by:
      maximumSize in interface Size
      Parameters:
      container - the layout container
      components - the list of components to measure
      minMeasure - the measure used to determine the minimum size
      prefMeasure - the measure used to determine the preferred size
      defaultMeasure - the measure used to determine the default size
      Returns:
      the maximum size in pixels for the given list of components
    • compressible

      public boolean compressible()
      Describes if this Size can be compressed, if container space gets scarce. Used by the FormLayout size computations in #compressedSizes to check whether a column or row can be compressed or not.

      The DEFAULT ComponentSize is compressible, MINIMUM and PREFERRED are incompressible.

      Specified by:
      compressible in interface Size
      Returns:
      true for the DEFAULT size, false otherwise
      Since:
      1.1
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • encode

      public String encode()
      Returns a parseable string representation of this ComponentSize.
      Specified by:
      encode in interface Size
      Returns:
      a String that can be parsed by the Forms parser
      Since:
      1.2
    • readResolve

      private Object readResolve()