BlackBerry
Skip Top Navigation
Developers Partners
North America [change region] Products Solutions Purchasing Support
Developers


Displaying a List of Complex Records

Exercise

Create an application that displays a sequence of complex records in a grid with selectable rows.

Prerequisite: You should have completed the lab entitled Introduction to User Interface managers before starting this exercise.

Objectives

  • Apply your understanding of managers in building a useful custom UI component.
  • Discover how to use a ListField and ListFieldCallback for showing a sequence of selectable items.
  • Discover how to manipulate a Graphics context.
  • Experience some uses of BitmapField, NullField and DateField.

Setup

  1. Download the file
  2. In the IDE, open the table_list_field.jdw workspace
  3. Open the TableListApp.java source file.
  4. Open the TableListField.java source file.

Tasks

  1. Create a row manager for each row that is to be the content of a newly-created TableListField.
  2. Set the size and callback of the newly-created TableListField.
  3. Implement getColumnStart to calculate the horizontal position at which a given column should begin.
  4. When a TableRowManager is called upon to draw a row, transform and restore the Graphics context before and after the call to paint, so that the row paints into the correct region.
  5. Complete the sublayout, getPreferredWidth, and getPreferredHeight methods of the TableRowManager.
  6. When the framework invokes the RENDERER callback to draw a row from a list, have the RENDERER delegate to the proper TableRowManager.
  7. Within the TableListApp constructor, instantiate appropriate tableContent fields to represent the FAKE_DATA array.
  8. Within the TableListApp constructor, create the table and add it to the screen.

Check Your Work

Download the completed code

Review

In this exercise, you discovered the following things:

  • how to build a custom UI component.
  • to use a ListField and ListFieldCallback for showing a sequence of selectable items.
  • to manipulate a Graphics context.
  • some uses of BitmapField, NullField and DateField.


Additional Labs

Go to the first exercise in “Connecting to Email, Calendar and PIM Applications on BlackBerry”, Sending email messages

Back to the Developer Lab Main Menu

 
Other Resources
 
     
 Home | Products | Solutions | Purchasing | Support | Developers | Worldwide | News | About Us | Contact Us | Site Map
 Legal | Copyright © 2008 Research In Motion Limited, unless otherwise noted.