ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/lstdtout.htm

120 lines
5.4 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Example: Using ListRowData" />
<meta name="abstract" content="" />
<meta name="description" content="" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="lstdtout" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Example: Using ListRowData</title>
</head>
<body id="lstdtout"><a name="lstdtout"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Using ListRowData</h1>
<div><p></p>
<div class="section"><p>This example has three parts:</p>
<ul><li> <a href="#lstdtout__javalistrowdata">Java source that shows how the ListRowData class works</a></li>
<li> <a href="#lstdtout__htmllistrowdata">HTML source generated from the Java source by the using HTMLTableConverter</a></li>
<li> <a href="#lstdtout__displaylistrowdata">How a browser displays the generated HTML</a></li>
</ul>
</div>
<div class="section" id="lstdtout__javalistrowdata"><a name="lstdtout__javalistrowdata"><!-- --></a><h4 class="sectiontitle">Java™ source that shows how the ListRowData
class works</h4><pre> // Access an existing non-empty data queue
KeyedDataQueue dq = new KeyedDataQueue(systemObject_, "/QSYS.LIB/MYLIB.LIB/MYDQ.DTAQ");
// Create a metadata object.
ListMetaData metaData = new ListMetaData(2);
// Set first column to be the customer ID.
metaData.setColumnName(0, "Customer ID");
metaData.setColumnLabel(0, "Customer ID");
metaData.setColumnType(0, RowMetaDataType.STRING_DATA_TYPE);
// Set second column to be the order to be processed.
metaData.setColumnName(1, "Order Number");
metaData.setColumnLabel(1, "Order Number");
metaData.setColumnType(1, RowMetaDataType.STRING_DATA_TYPE);
// Create a ListRowData object.
ListRowData rowData = new ListRowData();
rowData.setMetaData(metaData);
// Get the entries off the data queue.
KeyedDataQueueEntry data = dq.read(key, 0, "EQ");
while (data != null)
{
// Add queue entry to row data object.
Object[] row = new Object[2];
row[0] = new String(key);
row[1] = new String(data.getData());
rowData.addRow(row);
// Get another entry from the queue.
data = dq.read(key, 0, "EQ");
}
// Create an HTML converter object and convert the rowData to HTML.
HTMLTableConverter conv = new HTMLTableConverter();
conv.setUseMetaData(true);
HTMLTable[] html = conv.convertToTables(rowData);
// Display the output from the converter.
System.out.println(html[0]);</pre>
</div>
<div class="section" id="lstdtout__htmllistrowdata"><a name="lstdtout__htmllistrowdata"><!-- --></a><h4 class="sectiontitle">HTML source generated from the Java source
by the using HTMLTableConverter</h4><p>Using the <a href="tablconv.htm#tablconv">HTMLTableConverter class</a> in
the Java source
example above generates the following HTML code.</p>
<pre> &lt;table&gt;
&lt;tr&gt;
&lt;th&gt;Customer ID&lt;/th&gt;
&lt;th&gt;Order Number&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;777-53-4444&lt;/td&gt;
&lt;td&gt;12345-XYZ&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;777-53-4444&lt;/td&gt;
&lt;td&gt;56789-ABC&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</pre>
</div>
<div class="section" id="lstdtout__displaylistrowdata"><a name="lstdtout__displaylistrowdata"><!-- --></a><h4 class="sectiontitle">How a browser displays the generated
HTML</h4><p>The following table shows how the HTML source code looks when
viewed in a browser.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="void" border="0" rules="none"><thead align="left"><tr><th valign="top" width="47.82608695652174%" id="d0e61">Customer ID</th>
<th valign="top" width="52.17391304347826%" id="d0e63">Order Number</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="47.82608695652174%" headers="d0e61 ">777-53-4444</td>
<td valign="top" width="52.17391304347826%" headers="d0e63 ">12345-XYZ</td>
</tr>
<tr><td valign="top" width="47.82608695652174%" headers="d0e61 ">777-53-4444</td>
<td valign="top" width="52.17391304347826%" headers="d0e63 ">56789-ABC</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>