[Home] [Contents] [Index] [Javadoc] | ![]() [Frames] [No Frames] |
[Previous] [Next] |
There have been significant structural changes to JClass Field in its 4.x version. These modifications allow more flexibility and control over the composition of fields. Although the changes are noteworthy, you can easily convert any code created with 3.6.x versions to version 4.x. The following sections will describe how to upgrade your code to JClass Field 4.5.
In earlier versions of JClass Field, each field consisted of a visual component and a validator together. The validator portion determined what type of data the field expected. The names of the fields indicated their visual aspect and supported data type. For example, a text field that contained integers and a text field that held string values were named JCIntTextField
and JCStringTextField
respectively.
Now the five basic styles of visual components, which are represented by one of JClass Field's standard Beans: JCTextField
, JCSpinField
, JCComboField
, JCPopupField
, and JCLabelField
, are separated from the validators and the supported data types. To use a field, you must associate it with a validator and declare an appropriate value model. The following table lists the a few examples of the combination of components, validators and value models in JClass Field 4.x that are equivalent to fields in earlier versions:
Field in JClass Field 3.6.3 and earlier | Equivalent Field in JClass Field 4.x |
---|---|
You can duplicate all the fields contained in earlier versions by selecting the corresponding field, validator and value model. In fact, you can create even more fields since JClass Field 4.x expands the list of supported validators to include java.lang.byte
, java.lang.short
, java.lang.long
, java.lang.float
, java.math.BigDecimal
, java.sql.date
, and java.sql.timestamp
and introduces a new GUI component, JCLabelField
. This new field can be used to simulate a heading or to display uneditable data.
The following table shows the differences in code between JClass Field 4.x and previous versions for a text field containing a string value.
JClass Field 3.6.3 and earlier | JClass Field 4.0 and later |
---|---|
This section breaks down the above code listings and gives a line-by-line description of the differences.
Since the introduction of the validator and invalidInfo objects, the properties have been divided between these two objects and the field component, which in earlier versions contained all the properties. The following table shows how the JClass Field 4.x properties are allocated.
The following list gives a general outline of the steps you should follow to port your code to JClass Field 4.x from earlier versions.
JClass Field events have also undergone significant change in version 4.x.
The event listener that receives the events generated by the four editable Fields is now called JCValueListener
instead of JCFieldListener
. Its methods are valueChanging()
and valueChanged()
instead of valueChangedBegin()
, valueChangedEnd()
, and stateIsInvalid
.
Changes to any one of the Fields are handled by invoking addValueListener()
. You supply the code to implement the JCValueListener
interface. To register the method see addValueListener, removeValueListener in chapter 3.
The methods of the JClass Field event listeners are compared below:
JCFieldListener: Event Methods (earlier versions) |
JCValueListener: Event Methods (JClass Field 4.x) |
Although the stateIsInvalid()
method is not available in JCValueListener
, you can use a Field component's addPropertyChangeListener()
method to determine changes to the state of a field.
[Home] [Contents] [Index] [Javadoc] | Comments on the documentation? Please send them to jclass_docs@klgroup.com |
[Previous] [Next] | |
[Frames] [No Frames] |