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

114 lines
9.1 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="Listing Print objects" />
<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="printli" />
<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>Listing Print objects</title>
</head>
<body id="printli"><a name="printli"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Listing Print objects</h1>
<div><p></p>
<div class="section"><p>You can use the <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#NAVBAR_TOP"> PrintObjectList</a> class and its subclasses to work with
lists of print objects. Each subclass has methods that allow filtering of
the list based on what makes sense for that particular type of print object.
For example, <a href="javadoc/com/ibm/as400/access/SpooledFileList.html#NAVBAR_TOP"> SpooledFileList</a> allows you to filter a list of spooled
files based on the user who created the spooled files, the output queue that
the spooled files are on, the form type, or user data of the spooled files.
Only those spooled files that match the filter criteria are listed. If no
filters are set, a default for each of the filters are used.</p>
<p>To actually
retrieve the list of print objects from the server, the <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#OPENSYNCHRONOUSLY()"> openSynchronously()</a> or <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#OPENASYNCHRONOUSLY()"> openAsynchronously()</a> methods are used. The openSynchronously()
method does not return until all objects in the list have been retrieved from
the server. The openAsynchronously() method returns immediately, and the caller
can do other things in the foreground while waiting for the list to build.
The asynchronously opened list also allows the caller to start displaying
the objects to the user as the objects come back. Because the user can see
the objects as they come back, the response time may seem faster to the user.
In fact, the response time may actually take longer overall due to the extra
processing being done on each object in the list.</p>
<p>If the list is opened
asynchronously, the caller may get feedback on the building of the list. Methods,
such as <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#ISCOMPLETED()"> isCompleted()</a> and <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#SIZE()"> size()</a>, indicate whether the list has finished being
built or return the current size of the list. Other methods, <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#WAITFORLISTTOCOMPLETE()"> waitForListToComplete()</a> and <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#WAITFORITEM(INT)"> waitForItem()</a>, allow the caller to wait for the list
to complete or for a particular item. In addition to calling these PrintObjectList
methods, the caller may register with the list as a listener. In this situation,
the caller is notified of events that happen to the list. To register or unregister
for the events, the caller uses <a href="javadoc/com/ibm/as400/access/PrintObjectListListener.html"> PrintObjectListListener()</a>, and then calls <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#ADDPRINTOBJECTLISTLISTENER(COM.IBM.AS400.ACCESS.PRINTOBJECTLISTLISTENER)"> addPrintObjectListListener()</a> to register or <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#REMOVEPRINTOBJECTLISTLISTENER(COM.IBM.AS400.ACCESS.PRINTOBJECTLISTLISTENER)"> removePrintObjectListListener()</a> to unregister. The following
table shows the events that are delivered from a PrintObjectList.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="border" border="1" rules="all"><thead align="left"><tr class="tablemainheaderbar"><th valign="top" width="25.925925925925924%" id="d0e57">PrintObjectList event</th>
<th valign="top" width="74.07407407407408%" id="d0e59">When event is delivered</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="25.925925925925924%" headers="d0e57 "><a href="javadoc/com/ibm/as400/access/PrintObjectListListener.html#LISTCLOSED(COM.IBM.AS400.ACCESS.PRINTOBJECTLISTEVENT)"> listClosed</a></td>
<td valign="top" width="74.07407407407408%" headers="d0e59 ">When the list is closed.</td>
</tr>
<tr><td valign="top" width="25.925925925925924%" headers="d0e57 "><a href="javadoc/com/ibm/as400/access/PrintObjectListListener.html#LISTCOMPLETED(COM.IBM.AS400.ACCESS.PRINTOBJECTLISTEVENT)"> listCompleted</a></td>
<td valign="top" width="74.07407407407408%" headers="d0e59 ">When the list completes.</td>
</tr>
<tr><td valign="top" width="25.925925925925924%" headers="d0e57 "><a href="javadoc/com/ibm/as400/access/PrintObjectListListener.html#LISTERROROCCURRED(COM.IBM.AS400.ACCESS.PRINTOBJECTLISTEVENT)"> listErrorOccurred</a></td>
<td valign="top" width="74.07407407407408%" headers="d0e59 ">If any exception is thrown while the list is being retrieved.</td>
</tr>
<tr><td valign="top" width="25.925925925925924%" headers="d0e57 "><a href="javadoc/com/ibm/as400/access/PrintObjectListListener.html#LISTOPENED(COM.IBM.AS400.ACCESS.PRINTOBJECTLISTEVENT)"> listOpened</a></td>
<td valign="top" width="74.07407407407408%" headers="d0e59 ">When the list is opened.</td>
</tr>
<tr><td valign="top" width="25.925925925925924%" headers="d0e57 "><a href="javadoc/com/ibm/as400/access/PrintObjectListListener.html#LISTOBJECTADDED(COM.IBM.AS400.ACCESS.PRINTOBJECTLISTEVENT)"> listObjectAdded</a></td>
<td valign="top" width="74.07407407407408%" headers="d0e59 ">When an object is added to the list.</td>
</tr>
</tbody>
</table>
</div>
<p>After the list has been opened and the objects in the list processed,
close the list using the <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#CLOSE()"> close()</a> method. This frees up any resources allocated
to the garbage collector during the open. After a list has been closed, its
filters can be modified, and the list can be opened again.</p>
<p>When print
objects are listed, attributes about each print object listed are sent from
the server and stored with the print object. These attributes can be updated
using the <a href="javadoc/com/ibm/as400/access/PrintObject.html#UPDATE()"> update()</a> method in the PrintObject class. Which attributes
are sent back from the server depends on the type of print object being listed.
A default list of attributes for each type of print object that can be overridden
by using the <a href="javadoc/com/ibm/as400/access/PrintObjectList.html#SETATTRIBUTESTORETRIEVE(INT[])"> setAttributesToRetrieve()</a> method in PrintObjectList
exists. See the <a href="printatt.htm#printatt">Retrieving PrintObject
attributes</a> section for a list of the attributes each type of print
object supports.</p>
<p>Listing AFP™ Resources is allowed only on Version
3 Release 7 and later releases of i5/OS™. Opening an <a href="javadoc/com/ibm/as400/access/AFPResourceList.html"> AFPResourceList</a> to an system older than V3R7 generates
a <a href="javadoc/com/ibm/as400/access/RequestNotSupportedException.html"> RequestNotSupportedException</a> exception.</p>
</div>
<div class="section"><h4 class="sectiontitle">Examples</h4><p>The following examples show different ways
to list spooled files.</p>
<blockquote><p><a href="npexamplelistsplfasynch.htm#npexamplelistsplfasynch">Example: Listing spooled files asynchronously (using listeners)</a> shows
how to asynchronously list all spooled files on a system and how to use the
PrintObjectListListener interface to get feedback as the list is being built</p>
<p><a href="npexamplelistsplfasynch2.htm#npexamplelistsplfasynch2">Example: Listing spooled files asynchronously (without using listeners)</a> shows
how to asynchronously list all spooled files on a system <em>without</em> using
the PrintObjectListListener interface</p>
<p><a href="npexamplelistsplfsynch.htm#npexamplelistsplfsynch">Example: Listing spooled files synchronously</a>
shows how to synchronously list all spooled files on a system</p>
</blockquote>
</div>
</div>
</body>
</html>