READMEBean Builder
|
The Bean Builder is a simple builder that demonstrates new and emerging technologies within the JavaTM Platform that allow the construction of applications using component assembly mechanisms. The Bean Builder extends the capabilities of the original BeanBox by demonstrating new techniques for persistence, layout editing and dynamic event adapter generation.
Bean Builder demonstrates the following technologies:
Watch The Swing Connection or the JavaBeans Component Architecture product page for upcoming articles about how Bean Builder implements these technologies.
Long Term Persistence for JavaBeans (LTP) is a new persistence model for JavaBeans components. LTP is designed to handle the process of converting a parent/child "tree" or "graph" of JavaBeans to and from an XML-based text format.
The LTP architecture was developed using the Java Community Process as JSR 57.
The new streams XMLEncoder
and XMLDecoder
are similar to
ObjectOutputStream
and ObjectInputStream
used by the serialization framework
and work the same way.
The implementation of the JavaBeans Persistence APIs and the palette file format uses the XML Processing API included in release 1.4. For more details about the XML parser, refer to the Java Technology and XML web site.
The Swing Connection has a series of articles describing the design and implementation of the Persistence API. These articles are indexed at the JavaBeans product site at the training and support page.
The SpringLayout
layout manager, introduced in release 1.4, was designed to address layout requirements unique to user interface
builders.
The objective is to have a layout manager which behaves like an absolute layout manager (null layout) so that UI designers can put the "picture in their head" onto a "canvas". After all the components have been laid out, the dynamic behavior of what happens when the container is sized can be defined afterwards by linking edges of the components to the container or to other components with a fixed distance between them. When the edge of the anchor component moves, the edge of the dependent component moves with it, maintaining the fixed distance.
One of the features of the SpringLayout is that it will use the default preferred size of the components that it manages. This means that if the preferred size has not been explicitly set, it will be calculated based on the font size, text length, the margins, insets and the border of the component. This will allow the user interface to scale correctly if the text is internationalized or the font is changed.
Conceptually, SpringLayout is fairly hard to grasp. The desire is that there will be standard customizers and gestures for SpringLayout that may work in any user interface builder.
Note: SpringLayout isn't quite finished for release 1.4. There are still some issues with positioning the components and there may also be some lingering issues when the layout is persisted using the Long Term Persistence mechanism. Hopefully, these issues will be resolved for the next minor release.
The Bean Builder requires Java 2 Standard Edition, release 1.4 or later to be installed in order to run. The full Java 2 Software Development Kit, Standard Edition (J2SE SDK) should be used rather than the Java 2 Runtime Environment, Standard Edition (JRE) since the Bean Builder uses the BeanInfo design time information (dt.jar) which ships with the J2SE SDK.
Designs created by the Bean Builder can be executed with the JRE.
You can download Java 2 Standard Edition from http://java.sun.com/j2se/
To install the Bean Builder,
c:\jdk1.4
.
The guide directory contains the Tutorial for the Bean Builder.
Make sure that release 1.4 has been installed. You must use release 1.4 or later since the Bean Builder uses API that has been introduced in that version.
The run script assumes that the root of the JDK is installed in a default location:
For Solaris, the shell script is called run.sh and the default root used is /usr/local/java/jdk1.4/solaris.
For the PC, the batch file is called run.bat and the default root is assumed to be c:\jdk1.4.
You may override the default location by setting the JAVA_HOME environment
variable to point to the location of the root of your installed SDK. For example,
in Windows, if you installed the J2SE SDK in d:\java\1.4
, then you would set the
environment variable to:
> set JAVA_HOME=d:\java\1.4
The run script has optional arguments for start up which can load a different Object palette or load an existing design.
Usage: run [-p palettefile] [-i] [filename.xml]
[-i]
is interpret mode. Execute filename.xml
without starting the Builder.
[filename.xml]
load the archived xml file.
[-p palettefile]
use "palettefile" as the Bean Builder palette
Note: the -i and -p flags cannot be used simultaneously
A JFrame
instance is the root of the object
hierarchy by default. This JFrame uses the new SpringLayout
as the layout manager for its content pane. SpringLayout is new in release 1.4.
The Builder can edit arbitrary root containers such as a JPanel or non-visual Bean containers. You can specify the root object when the New button is pressed by setting the system property builder.new.root in the VM. For example, if you pass "-Dbuilder.new.root=javax.swing.JPanel" as a parameter to the java interpreter, then the root Object will be a JPanel
The builder was not designed for building a menu tree. All behavior associated with components on the Menu tab is unsupported. A later release may address this.
Creating instances of components from the Containers tab is undefined with the exception of JScrollPane.
You can drop a Scrollable component such as JList, JTable and JTree in a JScrollPane and the component will be added correctly to the JScrollPane container delegate. If you use define a preferred size for that component (by instantiating the component by dragging a rectangle), then the scrolling behavior may be incorrect.
Editing a text field PropertyEditor could cause an exception if the value is not committed. Pressing the Enter key after entering a new value will set that property on the bean. If the value has not been committed then an exception may occur when the property panel is loaded with properties from another object. This is a known bug.
There is no separation between a design representation and the actual application being designed. The archive created will reflect the actual state of the application at the time it was archived. If the application is tested and the runtime properties have changed an archive snapshot will represent the current state.
There are no bugs! Just kidding. There are probably a lot of lingering bugs and feature holes in this application.
When saving the design, you may see this message in the window where you started the Bean Builder:
java.lang.InstantiationException: javax.swing.PopupFactory$1 Continuing ... java.lang.Exception: discarding statement JFrame0.addWindowListener(PopupFactory$10); Continuing ...This message is harmless. It's a side effect of a Swing bug which should be fixed for the next minor release.
Tutorial for Bean Builder - Step by step instructions to become familiar with the features of Bean Builder
Bean Builder Architecture - Describes the internals of the Bean Builder.
JavaBeans API documentation at java.sun.com. - A detailed description of Long Term Persistence for JavaBeans.
SpringLayout API documentation at java.sun.com - Details about the SpringLayout. Pretty heavy reading.
Many, many changes!
Architecturally the internals have changed significantly with less messaging and more singleton instances. Hopefully, it's simpler.
The layout editor in the designer uses the new javax.swing.SpringLayout
.
This layout manager has been introduced in release 1.4. There are still some flaws
with laying out the components.
Reworked the DesignPanel into itss own package and broke out some of the inner
classes. The event interaction which use the release 1.3 dynamic proxy mechanism for
generating event adapters is encapsulated in EventPane
. The SpringLayout
interactions is encapsulated in LayoutPane
.
The Palette is represented as an external xml document called palette.xml
.
You can configure this with your own beans. Thanks to Mark Chung of SRI for this feature.
You can use the "-p" command line parameter to load an external palette. There is also
a menu item which will allow you to load a palette.
You can select a bean that's in a Swing container as the target for an interaction.
Dynamic Proxy Event Handling mechanism uses the java.beans.EventHandler
.
It uses a static factory method, create
, to create the proxy object. This
class is currently in the com.sun.java.beans
package but will be in the
java.beans
package in release 1.4.
Performance of the Interaction Wizard has been increased significantly. The Interaction Wizard is re-used and the data is changed.
Fixed a button size bug in the Swing property editors.
Uses a custom Introspector to support Java Web Start deployment. This new Introspector will be similar to the JavaBeans Introspector for release 1.4
The Bean Builder is a demonstration of current Java user interface technologies. The Bean Builder is released for education purposes only. There is no product support for the Bean Builder nor is there a release schedule.
Please direct all comments to java-beans@java.sun.com and use detailed subject lines. We'll try to respond to your comments but please excuse us if we are unable to reply.
The Bean Builder, is a product of Sun MicrosystemsTM, Inc. For answers to common questions and further contact information please see the java.sun.com Help Pages. |
Copyright © 1997-2002 Sun Microsystems, Inc. All Rights Reserved. Terms of Use. Privacy Policy. |