Control : FormList

Page Status: Beta
Jump to: navigation, search

FormList Icon

Back to Controls

The FormList control allows you to display (in list fashion) the forms belonging to application object within a collection.

 

Contents

Overview

Use the FormList control to display forms that are associated with objects in a collection. For example, you might have an address object in a collection and a form that displays the city and state. The FormList control can display the form in list fashion, thereby displaying the city and state for each object in the collection.

Capabilities

You can use the FormList control to:

  • Display a form (Example1).
  • Display a form with selection (Example2).
  • Display a form with selection and editing (Example 3).
  • Display a form with selection, editing, and drag-and-drop (Example 4).

Limitations

 

Requirements

 

Examples

The following examples are intended to be used with sample code that you can import into your Bungee Builder workspace from the Start Page. Each example is intended to build upon a previous example to provide you with a complete understanding of how to use this control.

Example 1: Display a Form (Ex1_Addresses)

This example shows how to bind a DynamicForm control to a collection and display a form. 

A FormList control is bound to a collection (addr) whose element type is Address. The Element Form property (Interface tab) is set to RowDetail (this is the form interface used by the FormList control). In the Address class, the form Row has its Adpater List property also set to RowDetail.

Click for larger image 

Example 2: Display a Form with Selection (Ex2_AddressesWithSelection)

This example adds support for selection to Example 1.

To allow for selecting items, the Allow Selection property is set to true. In addition, to allow for selecting multiple items simultaneously, the Multiple Select property is also set to true. The selection adapter interface is implemented by the example object containing the collection field.

A Get Directions link (a LinkLabel control) has also been added. When two items in the list are selected, the Get Directions link is active. When you click Get Directions, the setDirectionInfo function is called and a map (using Google Maps) is displayed with the directions between the selected items.

Click for larger image 

Example 3: Display a Form with Selection and Editing (Ex3_EditAddresses)

You can add the ability to edit when you bind a FormList to a collection. This example builds on the two previous examples. Now, support for direct editing (selecting an item and pressing the Delete key after selecting within the control) and indirect editing (through buttons bound to functions that programmatically change the collection using add and removeSelected API functions) are added. 

The Add New button control is bound to the addNewAddress function on the parent object of the collection. When the end user clicks the button, the function creates a new instance of Address and prompts the user to fill in the information. When the user clicks OK, the newly created address object is added to the collection.

In removeAddressWithPrompt, the end user is prompted to confirm the removal of the object, and the selected context (the selectedName argument passed in) is used to delete the object from the collection. To enable edit, the selectedFormInterface field is set on the Element adapter interface. When an end user selects the address in the list, the form changes to RowEdit per the interface set on the selectedFormInterface.

Click for larger image 

Example 4: Display a Form with Selection, Editing, and Drag-and-Drop (Ex4_DragDropAddresses)

You can add drag-and-drop ability when you bind a FormList to a collection. This example includes all the functionality of the previous example and adds support for drag-and-drop by adding a field (favorites) as a target location to which address objects can be dragged. The Drag Zone and Drop Zones properties (Behavior tab) are changed so each property contains the same reference (AddrList).

Click for larger image 

Example Helper Class Address

The helper class (Address) contains address information used by the examples. It also contains three forms, which are used as follows:

  • NewAddressDetail: This form is displayed by Example 3 when you click Add New.
  • RowEdit: This form is displayed by Example 3 when you select an item in the list.
  • Row: This form is used by all the examples. It displays the link and description for each item in the list.

Click for larger image 

Reference

Supported Types (Control Interface)

TypeSummary
Collection<Object>

Use the FormList to display an collection type field of complex Objects. You choose either of two ways to indicate which form to use to represent the item in the collection:

1) Select the FormList control on the form, then set the Element Form property (Interfaces tab). At runtime the Collection queries the item object for a form that references that Element Form type.

2) Implement the "Element" adapter interface on the object item itself. This allows the object item to "compute" the form to use at runtime. A common practice is to create a collection field whose item type is Object or some other base type representative of all the items in that collection. For example, if the collection element type is "Person," then at runtime, all the items in the list are at least an instance of type Person. In addition, any subclass of Person is also acceptable. If you are unsure which type instances will be in the collection (as designed) then set the type to Object, as all objects in the system inherit from Object.

Default Interfaces

TypeSummary
FormListInterface A adapter interface, assigned to the control through the Selection property
FormListElementInterface A adapter interface, assigned to the control through the Element property

Adapters

TypeSummary
FormListAdapter Enables control over the selection of items displayed in a FormList control. You use a FormListAdapter to set initial selection in the control, as well as to respond to end-user selection of items in a List.
FormListElementAdapter Enables control over which form the FormList displays for each item in the list within the application object

Associated Properties

Common Properties Index

Specialized Properties

Unique Properties

 

 

 

    Copyright © 2005 - 2008 Bungee Labs. All rights reserved.