The BeanBox allows you to:
It must be emphasized that the BeanBox is merely one rather simplistic way of representing beans to humans. We expect all bean-based tools to use the same standard JavaBeans APIs, but to provide very different ways of visually representing beans and different styles for manipulating and connecting beans.
The BeanBox comes up as three separate windows.
To select a bean you must click the mouse just outside of the bean in the boundary area where the black-and-white hashed boundary will appear.
Some beans (such as the ExplicitButton or the Juggler) will allow you to select the bean by clicking anywhere in the bean, but some other beans (such as the Molecule or the ChangeReporter) won't notice a click on the bean itself, and require you to click in the surrounding border area. This behaviour reflects problems with mouse event processing which we hope to fix for the final version of the BDK.
Some beans, such as the BeanBox bean or the ExplicitButton, also allow themselves to be resized. You can try to resize the currently selected bean by clicking on one of the corners of the black-and-white boundary and holding the mouse down and stretching the corner out.
For each editable property the PropertySheet window shows the name of the property and its current value. The current value may be shown as:
If the currently selected bean has a customizer, then the "edit" menu on the central window will include a "Customize..." entry. If you select that entry, then a dialog window will come up with the bean's customizer.
Two of the example beans have a customizer. The ExplicitButton has a trivial customizer that simply lets you set the button's label. The JDBC SELECT bean has a much more interesting customizer that will try to connect through JDBC to a local database to help you create a SQL query.
The "edit" menu on the central composition window has an "events" menu that has a sub-menu for all the different kinds of events that the currently selected bean fires. These events are grouped and named according to their EventListener interfaces. So for example, if you select an ExplicitButton bean you will see that it has two EventListener interfaces "button push" and "bound property change", each of which contain a single event.
If you select one of the events from this menu, the BeanBox will start drawing a "rubber band" line from the source bean. You can then click on the border of the target bean to which you want the event delivered. (Note that as for selection, you may need to click on the target bean's border rather than on the bean itself.)
The BeanBox will then check for methods in the target bean that accept the same EventObject argument that is fired by the source event. You will then be offered a dialog box to chose which matching method you would like to have called when the source event is fired. After you select a method, the BeanBox will generate, compile, and load an event adaptor class to connect the source bean's event to the target event handler method.
Try this out by connecting an ExplicitButton's button push event to a Juggler's) start method. Now when you push the button the Juggler will start juggling.
Note that this particular visual style for connecting up events isn't part of the beans architecture, nor is the associated search for a handler method with a particular method signature. Professional application development environments may do things like providing users with a handler method template and allowing the user to type in Java code for an event handler.
If the currently selected bean supports bound properties, then the "edit" menu will include a "Bind property..." item. If you chose this menu item, then the BeanBox will bring up a dialog showing the bound properties available on the source bean. You can then select a source property and press "OK". The beanbox will then draw a "rubber band" line. You can then click on the border of the target bean to which you want the property bound. (Note that as for selection, you may need to click on the target bean's border rather than on the bean itself.)
The BeanBox will then bring up a dialog listing the target properties on the target bean that match the the of the source property. You can select a target property and press "OK".
Now when you change the source property on the source bean then the target property on the target bean will also be updated.
Try this out by connecting up the background colors on two ExplicitButtons and then use the PropertySheet to change the background color of the source bean.
This uses Java Object Serialization to automagically store away all the state of the beans into a named file.
You can then use the "File" menu's "Clear" item to discard the current set of beans and use the "Load..." item to read in and recreate all the serialized beans.
This provides a simple way to test the use of serialization with your beans.
Invoking the MakeApplet item will create a JAR file that contains the serialized data (if any) plus hookup and other classes. The action will also create a test HTML file that uses that JAR file (plus any other JAR files containing the buttons used in the Applet), a subdirectory with Java source files plus makefiles, and a "readme" file with more details.
The generated applet can be used in any fully compliant Java 2 SDK version 1.2 browser. A simple test platform is the appletviewer from the Java 2 SDK distributions. Another fully compliant browser is the HotJava Browser.
The preview2 release of Internet Explorer 4.0 has a couple of problems:
This generates a summary report to the standard output of the introspection information for the selected bean.
To add your bean to the BeanBox, you must wrap it up in a JAR file which contains a suitable manifest file describing the bean. Take a look at one of the example bean makefiles such as demo\juggler.mk (for Windows nmake users) or demo/juggler.gmk (for Unix gnumake users) to see how to create a manifest file and a JAR file.
Once you have a suitable JAR file, simply add it to the "jars" directory and restart the BeanBox, or load the JAR directly using the "LoadJar..." item in the "File" menu.
The Juggler demo is an example of a bean that has a BeanContextChild proxy and implements the DesignMode interface.
Java, JavaBeans, and JavaSoft are trademarks of Sun Microsystems Inc.
Copyright © 1996 Sun Microsystems, Inc., 2550 Garcia
Ave., Mtn. View, CA 94043-1100 USA.
All rights reserved.