org.jfree.report.style
Class StyleSheetCollectionHelper

java.lang.Object
  extended byorg.jfree.report.style.StyleSheetCollectionHelper
All Implemented Interfaces:
java.io.Serializable

public abstract class StyleSheetCollectionHelper
extends java.lang.Object
implements java.io.Serializable

An abstract helper implementation to make handling the complex registration and unregistration of the StyleSheetCollection easier.

If the stylesheet collection is not registered/unregistered properly, it may cause horrible effects like OutOfMemoryExceptions or uncontrollable missbehaviour.

Author:
Thomas Morgner
See Also:
StyleSheetCollection, ElementStyleSheet, Serialized Form

Constructor Summary
StyleSheetCollectionHelper()
          DefaultConstructor.
 
Method Summary
 StyleSheetCollection getStyleSheetCollection()
          Returns the stylesheet collection assigned with this StyleSheetCollectioHelper, or null, if no collection is registered.
protected abstract  void handleRegisterStyleSheetCollection()
          Handles the stylesheet collection registration.
protected abstract  void handleUnregisterStyleSheetCollection()
          Handles the stylesheet collection removal.
 void registerStyleSheetCollection(StyleSheetCollection styleSheetCollection)
          Registers the given StyleSheet collection with this helper.
 void unregisterStyleSheetCollection(StyleSheetCollection styleSheetCollection)
          Unregisters the given stylesheet collection from this helper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyleSheetCollectionHelper

public StyleSheetCollectionHelper()
DefaultConstructor. Does nothing.

Method Detail

getStyleSheetCollection

public StyleSheetCollection getStyleSheetCollection()
Returns the stylesheet collection assigned with this StyleSheetCollectioHelper, or null, if no collection is registered.

Returns:
the registered collection or null.

unregisterStyleSheetCollection

public void unregisterStyleSheetCollection(StyleSheetCollection styleSheetCollection)
                                    throws InvalidStyleSheetCollectionException
Unregisters the given stylesheet collection from this helper. If this stylesheet collection is not registered with this helper, this method will throw an InvalidStyleSheetCollectionException

Parameters:
styleSheetCollection - the stylesheet collection that should be unregistered.
Throws:
InvalidStyleSheetCollectionException - when an other stylesheet was already registered with this helper
java.lang.NullPointerException - if the given stylesheet collection is null.

registerStyleSheetCollection

public void registerStyleSheetCollection(StyleSheetCollection styleSheetCollection)
                                  throws InvalidStyleSheetCollectionException
Registers the given StyleSheet collection with this helper. If there is already another stylesheet collection registered, this method will throw an InvalidStyleSheetCollectionException.

Parameters:
styleSheetCollection - the stylesheet collection that should be registered.
Throws:
InvalidStyleSheetCollectionException - if there is already an other stylesheet registered.
java.lang.NullPointerException - if the given stylesheet collection is null.

handleRegisterStyleSheetCollection

protected abstract void handleRegisterStyleSheetCollection()
Handles the stylesheet collection registration.


handleUnregisterStyleSheetCollection

protected abstract void handleUnregisterStyleSheetCollection()
Handles the stylesheet collection removal.