170 lines
8.0 KiB
HTML
170 lines
8.0 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="Displaying your panels at runtime" />
|
|||
|
<meta name="abstract" content="The Graphical Toolbox provides a redistributable API that your Java programs can use to display user interface panels defined using PDML. The API displays your panels by interpreting the PDML and rendering your user interface using the Java Foundation Classes." />
|
|||
|
<meta name="description" content="The Graphical Toolbox provides a redistributable API that your Java programs can use to display user interface panels defined using PDML. The API displays your panels by interpreting the PDML and rendering your user interface using the Java Foundation Classes." />
|
|||
|
<meta name="DC.Relation" scheme="URI" content="pdmlpg1.htm" />
|
|||
|
<meta name="DC.Relation" scheme="URI" content="rzahh504.htm" />
|
|||
|
<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="pdmlasui" />
|
|||
|
<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>Displaying your panels at runtime</title>
|
|||
|
</head>
|
|||
|
<body id="pdmlasui"><a name="pdmlasui"><!-- --></a>
|
|||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|||
|
<h1 class="topictitle1">Displaying your panels at runtime</h1>
|
|||
|
<div><p>The Graphical Toolbox provides a redistributable API that your Java™ programs
|
|||
|
can use to display user interface panels defined using PDML. The API displays
|
|||
|
your panels by interpreting the PDML and rendering your user interface using
|
|||
|
the Java Foundation
|
|||
|
Classes.</p>
|
|||
|
<div class="section"><p>The Graphical Toolbox runtime environment provides the following
|
|||
|
services:</p>
|
|||
|
<ul><li>Handles all data exchanges between user interface controls and the JavaBeans™ that
|
|||
|
you identified in the PDML.</li>
|
|||
|
<li>Performs validation of user data for common integer and character data
|
|||
|
types, and defines an interface that allows you to implement custom validation.
|
|||
|
If data is found to be invalid, an error message is displayed to the user.</li>
|
|||
|
<li>Defines standardized processing for Commit, Cancel and Help events, and
|
|||
|
provides a framework for handling custom events.</li>
|
|||
|
<li>Manages interactions between user interface controls based on state information
|
|||
|
defined in the PDML. (For example, you may want to disable a group of controls
|
|||
|
whenever the user selects a particular radio button.)</li>
|
|||
|
</ul>
|
|||
|
<p>The package <a href="javadoc/com/ibm/as400/ui/framework/java/package-summary.html">com.ibm.as400.ui.framework.java</a> contains the Graphical
|
|||
|
Toolbox runtime API. </p>
|
|||
|
<p>The elements of the Graphical Toolbox runtime
|
|||
|
environment are shown in <a href="#pdmlasui__figas400tool">Figure 1</a>.
|
|||
|
Your Java program
|
|||
|
is a client of one or more of the objects in the <strong>Runtime Managers</strong> box.</p>
|
|||
|
</div>
|
|||
|
<div class="section" id="pdmlasui__figas400tool"><a name="pdmlasui__figas400tool"><!-- --></a><p><strong>Figure 1: Graphical Toolbox Runtime Environment</strong></p>
|
|||
|
<p><img src="rzahh504.gif" longdesc="rzahh504.htm" alt="Elements of the Graphical Toolbox runtime environment" /> <img src="c.gif" alt="Image description" /></p>
|
|||
|
</div>
|
|||
|
<div class="section" id="pdmlasui__display"><a name="pdmlasui__display"><!-- --></a><h4 class="sectiontitle">Examples</h4><p>Assume that the panel <strong>MyPanel</strong> is
|
|||
|
defined in the file <strong>TestPanels.pdml</strong>, and that a properties file <strong>TestPanels.properties</strong> is
|
|||
|
associated with the panel definition. Both files reside in the directory <strong>com/ourCompany/ourPackage</strong>,
|
|||
|
which is accessible either from a directory defined in the classpath or from
|
|||
|
a ZIP or JAR file defined in the classpath.</p>
|
|||
|
<div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm#codedisclaimer">Code
|
|||
|
example disclaimer</a> for important legal information.</div>
|
|||
|
<p id="pdmlasui__pdmlasuiexample1"><a name="pdmlasui__pdmlasuiexample1"><!-- --></a><strong>Example:
|
|||
|
Creating and displaying a panel</strong></p>
|
|||
|
<p>The following code creates and displays
|
|||
|
the panel:</p>
|
|||
|
<pre>import com.ibm.as400.ui.framework.java.*;
|
|||
|
|
|||
|
// Create the panel manager. Parameters:
|
|||
|
// 1. Resource name of the panel definition
|
|||
|
// 2. Name of panel
|
|||
|
// 3. List of DataBeans omitted
|
|||
|
|
|||
|
PanelManager pm = null;
|
|||
|
try {
|
|||
|
pm = new PanelManager("com.ourCompany.ourPackage.TestPanels", "MyPanel", null);
|
|||
|
}
|
|||
|
|
|||
|
catch (DisplayManagerException e) {
|
|||
|
e.displayUserMessage(null);
|
|||
|
System.exit(-1);
|
|||
|
}
|
|||
|
|
|||
|
// Display the panel
|
|||
|
pm.setVisible(true);</pre>
|
|||
|
<p id="pdmlasui__pdmlasuiexample2"><a name="pdmlasui__pdmlasuiexample2"><!-- --></a><strong>Example: Creating
|
|||
|
a dialog</strong></p>
|
|||
|
<p>Once the DataBeans that supply data to the panel have been
|
|||
|
implemented and the attributes have been identified in the PDML, the following
|
|||
|
code may be used to construct a fully-functioning dialog:</p>
|
|||
|
<pre>import com.ibm.as400.ui.framework.java.*;
|
|||
|
import java.awt.Frame;
|
|||
|
|
|||
|
// Instantiate the objects which supply data to the panel
|
|||
|
TestDataBean1 db1 = new TestDataBean1();
|
|||
|
TestDataBean2 db2 = new TestDataBean2();
|
|||
|
|
|||
|
// Initialize the objects
|
|||
|
db1.load();
|
|||
|
db2.load();
|
|||
|
|
|||
|
// Set up to pass the objects to the UI framework
|
|||
|
DataBean[] dataBeans = { db1, db2 };
|
|||
|
|
|||
|
// Create the panel manager. Parameters:
|
|||
|
// 1. Resource name of the panel definition
|
|||
|
// 2. Name of panel
|
|||
|
// 3. List of DataBeans
|
|||
|
// 4. Owner frame window
|
|||
|
|
|||
|
Frame owner;
|
|||
|
...
|
|||
|
PanelManager pm = null;
|
|||
|
try {
|
|||
|
pm = new PanelManager("com.ourCompany.ourPackage.TestPanels", "MyPanel", dataBeans, owner);
|
|||
|
}
|
|||
|
|
|||
|
catch (DisplayManagerException e) {
|
|||
|
e.displayUserMessage(null);
|
|||
|
System.exit(-1);
|
|||
|
}
|
|||
|
|
|||
|
// Display the panel
|
|||
|
pm.setVisible(true);</pre>
|
|||
|
<p id="pdmlasui__example3"><a name="pdmlasui__example3"><!-- --></a> <strong>Example: Using the dynamic
|
|||
|
panel manager</strong></p>
|
|||
|
<p>A new service has been added to the existing panel
|
|||
|
manager. The dynamic panel manager dynamically sizes the panel at runtime.
|
|||
|
Let's look at the <strong>MyPanel</strong> example again, using the dynamic panel manager:</p>
|
|||
|
<pre>import com.ibm.as400.ui.framework.java.*;
|
|||
|
|
|||
|
// Create the dynamic panel manager. Parameters:
|
|||
|
// 1. Resource name of the panel definition
|
|||
|
// 2. Name of panel
|
|||
|
// 3. List of DataBeans omitted
|
|||
|
|
|||
|
DynamicPanelManager dpm = null;
|
|||
|
try {
|
|||
|
pm = new DynamicPanelManager("com.ourCompany.ourPackage.TestPanels", "MyPanel", null);
|
|||
|
}
|
|||
|
|
|||
|
catch (DisplayManagerException e) {
|
|||
|
e.displayUserMessage(null);
|
|||
|
System.exit(-1);
|
|||
|
}
|
|||
|
|
|||
|
// Display the panel
|
|||
|
pm.setVisible(true);</pre>
|
|||
|
<p>When you instantiate this panel application
|
|||
|
you can see the dynamic sizing feature of the panels. Move your cursor to
|
|||
|
the edge of the GUI's display and, when you see the sizing arrows, you can
|
|||
|
change the size of the panel.</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div>
|
|||
|
<ul class="ullinks">
|
|||
|
<li class="ulchildlink"><strong><a href="rzahh504.htm">Long description of Figure 1: Graphical Toolbox runtime environment (rzahh504.gif)</a></strong><br />
|
|||
|
</li>
|
|||
|
</ul>
|
|||
|
|
|||
|
<div class="familylinks">
|
|||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="pdmlpg1.htm" title="The Graphical Toolbox, a set of UI tools, makes it easy to create custom user interface panels in Java.">Graphical Toolbox and PDML</a></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</body>
|
|||
|
</html>
|