com.jgoodies.forms.layout
Class FormLayout.ComponentSizeCache

java.lang.Object
  extended by com.jgoodies.forms.layout.FormLayout.ComponentSizeCache
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
FormLayout

private static final class FormLayout.ComponentSizeCache
extends java.lang.Object
implements java.io.Serializable

A cache for component minimum and preferred sizes. Used to reduce the requests to determine a component's size.


Field Summary
private  java.util.Map minimumSizes
          Maps components to their minimum sizes.
private  java.util.Map preferredSizes
          Maps components to their preferred sizes.
 
Constructor Summary
private FormLayout.ComponentSizeCache(int initialCapacity)
          Constructs a ComponentSizeCache.
 
Method Summary
(package private)  java.awt.Dimension getMinimumSize(java.awt.Component component)
          Returns the minimum size for the given component.
(package private)  java.awt.Dimension getPreferredSize(java.awt.Component component)
          Returns the preferred size for the given component.
(package private)  void invalidate()
          Invalidates the cache.
(package private)  void removeEntry(java.awt.Component component)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minimumSizes

private final java.util.Map minimumSizes
Maps components to their minimum sizes.


preferredSizes

private final java.util.Map preferredSizes
Maps components to their preferred sizes.

Constructor Detail

FormLayout.ComponentSizeCache

private FormLayout.ComponentSizeCache(int initialCapacity)
Constructs a ComponentSizeCache.

Parameters:
initialCapacity - the initial cache capacity
Method Detail

invalidate

void invalidate()
Invalidates the cache. Clears all stored size information.


getMinimumSize

java.awt.Dimension getMinimumSize(java.awt.Component component)
Returns the minimum size for the given component. Tries to look up the value from the cache; lazily creates the value if it has not been requested before.

Parameters:
component - the component to compute the minimum size
Returns:
the component's minimum size

getPreferredSize

java.awt.Dimension getPreferredSize(java.awt.Component component)
Returns the preferred size for the given component. Tries to look up the value from the cache; lazily creates the value if it has not been requested before.

Parameters:
component - the component to compute the preferred size
Returns:
the component's preferred size

removeEntry

void removeEntry(java.awt.Component component)