ITemplateData interface (deprecated)
ITemplateData is deprecated and is provided for backward compatibility only. New Java applications should use the standard servlet-JSP programming model, where similar functionality is provided through interfaces such as java.sql.ResultSet and javax.sql.RowSet.
For information about replacing ITemplateData functionality in existing applications, see the Migration Guide.
The ITemplateData interface represents a hierarchical source of data used for HTML template processing. ITemplateData provides methods for iterating through rows in a set of memory-based hierarchical data and retrieving column values.
To create an ITemplateData object, an AppLogic calls GX.CreateTemplateDataBasic( ). The AppLogic populates the ITemplateData object with rows of hierarchical data, then passes this ITemplateDataBasicobject as the data parameter in evalTemplate( ) or evalOutput( ) in the AppLogic class (deprecated). The Template Engine then draws upon the hierarchical data during template processing using methods in the ITemplateData interface.
The Template Engine normally processes the hierarchical template data internally. To provide application-specific special processing and hook into the template generation process, the AppLogic can subclass the TemplateDataBasic class (deprecated) and override the ITemplateData member methods.
Package
com.kivasoft
Methods
Example
// Determine whether AppLogic module is listed in project
TemplateDataBasic tdb;
tdb = GetProjectData();
if (tdb == null) {
return false;
}
if (!tdb.isEmpty("MODULE")) {
loopChild:
do {
String name;
name = tdb.getValue("MODULENAME");
if ((name != null) &&
(name.compareTo(moduleName) == 0)) {
GenerateReport("The AppLogic already exists.<br>"
+"Please choose another name.", null, null);
return false;
}
}
while (tdb.moveNext("MODULE") == 0);
}
Related Topics
evalTemplate( ) and evalOutput( ) in the AppLogic class (deprecated)
TemplateDataBasic class (deprecated)
getValue( )
The Template Engine calls this method to dynamically retrieve the value of the specified field from the current row in the hierarchical template data.
Syntax
public IBuffer getValue(
String szExpr)
szExpr.
Name of a field in the template data object.
Usage
The Template Engine calls getValue( ) to retrieve values from the hierarchical template data object for subsequent processing.
Rule
The specified field name must exist in the template data object.
Tips
Return Value
An IBuffer object that contains the value of the specified field name, or null for failure (such as invalid field name).
Related Topics
evalTemplate( ) and evalOutput( ) in the AppLogic class (deprecated)
TemplateDataBasic class (deprecated)
isEmpty( )
The Template Engine calls this method to determine whether the specified group in the hierarchical result set is empty (contains no rows).
Syntax
public boolean isEmpty(
String group)
group.
Name of a group in the hierarchical result set.
Usage
The Template Engine calls isEmpty( ) to test whether the specified group in the ITemplateData object contains any rows of data before processing individual fields using getValue( ).
Rule
The specified group name must exist in the hierarchical data set.
Tip
When processing result sets, first call isEmpty( ) to determine whether rows were returned. Next, for each row in the result set, call getValue( ) to retrieve field values, then call moveNext( ) to move to the next row in the result set, until the end of the result set is reached.
Return Value
True if the specified group is empty, and false if it contains rows of data or if the specified group name is invalid.
Related Topics
evalTemplate( ) and evalOutput( ) in the AppLogic class (deprecated)
TemplateDataBasic class (deprecated)
moveNext( )
The Template Engine calls this method to retrieve the next row of the specified group in the hierarchical template data object.
Syntax
public int moveNext(
String group)
group.
Name of a group to process in the hierarchical data of the template data object.
Usage
The Template Engine calls moveNext( ) when iterating through rows in the template data object to retrieve the contents of the next sequential hierarchical row of data.
Rule
The specified group name must exist in the hierarchical data set.
Tip
When processing result sets, first call isEmpty( ) to determine whether rows were returned. Next, for each row in the result set, call getValue( ) to retrieve field values, then call moveNext( ) to move to the next row in the result set, until the end of the result set is reached.
Return Value
GXE.SUCCESS if the method succeeds.
Related Topics
evalTemplate( ) and evalOutput( ) in the AppLogic class (deprecated)
TemplateDataBasic class (deprecated)
setHint( )
The setHint( ) method is a placeholder for future functionality. Currently, it is implemented to return 0. If you create a custom template data class that implements the ITemplateData interface, implement setHint( ) to return 0.
Syntax
public int setHint(
String group,
int flags,
int max,
IValList pVal)
|