[Previous] [Contents]

Chapter 8
JSB File Structure Reference

JSB File Structure Reference

This document describes the structure of the JavaScript Bean (JSB) file and provides a reference to JSB file tag and attribute syntax.

A JSB file is used to communicate meta information about a Netscape ONE component to any platform or tool, such as Visual JavaScript, that recognizes the JSB file format. Meta information is necessary to allow connections to be made between components, and to allow component manipulation and inspection at design time, such as through the VJS Inspector.

A JSB file may also provide additional component information, depending on the type of component it describes. For example, JavaScript components exist only as JSB files. A JSB file for a JavaScript component includes a constructor script, and may include JavaScript functions that support the constructor script, or that process events.

The JSB file structure is modeled on the Java Bean BeanInfo class with extensions that support specific features of the Netscape ONE platform and development tools, such as VJS. The following sections describe the JSB file structure and provide a reference for JSB syntactic elements.

Uses of the JSB File

The following table lists the intended uses for JSB files in Visual JavaScript:

Use Description
Definition of JavaScript Components

Defines components that are constructed completely from Java Script. This is the most common use of the JSB file.

HTML Elements

Defines files loaded explicitly from Visual JavaScript in order to retrieve information about the properties and events of an object that are generated at run time from an HTML tag. For example, form elements fall into this category.

JSB files that contain HTML element definitions are give a default extension of .hi to distinguish them from JSB files that contain components for import or export.

Hidden Java class implementations

Defines meta information for a Java class, while hiding the actual class implementation. For example, this is the only way to work with server-side Java components in Visual JavaScript, and is typically used with LiveConnect to instantiate a Java class from JavaScript. The intention here is that only part of the underlying class need be exposed through the JSB file as long as the class can be instantiated using the JavaScript new operation.

Definition of CORBA components

Defines a CORBA component for VJS and the Netscape ONE platform in terms of the IDL definition of the original CORBA object. VJS automatically creates the JSB file for a CORBA object when you import the object.

Overview of the JSB File Structure

A JSB file consists of text tags that encapsulate a single component definition. The file format is plain text that can be parsed according to SGML rules. Tags are enclosed in angle brackets, and can be nested as appropriate. A component definition in a JSB file is enclosed by a <JSB> and </JSB> tag pair. Within this pair, are embedded tags that define meta information for the component. For example, all components defined in a JSB file have tags that define:

Typically, a skeleton JSB file looks like this:

<JSB>
   <JSB_DESCRIPTOR ...>
   <JSB_ICON...>
   <JSB_PROPERTY ...>
   ...
   <JSB_EVENT ...>
   ...
   <JSB_METHOD ...>
   ...
      <JSB_PARAMETER>
      ...
   </JSB_METHOD>
   ...
   <JSB_CONSTRUCTOR ...> </JSB_CONSTRUCTOR>
</JSB>
Depending on a component's event definitions, the JSB file may also contain interface definitions that enable handling a component's events through an external object, such as another Java component. Interface definitions follow a component's definition. Each interface definition is placed within <JSB_LISTENER> and </JSB_LISTENER> tags:

...
</JSB>

<JSB_LISTENER ...> </JSB_LISTENER>
...
NOTE: JavaScript components defined in separate JSB files can share listener interfaces. To share an interface, provide the identical listener interface definition for each component in that component's JSB file.

Component Descriptor

The first tag embedded in a component definition is the <JSB_DESCRIPTOR> component descriptor tag that provides a component's actual name, environment type, display name, and hint text.

Icon Descriptor

A component definition can include an optional <JSB_ICON> tag that defines icon information for the component, including

Property Descriptors

Each property for a component must have a <JSB_PROPERTY> property descriptor tag in the JSB file. A property descriptor defines a property's name and type. It can optionally specify a property editor class, and optionally specify the Get and Set methods that enable an application to retrieve and set the property's value.

