|| At A Glance | About This Document | Class Description | Summaries | Properties | Methods | Events | See Also ||

The HotJavaTM Component Series

HotJava Document Stack Bean


Class At A Glance

Class Name: HotjavaDocumentStack
Extends: Object
Implements: Serializable, BrowserHistoryListener

Purpose

The HotJavaDocumentStack is an invisible JavaBean that maintains a stack of URLs describing "documents." It is intended for use with the HotJava HTML Component. It is typically combined with user interface controls to provide the "forward" and "back" behavior seen in HotJava and other Web browsers.
Key Properties
logicalDepth - How many documents deep is the stack?
contentsDepth - How many documents deep is document state kept?
nextDocumentAvailable - is there a next document for which to enable a "Forward" button?
previousDocumentAvailable - is there a previous document for which to enable a "Back" button?
Creation
HotjavaDocumentStack()
Commonly Used Methods
executeHistoryCommand() - process a history command.
nextDocument() - go forward to the next document.
previousDocument() - go back to the previous document.

About This Document

Audience
This document describes the HotJava Document Stack JavaBean component. It is intended for both "component assemblers" who will be instantiating and connecting the bean in builder applications as well as Java developers who will be programatically accessing the component. It assumes that you are already familiar with JavaBeans. If terms like property, event, method, introspection, or serialization are unfamiliar, you may want to refer to the JavaBeans documentation or take the JavaBeans tutorial.
Table of Contents

Class Description

Overview

The document stack is an invisible bean intended for use with the HotJava HTML Component. It provides the record necessary for the "forward" and "back" navigation familiar to Web browsers.

The document stack bean is simply a collection of the "documents" visited by the user. It can process a number of history commands to push a document on the stack or clear the history. Methods are provided to go to the previous and next documents, and to indicate the existence of next and previous to allow enabling and disabling controls as appropriate.

Introspection
A BeanInfo class, HotjavaDocumentStackBeanInfo, explicitly provides information for properties, events, and methods.
Example Use
Instantiate a HotjavaDocumentStack, HotJava HTML Component, and two buttons. Label one button "Forward" and bind its buttonPushed event to the nextDocument() method of the document stack. Label the other "Back" and set it to activate previousDocument(). Connect the executeHistoryCommand event for HTML component to the corresponding method of the document stack. Do the same in reverse from the executeHistoryCommand event of the document stack to the method of the HTML component.

Summaries


Property Summary

boolean logicalDepth - How many documents deep is the stack? (rw)
boolean contentsDepth - How many documents deep is document state kept? (rw)
boolean nextDocumentAvailable [bound] - is there a next document? (rw)
boolean previousDocumentAvailable [bound] - is there a previous document? (rw)

Method Summary

instantiation HotjavaDocumentStack()
navigation nextDocument()
previousDocument()
state accessors isNextAvailable()
setNextAvailable()
isPreviousAvailable()
setPreviousAvailable()
adding/removing document history    eraseDocumentHistory()
executeHistoryCommand()
adding/removing listeners addBrowserHistoryListener()
removeBrowserHistoryListener()
addPropertyChangeListener()
removePropertyChangeListener()

Event Summary

As Source
EventListener Interfaces: PropertyChangeListener
BrowserHistoryListener
As Listener
EventListener Interfaces: BrowserHistoryListener

Alphabetical Reference


Properties

contentsDepth
Type: int
Get: getContentsDepth()
Set: setContentsDepth()

logicalDepth
Type: int
Get: getLogicalDepth()
Set: setLogicalDepth()

nextDocumentAvailable [bound]
Type: boolean
Get: isNextAvailable()
Set: setNextAvailable()

previousDocumentAvailable [bound]
Type: boolean
Get: isPreviousAvailable()
Set: setPreviousAvailable()

Methods

void addBrowserHistoryListener(BrowserHistoryListener l)
Add this listener to be sent executeHistoryCommand() messages.
See also: removeBrowserHistoryListener().

void addPropertyChangeListener(PropertyChangeListener l)
Add this listener to be notified of changes to bound properties.
See also: removePropertyChangeListener().

void eraseDocumentHistory()
Fires a BrowserHistoryEvent with id equal to Clear to indicate that browser should erase the document history.

void executeHistoryCommand(BrowserHistoryEvent evt)
Processes a BrowserHistoryEvent. This method is implemented as part of the BrowserHistoryListener interface. It is used to enable the stack bean to receive history notifications from the browser bean. Make no assumptions about the internals of this event, i.e. treat this an an opaque event.

int getContentsDepth()
Gets the value of the contentsDepth property.
See also: setContentsDepth().

int getLogicalDepth()
Gets the value of the logicalDepth property.
See also: setLogicalDepth().

HotjavaDocumentStack()
Default constructor.

boolean isNextAvailable()
Get the nextDocumentAvailable property.
See also: setNextAvailable().

boolean isPreviousAvailable()
Get the previousDocumentAvailable property.
See also: setPreviousAvailable().

void nextDocument()
Fires a BrowserHistoryEvent with id equal to Next to indicate that browser should go to the next document.

void previousDocument()
Fires a BrowserHistoryEvent with id equal to Previous to indicate that browser should go to the previous document.

void removeBrowserHistoryListener(BrowserHistoryListener l)
Remove this listener so it no longer receives executeHistoryCommand() messages.
See also: addBrowserHistoryListener().

void removePropertyChangeListener(PropertyChangeListener l)
Remove this listener from those notified of changes on bound properties.
See also: addPropertyChangeListener().

void setContentsDepth(boolean val)
Set the contentsDepth property. This property controls how far back on the stack the browser will hold the state associated with a web page. Examples of document state include running applets, and the contents of HTML forms. Setting this to a large number will increase memory consumption. The default value is 10.
See also: getContentsDepth().

void setLogicalDepth(boolean val)
Set the logicalDepth property. This property controls how large the stack is allowed to grow. The default value is 100.
See also: getLogicalDepth().

void setNextAvailable(boolean val)
Set the nextDocumentAvailable property.
See also: isNextAvailable().

void setPreviousAvailable(boolean val)
Set the previousDocumentAvailable property.
See also: isPreviousAvailable().


Events

As Source
The two document stack properties are bound. Therefore, notification of change to next/previous document availablity is multicast with a PropertyChangedEvent to any PropertyChangeListener registered using addPropertyChangeListener().

BrowserHistoryEvent objects are sent to registered BrowserHistoryListeners to notify of changes in the "current document" due to nextDocument() and previousDocument() actions.

EventListener Interfaces: PropertyChangeListener
BrowserHistoryListener
EventObjects: PropertyChangeEvent
BrowserHistoryEvent

As Listener
The document stack receives executeHistoryCommand() messages in order to add documents as they are visited in the browser and to clear its history when requested.

EventListener Interfaces: BrowserHistoryListener
EventObjects: BrowserHistoryEvent


See Also

Related Topics
HotJava Browser Components
HotJava Authenticator Bean
HotJava HTML Component
HotJava System State Bean

|| At A Glance | About This Document | Class Description | Summaries | Properties | Methods | Events | See Also ||

HotJava Components version 1.1.2