net.rim.device.api.ui.component.table
Class TableController

java.lang.Object
  extended by net.rim.device.api.ui.component.table.DataController
      extended by net.rim.device.api.ui.component.table.TableController

public class TableController
extends DataController

A controller class for table components. Implementations of TableController should handle user input and programmatic requests by notifying the model of possible changes, e.g. updating the contents of a table row. It may also be necessary for the controller to modify the view directly, e.g. visual state changes such as focus. Each TableController must provide references to a DataModel and a DataView.

Since:
BlackBerry API 6.0.0

Field Summary
static int FIELD_FOCUS
          A focus policy that ensures that Data Records (shaped by a Data Template) do not receive focus as a whole.
static int REGION_FOCUS
          A focus policy that ensures that Data Records (shaped by a Data Template) do not receive focus as a whole.
static int ROW_FOCUS
          A focus policy that ensures that only the Data Records (shaped by a Data Template) receive focus in the form of background focus that appears behind the area defined by the Data Template.
 
Constructor Summary
TableController(AbstractTableModel model, DataView view)
          Create a TableController for the given model and view.
TableController(AbstractTableModel model, DataView view, int focusPolicy)
          Create a TableController for the given model and view.
 
Method Summary
protected  boolean keyChar(char ch, int status, int time)
          Handles key generation events.
 void moveFocus(int x, int y, int status, int time)
          Moves focus to an exact position within this manager.
protected  boolean navigationMovement(int dx, int dy, int status, int time)
          Move the Table Field focus from one data template to the next one to be focused vertically.
protected  boolean navigationUnclick(int status, int time)
          handle the navigation unclick event by invoking the command handler if it is set.
 void setCommand(Command command)
          Set the command that will be executed on navigation click and touch click events.
 void setCommand(CommandHandler commandHandler, ReadOnlyCommandMetadata metadata, Object context)
          Deprecated. Use setCommand(Command command) and setCommandContext(Object commandContext) instead.
 void setCommandContext(Object commandContext)
          Sets command context to use on navigation click and touch click events.
 void setFocusPolicy(int newFocusPolicy)
          Sets the current focus policy of this Table object.
protected  boolean touchEvent(TouchEvent message)
          Handles touch input events (see TouchEvent).
 
Methods inherited from class net.rim.device.api.ui.component.table.DataController
getModel, getView, keyControl, keyDown, keyRepeat, keyStatus, keyUp, makeMenu, moveFocus, navigationClick, setModel, setView
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

FIELD_FOCUS

public static final int FIELD_FOCUS
A focus policy that ensures that Data Records (shaped by a Data Template) do not receive focus as a whole. Instead, foreground focus is only given to fields inside these Data Records.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ROW_FOCUS

public static final int ROW_FOCUS
A focus policy that ensures that only the Data Records (shaped by a Data Template) receive focus in the form of background focus that appears behind the area defined by the Data Template. Foreground focus is never given to the fields inside these Data Records.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

REGION_FOCUS

public static final int REGION_FOCUS
A focus policy that ensures that Data Records (shaped by a Data Template) do not receive focus as a whole. Instead, background focus is only given to the regions that were defined using DataTemplate.createRegion(XYRect) or DataTemplate.createRegion(XYRect, RegionStyles).

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0


Constructor Detail

TableController

public TableController(AbstractTableModel model,
                       DataView view)
Create a TableController for the given model and view.

Parameters:
model - the data model that contains the data that is displayed in the table
view - the view that displays the data in the model
Since:
BlackBerry API 6.0.0

TableController

public TableController(AbstractTableModel model,
                       DataView view,
                       int focusPolicy)
Create a TableController for the given model and view.

Parameters:
model - the data model that contains the data that is displayed in the table
view - the view that displays the data in the model
focusPolicy - the focus policy that this TableController will follow. Acceptable focusPolicy values are: TableController.FIELD_FOCUS, TableController.ROW_FOCUS or TableController.REGION_FOCUS
Since:
BlackBerry API 6.0.0


Method Detail

moveFocus

public void moveFocus(int x,
                      int y,
                      int status,
                      int time)
Moves focus to an exact position within this manager.

Parameters:
x - Distance from left edge of virtual region.
y - Distance from top edge of virtual region.
status - Trackwheel event modifiers.
time - Number of milliseconds since the device was turned on.
Since:
BlackBerry API 6.0.0

setFocusPolicy

public void setFocusPolicy(int newFocusPolicy)
Sets the current focus policy of this Table object.

Parameters:
newFocusPolicy - Acceptable values are: TableController.FIELD_FOCUS, TableController.ROW_FOCUS or TableController.REGION_FOCUS
Since:
BlackBerry API 6.0.0

touchEvent

protected boolean touchEvent(TouchEvent message)
Handles touch input events (see TouchEvent). The coordinates reflect the location of the touch event with respect to the top-left of this Manager. The x, y coordinates are then further mapped to the top-left corner of the field with input.

Overrides:
touchEvent in class DataController
Parameters:
message - TouchEvent object containing various input parameters including the event type and touch coordinates.
Returns:
True if event consumed; otherwise, false.
Throws:
IllegalArgumentException - If message is null.
Since:
BlackBerry API 6.0.0

keyChar

protected boolean keyChar(char ch,
                          int status,
                          int time)
Handles key generation events.

Sends the event to the field with focus. If no field has the focus, this method does nothing and returns false.

Overrides:
keyChar in class DataController
Parameters:
ch - Character generated.
status - Modifier key status.
time - Number of milliseconds since the device was turned on.
Returns:
true if event was consumed; otherwise, returns false.
Since:
BlackBerry API 7.0.0

navigationMovement

protected boolean navigationMovement(int dx,
                                     int dy,
                                     int status,
                                     int time)
Move the Table Field focus from one data template to the next one to be focused vertically. The next one to be focused is current row in focus plus dy.

Overrides:
navigationMovement in class DataController
Parameters:
dx - Magnitude of navigational motion: negative for a move left and postive for a move right.
dy - Magnitude of navigational motion: negative for an upwards move, and positive for a downwards move.
status - Bitfield of values defined by KeypadListener.
time - Number of milliseconds since the device was turned on.
Returns:
True if event was consumed; otherwise, false.
Since:
BlackBerry API 6.0.0

navigationUnclick

protected boolean navigationUnclick(int status,
                                    int time)
handle the navigation unclick event by invoking the command handler if it is set.

Overrides:
navigationUnclick in class DataController
Parameters:
status - Bitfield of values defined by KeypadListener.
time - Number of milliseconds since the device was turned on.
Returns:
True if this method consumed the event; otherwise, false.
Since:
BlackBerry API 6.0.0

setCommand

public void setCommand(CommandHandler commandHandler,
                       ReadOnlyCommandMetadata metadata,
                       Object context)
Deprecated. Use setCommand(Command command) and setCommandContext(Object commandContext) instead.

Set the command that will be executed on navigation click and touch click events.

Parameters:
command - the command to be executed.
metadata - the metadata to be sent when the command is executed
context - the context to be sent whent he command is executed
Since:
BlackBerry API 6.0.0

setCommand

public void setCommand(Command command)
Set the command that will be executed on navigation click and touch click events. For more information, see Command Framework API.

Parameters:
command - Command to be executed.
Since:
BlackBerry API 7.0.0

setCommandContext

public void setCommandContext(Object commandContext)
Sets command context to use on navigation click and touch click events.

Parameters:
commandContext - Command context to use when the Command instance is executed.
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal