Package net.rim.blackberry.api.messagelist

Examples of net.rim.blackberry.api.messagelist.ApplicationMessageFolderRegistry


    _GUID = GUID;
   
    MessageListNamespace.setGUID(GUID);
   
    // 1. Register folders and application descriptors ----------------------
    ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
   
    // Some context menu items don't need a GUI (e.g. an item for deleting a
    // message) and will be run in the current daemon application.
    ApplicationDescriptor appDescr = new ApplicationDescriptor(ApplicationDescriptor.currentApplicationDescriptor(),new String[]{});
   
    CustomMessageStore messages = CustomMessageStore.getInstance(GUID);
    ReadableListImpl inboxMessages = messages.getInboxMessages();
   
    ApplicationMessageFolder inbox = reg.registerFolder(CustomMessage.INBOX_FOLDER_ID, _folderName, inboxMessages);

    // Register as a listener for callback notifications
    inbox.addListener(this, ApplicationMessageFolderListener.MESSAGE_DELETED | ApplicationMessageFolderListener.MESSAGE_MARKED_OPENED
      | ApplicationMessageFolderListener.MESSAGE_MARKED_UNOPENED, appDescr);     

    // We've registered two folders, specify root folder name for the [View Folder] screen.
    reg.setRootFolderName(_folderName);     

    // Set up menu items --------------------------------------
    ApplicationMenuItem openMenuItem = new OpenContextMenu(0x230010);
    ApplicationMenuItem markOpenedMenuItem = new MarkOpenedContextMenu(0x230030);
    ApplicationMenuItem markUnreadMenuItem = new MarkUnreadContextMenu(0x230031);
View Full Code Here


      }
    }
    }
   
    public static void registerType(int type, String newImage, String readImage){
      ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
      ApplicationDescriptor appDescr = new ApplicationDescriptor(ApplicationDescriptor.currentApplicationDescriptor(),new String[]{});
     
     
    // 2. Register message icons -------------------------------------------
      newImage = newImage.length()==0?MessageListNamespace.getInstance().getDefaultNewImage():newImage;
      readImage = readImage.length()==0?MessageListNamespace.getInstance().getDefaultReadImage():readImage;
    ApplicationIcon newIcon = new ApplicationIcon(EncodedImage.getEncodedImageResource(newImage), true);
    ApplicationIcon readIcon = new ApplicationIcon(EncodedImage.getEncodedImageResource(readImage), true);
    reg.registerMessageIcon(type, CustomMessage.STATUS_NEW, newIcon);
    reg.registerMessageIcon(type, CustomMessage.STATUS_OPENED, readIcon);

    //3. Register message menu items --------------------------------------
    reg.registerMessageMenuItems(type, CustomMessage.STATUS_NEW, _newGuiMenuItems, appDescr);
    reg.registerMessageMenuItems(type, CustomMessage.STATUS_NEW, _newDaemonMenuItems, appDescr);
    reg.registerMessageMenuItems(type, CustomMessage.STATUS_OPENED, _openedGuiMenuItems, appDescr);
    reg.registerMessageMenuItems(type, CustomMessage.STATUS_OPENED, _markedUnreadMenuItems, appDescr);
    reg.setBulkMarkOperationsSupport(type, CustomMessage.STATUS_NEW, true, false);
    reg.setBulkMarkOperationsSupport(type, CustomMessage.STATUS_OPENED, false, true);
    }
View Full Code Here

      int length = messageStore.getInboxMessages().size();
      for (int i = 0; i < length; i++) {
        CustomMessage msg = (CustomMessage) messageStore.getInboxMessages().getAt(i);
        msg.markRead();
      }
      ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
      ApplicationMessageFolder folder = reg.getApplicationFolder(CustomMessage.INBOX_FOLDER_ID);
      folder.fireReset();
      } catch (Exception e)
      {
        Dialog.alert("problem marking all messages as read " + e.getMessage());
      }
View Full Code Here

        {
            if(context instanceof CustomMessage)
            {
                CustomMessage message = (CustomMessage) context;
                message.markRead();
                ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
                ApplicationMessageFolder folder = reg.getApplicationFolder(CustomMessage.INBOX_FOLDER_ID);
                folder.fireElementUpdated(message, message);
       
        // Invoke our callback
                MessageListNamespace.getInstance().invokeItemMarkedRead(message);
            }
View Full Code Here

        {
            if(context instanceof CustomMessage)
            {
                CustomMessage message = (CustomMessage) context;
                message.markUnRead();
                ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
                ApplicationMessageFolder folder = reg.getApplicationFolder(CustomMessage.INBOX_FOLDER_ID);
                folder.fireElementUpdated(message, message);
       
        // Invoke our callback
                MessageListNamespace.getInstance().invokeItemMarkedUnread(message);
            }
View Full Code Here

                // Update status if message is new
                if(message.isNew())
                {
                    message.markRead();
                    ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
                    ApplicationMessageFolder folder = reg.getApplicationFolder(CustomMessage.INBOX_FOLDER_ID);
                    folder.fireElementUpdated(message, message);
                }
       
        // Invoke our callback
                message.invokeItemOpen(MessageListNamespace.getInstance());
View Full Code Here

      public void run() {
        try {
          CustomMessageDispatcher daemon = new CustomMessageDispatcher();

          // Check if this application registered folders already
          ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
          if (reg.getApplicationFolder(CustomMessageInterface.INBOX_FOLDER_ID) == null) {
            // Register folders & message types and initialize
            // folders
            daemon.init(folderName, appName, GUID);
          }
View Full Code Here

              CustomMessage message = (CustomMessage)list.getAt(i);
              if (message.getId().equals(id)) { 
                messageStore.deleteInboxMessage(message);
               
                // Update the inbox
                ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
                ApplicationMessageFolder folder = reg.getApplicationFolder(CustomMessage.INBOX_FOLDER_ID);
                folder.fireElementRemoved(message);
               
                MessageListNamespace.getInstance().invokeItemDeleted(message)
               
                break;
View Full Code Here

            int size = list.size();
            for (int i = 0; i < size; i++ ) {
              CustomMessage message = (CustomMessage)list.getAt(i);
              if (message.getId().equals(id)) { 
                // Update the inbox
                ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
                ApplicationMessageFolder folder = reg.getApplicationFolder(CustomMessage.INBOX_FOLDER_ID);
               
                // Update message
                message.markRead();

                // Update storage
View Full Code Here

            int size = list.size();
            for (int i = 0; i < size; i++ ) {
              CustomMessage message = (CustomMessage)list.getAt(i);
               
              // Update the inbox
              ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
              ApplicationMessageFolder folder = reg.getApplicationFolder(CustomMessage.INBOX_FOLDER_ID);
             
              // Update message
              message.markRead();                         

              // Notify GUI that message has changed
View Full Code Here

TOP

Related Classes of net.rim.blackberry.api.messagelist.ApplicationMessageFolderRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.