com.alee.utils
Class ShapeCache

java.lang.Object
  extended by com.alee.utils.ShapeCache

public class ShapeCache
extends java.lang.Object

This utility class can be used to implement shape caching withing any painter or component. This might be useful to improve component painting performance in case it uses complex shapes.

Author:
Mikle Garin

Constructor Summary
ShapeCache()
           
 
Method Summary
static
<T extends java.awt.Shape>
T
getShape(java.awt.Component component, java.lang.String shapeId, DataProvider<T> shapeProvider, java.lang.Object... settings)
          Returns cached component shape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeCache

public ShapeCache()
Method Detail

getShape

public static <T extends java.awt.Shape> T getShape(java.awt.Component component,
                                                    java.lang.String shapeId,
                                                    DataProvider<T> shapeProvider,
                                                    java.lang.Object... settings)
Returns cached component shape. If shape is not yet cached it will be created. If shape settings are changed from the last time it was queued it will be re-created.

Type Parameters:
T - shape type
Parameters:
component - component for which shape is cached
shapeId - unique shape ID
shapeProvider - shape provider
settings - shape settings used as a shape key
Returns:
cached component shape