Using PIM Actions

You can add a PIM action to a control to integrate the control with a BlackBerry PIM application. The PIM action constructor takes the following arguments.

int type:

public interface RIMPimConstants
{
    // #################### Available RIM applications #################### //
    
    public static int RIM_PIM_CONTACT   = 0;
    public static int RIM_PIM_EMAIL     = 1;
    public static int RIM_PIM_PHONE     = 2;
    public static int RIM_PIM_EVENT     = 3;
    public static int RIM_PIM_TODO      = 4;
    public static int RIM_PIM_MEMO      = 5;
}

boolean isRead: if true, the constructor reads from the BlackBerry PIM application; if false the constructor writes to the BlackBerry PIM application.

Object control: A com.sybase.uep.bobclient.controls.MobileDataControl widget such as com.sybase.uep.bobclient.controls.MobileAppTable, com.sybase.uep.bobclient.controls.TwoColumnLayout or com.sybase.uep.bobclient.screens.IBOBScreen.

The following code example shows the use of the PIM read action, which requires the control’s logical type to be set as one of the PIM application type, and the creation of a PIM action that refers to the control or the control’s parent screen.

TextInput textInput = new TextInput("", "",
    BasicEditField.DEFAULT_MAXCHARS, Field.FIELD_LEFT);
// set logical type of text input, this is important for PIM usage
textInput.setLogicalType(
    new LogicalType(
        RIMPimConstants.RIM_PIM_CONTACT,
        BlackBerryContact.NAME,
        PIMItem.ATTR_NONE, Contact.NAME_GIVEN));
layoutManager.addWidget(textInput1, 1, 1);
Button button2 = (Button) object;
// Create list of actions
ActionList actionList2 = new ActionList();
button2.setAction(actionList2);
// pass the text input’s parent screen to PIM action
Action rimAction2 = 
    new RIMPimAppAction(
        RIMPimConstants.RIM_PIM_CONTACT, true, this, false);
actionList2.addAction(rimAction2);
layoutManager.addWidget(button2, 1, 1);

The following is a code example for the PIM write action:

TextInput textInput3 = (TextInput) object;
textInput3.setInvalidValueMessage(
    "Enter a valid value (data type {0} and logical type {1}).");
textInput3.setLogicalType(
    new LogicalType(
        RIMPimConstants.RIM_PIM_CONTACT,
        BlackBerryContact.NAME,
        PIMItem.ATTR_NONE, Contact.NAME_FAMILY));
layoutManager.addWidget(textInput3, 1, 1);
Button button4 = (Button) object;
//Create list of actions
ActionList actionList2 = new ActionList();
button4.setAction(actionList2);
Action rimAction2 = new RIMPimAppAction(
    RIMPimConstants.RIM_PIM_CONTACT, false, this,
    true);
actionList2.addAction(rimAction2);
layoutManager.addWidget(button4, 1, 1);

boolean launchPIMApp: if true, the PIM application gets launched after performing a write operation, otherwise false.

case MENU13:
  MenuAction menu13 = (MenuAction) object;
  Action rimAction9 =
      new RIMPimAppAction(
         RIMPimConstants.RIM_PIM_CONTACT, true, this,
         false);
  menu13.setAction(rimAction9);
  break;