Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Displaying a list of complex records

by BlackBerry Development Advisor ‎02-12-2010 02:20 PM - edited ‎09-17-2010 04:30 PM (8,784 Views)

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. Open table_list_field_incomplete.zip
  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

 

Check table_list_field_complete.zip

 

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.
Contributors
Users Online
Currently online: 28 members 1,119 guests
Please welcome our newest community members: