JLCA3.0 - Java Beans

Java Beans are components that can be controlled dynamically and assembled to applications via visual components. However, they not only have visual uses but they could be used to implement non-visual components as well. They are mainly converted to .NET Framework through System.ComponentModel API and System.Windows.Forms.UserControl.

 

Principally, JLCA 3.0 conversion takes into account the following features of Java Beans - File Manifest.MF, Bean Classes (Visual and non-Visual), Descriptors Info (converted to the equivalent .NET Framework attributes for design-time), Properties (Bound and Indexed; Property Editors), Events, Inheritance Hierarchy and Persistence.

 

Table 6 and Table 7 below contain the relevant details for Java Beans conversion. In a summarized manner, they enunciate the Java Beans features preserved in the converted applications. On the other hand, they suggest the issues that the user should take care while converting application containing Java Beans.

Coverage Details

Class / Interface in Package java.beans

Functionality

JLCA 3.0 Coverage

Description

AppletInitializer

Provides a proper initialization to invoke java.beans.Beans.instantiate method.

Not Converted

This kind of initialization is not necessary in .NET Framework.

BeanDescriptor

BeanInfo

EventSetDescriptor

IndexedPropertyDescriptor

MethodDescriptor

ParameterDescriptor

PropertyDescriptor

SimpleBeanInfo

Used within BeanInfo to provide information for design-time.

Not Converted

In .NET Framework, this kind of information is represented using attributes of System.ComponentModel.

The required information of these classes is converted based onBeanInfo’s source code.

Beans

This class initializes a JavaBean.

Not Converted

In .NET Frameowrk, this should be done like a normal construction of a type.

Customizer

This class provides a complete custom GUI for customizing a target Java Bean.

Not Converted

Controls in .NET Framework have the capacity to define a class using System.ComponentModel.DesignerAttribute for controlling the controls in Design-time, but the approach is different.

FeatureDescriptor

This class is the common baseclass for PropertyDescriptor, EventSetDescriptor, and MethodDescriptor, etc.

Partially Converted

The important methods of this class that are inherited by other descriptors are also converted.

Introspector

InstrospectionException

Provides a standard way for tools to learn about the properties, events and methods supported by a target Java Bean.

Not Converted

.NET Framework does not need more introspection than its normal reflection to extract the data or the corresponding exception.

PropertyChangeEvent

A "PropertyChange" event gets delivered whenever a bean changes a "bound" or "constrained" property.

Converted

Conversion maps to SupportClass.PropertyChangingEventArgs which extends from PropertyChangedEventArgs and provides properties used in constrained properties

PropertyChangeListener

VetoableChangeListener

Provides listener to bean’s PropertyChange Event.

Not Converted

The listener related to the PropertyChangeEvent is converted like any other event listener.

PropertyChangeSupport

Utility class used by beans that support bound properties.

Not Converted

In .NET Framework this is handled with += or -= operators through the PropertyChangeListener.

PropertyEditor

This class provides support for GUIs that want to allow users to edit a property value of a given type.

Partially Converted

The enumerations and text representations are converted through System.ComponentModel.TypeConverter. Custom representations are supported partially since automatic conversion to System.Drawing.Design.UITypeEditor cannot be generalized.

PropertyEditorManager

Associates an editor to a data type.

Not Converted

In .NET Framework this functionality supported with editors like TypeConverter or UITypeEditor, with the System.ComponentModel.TypeConverterAttribute or System.ComponentModel.EditorAttribute

PropertyVetoException

This exception is thrown when a proposed change to a property represents an unacceptable value.

Converted

The System.ArgumentOurOfRangeException is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.

VetoableChangeSupport

This is a utility class used by beans that support constrained properties.

Not Converted

.NET Framework can support the change of values in a property but not with the kind of restrictions provided by this class.

Visibility

Determines whether the component must be visually displayed.

Not Converted

This methodology does not apply in .NET Framework.

Table 6: Java Beans Conversion Coverage – Package java.beans

Issues

Issue

Description

Bean Info Classes

Bean Info classes are analyzed to extract information and convert supported features. They are not converted since do not apply for the .NET Framework Component Model. The user can ignore the converted BeanInfo classes since their features are “converted” to .NET Framework model.

Bean’s Icons

Conversion of Icons used to represent Java Beans in tool boxes or list views is not supported.

A workaround could be to use the attribute System.Drawing.ToolboxBitmap.

Bean’s Unicast and Multicast Events

Conversion of setting the default event as Multicast is not converted. Setting event descriptors as Unicast is not supported too. A workaround can be to use the class attribute System.ComponentModel.DefaultEvent.

General Issues

And

Manifest Files

Conversion for Java Beans requires the respective Manifest File (META-INF\MANIFEST.MF) to reside inside the source code directory (or inside .jar files). It allows identify Java Bean and relative BeanInfo classes.

Table 7: Java Beans Conversion Issues

Comments