IBM Books

Net.Data Language Environment Reference

Generating the Applet Tags

You specify a call to the applet language environment with a Net.Data function call. No declaration is needed for the function call. The syntax for the function call is shown here:

@DTWA_AppletName(parm1, parm2, ..., parmN)

To write a macro file that generates applet tags:

  1. Define any parameters required by the applet in the DEFINE section of the macro file. These parameters include any applet tag attributes, Net.Data variables, and Net.Data table parameters that you need as input for the applet. For example:
    %define{
    DATABASE = "celdial"                   <=Net.Data variable: name of the database
    MyGraph.codebase = "/netdata-java/" <=Required applet parameter
    MyGraph.height = "200"                 <=Required applet parameter
    MyGraph.width = "400"                  <=Required applet parameter
    MyTitle = "This is my Title"           <=Net.Data variable: name of the Web page
    MyTable = %TABLE(all)                  <=Table to store query results
    %}
    

  2. Optional: Specify a query to the database to generate a result set as input for the applet. This is useful when you are using an applet that generates a chart or table. For example:
    %FUNCTION(DTW_SQL) mySQL(OUT table){
    select name, ages from ibmuser.guests
    %}
    

  3. Specify the function call in the Net.Data macro to call the Java applet language environment and invoke the applet. The function call specifies the name of the applet and the parameters you want to pass to the language environment. These parameters include any Net.Data variables, and Net.Data table or column parameters that you need as input for the applet.

    For example:

    %HTML(report){                                    <=The start of the HTML block
    @mySQL(MyTable)                                   <=A call to the SQL function
                                                             mySQL
    @DTWA_MyGraph( MyTitle, DTW_COLUMN(ages) MyTable) <=Applet function call
    %}
     
    

  4. Invoke Net.Data and run the macro file. See Net.Data Administration and Programming Guide to learn how to invoke Net.Data.

Applet Tag Attributes

You can specify attributes for applet tags anywhere in your Net.Data macro. Net.Data substitutes all variables that have the form AppletName.attribute into the applet tag as attributes. The syntax for defining an attribute on an applet tag is shown here:

%define AppletName.attribute = "value"

These attributes are required for all applets:

For example, if your applet is called MyGraph, you can define these required attributes as shown here:

%DEFINE{
MyGraph.codebase = "/netdata-java/"
MyGraph.height   = "200"
MyGraph.width    = "400"
%}

The actual assignment need not be in a DEFINE section. You can set the value with the DTW_ASSIGN function. If you do not define a variable for AppletName.code variable, Net.Data adds a default code parameter to the applet tag. The value of the codeparameter is AppletName.class, where AppletName is the name of your applet.

Applet Tag Parameters

You define a list of parameters to pass to the Java applet language environment in the function call. You can pass parameters that include:

When you pass a parameter, Net.Data creates a Java applet PARAM tag in the HTML output with the name and value that you assign to the parameter. You cannot pass string literals or results of function calls.

Net.Data Variable Parameters

You can use Net.Data variables as parameters. If you define a variable in the DEFINE block of the macro and pass the variable value in the DTWA_AppletName function call, Net.Data generates a PARAM tag that has the same name and value as the variable. For example, given the following macro statement:

%define{
 
...
 
MyTitle = "This is my Title"
%}
 
%HTML(report){
@DTWA_MyGraph( MyTitle, ...)
%}

Net.Data produces the following applet PARAM tag:

<param name = 'MyTitle' value = "This is my Title" >
 

Net.Data Table Parameters

Net.Data automatically generates a PARAM tag with the name DTW_NUMBER_OF_TABLES every time the Java applet language environment is called, specifying whether the function call has passed any table variables. The value is the number of table variables that Net.Data uses in the function. If no table variables are specified in the function call, the following tag is generated:

<param name = "DTW_NUMBER_OF_TABLES" value = "0" >

You can pass one or more Net.Data table variables as parameters on the function call. If you specify a Net.Data table variable on a DTWA_AppletName function call, Net.Data generates the following PARAM tags:

Table name parameter tag:

This tag specifies the names of the tables to pass. The tag has the following syntax:

<param name = 'DTW_TABLE_i_NAME' value = "tname" >

Where i is the number of the table based on the ordering of the function call, and tname is the name of the table.

Row and column specification parameter tags:

PARAM tags are generated to specify the number of rows and columns a particular table. This tag has the following syntax:

<param name = 'DTW_tname_NUMBER_OF_ROWS' value = "rows" >
<param name = 'DTW_tname_NUMBER_OF_COLUMNS' value = "cols" >

Where the name of the table is tname, rows is the number of rows in the table, and cols is the number of columns in the table. This pair of tags is generated for each unique table specified in the function call.

Column value parameter tags:

This PARAM tag specifies the column name of a particular column. This tag has the following syntax:

<param name = 'DTW_tname_COLUMN_NAME_j' value = "cname" >

Where the table name is tname, j is the column number, and cname is the name of the column in the table.

Row value parameter tags:

This PARAM tag specifies the values at a particular row and column. This tag has the following syntax:

<param name = 'DTW_tname_cname_VALUE_k' value = "val" >

Where the table name is tname, cname is the column name, k is the row number, and val is the value that matches the value in the corresponding row and column.

Table Column Parameters

You can pass a table column as a parameter on a function call to generate tags for a specific column. Net.Data generates the corresponding applet tags only for the specified column. A table column parameter uses the following syntax:

@DTWA_AppletName(DTW_COLUMN( x )Table)

Where x is the name or number of the column in the table.

Table column parameters use the same applet tags defined for the table parameters.

Alternate Text for the Applet Tag on Browsers that are not Java-Enabled

The variable DTW_APPLET_ALTTEXT specifies the text to display on browsers that do no support Java or have turned Java support off. For example, the following variable definition:

%define DTW_APPLET_ALTTEXT = "<P>Sorry, your browser is not Java-enabled."

produces the following HTML tag and text:

<P>Sorry, your browser is not Java-enabled.<BR>

If this variable is not defined, no alternate text is displayed.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]