[Previous] [Contents]

Chapter 11
Java Components

This chapter lists and describes all of the built-in Java components and the properties, methods, and events of each.

Java components are JavaBeans, defined in the Java language in component.class and componentBeanInfo.class files, collected into .jar files. You can find he binary files that define these components in the netscape/peas directory in your Visual JavaScript installation. In general, source files are not available for Java components.

Note that when an application uses Java components, the runtime environment must include a Java-enabled browser.

Components are presented below alphabetically. The properties are listed alphabetically by the display name under which they are presented in the Inspector. These are not the actual property names that are used to access property values in code.

These are the built-in Java components:

Coffee Table

The Coffee Table is a client-side Java component that can be used to display tabular data in a spreadsheet-like user interface. The Coffee Table supports sorting and editing of the displayed data and has full scrolling capabilities.

The Coffee Table supports direct and property connections. It supports a one-way or two-way direct connection with a client-side cursor component such as the JavaScript Client Cursor or Java Client Cursor. When you make this connection (using the Connection Builder) the Coffee Table is automatically populated with data from the current data set whenever the data changes; that is, when the cursor's rowChange or tableChange event occurs.

Additional documentation is available for this component. Right-click the Coffee Table component in the Component Palette and choose Component Info from the context menu.

This component is provided by Argent Software. A more full-featured version will become available, and can be purchased directly from Argent Software (http://www.argent.com.). The full version will include a custom component editor, and many more features such as properties for fonts and colors and more public methods for better integration.

The component has no methods.

Properties

Coffee Table  
Property Description
Alignment

The alignment of the applet with respect to surrounding text.

Property name: align

Value type: string (ABSBOTTOM, ABSMIDDLE, BOTTOM, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP)

Alternate Text

Text to display when the applet is not displayed (also displayed in tool tip in Communicator).

Property name: alt

Value type: string

Demo Text

When set totrue, displays "placeholder" text in cells for demonstration purposes (for example, Row:1, Col:1). Default value is false.

Property name: demoText

Value type: boolean

Editing

When set totrue, the user can edit text in the table by double-clicking in a cell. Default value is false.

Property name: editing

Value type: boolean

Height

The height, in pixels, of the applet.

Property name: height

Value type: number

Horizontal Margin

The amount of extra horizontal space, in pixels, inserted on the left and right of the applet.

Property name: hspace

Value type: number

Name

The name of the component.

Property name: name

Value type: string

Number of Columns

Initial number of columns in the table grid.

Property name: numCols

Value type: number (1-100)

Number of Rows

Initial number of rows in the table grid.

Property name: numRows

Value type: number (1-1000)

Row Header Width

Width, in pixels, of row headers. When the value is 0, no row headers are displayed. When the value is non-zero, and when the Row Numbers property is true, row numbers are displayed in the header. When the Row Numbers property is false, a blank row header is displayed. The user can use the blank row header to manipulate the row size with the mouse.

Property name: rowHeaderWidth

Value type: number (0-100)

Row Numbers

When set to true, the table displays row numbers in the row headers. This is possible only when the Row Header Width property has a non-zero value. Default value is false.

Property name: rowNumbers

Value type: boolean

Sorting

When set to true, enables sorting of each column in the grid. Sorting occurs when the user clicks in the column header. The first click sorts alphabetically. A subsequent click reverses the sort order. Default value is false.

Property name: sorting

Value type: boolean

URL Column 1

The column number of a URL-valued column. The first column is number 1.

When a column has a URL value, a user can click in any cell in that column to go to the specified URL. The cell's value must specify the URL as a string (for example, "http://www.argent.com"), or a string containing label text with a valid URL in brackets (for example, "Argent Software<http://www.argent.com>"). The link or text label is displayed in blue and underlined.

Property name: URLCol1

Value type: number

URL Column 2

The column number of a second URL-valued column. (See URL Column 1.)

Property name: URLCol2

Value type: number

Vertical Margin

Specifies the amount of extra vertical space, in pixels, inserted above and below the applet.

Property name: vspace

Value type: number

Width

Specifies the width, in pixels, of the applet.

Property name: width

Value type: number

Events

Coffee Table  
Event Description
propertyChange

Occurs when any bound property changes.

rowChange

Occurs when any change occurs in the current row--either to an individual value, or to the row composition.

tableChange

Occurs when any change occurs in the current dataset or when a new dataset is obtained.

Java Client Cursor

The Java Client Cursor is a client-side Java component that communicates with a server-side LiveWire database cursor. The curser is based on the query specified in the SQL Query property. You can connect HTML form elements to the cursor to display values and call the component's methods, which can scroll through the result set and modify the database. See Writing Server-Side JavaScript Applications for more information on cursors.

The cursor must connect to a LiveWire DBPool component in the same project.

The Java Client Cursor component supports direct and property connections. Property change events occur in response to changes in bound properties. In this component, bound properties include dynamically added properties that correspond to database columns.

This nonvisible component is described in install dir/netscape/peas/ClientCursor.jsb

Properties

Java Client Cursor  
Property Description
Current Row Number

Specifies and reflects the current row number. Used only at run time. The nextRow and previousRow methods increment and decrement this value. Use the getCurrentRowNumber method to access the value.

Property name: currentRowNumber

Value type: integer

DBPool

Name of LiveWire DBPool component from which to get database connection.

Property name: dbpool

Value type: DBPool

SQL Query

SQL select statement that defines cursor data set.

Property name: SQL

Value type: SQLQuery

Updatable

When set to true, the user can use the cursor to update data in the connected database.

Property name: updatable

Value type: boolean

Methods

Java Client Cursor  
Method Description
addRow

Clears current values of connected form elements, replacing with "?".

Arguments: none

Return value: none

deleteRow

Deletes current row from database.

Arguments: none

Return value: none

executeQuery

Causes the specified query to be executed and the result set to be initialized.

Arguments: none

Return value: success (boolean)

getCurrentRowNumber

Returns the row number of the current row.

Arguments: none

Return value: row (int)

getQuery

Returns the current SQL query.

Arguments: none

Return value: query (string)

nextRow

Goes to next row in client data set.

Arguments: none

Return value: success (boolean)

previousRow

Goes to previous row in client data set.

Arguments: none

Return value: success (boolean)

setCurrentRowNumber

Changes the current row number to the specified row number.

Arguments: row (int)

Return value: success (boolean)

setQuery

Sets a new SQL query for the cursor.

Arguments: query (string)

Return value: none

updateCurrentRow

Changes values of the current row in the database based on current values of connected form elements.

Arguments: none

Return value: none

Events

Java Client Cursor  
Event Description
propertyChange

Occurs when any bound property changes.

property currentRowNumber change

Occurs when the Current Row Number property changes.

property SQL change

Occurs when the SQL Query property changes.

property name change

Occurs when the referenced property changes. These events and properties are added dynamically when the cursor is connected to data, and correspond to the database columns.

rowChange

Occurs when any change occurs in the current row--either to an individual value, or to the row composition.

tableChange

Occurs when any change occurs in the current dataset, or when a new dataset is obtained.

Java Dummy Cursor

The Java Dummy Cursor is a sample client-side database cursor, intended for demonstration and testing purposes. The component accesses "dummy" data to mimic the behavior of a Java Client Cursor without requiring a server or a database connection. A Java Dummy Cursor component supports direct and property connections.

This nonvisible component is described in install dir/netscape/peas/JavaDummyCursor.jsb

Properties

Java Dummy Cursor  
Property Description
Current Row Number

Specifies and reflects the current row number. Used only at run time. The nextRow and previousRow methods increment and decrement this value. Use the getCurrentRowNumber and setCurrentRowNumber methods to access the value.

Property name: currentRowNumber

Value type: number

Updatable

When set to true, the user can use the cursor to update the dummy data. Default value is true.

Property name: updatable

Value type: boolean

Methods

Java Dummy Cursor  
Method Description
addRow

Clears current values of connected form elements, replacing with "?".

Arguments: none

Return value: none

deleteRow

Deletes current row from database.

Arguments: none

Return value: none

executeQuery

Causes the specified query to be executed and the result set to be initialized.

Arguments: none

Return value: none

getCurrentRowNumber

Returns the row number of the current row.

Arguments: none

Return value: row (int)

getQuery

Returns the current SQL query.

Arguments: none

Return value: query (string)

nextRow

Goes to the next row in the client data set.

Arguments: none

Return value: success (boolean)

previousRow

Goes to the previous row in the client data set.

Arguments: none

Return value: success (boolean)

setCurrentRowNumber

Changes the current row number to the specified row number.

Arguments: row (Number)

Return value: success (boolean)

setQuery

Sets a new SQL query for the cursor.

Arguments: query (string)

Return value: none

updateCurrentRow

Changes values of the current row in the database based on current values of connected form elements.

Arguments: none

Return value: none

Events

Java Dummy Cursor  
Event Description
propertyChange

Occurs when any bound property changes.

property currentRowNumber change

Occurs when the Current Row Number property changes.

property SQL change

Occurs when the SQL Query property changes.

property name change

Occurs when the referenced property changes. These events and properties are added dynamically when the cursor is connected to data, and correspond to the database columns.

rowChange

Occurs when any change occurs in the current row--either to an individual value, or to the row composition.

tableChange

Occurs when any change occurs in the current dataset, or when a new dataset is obtained.

Java Form

The Java Form is a sample client-side form. The Java Form supports direct and property connections from client-side cursors: Java Client Cursor, JavaScript Client Cursor, or either dummy cursor. Make a two-way connection between the Java Form and the cursor component if the form allows the user to update the database.

The component has no methods

Properties

Java Form  
Property Description
Alignment

The alignment of the applet with respect to surrounding text.

Property name: align

Value type: string (ABSBOTTOM, ABSMIDDLE, BOTTOM, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP)

Alternate Text

Text to display when the applet is not displayed (also displayed in tool tip in Communicator).

Property name: alt

Value type: string

Height

The height, in pixels, of the applet.

Property name: height

Value type: number

Horizontal Margin

The amount of extra horizontal space, in pixels, inserted on the left and right of the applet.

Property name: hspace

Value type: number

Name

The name of the component.

Property name: name

Value type: string

Vertical Margin

Specifies the amount of extra vertical space, in pixels, inserted above and below the applet.

Property name: vspace

Value type: number

Width

Specifies the width, in pixels, of the applet.

Property name: width

Value type: number

Events

Java Form  
Event Description
propertyChange

Occurs when any bound property changes.

rowChange

Occurs when any change occurs in the current row--either to an individual value, or to the row composition.

Nervous Text

The Nervous Text is a client-side Java component that displays text in which the letters change position randomly. In the Message property, specify the text to be displayed. The component supports property connections.

The component has no methods and no events.

Properties

Nervous Text  
Property Description
Alignment

The alignment of the applet with respect to surrounding text.

Property name: align

Value type: string (ABSBOTTOM, ABSMIDDLE, BOTTOM, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP)

Alternate Text

Text to display when the applet is not displayed (also displayed in tool tip in Communicator).

Property name: alt

Value type: string

Height

The height, in pixels, of the applet.

Property name: height

Value type: number

Horizontal Margin

The amount of extra horizontal space, in pixels, inserted on the left and right of the applet.

Property name: hspace

Value type: number

Message

The text of the message to be displayed.

Property name: message

Value type: string

Name

The name of the component.

Property name: name

Value type: string

Vertical Margin

Specifies the amount of extra vertical space, in pixels, inserted above and below the applet.

Property name: vspace

Value type: number

Width

Specifies the width, in pixels, of the applet.

Property name: width

Value type: number

PopChart Lite

The PopChart Lite is a client-side Java graphing component that displays data in a highly configurable bar, area, or pie graph.

The PopChart Lite supports a direct connection from a client-side cursor component such as the JavaScript Client Cursor or Java Client Cursor. When you make this connection (using the Connection Builder) the graph is automatically populated with data from the current data set whenever the data changes; that is, when the cursor's rowChange or tableChange event occurs.

When you inspect a PopChart component, a custom component editor appears. Use this editor to change the appearance of the graph; do not edit the properties directly. You can click the title bar of the Inspector to switch between the custom component editor and the Inspector and see how the editor sets the properties for you.

Additional documentation is available for this component. Right-click the PopChart Lite component in the Component Palette and choose Component Info from the context menu.

This component is provided by Corda Technologies, Inc. A more full-featured version can be purchased directly from Corda Technologies (http:// www.corda.com).


[Previous] [Contents]

Last Updated: 11/06/97 13:25:03


Copyright © 1997 Netscape Communications Corporation