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

The HotJavaTM Component Series

HotJava System State Bean


Class At A Glance

Class Name: HotJavaSystemState
Extends: Component
Implements: Externalizable

Purpose

The HotJava System State bean is an invisible JavaBeans component that allows customization of the HotJava HTML Component by exposing its system state.
Key Properties
none
Creation
HotJavaSystemState()
Commonly Used Methods
none

About This Document

Audience
This document describes the HotJava HTML 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 HotJava System State bean is an invisible JavaBeans component intended for use with the HotJava HTML Component.

The browser maintains a fair amount of "system state." This state represents things like system properties (like the HTTP proxy settings), the URL pool, the Cookie jar, etc. There should be at most one HotJava System State bean for the entire VM. This bean simply exposes this state, which is stored elsewhere. If this bean is not included, reasonable defaults will be supplied, but state cannot be accessed. If more than one is instantiated, the last to write a value will take precedence in each case.

Security
Please note that it is extremely important to set the package.restrict.access and package.restrict.definition properties.
Color
The HotJava Browser supports the sixteen color names listed below from the HTML 3.2 standard (listed on p. 514 of HTML The Definitive Guide, 2nd edition) and not the extended list. Of course, explicit hex values may also be used.

black maroon green navy
silver red lime blue
gray purple olive teal
white fuschia yellow aqua
Introspection
A BeanInfo class, HotJavaSystemStateBeanInfo, explicitly provides information for properties, events, and methods.

Summaries


Property Summary

CookieJar cookies [constrained][bound]   - a collection of all cookies added (rw)
URLPool URLPool [bound] - the list of visited URLs (rw)
SystemProperties SystemPropertyDefaults - the system properties for developers to customize (rw)
SystemProperties UserProperties [bound] - the system properties provided to the user (rw)

Method Summary

instantiation HotJavaSystemState()
clone()
accessing properites getCookies()
setCookies()
getURLPool()
setURLPool()
getSystemPropertyDefaults()
setSystemPropertyDefaults()
getUserProperties()
setUserProperties()
editing properites editUserProperties()
adding/removing listeners   addPropertyChangeListener()
removePropertyChangeListener()
addVetoableChangeListener()
removeVetoableChangeListener()

Event Summary

As Source
EventListener Interfaces: PropertyChangeListener
VetoableChangeListener
As Listener
The HotJava System State bean does not act as a listener.

Alphabetical Reference


Properties

cookies [constrained][bound] - a collection of all cookies added
Type: CookieJar
Get: getCookies()
Set: setCookies()

SystemPropertyDefaults - default values for various system properties
Type: SystemProperties
Get: getSystemPropertyDefaults()
Set: setSystemPropertyDefaults()

UserProperties [bound] - user-specific values for system properties
Type: SystemProperties
Get: getUserProperties()
Set: setUserProperties()

URLPool [bound] - the list of visited URLs
Type: URLPool
Get: getURLPool()
Set: setURLPool()

Methods

void addPropertyChangeListener(PropertyChangeListener l, String propertyName)
Add a listener for post-notification of changes in a bound property.
See also: removePropertyChangeListener(), addVetoableChangeListener(), removeVetoableChangeListener().

void addVetoableChangeListener(VetoableChangeListener l, String propertyName)
Add a listener for pre-notification of changes in a constrained property.
See also: removeVetoableChangeListener(), addPropertyChangeListener(), removePropertyChangeListener().

HotJavaSystemState clone()
This method clones the system state bean and returns it.
See also: HotJavaSystemState().

void editUserProperties()
Launches a dialog to edit the UserProperties property. This is meant to provide a basic, minimal UI; the application writer will probably want to create their own dialog to edit system properties (both for properties relevant to HotJava, and others). This method may be removed and replaced by something better that provides equivalent functionality in a later release.

HotJavaSystemState()
The default constructor.
See also: clone().

CookieJar getCookies()
Get the cookies property. This is a bound and constrained property. A new cookie is added whenever a new cookie is received. This is primarily used to provide persistence for cookies, but, through the veto mechanism, it can also be used to control cookie use.

See also the Cookie and CookieJar classes.
See also: setCookies().

SystemProperties getSystemPropertyDefaults()
Get the SystemPropertyDefaults property. This allows a developer to provide default values for various system properties that control the editor's appearance, behavior, etc. The bean can be deployed with these defaults, but the user can override the bean's defaults in UserProperties. The value of SystemPropertyDefaults is saved when the HotJavaSystemState bean is serialized.
See also: System Properties, setSystemPropertyDefaults(), System.getProperty().

URLPool getURLPool()
Get the URLPool property. This is a bound property, set whenever a new URL is visited. This list is used by the bean to determine the color of displayed links - links in this list will be displayed in a different color than all others. If the client wishes this list to be persistent, it should be saved on shutdown, and set at startup. URLPool is a class that contains a collection of PoolEntry instances. PoolEntry contains the URL of the document, and an expiration date. The pool may be discarded by setting it to null.
See also: setURLPool().

SystemProperties getUserProperties()
Get the UserProperties property. This is used to set user-specific values for system properties (see also System.getProperty() in the JDK). This is used for setting things like the HTTP proxy. It is expected that the application that uses the bean will store the user's properties in persistent storage, and set the SystemProperties property at program startup.
See also: setUserProperties().

void removePropertyChangeListener(PropertyChangeListener l, String propertyName)
Remove a listener for post-notification of changes in a bound property.
See also: addPropertyChangeListener(), addVetoableChangeListener(), removeVetoableChangeListener().

void removeVetoableChangeListener(VetoableChangeListener l, String propertyName)
Remove a listener for pre-notification of changes in a constrained property.
See also: addVetoableChangeListener(), addPropertyChangeListener(), removePropertyChangeListener().

