You can add a Java Object table to your project file. Then, after adding the table, you can view the table and edit its properties, and rename, duplicate, or remove the table.

 

Note that the sample project Chapter06_JavaObject.pnj contains the Java Object table shown in the following procedures. You can access this project by clicking File – Open Project in the application menu, then enabling the Open a sample project option.

 

To add a Java Object table to your project file

 

1.Double-click the Tables item.

2.From the Link Table dialog box, select Java Object.

 

link_table_dialog_3

 

3.Click Next.

4.Type a name for the table into the Name field.

5.Type a source (Java expression) for the table into the Source field. The Source is a call to the user-defined static class method to return a collection object; for example, com.peernet.javaobject.Student.createStudents()

6.Type a name for the first field into the Field Name field; for example, student.

7.Select a data type for the first field (for example, com.peernet.javaobject.Student) from the Java Data Type drop-down list.

8.Continue adding field names and data types as required; for example, department java.lang.String, university java.lang.String

 

link_table_java_object_dialog_1

 

9.Click Finish.

 

To view a Java Object table

 

1.Click the icon_expand to expand the Tables item.

2.Right-click the Java Object table, and click Edit Table.

3.The table opens in the Design Window. If a column’s type is an object, it will have a string representation.

 

The following example shows a Java Object table in both Design View and Datasheet View:

 

 

link_table_java_object_design_view

 

 

link_table_java_object_datasheet_view

 

 

To edit the properties of a Java Object table

 

1.Click the icon_expand to expand the Tables item.

2.Right-click the Java Object table you want to edit, and click Edit Table.

3.In the Properties Pane or Design Window, adjust the table’s properties as required.

 

The Design View will contain Field Name and Java Data Type columns:

 

link_java_object_design_view_column_headings

 

You can edit the fields in the Field Name column by clicking in the field and typing a new value. As well, you can edit the fields in the Java Data Type column by clicking in the field and making a new data type selection from the drop-down list.

 

To rename a Java Object table

 

1.Click the icon_expand to expand the Tables item.

2.Right-click the Java Object table you want to rename, and click Rename Table.

3.Type a new name for the table in the edit field.

 

Note that you should not rename a table that is already being referenced in another item of the project (for example, in a report or label). If you rename a table that is already being referenced, you will break the link from the report or label to the data in the table.

 

To duplicate a Java Object table

 

1.Click the icon_expand to expand the Tables item.

2.Right-click the Java Object table you want to duplicate, and click Duplicate Table. A copy of the table appears in the list.

 

To remove a Java Object table from your project file

 

1.Click the icon_expand to expand the Tables item.

2.Right-click the Java Object table you want to delete, and click Remove Table.

3.In the Delete Confirmation dialog box, click Yes.