Documentation

(jvx:client:gui)

Bind Editors to Tables

Translations of this page:

Editing of data in a database application should be possible directly in a table as well as via forms.

Form-based entry increases clarity and allows grouping that is difficult when using tables.

The active model of JVx allows the displaying and editing of data in many different ways, regardless of whether the data is a table, a graph, or a text editor. In all cases, the data is governed by the model. Changes in the model affect all registered components. Therefore, the displayed data is always synchronized.

Example

In our application, we want to create a form that allows the viewing and editing of contact details. Data entry should be possible directly in a table or via a form.

The following are the definitions of the editors for the form. Details about displaying data tables can be found here.

Definition of the editors:

RemoteDataBook rdbContacts = new RemoteDataBook();
 
rdbContacts.setDataSource(dataSource);
rdbContacts.setName("contacts");
rdbContacts.open();
 
UIEditor edtFirstName = new UIEditor();
edtFirstName.setDataRow(rdbContacts);
edtFirstName.setColumnName("FIRSTNAME");
 
UIEditor edtLastName = new UIEditor();
edtLastName.setDataRow(rdbContacts);
edtLastName.setColumnName("LASTNAME");
 
UIEditor edtStreet = new UIEditor();
edtStreet.setDataRow(rdbContacts);
edtStreet.setColumnName("STREET");
 
UIEditor editNr = new UIEditor();
editNr.setDataRow(rdbContacts);
editNr.setColumnName("NR");

It is sufficient when the column description and the IDataRow are set in an UIEditor. The column´s data type determines which editor is used. In our example, a number editor is used for the NR and a text editor for all other fields.

A date editor is used for the date column.

The UIEditor can easily be added to the layout/form. For example:

panel.add(editNr);

Of course, the characteristics of the layout should be considered!

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information