void setCookies(CookieJar jar)
Set the cookies property. This is a bound and constrained property. A new cookie is added whenever a new cookie is received. This is primarily used to provide persistence for cookies, but, through the veto mechanism, it can also be used to control cookie use.

See also the Cookie and CookieJar classes.
See also: getCookies().

void setSystemPropertyDefaults(SystemProperties p)
Set the SystemPropertyDefaults property. This allows someone to provide specific default values for various system properties that control the editor's appearance, behavior, etc. The bean can be deployed with these defaults, but the user can override the bean's defaults in UserProperties. The value of SystemPropertyDefaults is saved when the HotJavaSystemState bean is serialized. See System.getProperty().
See also: System Properties, getSystemPropertyDefaults(), System.getProperty().

void setURLPool(URLPool pool)
Set the URLPool property. This is a bound property, set whenever a new URL is visited. This list is used by the bean to determine the color of displayed links - links in this list will be displayed in a different color than all others. If the client wishes this list to be persistent, it should be saved on shutdown, and set at startup. URLPool is a class that contains a collection of PoolEntry instances. PoolEntry contains the URL of the document, and an expiration date. The pool may be discarded by setting it to null.
See also: getURLPool().

void setUserProperties(SystemProperties p)
Set the UserProperties property. This is used to set user-specific values for system properties (see also System.getProperty() in the JDK). This is used for setting things like the HTTP proxy. It is expected that the application that uses the bean will store the user's properties in persistent storage, and set the SystemProperties property at program startup.
See also: getUserProperties().

Events

As Source
EventListener Interfaces: PropertyChangeListener
VetoableChangeListener
EventObjects: PropertyChangeEvent
As Listener
The HotJava System State bean does not act as a listener.

System Properties

Exposed to the User
These system properties are exposed to the user to set. They control important aspects of the browser's functioning that a user might want to set for himself. All of the system properties listed below are also exposed in a property editor; this allows a developer to provide default values that the user can override.
http.proxyHost
Gives the hostname of the HTTP proxy, if there is one.

http.proxyPort
Gives the port number for the HTTP proxy.

ftpProxySet
If true, indicates that an FTP proxy has been set.

ftpProxyHost
Gives the hostname of the FTP proxy.

ftpProxyPort
Gives the port number of the FTP proxy.

gopherProxySet
If true, indicates that a gopher proxy has been set.

gopherProxyHost
Gives the hostname of the gopher proxy.

gopherProxyPort
Gives the port number of the gopher proxy.

delayAppletLoading
If true, applets will not be loaded immediately. Instead, an image will be displayed; clicking on the image will load the applet.

delayImageLoading
If true, images won't be loaded immediately.

displayBackgroundImages
Setting this false will disable the display of background images.

Exposed to Developers
These system properties are exposed via a property editor only to developers. They are in addition to the user properties listed in the previous section.
fonts.sizes
Gives a list of thirteen font sizes. These control the sizes of the fonts that HotJava uses to display HTML text.

hotjava.docfontsize
A number between -2 and 2, this acts as an offset into fonts.sizes. This is typically used to control display font size, with -2 meaning "very small," and 2 meaning "very large."

hotjava.docfont
The name of the font used to render HTML text.

printfonts.sizes
Gives a list of thirteen font sizes: 6,7,8,9,10,12,14,16,18,20,22,24,26. These are likse fonts.sizes, but are used for printing HTML documents instead of displaying them.

hotjava.printfontsize
Like hotjava.docfontsize, except that it applies to printing.

hotjava.printfont
Like hotjava.docfont, except that it applies to printing. Initially TimesRoman.

hotjava.docbg
Gives a default value for a document's background color, if the document doesn't specify it.

hotjava.curcolor
Gives the color of the cursor.

hotjava.selcolor
Gives the color of selected text.

hotjava.alttextcolor
Gives the color for HTML "alt" attribute text strings.

anchorStyle
Should the links be underlined?

http.agent
Sent by the browser on the User-Agent HTTP header.

urlpool.expires
URLPool entries will expire after this many hours. This is what causes links to display as "visited."

hotjava.enableCookies
If true, the browser will accept HTTP cookies from remote sites.

hotjava.security.getInterFrameApplets
If set true, an applet in one frame will be able to access applets in another frame (but in the same codebase) via AppletContext.getApplets(). Most browsers disable this, and the default for HotJava is false.

hotjava.security.giveRealFrame
If set true, applets will be able to get a reference to the frame that encloses them, via Component.getParent(). The default behavior, when this property is false, is to return an invisible frame that is positioned to coincide with the real enclosing frame. If you set this property true, you should ensure that applets cannot attack your application by invoking methods on the enclosing frame (perhaps via reflection, or by accessing child components).

trustProxy
If true, we will trust IP addresses that we can't resolve directly by ourselves.

package.restrict.access
Gives a list of package name prefixes that untrusted applets will not be able to access. It is crucial that you include any packages that your application puts on the CLASSPATH in this property. For example, if your code is in packages starting with "com.foo," but you also include components in the package "com.bar," you should set this property to "com.foo, com.bar." If you fail to do this, untrusted applets will be able to access any public data members of methods in your classes. If applets are allowed to define classes in your packages, they'll also be able to see package-private members. Be sure you set this property, and be sure that you include the prefixes of all CLASSPATH classes!

package.restrict.definition
Gives a list of package name prefixes that untrusted applets will not be able to define classes. Normally, this will be a superset of package.restrict.access. It is extremely important that you set this property, for reasons outlined under package.restrict.access.

See Also

Related Topics
HotJava Browser Components
HotJava Authenticator Bean
HotJava Document Stack Bean
HotJava HTML Component

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

HotJava Components version 1.1.2