Package net.rim.device.api.collection

Examples of net.rim.device.api.collection.ReadableList


      CustomMessage message = null;
     
      // Loop through our stored messages
      CustomMessageStore messageStore = CustomMessageStore.getInstance();
      synchronized (messageStore) {
        ReadableList list = messageStore.getInboxMessages();
        int size = list.size();
        for (int i = 0; i < size; i++ ) {
          CustomMessage temp = (CustomMessage)list.getAt(i);
          if (temp.getId().equals(id)) {
            message = temp;
            break;
          }           
        }
View Full Code Here


      CustomMessage[] messages = null;
     
      // Loop through our stored messages
      CustomMessageStore messageStore = CustomMessageStore.getInstance();
      synchronized (messageStore) {
        ReadableList list = messageStore.getInboxMessages();
        int size = list.size();
        messages = new CustomMessage[size];
        list.getAt(0, size, messages, 0);
      }
   
      return messages; 

    } catch (Exception e) {
View Full Code Here

      public void run() {
        try {     
          // Loop through our stored messages
          CustomMessageStore messageStore = CustomMessageStore.getInstance();
          synchronized (messageStore) {
            ReadableList list = messageStore.getInboxMessages();
            int size = list.size();
            for (int i = 0; i < size; i++ ) {
              CustomMessage message = (CustomMessage)list.getAt(i);
              if (message.getId().equals(id)) { 
                messageStore.deleteInboxMessage(message);
               
                // Update the inbox
                ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
View Full Code Here

      public void run() {
        try {     
          // Loop through our stored messages
          CustomMessageStore messageStore = CustomMessageStore.getInstance();
          synchronized (messageStore) {
            ReadableList list = messageStore.getInboxMessages();
            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);
               
View Full Code Here

      public void run() {
        try {     
          // Loop through our stored messages
          CustomMessageStore messageStore = CustomMessageStore.getInstance();
          synchronized (messageStore) {
            ReadableList list = messageStore.getInboxMessages();
            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);
             
View Full Code Here

     *
     * @param messageStore
     *            The message store to perform the random action to
     */
    private void performRandomAction(final MessageListDemoStore messageStore) {
        final ReadableList inboxMessages = messageStore.getInboxMessages();
        final ReadableList deletedMessages = messageStore.getDeletedMessages();

        switch (_random.nextInt(3)) {
        case 0:

            // Update an existing message
            if (inboxMessages.size() > 0) {
                final DemoMessage msg =
                        (DemoMessage) inboxMessages.getAt(_random
                                .nextInt(inboxMessages.size()));
                if (msg.isNew()) {
                    msg.markRead();
                } else if (!msg.hasReplied()) {
                    msg.reply("Auto reply");
                } else {
                    msg.markAsNew();
                }
                messageStore.getInboxFolder().fireElementUpdated(msg, msg);
            } else {
                addInboxMessage(messageStore);
            }
            break;

        case 1:

            // Delete an inbox message
            if (inboxMessages.size() > 0) {
                final DemoMessage msg =
                        (DemoMessage) inboxMessages.getAt(_random
                                .nextInt(inboxMessages.size()));
                messageStore.deleteInboxMessage(msg);
                messageStore.getInboxFolder().fireElementRemoved(msg);
                messageStore.getDeletedFolder().fireElementAdded(msg);
            } else {
                addInboxMessage(messageStore);
            }
            break;

        default:

            // Delete message completely
            if (deletedMessages.size() > 0) {
                final DemoMessage msg =
                        (DemoMessage) deletedMessages.getAt(_random
                                .nextInt(deletedMessages.size()));
                messageStore.deleteMessageCompletely(msg);
                messageStore.getDeletedFolder().fireElementRemoved(msg);
            } else {
                addInboxMessage(messageStore);
            }
View Full Code Here

TOP

Related Classes of net.rim.device.api.collection.ReadableList

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.