Package net.suberic.pooka.gui

Examples of net.suberic.pooka.gui.MessageProxy$SaveAddressAction


   */
  public List performFilter(List filteredMessages) {
    List moved = new ArrayList();
    try {
      for (int i = 0; i < filteredMessages.size(); i++) {
        MessageProxy current = (MessageProxy) filteredMessages.get(i);
        current.moveMessage(getTargetFolder(), false);
        moved.add(current);
      }
    } catch (OperationCancelledException oce) {

    } catch (MessagingException me) {
View Full Code Here


      mi = new MessageInfo(newMessage, this);

      if ( i >= firstFetched)
        mi.setFetched(true);

      messageProxies.add(new MessageProxy(getColumnValues() , mi));
      messageToInfoTable.put(newMessage, mi);
      uidToInfoTable.put(new Long(uid), mi);
    }

    return messageProxies;
View Full Code Here

    Vector proxies = new Vector();
    for (int i = 0; i < messages.length; i++) {
      // FIXME
      MessageInfo mi =  getMessageInfo(messages[i]);
      MessageProxy mp = mi.getMessageProxy();
      mi.setFetched(false);
      mp.setRefresh(true);
      proxies.add(mp);
    }

    getLogger().log(Level.FINE, "updating flags for " + proxies.size() + " messages.");
View Full Code Here

          } else {
            mi = new MessageInfo(newMsg, this);
            // this has already been fetched; no need to do so again.
            mi.setFetched(true);

            addedProxies.add(new MessageProxy(getColumnValues(), mi));
            messageToInfoTable.put(newMsg, mi);
            uidToInfoTable.put(new Long(uid), mi);
          }
        }
View Full Code Here

        UIDMimeMessage changedMsg = getUIDMimeMessage(msg);
        long uid = changedMsg.getUID();

        MessageInfo mi = getMessageInfoByUid(uid);
        if (mi != null) {
          MessageProxy mp = mi.getMessageProxy();
          if (mp != null) {
            mp.unloadTableInfo();
            mp.loadTableInfo();
          }
        }
      } catch (MessagingException me) {
        // if we catch a MessagingException, it just means
        // that the message has already been expunged.
View Full Code Here

   * by the filter.
   */
  public List performFilter(List filteredMessages) {
    List removed = new ArrayList();
    for (int i = 0; i < filteredMessages.size(); i++) {
      MessageProxy current = (MessageProxy) filteredMessages.get(i);
      current.bounceMessage(getTargetAddresses(), removeBounced, false);
      if (removeBounced) {
  removed.add(current);
      }
    }

View Full Code Here

 
  /**
   * Loads the messages in the queue.
   */
  public void loadNextBatch() {
    MessageProxy mp;
   
    // start this load section.
    int queueSize = getQueueSize();   
    if (! stopped) {
      if (queueSize > 0) {
  folderInfo.getLogger().log(java.util.logging.Level.FINE, folderInfo.getFolderID() + " loading " + queueSize + " messages.");
 
  // get the batch sizes.
  int fetchBatchSize = 50;
  try {
    fetchBatchSize = Integer.parseInt(Pooka.getProperty("Pooka.fetchBatchSize", "50"));
  } catch (NumberFormatException nfe) {
  }
 
  FetchProfile fetchProfile = getFolderInfo().getFetchProfile();
 
  // get the next batch.
  List messageProxies = retrieveNextBatch(fetchBatchSize);
  List toFetchInfos = new LinkedList();
 
  // go through and find all of the messages that need to be fetched
  // or refetched, and add them to the toFetchInfos list.
  for (int i = 0 ; i < messageProxies.size(); i++) {
    MessageInfo fetchCheckInfo = ((MessageProxy) messageProxies.get(i)).getMessageInfo();
    if (! fetchCheckInfo.hasBeenFetched()) {
      toFetchInfos.add(fetchCheckInfo);
    }
  }
 
  if (toFetchInfos.size() > 0) {
    try {
      MessageInfo[] toFetch = new MessageInfo[toFetchInfos.size()];
      toFetch = (MessageInfo[]) toFetchInfos.toArray(toFetch);
      getFolderInfo().fetch(toFetch, fetchProfile);
    } catch(MessagingException me) {
      if (folderInfo.getLogger().isLoggable(java.util.logging.Level.WARNING)) {
        System.out.println("caught error while fetching for folder " + getFolderInfo().getFolderID() + ":  " + me);
        me.printStackTrace();
      }
    }
  }
 
  // now load each individual messageproxy.
  // and refresh each message.
  for (int i = 0 ; i < messageProxies.size(); i++) {
    mp = (MessageProxy) messageProxies.get(i);
    try {
      if (! mp.isLoaded())
        mp.loadTableInfo();
      if (mp.needsRefresh()) {
        mp.refreshMessage();
      }
      else if (! mp.matchedFilters()) {
        mp.matchFilters();
      }
    } catch (Exception e) {
      if (folderInfo.getLogger().isLoggable(java.util.logging.Level.WARNING)) {
        e.printStackTrace();
      }
    }
  }

      } else if (getCacheQueueSize() > 0) {
  try {
    MessageProxy nextCache = (MessageProxy) cacheQueue.remove(0);
    if (folderInfo instanceof CachingFolderInfo) {
      MessageInfo mi = nextCache.getMessageInfo();
      MimeMessage mimeMessage = (MimeMessage) mi.getMessage();
      CachingFolderInfo cfi = (CachingFolderInfo) folderInfo;
      if (cfi.getFolderDisplayUI() != null) {
        cfi.showStatusMessage(cfi.getFolderDisplayUI(), "caching messages, " + getCacheQueueSize() + " remaining...");
      }
View Full Code Here

        for (int i = 0; i < uids.length; i++) {
          Message m = new CachingMimeMessage(this, uids[i]);
          mi = new MessageInfo(m, this);

          messageProxies.add(new MessageProxy(getColumnValues() , mi));
          messageToInfoTable.put(m, mi);
          uidToInfoTable.put(new Long(uids[i]), mi);
        }

        return messageProxies;
      } catch (Exception e) {
        final Exception fe = e;
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              if (getFolderDisplayUI() != null) {
                getFolderDisplayUI().showError(Pooka.getProperty("error.CachingFolder.synchronzing", "Error synchronizing with folder"), Pooka.getProperty("error.CachingFolder.synchronzing.title", "Error synchronizing with folder"), fe);
              } else {
                Pooka.getUIFactory().showError(Pooka.getProperty("error.CachingFolder.synchronzing", "Error synchronizing with folder"), Pooka.getProperty("error.CachingFolder.synchronzing.title", "Error synchronizing with folder"), fe);

              }
            }
          });
      }
    }

    long[] uids = cache.getMessageUids();
    MessageInfo mi;

    for (int i = 0; i < uids.length; i++) {
      Message m = new CachingMimeMessage(this, uids[i]);
      mi = new MessageInfo(m, this);
      MessageProxy mp = new MessageProxy(getColumnValues() , mi);
      mp.setRefresh(true);
      messageProxies.add(mp);
      messageToInfoTable.put(m, mi);
      uidToInfoTable.put(new Long(uids[i]), mi);
    }
View Full Code Here

            if (getLogger().isLoggable(Level.FINE))
              getLogger().log(Level.FINE, getFolderID() + ":  this is a duplicate.  not making a new messageinfo for it.");
          } else {
            mi = new MessageInfo(addedMessages[i], CachingFolderInfo.this);
            addedInfos.add(mi);
            addedProxies.add(new MessageProxy(getColumnValues(), mi));
            messageToInfoTable.put(addedMessages[i], mi);
            uidToInfoTable.put(new Long(((CachingMimeMessage) addedMessages[i]).getUID()), mi);
          }

          // we need to autoCache either way.
          /*
            try {
            if (autoCache) {
            showStatusMessage(getFolderDisplayUI(), "caching " + i + " of " + addedMessages.length + " messages....");
            getCache().cacheMessage((MimeMessage)addedMessages[i], ((CachingMimeMessage)addedMessages[i]).getUID(), getUIDValidity(), SimpleFileCache.MESSAGE, false);
            } else {
            getCache().cacheMessage((MimeMessage)addedMessages[i], ((CachingMimeMessage)addedMessages[i]).getUID(), getUIDValidity(), SimpleFileCache.FLAGS_AND_HEADERS, false);
            }
            } catch (MessagingException me) {
            getLogger().log(Level.FINE, "caught exception:  " + me);
            me.printStackTrace();
            }
          */
        } else {
          // it's a 'real' message from the server.

          long uid = -1;
          try {
            uid = getUID(addedMessages[i]);
          } catch (MessagingException me) {
          }

          mi = getMessageInfoByUid(uid);
          if (mi != null) {
            addedInfos.add(mi);
            if (getLogger().isLoggable(Level.FINE))
              getLogger().log(Level.FINE, getFolderID() + ":  this is a duplicate.  not making a new messageinfo for it.");

            // but we still need to autocache it if we're autocaching.
            if (autoCache) {
              mMessageLoader.cacheMessages(new MessageProxy[] { getMessageInfoByUid(uid).getMessageProxy()});
            }
          } else {
            CachingMimeMessage newMsg = new CachingMimeMessage(CachingFolderInfo.this, uid);
            mi = new MessageInfo(newMsg, CachingFolderInfo.this);
            addedInfos.add(mi);
            addedProxies.add(new MessageProxy(getColumnValues(), mi));
            messageToInfoTable.put(newMsg, mi);
            uidToInfoTable.put(new Long(uid), mi);
          }

          /*
 
View Full Code Here

            getCache().cacheMessage((MimeMessage)msg, uid, uidValidity, SimpleFileCache.HEADERS);
        }

        MessageInfo mi = getMessageInfoByUid(uid);
        if (mi != null) {
          MessageProxy mp = mi.getMessageProxy();
          if (mp != null) {
            mp.unloadTableInfo();
            mp.loadTableInfo();
          }
        }

      } catch (MessagingException me) {
        // if we catch a MessagingException, it just means
View Full Code Here

TOP

Related Classes of net.suberic.pooka.gui.MessageProxy$SaveAddressAction

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.