If the Get and Set methods are specified for a property, the JSB file must also contain the corresponding method descriptors for those methods. If the Get and Set methods are not specified, or if they are null, they are automatically created for the component by Visual JavaScript at design time. The Get method uses an expression of the type "object.property" to retrieve a value. The Set method is created using an assignment expression to set the property.

At design time, a property is assigned an initial value that must be translated into a proper literal form for embedding in an HTML page. Properties are stored into the page in different ways, depending on the type of property.

Finally, a property can be "bound," meaning that an event is triggered when the property value changes. A property must be bound in order for Visual JavaScript to establish a property connection from this component to another.

Method Descriptors

Methods are functions that operate on a component, its properties, and data. Each method defined for a component must be encapsulated in a <JSB_METHOD> and
</JSB_METHOD> method descriptor tag pair in the JSB file. A method descriptor defines a method's name, its return type, and its parameters, if any.

Each parameter must be placed in a parameter descriptor that is embedded in the method descriptor.The parameter descriptor specifies the parameter's name and type.

Method descriptors must be created for each Get and Set method defined for a property. Method descriptors must also be created for methods that provide support functions for a component's event handlers.

EventSetDescriptors

Events are methods that are triggered when a certain condition occurs within a component (e.g., when the value for a property is changed). Events are typically callbacks to methods belonging to other objects outside the component. The <JSB_EVENT> event set descriptor tag specifies the name of the event, the event model to which the event conforms, and, depending on the specified event model, a listener type parameter that specifies the name of the listener interface used by the component.

The event model determines whether or not a listener type parameter must be defined for the component. If the event model corresponds to the AWT11 interface, the listener type parameter is required.

Constructor

The <JSB_CONSTRUCTOR> and </JSB_CONSTRUCTOR> tag pair enclose the JavaScript code that creates instances of the component at run time, defines a component's methods and that links the actual implementation of those methods to the component's method descriptors. All JavaScript components must have a constructor definition.

Listener Interfaces

The <JSB_LISTENER> and </JSB_LISTENER> tag pair describes the interface information a component returns to a Java object that implements the actual interface. The listener interface enables Visual JavaScript to determine which external Java objects can handle a component's events when they are triggered. Using an external object to handle events enables sharing of event handlers across JavaScript components.

Creating a JSB File

Because a JSB file is in plain text format, it can be created using any editor capable of producing unformatted text.

NOTE: On Windows platforms, the CDK ships with the Acadia JavaScript BeanBuilder which you can also use to create JS components. The Acadia JavaScript BeanBuilder is not described in this document, but it and its supporting documentation is delivered as part of the CDK.

JSB Tag Reference

The following sections describe tags and tag attributes used in JSB files. The heading for each tag type indicates whether or not a tag requires a matching end-tag. For example, a heading such as <JSB> </JSB> indicates tags that are part of a pair. A heading such as <JSB_PROPERTY> indicates a tag that does not require an end-tag.

The text that follows a heading describes the main purpose of the tag. It is followed by a list of tag attributes, if any, their purposes, whether or not the attribute is required, and a description of possible attribute values if there is a restricted list of values.

<JSB> </JSB>

Encapsulates a component's definition, including its properties, events, methods, and constructor tags. Only <JSB_LISTENER> tags are permitted outside the scope of the <JSB> and </JSB> tag pair in a JSB file.

Attributes

None.

<JSB_DESCRIPTOR>

Provides general component information, such as the component's name, display name, and environment where the component executes at run time.

NOTE: In addition to the attributes described below that are already defined for <JSB_DESCRIPTOR>, developers can provide custom attributes that follow standard SGML formatting conventions. Extensions are roughly mapped into the corresponding attributes supported by name in the Java FeatureDescriptor base class.

Attributes

The following attributes are used with the <JSB_DESCRIPTOR> tag.

CUSTOMIZER
Specifies a Java class used to customize the component. Optional. If used, CUSTOMIZER takes the form:

CUSTOMIZER="packagename.packageclass"
where packagename is the name of the Java package to use, and packageclass is the name of the class to use for customizing the JavaScript component.

DISPLAYNAME
Specifies a name for the component that can be used for display purposes. Required. Visual JavaScript displays this name in the object inspector. DISPLAYNAME takes the form:

DISPLAYNAME="componentclassname"
ENV
Specifies the environment where the component runs. Optional. ENV takes the following form:

ENV="value"
where value can be one of the values in the following table. The table summarizes possible values for ENV, and what those values signify.

Value Meaning
"client"

Component runs on the client. When the JSB file is processed, its code is automatically placed within <SCRIPT> tags in the HTML document.

"server"

Component runs on the server. When the JSB file is processed, its code is automatically placed within <SERVER> tags in the HTML document.

"both"

An instance of the component is generated at run time on both the client and the server. If this setting is specified, then each property and method defined for the component must specify individual ENV attributes.

"either"

Component can run either on the server or the client, as determined by the application developer. This is the default behavior if ENV is not specified.

If this attribute is not specified, "either" is assumed. Whether the component executes on the server or the client is left to the application developer to decide.

ISJAVA
No longer used. Some existing JSB examples in the CDK may include this attribute, but it is no longer needed.

NAME
Specifies the unique identifier for the component. Required. NAME takes the form:

NAME="packagename.componentname"
where packagename is the name of the package containing the component, and componentname is the unique name of a component in the specified package.

SHORTDESCRIPTION
Provides a brief description of the component class that is displayed in Visual JavaScript Tool Tips. Optional. SHORTDESCRIPTION takes the form:

SHORTDESCRIPTION="tiptext"
VISUAL
Specifies the name of a class used to provide the design time visual appearance of a component. Optional. VISUAL takes the form:

VISUAL="packagename.packageclass"
where packagename is the name of the Java package to use, and packageclass is the name of the class to use for providing the component's design time appearance. Instances of this class are passed to the engine for Layout view.

<JSB_ICON>

Provides the name of the file containing a display icon for a component. JSB_ICON differs from the Java Beans specification in that only one icon file can be specified per a component.

Attributes

The following attributes are used with the <JSB_ICON> tag.

ICONNAME
Specifies the base file that contains a display icon for the component. Optional. ICONNAME takes the form:

ICONNAME= "filename"
where file name is a standard file name that can include an optional extension. For example:

ICONNAME= "myicon.gif"
The file name you specify is both the actual file name of a 16x16 pixel color icon, and a base file name that VJS uses to locate a corresponding 32x32 pixel color icon. VJS appends "32" to the base file name prior to the file extension, if any, and looks for the 32x32 icon file. For example if ICONNAME is myicon.gif, VJS looks for these files:

<JSB_PROPERTY>

Defines a property for a component. <JSB_PROPERTY> is primarily modeled on the Java Beans PropertyDescriptor object. JavaScript properties, however, can be retrieved and set directly, or through Get and Set methods defined for the component.

NOTE: In addition to the attributes described below that are already defined for <JSB_PROPERTY>, developers can provide custom attributes that follow standard SGML formatting conventions. Extensions are roughly mapped into the corresponding attributes supported by name in the Java FeatureDescriptor base class.

Attributes

The following attributes are used with the <JSB_PROPERTY> tag.

DEFAULT_VALUE
Provides a default value for a property if no other value is assigned. Optional. DEFAULT_VALUE takes the form:

DEFAULT_VALUE ="value"
where value is a property value.

DISPLAYNAME
Specifies a name for the property that can be used for display purposes. Required. Visual JavaScript displays this name in the object inspector. DISPLAYNAME takes the form:

DISPLAYNAME="propname"
ENV
Specifies the environment where the application can retrieve or set a property's value. Optional and meaningful only if the corresponding ENV attribute in the <JSB_DESCRIPTOR> is set to "both". Otherwise ENV is ignored if specified for a property. ENV takes the following form:

ENV="value"
where value can be one of the values in the following table.

Value Meaning
"client"

Property can be retrieved and set by the client.

"server"

