org.jhotdraw.contrib.html
Class StandardDisposableResourceHolder

java.lang.Object
  extended by org.jhotdraw.contrib.html.StandardDisposableResourceHolder
All Implemented Interfaces:
java.io.Serializable, DisposableResourceHolder

public class StandardDisposableResourceHolder
extends java.lang.Object
implements DisposableResourceHolder, java.io.Serializable

StandardDisposableResourceHolder is a standard implementation of the DisposableResourceHolder interface

Version:
<$CURRENT_VERSION$>
Author:
Eduardo Francos - InContext
See Also:
Serialized Form

Constructor Summary
StandardDisposableResourceHolder()
          Constructor for the StandardDisposableResourceHolder object
StandardDisposableResourceHolder(java.lang.Object newResource)
          Constructor for the StandardDisposableResourceHolder object
 
Method Summary
 java.lang.Object clone()
          Makes a clone of this
 void dispose()
          Disposes of the resource
 long getDisposableDelay()
          Gets the disposableDelay attribute of the StandardDisposableResourceHolder object
 long getLastTimeAccessed()
          Gets the lastTimeAccessed attribute of the DisposableResourceHolder object
 java.lang.Object getResource()
          Gets the resource attribute of the StandardDisposableResourceHolder object
 boolean isAvailable()
          Gets the available attribute of the StandardDisposableResourceHolder object
 boolean isLocked()
          True if the resource is locked
 void lock()
          Locks the resource so it cannot be automatically disposed of until unlock is called.
 void resetDelay()
          Resets the disposing delay so as to restart the time counter
 void setDisposableDelay(long millis)
          Sets the disposableDelay attribute of the StandardDisposableResourceHolder object
 void setResource(java.lang.Object newResource)
          Sets the resource attribute of the StandardDisposableResourceHolder object
 void unlock()
          Unlocks the resource so it can be automatically disposed of again.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardDisposableResourceHolder

public StandardDisposableResourceHolder()
Constructor for the StandardDisposableResourceHolder object


StandardDisposableResourceHolder

public StandardDisposableResourceHolder(java.lang.Object newResource)
Constructor for the StandardDisposableResourceHolder object

Parameters:
resource - Description of the Parameter
Method Detail

clone

public java.lang.Object clone()
Makes a clone of this

Specified by:
clone in interface DisposableResourceHolder
Overrides:
clone in class java.lang.Object
Returns:
the clone

getResource

public java.lang.Object getResource()
                             throws java.lang.NullPointerException
Gets the resource attribute of the StandardDisposableResourceHolder object

Specified by:
getResource in interface DisposableResourceHolder
Returns:
The resource value
Throws:
java.lang.NullPointerException - Description of the Exception

setResource

public void setResource(java.lang.Object newResource)
Sets the resource attribute of the StandardDisposableResourceHolder object

Specified by:
setResource in interface DisposableResourceHolder
Parameters:
resource - The new resource value

setDisposableDelay

public void setDisposableDelay(long millis)
Sets the disposableDelay attribute of the StandardDisposableResourceHolder object

Specified by:
setDisposableDelay in interface DisposableResourceHolder
Parameters:
millis - The new disposableDelay value

getDisposableDelay

public long getDisposableDelay()
Gets the disposableDelay attribute of the StandardDisposableResourceHolder object

Specified by:
getDisposableDelay in interface DisposableResourceHolder
Returns:
The disposableDelay value

dispose

public void dispose()
Disposes of the resource

Specified by:
dispose in interface DisposableResourceHolder

isAvailable

public boolean isAvailable()
Gets the available attribute of the StandardDisposableResourceHolder object

Specified by:
isAvailable in interface DisposableResourceHolder
Returns:
The available value

lock

public void lock()
Locks the resource so it cannot be automatically disposed of until unlock is called.
Explicit disposing by calling dispose() is still possible though.

Specified by:
lock in interface DisposableResourceHolder

unlock

public void unlock()
Unlocks the resource so it can be automatically disposed of again.
Explicit disposing by calling dispose() is still possible though.

Specified by:
unlock in interface DisposableResourceHolder

isLocked

public boolean isLocked()
True if the resource is locked

Specified by:
isLocked in interface DisposableResourceHolder
Returns:
The locked status

getLastTimeAccessed

public long getLastTimeAccessed()
Gets the lastTimeAccessed attribute of the DisposableResourceHolder object

Specified by:
getLastTimeAccessed in interface DisposableResourceHolder
Returns:
The lastTimeAccessed value

resetDelay

public void resetDelay()
Resets the disposing delay so as to restart the time counter

Specified by:
resetDelay in interface DisposableResourceHolder