|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--calpa.html.CalHTMLManager
A class with static members and methods which primarily controls the caching of data
which will be available to all current instances of CalHTMLPane
.
CalHTMLPane
Method Summary | |
static void |
addUserComponent(javax.swing.JComponent component)
Adds a JComponent to the Manager's component cache. |
static void |
addUserComponentArray(javax.swing.JComponent[] componentArray,
java.lang.String classname)
Adds an array of JComponents to the Manager's component cache. |
static void |
addUserImage(java.awt.Image img,
java.lang.String name)
Adds an Image to the Manager's image cache. |
static void |
emptyDocumentCache()
Empties the Manager's document cache. |
static int |
getDocumentCacheCurrentSize()
Returns the Manager's estimate of the current memory being taken up by cached documents. |
static int |
getDocumentCacheMaximumSize()
Returns the max size of the document cache used by the Manager. |
static javax.swing.JComponent |
getUserComponent(java.lang.String classname,
java.lang.String name)
Retrieves a JComponent from the Manager's component cache. |
static java.awt.Image |
getUserImage(java.lang.String name)
Retrieves an Image from the Manager's image cache. |
static boolean |
isCacheDocumentsEnabled()
Indicates whether document caching is currently enabled. |
static boolean |
isCalFocusManagerEnabled()
Indicates whether a CalFocusManager is currently enabled. |
static void |
removeOldestDocumentFromCache()
Removes the oldest document from the Manager's document cache. |
static void |
removeUserComponent(java.lang.String name)
Removes a JComponent from the Manager's component cache. |
static void |
removeUserComponentArray(java.lang.String classname)
Removes a JComponent array from the Manager's component cache. |
static void |
removeUserImage(java.lang.String name)
Removes an Image from the Manager's image cache. |
static void |
setCacheDocuments(boolean enabled)
Enables or disables the caching of documents by the Manager. |
static void |
setCalFocusManagerEnabled(boolean enabled)
Enables or disables the CalFocusManager . |
static void |
setDocumentCacheMaximumSize(int size)
Sets the size of the document cache used by the Manager. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static void addUserComponent(javax.swing.JComponent component)
AWT Component setName()
method).
JComponents sent to this method which do not have a name will not be cached by the Manager.component
- the JComponent to be added.public static void removeUserComponent(java.lang.String name)
name
- the name of the JComponent to be removed.public static void addUserComponentArray(javax.swing.JComponent[] componentArray, java.lang.String classname)
componentArray
- the JComponent array to be added.classname
- a class identifier for the JComponent array.public static void removeUserComponentArray(java.lang.String classname)
classname
- the class identifier of the JComponent array to be removed.public static javax.swing.JComponent getUserComponent(java.lang.String classname, java.lang.String name)
classname
- the class identifier of the array the JComponent resides in (may be null).name
- the name of the target JComponent.null
if no JComponent matching the sent
parameters can be foundaddUserComponent(javax.swing.JComponent)
,
addUserComponentArray(javax.swing.JComponent[], java.lang.String)
public static void addUserImage(java.awt.Image img, java.lang.String name)
loadImages
in CalHTMLPreferences
has
been disabled. This can be useful when images are being displayed in buttons and other
form controls.
See the README.TXT file accompanying this documentation for further details.
img
- the Image to be cached.name
- a name given to the Image for retrieval purposes.getUserImage(java.lang.String)
public static java.awt.Image getUserImage(java.lang.String name)
name
- the name of the target Image.null
if no Image matching the sent
name can be foundaddUserImage(java.awt.Image, java.lang.String)
public static void removeUserImage(java.lang.String name)
name
- the name of the Image to be removed.public static void setCacheDocuments(boolean enabled)
enabled
- a flag indicating whether the Manager should cache documents.public static boolean isCacheDocumentsEnabled()
public static void setDocumentCacheMaximumSize(int size)
Once the cache size has been exceeded the Manager will empty the oldest document from the cache and repeat this process until the memory taken up by documents in the cache falls below the cache size.
Documents in the Manager's cache do not contain images. These are cached by the JVM and will take up additional memory (sometimes far in excess of the memory taken by documents).
Note: Kilobytes have been used in order to allow for the creation of very small cache sizes. A cache size of 50K will be meaningless when dealing with normal HTML documents, but it allows for the caching of mini 'documents' which have been created via Strings rather than URLs.
size
- the required size in kilobytes of the Manager's document cache.public static int getDocumentCacheMaximumSize()
public static int getDocumentCacheCurrentSize()
The estimate does not include memory which is being taken up by cached document
images. These are managed separately by the JVM. Note also that a call to
Runtime.getRuntime().freeMemory()
will invariably show a memory usage greater
than indicated by this method. This is due to the additional memory being used by any
CalHTMLPane
objects and subsidiary objects related to the current document view
they are displaying.
public static void removeOldestDocumentFromCache()
public static void emptyDocumentCache()
public static void setCalFocusManagerEnabled(boolean enabled)
CalFocusManager
. When a CalHTMLPane
is
first instantiated it will replace the incumbent FocusManager
with a
CalFocusManager
unless disabled from doing so by this method.
The CalFocusManager
should function identically to Swing's
DefaultFocusManager
outside a CalHTMLPane
but extends functionality when a
CalHTMLPane
has keyboard focus (e.g. it enables tabbing between hyperlinks).CalFocusManager
has been implemented in this way.
(Note that this method will neither install nor uninstall the CalFocusManager.)
enabled
- a flag indicating whether a CalFocusManager should handle keyboard control within
a CalHTMLPane
.public static boolean isCalFocusManagerEnabled()
CalFocusManager
should handle keyboard traversalsetCalFocusManagerEnabled(boolean)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |