Sponsored Link •
A key part of the new beans extension can be understood best with a comparison. Bean authors will be familiar
BeanInfo, a bean companion class that tools discover and associate with a bean class at runtime.
Part of the JavaBeans specifications from the beginning,
BeanInfo contains static metadata
about a bean's class.
The new proposed class,
DesignInfo, defines dynamic behavior information about a bean
DesignInfo is discovered at runtime, or design time, existing beans require
no changes to benefit from this new functionality. According to Nuxoll, understanding the difference between design-time
configuration and static metadata is key to making Java a friendlier developer environment.
JSR 273 sets out to offer several design-time enhancements to the bean experience. First among them is the ability to
define an initial setup for a component when that component is created. For instance, when you drag a component
representing a database table to a design canvas, you will be able to define a data model for that table, the columns
you wish to populate, and even allow you to proceed to populate that table. The table component's
will provide hooks for that functionality.
The current JavaBeans specifications define a few static ways to relate beans to one another. JSR 273 offers more dynamic
abilities to link beans via the
linkBean() method on
DesignInfo. That will allow a bean to
dynamically interact with mouse events, or respond to drag and drop in a customized way. As a component author, you will
even be able to define hot areas on the bean's visual representation for special design-time behavior.
In addition, JSR 273 adds a context item to a bean instance. Such context can include, for instance, a list of common actions a developer would typically perform on that bean. That list could then be displayed by, say, right-clicking on the bean's icon. Nuxoll pointed out such possibilities have been part of VB and .NET for a long time, but were not available for Java components before.
A component author will also be able to specify runtime annotations for a bean. For markup-type components, such as JSF beans, that could mean rendering hints, whereas for components that need to paint on the screen, that often means custom painting. For instance, once you've associated that table with a data source, the design-time representation of that table on the design canvas would be able to display a database icon to indicate the availability of the data source.
In addition to property editors and customizers, all these additions to the JavaBeans API are designed to provide access to live bean proxies that facilitate design-time interaction with beans. While IDEs already define such proxies, says Nuxoll, each IDE vendor provides its own custom mechanism for how such proxies manipulate a bean at design time, and how the IDE provides design-time customization information bean proxies. JSR 273 aims to standardize that interaction. As a result, a component vendor can rely on that standard to provide richer design-time options for her wares.
Will Java technology ever have the kind of component market that drives the VB and .NET universe? "The gap is still huge, but we're working to bridge that gap," says Nuxoll.
While no early draft of this JSR is available at the time of this writing, you can read the design-time API specs for Java Studio Creator. According to Nuxoll, the JSR's spec will likely be based on that source. Nuxoll invites anyone interested in contributing or commenting to contact him, or to join the JSR 273 expert group. Contact information is on the JSR 273 home page on jcp.org.
JSR 273, Design-Time API for JavaBeans:
Design-Time API for Java Studio Creator:
A trial copy of Sun Java Studio Creator is available here:
Frank Sommers is a Senior Editor with Artima Developer. He also serves as chief editor of the Web zine ClusterComputing.org, the IEEE Technical Committee on Scalable Computing's newsletter, and is an elected member of the Jini Community's Technical Advisory Committee. Prior to joining Artima, Frank wrote the Jiniology and Web services columns for JavaWorld.