Property can be retrieved and set by the server.

"both"

Property can be retrieved and set by the client and the server. This is the default is ENV is not specified for the property.

ISBOUND
Specifies that when a property's value is changed an onChange event is triggered. Optional.

The type of event that is triggered depends on the property's PROPTYPE attribute.

ISDEFAULT
Indicates that this property is the default property for the component. Optional. If ISDEFAULT is omitted for all component properties, the first property listed in the JSB file automatically becomes the default property for the component. If more than one property is assigned the ISDEFAULT attribute, the first property with this attribute becomes the default, and all other ISDEFAULT attributes for properties are ignored.

ISRUNTIME
Specifies that a property's value can only be set at run time. Optional.

Properties that specify the ISRUNTIME attribute are not assigned an initial value at design time. For example, if a property represents the current row for a cursor object, or the number of rows returned in a result set, setting a value at design time is meaningless.

NOTE: Although the object inspector might display an ISRUNTIME property at design time, it should not permit setting the value.
NAME
Specifies a unique identifier for a property. Required. NAME is used in direct reference expressions to retrieve or set a property's value when Get and Set methods are not provided for the property. NAME takes the form:

NAME="propname"
where propname is a unique property name within this component.

PROPERTYEDITOR
Specifies a Java class that can be used by the VJS inspector to edit the property's value. Optional. PROPERTYEDITOR takes the form:

PROPERTYEDITOR="packagename.classname"
where packagename is the fully qualified package name containing the Java class, and classname is the name of the Java class to use as the property editor.

PROPTYPE
Determines how a property is stored in the HTML document, and how the property is treated if it is a bound property. The following table lists the possible values for PROPTYPE.

Value Meaning
JS

Stores a property using JavaScript inside a <SCRIPT> tag to form a parameter object that is passed to the constructor.

JS-expr

Permits a JavaScript expressions to provide a value for a property. The property is stored using JavaScript inside a <SCRIPT> tag to form a parameter object that is passed to the constructor. When the property is parsed, quotes are not removed from the value, and escape sequences are not transliterated.

TagAttribute

Stores a property in the HTML document as an attribute of the property tag. This option is primarily intended to support .hi files that describe HTML form elements and other built-in browser objects.

AWT11

Indicates that a property is accessed exclusively through Get and Set methods, like a Java Bean component.

READMETHOD
Specifies the name of the Get method used to retrieve the value of the property at run time. Optional. READMETHOD takes the following form:

READMETHOD="methodname"
where methodname corresponds to the name of a <JSB_METHOD> tag defined elsewhere in the JSB file.

NOTE: The return value of the specified read method must correspond to the property's TYPE attribute.
If READMETHOD is not specified for the property, an application can query directly for a property's value using standard JavaScript "variable=object.property" syntax. If the component is a LiveConnect component (i.e., a Java component), the standard JavaBeans naming conventions are used to attempt to locate the read method for the property.

SHORTDESCRIPTION
Provides a brief description of the property that is displayed in Visual JavaScript Tool Tips. Optional. SHORTDESCRIPTION takes the form:

SHORTDESCRIPTION="tiptext"
TYPE
Indicates the data type for the property. Required. TYPE is either a JavaScript data type, a primitive Java data type, or the fully qualified package name of a Java class that describes a data type. TYPE takes one of the following forms, depending on whether the specified data type is a JavaScript data type, Java primitive, or a Java class:

Type Origin Syntax
Java primitive data class

TYPE="datatype"
where datatype is a Java primitive data type, such as int or bool.

Java class

TYPE="package.class"
where package is the Java package containing a data type class, and class is the Java class that defines the data type.

JavaScript data type

TYPE="JSdatatype"
where JSdatatype is one of string, number, boolean, or void.

WRITEMETHOD
Specifies the name of the Set method used to set the value of the property at run time. Optional. WRITEMETHOD takes the following form:

WRITEMETHOD="methodname"
where methodname corresponds to the name of a <JSB_METHOD> tag defined elsewhere in the JSB file.

