ITile interface (deprecated)
ITile is deprecated and is provided for backward compatibility only. New Java applications should use the standard servlet-JSP programming model.
For information about replacing ITile functionality in existing applications, see the Migration Guide.
The ITile interface represents a tile, which is a record set that contains multiple records. A tile can also contain nested tiles. Organized like a hierarchical result set, a tile is returned by the GX.ProcessOutput( ) method.
AppLogics use ITile together with GX.ProcessOutput( ) when working with non-HTML results returned by another AppLogic. The following are the general steps for getting the tile:
A client AppLogic calls an AppLogic with newRequest( ).
Through newRequest( ), the client passes input and output IValLists to the called AppLogic. If the client is an AppLogic, it specifies the value "ocl" for the gx_client_type key in the input IValList.
The called AppLogic processes the request and sends back results using its output IValList or by calling evalOutput( ).
The client calls the GX.ProcessOutput( ) method to process the results into an ITile object.
Using methods in the ITile interface, the client traverses the tile and retrieves values to populate user interface controls, such as text boxes or list boxes, on a form.
The tile corresponds to the structure specified by the tile and cell tags in the template file that the called AppLogic used when it called evalOutput( ). The tile tag determines the tile or record set, and the cell tag, the values in each record.
Package
com.kivasoft
Methods
Example
The following example shows a template file used by a called AppLogic when generating output, and a section of a program that uses GX.ProcessOutput( ) and ITile methods to process the output:
GXML template file:
<gx type=tile id="PRODUCTS" max=100>
<gx type=cell id="PRODUCTS.Category"></gx>
<gx type=cell id="PRODUCTS.ProdName"></gx>
</gx>
<gx type=tile id="CATEGORIES" max=100>
<gx type=cell id="CATEGORIES.CategoryId"></gx>
</gx>
Code snippet:
// Call this AppLogic
hr = Conn.newRequest(guid, vIn, vOut, 0);
if (hr==GXE.SUCCESS)
{
// Get the root tile from the output vallist
ITile roottile = GX.ProcessOutput(null, 0, vOut);
if (roottile != null)
{
String sval;
ITile ptile;
//Iterate over all products and print their names
ptile = roottile.getTileChild("PRODUCTS");
hr = GXE.SUCCESS;
System.out.println("Products:");
while (ptile != null && hr != GXE.FAIL)
{
sval = ptile.getTileValue("PRODUCTS.ProdName");
System.out.println(" " + sval);
hr = ptile.moveTileNextRecord();
}
//Iterate over all categories and print their ids
ptile = roottile.getTileChild("CATEGORIES");
hr = GXE.SUCCESS;
System.out.println("Categories:");
while (ptile != null && hr != GXE.FAIL)
{
sval = ptile.getTileValue("CATEGORIES.CategoryId");
System.out.println(" " + sval);
hr = ptile.moveTileNextRecord();
}
}
}
Related Topics
newRequest( ) and evalOutput( ) in the AppLogic class (deprecated)
GX.ProcessOutput( ), IValList interface (deprecated)
getTileChild( )
Returns the specified tile.
Syntax
public ITile getTileChild(
String name)
name.
The name of the child tile in the tile. This name must match a name assigned to the id attribute of type tile in the template file.
Usage
Use getTileChild( ) to retrieve a tile from which to get records and record values. Use it in conjunction with moveTileNextRecord( ) and getTileValue( ) to traverse the tile and retrieve record values. The client can call these methods in a loop until all values in a tile have been retrieved.
Return Value
An ITile object, or null for failure.
Related Topics
getTileValue( ), moveTileNextRecord( )
getTileValue( )
Returns the value of a specified field in a record.
Syntax
public String getTileValue(
String name)
name.
The name of the field in the current record. This name must match a name assigned to the id attribute of type cell in the template file.
Usage
Use getTileValue( ) to retrieve values in a record. Use it in conjunction with getTileChild( ) and moveTileNextRecord( ) to traverse the tile and retrieve each value. The client can call these methods in a loop until all values in a tile have been retrieved.
Return Value
The record value as a string.
Related Topics
getTileChild( ), moveTileNextRecord( )
moveTileNextRecord( )
Moves to the next record in the tile.
Syntax
public int moveTileNextRecord()
Usage
Use moveTileNextRecord( )to go to the next record in a tile after retrieving values in the current record. Use the method in conjunction with getTileChild( ) and getTileValue( ) to traverse the tile and retrieve each value. The client can call these methods in a loop until all values in a tile have been retrieved.
Return Value
GXE.SUCCESS if the method succeeds.
Related Topics
getTileChild( ), getTileValue( )
moveTileToRecord( )
Moves to a specific record in the tile.
Syntax
public int moveTileNextRecord(
int ord)
ord.
The position of the record in the tile. The first record in a tile is 1, the second is 2, and so on.
Usage
Use moveTileToRecord( ) when iterating through the tile multiple times. For example, after iterating through all the records, the AppLogic can return to the first record in preparation for the next iteration. If the tile contains many records, the AppLogic can also use moveTileToRecord( ) to display only several records at a time.
Return Value
GXE.SUCCESS if the method succeeds.
|