org.jhotdraw.contrib.html
Class StandardDisposableResourceManager

java.lang.Object
  extended by org.jhotdraw.contrib.html.StandardDisposableResourceManager
All Implemented Interfaces:
DisposableResourceManager

public class StandardDisposableResourceManager
extends java.lang.Object
implements DisposableResourceManager

StandardDisposableResourceManager implements disposable resource management using a client supplied strategy.

Version:
<$CURRENT_VERSION$>
Author:
Eduardo Francos - InContext

Constructor Summary
StandardDisposableResourceManager(ResourceDisposabilityStrategy newStrategy)
          Constructor for the StandardDisposableResourceManager object
 
Method Summary
 java.util.Iterator getResources()
          Gets an iterator on the managed resources
 ResourceDisposabilityStrategy getStrategy()
          Gets the strategy attribute of the StandardDisposableResourceManager object
 boolean managesResource(DisposableResourceHolder resource)
          Description of the Method
 void registerResource(DisposableResourceHolder resource)
          Registers a resource to be automatically disposed of
 void setStrategy(ResourceDisposabilityStrategy newStrategy)
          Sets the strategy attribute of the StandardDisposableResourceManager object
 void startDisposing()
          Activates the strategy which starts disposing of resources as fitted
 void stopDisposing(long millis)
          Deactivates the strategy that stops automatic disposal of resource.
 void unregisterResource(DisposableResourceHolder resource)
          Unregisters a resource so it is not automatically GCed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardDisposableResourceManager

public StandardDisposableResourceManager(ResourceDisposabilityStrategy newStrategy)
Constructor for the StandardDisposableResourceManager object

Parameters:
strategy - Description of the Parameter
Method Detail

registerResource

public void registerResource(DisposableResourceHolder resource)
Registers a resource to be automatically disposed of

Specified by:
registerResource in interface DisposableResourceManager
Parameters:
resource - the resource

unregisterResource

public void unregisterResource(DisposableResourceHolder resource)
Unregisters a resource so it is not automatically GCed.
If does nothing if the resource was not registered with this manager

Specified by:
unregisterResource in interface DisposableResourceManager
Parameters:
resource - the resource

getResources

public java.util.Iterator getResources()
Gets an iterator on the managed resources

Specified by:
getResources in interface DisposableResourceManager
Returns:
The iterator

managesResource

public boolean managesResource(DisposableResourceHolder resource)
Description of the Method

Specified by:
managesResource in interface DisposableResourceManager
Parameters:
resource - the resource
Returns:
True if the resource is registered with this manager

getStrategy

public ResourceDisposabilityStrategy getStrategy()
Gets the strategy attribute of the StandardDisposableResourceManager object

Returns:
The strategy value

setStrategy

public void setStrategy(ResourceDisposabilityStrategy newStrategy)
Sets the strategy attribute of the StandardDisposableResourceManager object

Parameters:
newStrategy - The new strategy value

startDisposing

public void startDisposing()
                    throws ResourceManagerNotSetException
Activates the strategy which starts disposing of resources as fitted

Specified by:
startDisposing in interface DisposableResourceManager
Throws:
ResourceManagerNotSetException - Description of the Exception

stopDisposing

public void stopDisposing(long millis)
Deactivates the strategy that stops automatic disposal of resource.
The millis parameters specifies in milliseconds the time to wait for the disposal to stop. After this time the method returns, but the deactivation request remain active.

Specified by:
stopDisposing in interface DisposableResourceManager
Parameters:
millis - time to wait for disposal to stop