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

94 lines
5.2 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="Data queues" />
<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="vdtaq" />
<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>Data queues</title>
</head>
<body id="vdtaq"><a name="vdtaq"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Data queues</h1>
<div><p></p>
<div class="section"><p>The data queue graphical components allow a Java™ program
to use any Java Foundation Classes (JFC) graphical text component
to read or write to a server data queue.</p>
</div>
<div class="section"><p>The <a href="javadoc/com/ibm/as400/vaccess/DataQueueDocument.html#NAVBAR_TOP"> DataQueueDocument</a> and <a href="javadoc/com/ibm/as400/vaccess/KeyedDataQueueDocument.html#NAVBAR_TOP"> KeyedDataQueueDocument</a> classes are implementations of
the JFC Document interface. These classes can be used directly with any JFC
graphical text component. Several text components, such as single line fields
(JTextField) and multiple line text areas (JTextArea), are available in JFC.</p>
</div>
<div class="section"><p>Data queue documents associate the contents of a text component
with a server data queue. (A text component is a graphical component used
to display text that the user can optionally edit.) The Java program
can read and write between the text component and data queue at any time.
Use DataQueueDocument for <strong>sequential</strong> data queues and KeyedDataQueueDocument
for <strong>keyed</strong> data queues.</p>
</div>
<div class="section"><p>To use a DataQueueDocument, set both the system and path properties.
These properties can be set using a constructor or through the setSystem()
and setPath() methods. The DataQueueDocument object is then "plugged" into
the text component, usually using the text component's constructor or setDocument()
method. KeyedDataQueueDocuments work the same way.</p>
</div>
<div class="section"><p><span class="synph" id="vdtaq__vdtaqex1"><a name="vdtaq__vdtaqex1"><!-- --></a><span class="kwd"></span></span>The following example
creates a DataQueueDocument whose contents are associated with a data queue:</p>
</div>
<div class="section"><div class="p"><pre> // Create the DataQueueDocument
// object. Assume that "system" is
// an AS400 object created and
// initialized elsewhere.
DataQueueDocument dqDocument = new DataQueueDocument (system, "/QSYS.LIB/MYLIB.LIB/MYQUEUE.DTAQ");
// Create a text area to present the
// document.
JTextArea textArea = new JTextArea (dqDocument);
// Add the text area to a frame.
// Assume that "frame" is a JFrame
// created elsewhere.
frame.getContentPane ().add (textArea);</pre>
</div>
</div>
<div class="section"><p>Initially, the contents of the text component are empty. Use read()
or peek() to fill the contents with the next entry on the queue. Use write()
to write the contents of the text component to the data queue. Note that these
documents only work with String data queue entries.</p>
</div>
<div class="section"><p><strong><span class="synph" id="vdtaq__vdtaqexamples"><a name="vdtaq__vdtaqexamples"><!-- --></a><span class="kwd"></span></span>Examples</strong></p>
</div>
<div class="section"><p>Example of using a <a href="dataqueuedocumentexample.htm#dataqueuedocumentexample">DataQueueDocument</a> in
an application.</p>
</div>
<div class="section"><p>Figure 1 shows the DataQueueDocument graphical user interface
component being used in a JTextField. A button has been added to provide
a GUI interface for the user to write the contents of the test field to the
data queue.</p>
</div>
<div class="section"><p><strong>Figure 1: DataQueueDocument GUI component</strong></p>
</div>
<div class="section"><p><img src="rzahh081.gif" alt="DataQueueDocument GUI component" /></p>
</div>
</div>
</body>
</html>