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

java.lang.Object
  extended by net.rim.device.api.ui.component.table.DataController
Direct Known Subclasses:
TableController

public abstract class DataController
extends Object

A controller class for data components. Implementations of DataController 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 DataController must provide references to a DataModel and a DataView.

Since:
BlackBerry API 6.0.0

Constructor Summary
DataController(DataModel model, DataView view)
          Create a DataController for the given model and view.
 
Method Summary
 DataModel getModel()
          Retrieve the model associated with this table component.
 DataView getView()
          Retrieve the view associated with this table component.
protected  boolean keyChar(char ch, int status, int time)
          Handles key generation events.
protected  boolean keyControl(char ch, int status, int time)
          Sends key generation event to the controlled field with focus.
protected  boolean keyDown(int keyCode, int time)
          Sends key down event to the controlled field with focus.
protected  boolean keyRepeat(int keyCode, int time)
          Sends key repeat event to the field with focus.
protected  boolean keyStatus(int keyCode, int time)
          Sends key status event to the field with focus.
protected  boolean keyUp(int keyCode, int time)
          Sends key up event to the row with focus.
 void makeMenu(Menu menu, int instance)
          Called from SimpleTableManager#makeMenu to populate the menu.
 boolean moveFocus(int where)
          Moves focus one or more visible screenfuls in a specific direction.
protected  boolean navigationClick(int status, int time)
          Invoked when the navigational action is selected.
protected  boolean navigationMovement(int dx, int dy, int status, int time)
          Invoked when a navigational motion occurs.
protected  boolean navigationUnclick(int status, int time)
          Invoked when the navigational action is released.
 void setModel(DataModel model)
          Provide a reference to this table component's model.
 void setView(DataView view)
          Provide a reference to this table component's view.
protected  boolean touchEvent(TouchEvent message)
          Handle a touch event in the table field.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

DataController

public DataController(DataModel model,
                      DataView view)
Create a DataController 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


Method Detail

getModel

public DataModel getModel()
Retrieve the model associated with this table component. Implementations of DataController should notify the model of model changes in response to user input or programmatic requests.

Returns:
Reference to an instance of a DataModel implementation.
Since:
BlackBerry API 6.0.0

getView

public DataView getView()
Retrieve the view associated with this table component. Implementations of TableController may be required to notify DataView of view changes in response to user input or programmatic requests. return Reference to an instance of a DataView implementation.

Returns:
The DataView object associated with this DataController.
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.

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 6.0.0

keyControl

protected boolean keyControl(char ch,
                             int status,
                             int time)
Sends key generation event to the controlled field with focus.

If no controlled field has the focus, this method does nothing and returns false.

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 6.0.0

keyDown

protected boolean keyDown(int keyCode,
                          int time)
Sends key down event to the controlled field with focus.

If no controlled field has the focus, this method does nothing and returns false.

Parameters:
keyCode - Code of key pressed.
time - Number of milliseconds since the device was turned on.
Returns:
True if event was consumed; otherwise, returns false.
Since:
BlackBerry API 6.0.0

keyRepeat

protected boolean keyRepeat(int keyCode,
                            int time)
Sends key repeat event to the field with focus.

If no field has the focus, this method does nothing and returns false.

Parameters:
keyCode - Code of key pressed.
time - Number of milliseconds since the device was turned on.
Returns:
true if event was consumed; otherwise, returns false.
Since:
BlackBerry API 6.0.0

keyStatus

protected boolean keyStatus(int keyCode,
                            int time)
Sends key status event to the field with focus.

If no field has the focus, this method does nothing and returns false.

Parameters:
keyCode - Code of key pressed.
time - Number of milliseconds since the device was turned on.
Returns:
true if event was consumed; otherwise, returns false.
Since:
BlackBerry API 6.0.0

keyUp

protected boolean keyUp(int keyCode,
                        int time)
Sends key up event to the row with focus.

If no row has the focus, this method does nothing and returns false.

Parameters:
keyCode - Code of key pressed.
time - Number of milliseconds since the device was turned on.
Returns:
true if event was consumed; otherwise, returns false.
Since:
BlackBerry API 6.0.0

makeMenu

public void makeMenu(Menu menu,
                     int instance)
Called from SimpleTableManager#makeMenu to populate the menu.

Parameters:
menu - Menu to which items should be added.
instance - The instance of the desired menu. If your screen supports only one menu, this may be ignored. By default, it is 0.
Since:
BlackBerry API 6.0.0

moveFocus

public boolean moveFocus(int where)
Moves focus one or more visible screenfuls in a specific direction.

Parameters:
where - Combination of constant values to indicate in which direction, and how much, the focus is to move.
Returns:
True if this method successfully moved the focus to a new field; otherwise, false.
Since:
BlackBerry API 6.0.0

navigationClick

protected boolean navigationClick(int status,
                                  int time)
Invoked when the navigational action is selected.

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

navigationMovement

protected boolean navigationMovement(int dx,
                                     int dy,
                                     int status,
                                     int time)
Invoked when a navigational motion occurs.

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)
Invoked when the navigational action is released.

Parameters:
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

touchEvent

protected boolean touchEvent(TouchEvent message)
Handle a touch event in the table field.

Parameters:
message - the touch event that has occured
Returns:
true if the event was handled otherwise false
Since:
BlackBerry API 6.0.0

setModel

public void setModel(DataModel model)
Provide a reference to this table component's model. Implementations of DataController should notify DataModel of model changes in response to user input or programmatic requests.

Parameters:
model - Reference to an instance of a DataModel implementation.
Since:
BlackBerry API 6.0.0

setView

public void setView(DataView view)
Provide a reference to this table component's view. Implementations of TableController may be required to notify TableView of view changes in response to user input or programmatic requests.

Parameters:
view - Reference to an instance of a TableView implementation.
Since:
BlackBerry API 6.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