NOTE: The set method must have a single parameter that corresponds to the property's data type.
If WRITEMETHOD is not specified for the property, an application can directly set a property's value using standard JavaScript "object.property= value" syntax. If the component is a LiveConnect component (i.e., a Java component), the standard JavaBeans naming conventions are used to attempt to locate the write method for the property.

VALUESET
Specifies a range of allowed values for the property. Optional. Use VALUESET to limit possible property values. VALUESET takes the following form:

VALUESET="range"
where range is a string containing a list of possible values. The interpretation of the string depends upon the data type of the property. For string properties, the VALAUESET should be a comma-delimited list of strings. For example:

VALUESET="ORACLE,INFORMIX,SYBASE,ODBC"
For numeric properties, VALUESET can be a comma delimited list of values or ranges, where a range follows a "min:max" pattern. For example:

VALUESET="1:32,64"
which indicates that a property can have values from 1 to 32 and 64.

NOTE: Because VALUESET is a string, the property editor must be able to parse values in the string.

<JSB_METHOD> </JSB_METHOD>

Defines a method for a component. <JSB_METHOD> is primarily modeled on the Java Beans MethodDescriptor and Method objects.

NOTE: In addition to the attributes described below that are already defined for <JSB_METHOD>, developers can provide custom attributes that follow standard SGML formatting conventions. Extensions are roughly mapped into the corresponding attributes supported by name in the Java FeatureDescriptor base class.

Attributes

The following attributes are used with the <JSB_METHOD> tag.

DISPLAYNAME
Specifies a name for the method that can be used for display purposes. Required. Visual JavaScript displays this name in the object inspector. DISPLAYNAME takes the form:

DISPLAYNAME="methodname"
ENV
Specifies the environment where the method resides. Optional and meaningful only if the corresponding ENV attribute in the <JSB_DESCRIPTOR> is set to "both". Otherwise ENV is ignored if specified for a method. ENV takes the following form:

ENV="value"
where value can be one of the values in the following table.

Value Meaning
"client"

Method can be called by components on the client.

"server"

Method can be called by components on the server.

"both"

Method can be called by components on the client or server. This is the default is ENV is not specified for the method.

NAME
Specifies a unique identifier for a method. Required. NAME is used in scripts to call the method. NAME takes the form:

NAME="methodname"
where methodname is a unique method name within this component.

SHORTDESCRIPTION
Provides a brief description of the method that is displayed in Visual JavaScript Tool Tips. Optional. SHORTDESCRIPTION takes the form:

SHORTDESCRIPTION="tiptext"
TYPE
Indicates the data type for a method's return type. Required. TYPE is either a JavaScript data type, a primitive Java data type, or the fully qualified package name of a Java class that describes a data type.TYPE takes one of the following forms, depending on whether the specified data type is a JavaScript data type, Java primitive, or a Java class:

Type Origin Syntax
Java primitive data class

TYPE="datatype"
where datatype is a Java primitive data type, such as int or bool.

Java class

TYPE= "package.class"
where package is the Java package containing a data type class, and class is the Java class that defines the data type.

JavaScript data type

TYPE= "JSdatatype"
where JSdatatype is one of string, number, boolean, or void.

<JSB_EVENT>

Defines an event for a component. <JSB_EVENT> is primarily modeled on the Java Beans EventSetDescriptor object.

NOTE: In addition to the attributes described below that are already defined for <JSB_EVENT>, developers can provide custom attributes that follow standard SGML formatting conventions. Extensions are roughly mapped into the corresponding attributes supported by name in the Java FeatureDescriptor base class.

Attributes

The following attributes are used with the <JSB_EVENT> tag.

ADDLISTENERMETHOD
Specifies the name of the method used to add a listener method for the event. Required for the AWT11 event model if the listener methods belong to another object. The add method named here must be defined for this component using a <JSB_METHOD>
</JSB_METHOD> tag pair.

ADDLISTENERMETHOD takes the form:

ADDLISTENERMETHOD= "addMethod"
where addMethod is the name of the method that adds a listener method for the event.

DISPLAYNAME
Specifies a name for the event that can be used for display purposes. Required. Visual JavaScript displays this name in the object inspector. DISPLAYNAME takes the form:

DISPLAYNAME="eventname"
EVENTMODEL
Specifies which event model is used by this event. Required. Visual JavaScript uses the EVENTMODEL attribute to determine how to connect components. EVENTMODEL takes the form:

EVENTMODEL="model"
where model is one of:

Value Meaning
JS

A method body is created by Visual JavaScript and assigned to the Java Script object.

AWT11

Add and remove listener methods are used at run time to connect components.

HTML

Permits connection to HTML built-in objects (e.g., form elements). This is not an actual event model, but it enables Visual JavaScript to construct function bodies for "onChange" or "onClick" events.

ISDEFAULT
Indicates that this event is the default event for the component. Optional. If ISDEFAULT is omitted for all component events, the first event listed in the JSB file automatically becomes the default event for the component. If more than one event is assigned the ISDEFAULT attribute, the first event with this attribute becomes the default, and all other ISDEFAULT attributes for events are ignored.

LISTENERMETHODS
Provides a comma-delimited list of methods to call when the event is triggered. Required. Each method listed in this attribute must be defined inside its own <JSB_METHOD>
</JSB_METHOD> tag pair nested within a <JSB_LISTENER> </JSB_LISTENER> tag pair.

LISTENERMETHODS takes the form:

LISTENERMETHODS= "onEvent" [, "onEvent" ...]
where each onEvent name corresponds to a different method to call for the event. At least one such event must be listed.

LISTENERTYPE
Specifies the name of the listener interface that must be supported by the receiving object. Required for the AWT11 event model.

LISTENERTYPE takes the form:

LISTENERTYPE= "eventListener"
where eventListener corresponds to the name of a <JSB_LISTENER> tag defined at the end of the JSB file.

The JSB file must include a <JSB_LISTENER> </JSB_LISTENER> tag pair that specifies the listener interface, particularly the methods that are called by the interface. Note that the <JSB_LISTENER> </JSB_LISTENER> tag pair lies outside the <JSB> </JSB> tag pair that defines the component body.

REMOVELISTENERMETHOD
Specifies the name of a method used to remove a listener method for the event. Required for the AWT11 event model if the listener methods belong to another object. The remove method named here must be defined for this component using a <JSB_METHOD> </JSB_METHOD> tag pair.

REMOVELISTENERMETHOD takes the form:

REMOVELISTENERMETHOD= "deleteMethod"
where deleteMethod is the name of the method that deletes a listener method from the event.

NAME
Specifies a unique identifier for an event. Required. NAME is used in scripts to call the event. NAME takes the form:

NAME="eventname"
where eventname is a unique event name within this component.

SHORTDESCRIPTION
Provides a brief description of the event that is displayed in Visual JavaScript Tool Tips. Optional. SHORTDESCRIPTION takes the form:

SHORTDESCRIPTION="tiptext"

<JSB_PARAMETER>

Defines a parameter for a method belonging to the component. Parameter tags are always embedded within <JSB_METHOD> tags in a JSB file. <JSB_PARAMETER> is primarily modeled on the Java Beans ParameterDescriptor object.

NOTE: In addition to the attributes described below that are already defined for <JSB_PARAMETER>, developers can provide custom attributes that follow standard SGML formatting conventions. Extensions are roughly mapped into the corresponding attributes supported by name in the Java FeatureDescriptor base class.

Attributes

The following attributes are used with the <JSB_PARAMETER> tag.

DISPLAYNAME
Specifies a descriptive name for the parameter that can be used for display purposes. Optional. Visual JavaScript displays this name in the object inspector. DISPLAYNAME takes the form:

DISPLAYNAME="paramname"
If DISPLAYNAME is omitted, Visual JavaScript substitutes the NAME attribute.

NAME
Specifies a unique identifier for the parameter. Optional. If provided, NAME can be used for display purposes in Visual JavaScript.

NAME="paramname"
where paramname is a unique parameter name for the method.

SHORTDESCRIPTION
Provides a brief description for the parameter that is displayed in Visual JavaScript Tool Tips. Optional. SHORTDESCRIPTION takes the form:

SHORTDESCRIPTION="tiptext"
TYPE
Indicates the data type for a parameter's return type. Required. TYPE is either a JavaScript data type, or the fully qualified package name of a Java class that describes a data type.TYPE takes one of the following forms, depending on whether the specified data type is a JavaScript data type or a Java class:

Type Origin Syntax
Java class

TYPE= "package.class"
where package is the Java package containing a data type class, and class is the Java class that defines the data type.

JavaScript data type

TYPE= "JSdatatype"
where JSdatatype is one of string, number, or boolean.

<JSB_CONSTRUCTOR>
</JSB_CONSTRUCTOR>

Encapsulates the JavaScript script that constructs the component. The script must, at a minimum, define a function that matches the NAME attribute of the <JSB_DESCRIPTOR> tag, except that embedded dots in NAME must be replaced by underscores in the function definition. For example, given the following descriptor:

<JSB_DESCRIPTOR NAME="netscape.sample.SampleScrollingBanner">
then a minimum constructor would be as follows:

<JSB_CONSTRUCTOR>
   function netscape_sample_SampleScrollingBanner (params) {
   . . .
   }
</JSB_CONSTRUCTOR>
The script may also define helper functions for the component.

<JSB_INTERFACE>

Specifies an interface that can be returned from the getInstanceOf() command.Optional. If present, <JSB_INTERFACE> is used by Visual JavaScript to determine which Java objects can handle events associated with the component.

NOTE: In addition to the attribute described below that is already defined for <JSB_INTERFACE>, developers can provide custom attributes that follow standard SGML formatting conventions. Extensions are roughly mapped into the corresponding attributes supported by name in the Java FeatureDescriptor base class.

Attributes

The following attribute must be used with <JSB_INTERFACE>.

NAME
Indicates the unique identifier for the interface class. Required. NAME must be a fully qualified package name. NAME takes the form:

NAME= "packagename.class"
where packagename is the fully qualified package name containing the interface class, and class is the name of the interface in the package.

<JSB_LISTENER> </JSB_LISTENER>

Defines a listener interface for a component. The listener interface provides a name and signature for an event method. The <JSB_LISTENER> tag pair exists at the top level of the JSB file, outside the <JSB> tag pair that defines the component.

In a JSB file, the listener interface encapsulates the methods and parameters, if any, that are used to invoke the event handler. The listener interface is directly related to a previously declared <JSB_EVENT>, which has the name of a listener interface as one of its required attributes. Depending on the event model attribute of the associated <JSB_EVENT>, parameter requirements differ according to the following table

:

JSB_EVENT event model Listener interface requirement
JS

Three parameters required in order: A property name corresponding to a component property; the current value of the property; the new value of the property. Note that if an event does not need this information, dummy values can be passed.

AWT11

One required parameter: the event object. It is the responsibility of the component to create an object of the correct Java class, and to initialize it before calling the method.

HTML

No parameters required.

NOTE: In addition to the attribute described below that is already defined for <JSB_LISTENER>, developers can provide custom attributes that follow standard SGML formatting conventions. Extensions are roughly mapped into the corresponding attributes supported by name in the Java FeatureDescriptor base class.

Attributes

The following attribute is required for <JSB_LISTENER>.

NAME
Indicates the unique identifier for the listener interface. Required. NAME must be a fully qualified package name. NAME takes the form:

NAME= "packagename.class"
where packagename is the fully qualified package name containing the listener interface, and class is the name of the interface in the package.


[Previous] [Contents]

Last Updated: 09/03/97 11:33:54


Copyright © 1997 Netscape Communications Corporation