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

190 lines
11 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="HTMLList classes" />
<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="htmllist" />
<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>HTMLList classes</title>
</head>
<body id="htmllist"><a name="htmllist"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">HTMLList classes</h1>
<div><p></p>
<div class="section"><p>The HTMLList classes allow you to easily create lists within your
HTML pages. These classes provide methods to get and set various attributes
of the lists and the items within the lists.</p>
<p>In particular, the parent
class <a href="javadoc/com/ibm/as400/util/html/HTMLList.html#NAVBAR_TOP"> HTMLList</a> provides a method to produce a <a href="javadoc/com/ibm/as400/util/html/HTMLList.html#SETCOMPACT(BOOLEAN)"> compact list</a> that displays items in as small a vertical
space as possible.</p>
<ul><li>Methods for <a href="javadoc/com/ibm/as400/util/html/HTMLList.html#NAVBAR_TOP">HTMLList</a> include: <ul><li><a href="javadoc/com/ibm/as400/util/html/HTMLList.html#SETCOMPACT(BOOLEAN)">Compact</a> the list</li>
<li><a href="javadoc/com/ibm/as400/util/html/HTMLList.html#ADDLISTITEM(COM.IBM.AS400.UTIL.HTML.HTMLLISTITEM)">Add</a> and <a href="javadoc/com/ibm/as400/util/html/HTMLList.html#REMOVELISTITEM(COM.IBM.AS400.UTIL.HTML.HTMLLISTITEM)">remove</a> items from the list</li>
<li><a href="javadoc/com/ibm/as400/util/html/HTMLList.html#ADDLIST(COM.IBM.AS400.UTIL.HTML.HTMLLIST)">Add</a> and <a href="javadoc/com/ibm/as400/util/html/HTMLList.html#REMOVELIST(COM.IBM.AS400.UTIL.HTML.HTMLLIST)">remove</a> lists from the list (making it possible
to nest lists)</li>
</ul>
</li>
</ul>
<ul><li>Methods for <a href="javadoc/com/ibm/as400/util/html/HTMLListItem.html#NAVBAR_TOP">HTMLListItem</a> include: <ul><li><a href="javadoc/com/ibm/as400/util/html/HTMLListItem.html#GETITEMDATA()">Get</a> and <a href="javadoc/com/ibm/as400/util/html/HTMLListItem.html#SETITEMDATA(COM.IBM.AS400.UTIL.HTML.HTMLTAGELEMENT)">set</a> the contents of the item</li>
<li><a href="javadoc/com/ibm/as400/util/html/HTMLListItem.html#GETDIRECTION()">Get</a> and <a href="javadoc/com/ibm/as400/util/html/HTMLListItem.html#SETDIRECTION(JAVA.LANG.STRING)">set</a> the direction of the text interpretation</li>
<li><a href="javadoc/com/ibm/as400/util/html/HTMLListItem.html#GETLANGUAGE()">Get</a> and <a href="javadoc/com/ibm/as400/util/html/HTMLListItem.html#SETLANGUAGE(JAVA.LANG.STRING)">set</a> the language of the input element</li>
</ul>
</li>
</ul>
<p>Use the subclasses of HTMLList and HTMLListItem to create your HTML
lists:</p>
<ul><li> <a href="#htmllist__olandoli">OrderedList and OrderedListItem</a></li>
<li> <a href="#htmllist__ulanduli">UnorderedList and UnorderedListItem</a></li>
</ul>
<p>For coding snippets, see the following examples:</p>
<ul><li>Example: <a href="#htmllist__creatingorderedlists">Creating ordered
lists</a></li>
<li>Example: <a href="#htmllist__creatingunorderedlists">Creating unordered
lists</a></li>
<li>Example: <a href="#htmllist__creatingnestedlists">Creating nested lists</a></li>
</ul>
</div>
<div class="section" id="htmllist__olandoli"><a name="htmllist__olandoli"><!-- --></a><h4 class="sectiontitle">OrderedList and OrderedListItem</h4><p>Use
the <a href="javadoc/com/ibm/as400/util/html/OrderedList.html#NAVBAR_TOP"> OrderedList</a> and <a href="javadoc/com/ibm/as400/util/html/OrderedListItem.html#NAVBAR_TOP"> OrderedListItem</a> classes to create ordered
lists in your HTML pages.</p>
<ul><li>Methods for OrderedList include: <ul><li><a href="javadoc/com/ibm/as400/util/html/OrderedList.html#GETSTARTINGSEQUENCENUMBER()">Get</a> and <a href="javadoc/com/ibm/as400/util/html/OrderedList.html#SETSTARTINGSEQUENCENUMBER(INT)">set</a> the starting number for the first item
in the list</li>
<li><a href="javadoc/com/ibm/as400/util/html/OrderedList.html#GETTYPE()">Get</a> and <a href="javadoc/com/ibm/as400/util/html/OrderedList.html#SETTYPE(JAVA.LANG.STRING)">set</a> the type (or style) for the item numbers</li>
</ul>
</li>
</ul>
<ul><li>Methods for OrderedListItem include: <ul><li><a href="javadoc/com/ibm/as400/util/html/OrderedListItem.html#GETVALUE()">Get</a> and <a href="javadoc/com/ibm/as400/util/html/OrderedListItem.html#SETVALUE(INT)">set</a> the number for the item</li>
<li><a href="javadoc/com/ibm/as400/util/html/OrderedListItem.html#GETTYPE()">Get</a> and <a href="javadoc/com/ibm/as400/util/html/OrderedListItem.html#SETTYPE(JAVA.LANG.STRING)">set</a> the type (or style) for the item number</li>
</ul>
</li>
</ul>
<p>By using the methods in OrderedListItem, you can override the numbering
and type for a specific item in the list.</p>
<p>See the example for <a href="#htmllist__creatingorderedlists">creating ordered lists</a>.</p>
</div>
<div class="section" id="htmllist__ulanduli"><a name="htmllist__ulanduli"><!-- --></a><h4 class="sectiontitle">UnorderedList and UnorderedListItem</h4><p>Use
the <a href="javadoc/com/ibm/as400/util/html/UnorderedList.html#NAVBAR_TOP"> UnorderedList</a> and <a href="javadoc/com/ibm/as400/util/html/UnorderedListItem.html#NAVBAR_TOP"> UnorderedListItem</a> classes to create unordered
lists in your HTML pages.</p>
<ul><li>Methods for UnorderedList include: <ul><li><a href="javadoc/com/ibm/as400/util/html/UnorderedList.html#GETTYPE()">Get</a> and <a href="javadoc/com/ibm/as400/util/html/UnorderedList.html#SETTYPE(JAVA.LANG.STRING)">set</a> the type (or style) for the items</li>
</ul>
</li>
</ul>
<ul><li>Methods for UnorderedListItem include: <ul><li><a href="javadoc/com/ibm/as400/util/html/UnorderedListItem.html#GETTYPE()">Get</a> and <a href="javadoc/com/ibm/as400/util/html/UnorderedListItem.html#SETTYPE(JAVA.LANG.STRING)">set</a> the type (or style) for the item</li>
</ul>
</li>
</ul>
<p>See the example for <a href="#htmllist__creatingunorderedlists">creating
unordered lists</a>.</p>
</div>
<div class="section" id="htmllist__htmllistexamples"><a name="htmllist__htmllistexamples"><!-- --></a><h4 class="sectiontitle">Examples: Using HTMLList classes</h4><p>The
following examples show you how to use the HTMLList classes to create ordered
lists, unordered lists, and nested lists.</p>
<p id="htmllist__creatingorderedlists"><a name="htmllist__creatingorderedlists"><!-- --></a><strong>Example:
Creating ordered lists</strong></p>
<p>The following example creates an ordered
list:</p>
<pre> // Create an OrderedList.
OrderedList oList = new OrderedList(HTMLConstants.SMALL_ROMAN);
// Create the OrderedListItems.
OrderedListItem listItem1 = new OrderedListItem();
OrderedListItem listItem2 = new OrderedListItem();
// Set the data in the OrderedListItems.
listItem1.setItemData(new HTMLText("First item"));
listItem2.setItemData(new HTMLText("Second item"));
// Add the list items to the OrderedList.
oList.addListItem(listItem1);
oList.addListItem(listItem2);
System.out.println(oList.getTag());</pre>
<p>The previous example
produces the following tags:</p>
<pre> &lt;ol type="i"&gt;
&lt;li&gt;First item&lt;/li&gt;
&lt;li&gt;Second item&lt;/li&gt;
&lt;/ol&gt;</pre>
<p id="htmllist__creatingunorderedlists"><a name="htmllist__creatingunorderedlists"><!-- --></a><strong>Example: Creating
unordered lists</strong></p>
<p>The following example creates an unordered list:</p>
<pre> // Create an UnorderedList.
UnorderedList uList = new UnorderedList(HTMLConstants.SQUARE);
// Create the UnorderedListItems.
UnorderedListItem listItem1 = new UnorderedListItem();
UnorderedListItem listItem2 = new UnorderedListItem();
// Set the data in the UnorderedListItems.
listItem1.setItemData(new HTMLText("First item"));
listItem2.setItemData(new HTMLText("Second item"));
// Add the list items to the UnorderedList.
uList.addListItem(listItem1);
uList.addListItem(listItem2);
System.out.println(uList.getTag());</pre>
<p>The previous example
produces the following tags:</p>
<pre> &lt;ul type="square"&gt;
&lt;li&gt;First item&lt;/li&gt;
&lt;li&gt;Second item&lt;/li&gt;
&lt;/ul&gt;</pre>
</div>
<div class="section"><p id="htmllist__creatingnestedlists"><a name="htmllist__creatingnestedlists"><!-- --></a><strong>Example: Creating nested lists</strong></p>
<p>The
following example creates a nested list:</p>
<pre> // Create an UnorderedList.
UnorderedList uList = new UnorderedList(HTMLConstants.SQUARE);
// Create and set the data for UnorderedListItems.
UnorderedListItem listItem1 = new UnorderedListItem();
UnorderedListItem listItem2 = new UnorderedListItem();
listItem1.setItemData(new HTMLText("First item"));
listItem2.setItemData(new HTMLText("Second item"));
// Add the list items to the UnorderedList.
uList.addListItem(listItem1);
uList.addListItem(listItem2);
// Create an OrderedList.
OrderedList oList = new OrderedList(HTMLConstants.SMALL_ROMAN);
// Create the OrderedListItems.
OrderedListItem listItem1 = new OrderedListItem();
OrderedListItem listItem2 = new OrderedListItem();
OrderedListItem listItem3 = new OrderedListItem();
// Set the data in the OrderedListItems.
listItem1.setItemData(new HTMLText("First item"));
listItem2.setItemData(new HTMLText("Second item"));
listItem3.setItemData(new HTMLText("Third item"));
// Add the list items to the OrderedList.
oList.addListItem(listItem1);
oList.addListItem(listItem2);
// Add (nest) the unordered list to OrderedListItem2
oList.addList(uList);
// Add another OrderedListItem to the OrderedList
// after the nested UnorderedList.
oList.addListItem(listItem3);
System.out.println(oList.getTag());</pre>
<p>The previous example
produces the following tags:</p>
<pre> &lt;ol type="i"&gt;
&lt;li&gt;First item&lt;/li&gt;
&lt;li&gt;Second item&lt;/li&gt;
&lt;ul type="square"&gt;
&lt;li&gt;First item&lt;/li&gt;
&lt;li&gt;Second item&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Third item&lt;/li&gt;
&lt;/ol&gt;</pre>
</div>
</div>
</body>
</html>