Package net.suberic.pooka.gui

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


   * by the filter.
   */
  public List performFilter(List filteredMessages) {
    List deleted = new java.util.LinkedList();
    for (int i = 0; i < filteredMessages.size(); i++) {
      MessageProxy current = (MessageProxy) filteredMessages.get(i);
      current.deleteMessage(false);
      deleted.add(current);
    }

    return deleted;
  }
View Full Code Here


   * by the filter.
   */
  public List performFilter(List filteredMessages) {
    for (int i = 0; i < filteredMessages.size(); i++) {
      try {
  MessageProxy current = (MessageProxy) filteredMessages.get(i);
  current.getMessageInfo().getRealMessage().setFlags(flagToSet, flagValue);
      } catch (MessagingException me) {
      }
     
    }
   
View Full Code Here

   */
  public void loadWaitingMessages() {
   
    int updateCounter = 0;
    int loadedMessageCount = 0;
    MessageProxy mp;
   
    // start this load section.
    int queueSize = getQueueSize();   
    int totalMessageCount = queueSize;
    if (! stopped && queueSize > 0) {
      folderInfo.getLogger().log(java.util.logging.Level.FINE, folderInfo.getFolderID() + " loading " + queueSize + " messages.");
     
      MessageLoadedListener display = getFolderInfo().getFolderDisplayUI();
      if (display != null)
  this.addMessageLoadedListener(display);
     
      fireMessageLoadedEvent(MessageLoadedEvent.LOADING_STARTING, 0, totalMessageCount);
     
      // get the batch sizes.
      int fetchBatchSize = 50;
      int loadBatchSize = 25;
      try {
  fetchBatchSize = Integer.parseInt(Pooka.getProperty("Pooka.fetchBatchSize", "50"));
      } catch (NumberFormatException nfe) {
      }
     
      try {
  loadBatchSize = Integer.parseInt(Pooka.getProperty("Pooka.loadBatchSize", "25"));
      } catch (NumberFormatException nfe) {
      }
     
      FetchProfile fetchProfile = getFolderInfo().getFetchProfile();

      // we'll stay in this while loop until the queue is empty
      for (List messages = retrieveNextBatch(fetchBatchSize); ! stopped && messages != null; messages=retrieveNextBatch(fetchBatchSize)) {
  totalMessageCount = messages.size() + getQueueSize() + loadedMessageCount;
  if (Pooka.getProperty("Pooka.openFoldersInBackGround", "false").equalsIgnoreCase("true")) {
    synchronized(folderInfo.getFolderThread().getRunLock()) {
      try {
        folderInfo.getFolderThread().setCurrentActionName("Loading messages.");
        // break when either we've been stopped or we're out of messages,
        for (int batchCount = 0; ! stopped && batchCount < messages.size(); batchCount++) {
    mp=(MessageProxy)messages.get(batchCount);
   
    // if the message hasn't been fetched, then fetch fetchBatchSize
    // worth of messages.
    if (! mp.getMessageInfo().hasBeenFetched()) {
      try {
        List fetchList = new ArrayList();
        for (int j = batchCount; fetchList.size() < fetchBatchSize && j < messages.size(); j++) {
          MessageInfo fetchInfo = ((MessageProxy) messages.get(j)).getMessageInfo();
          if (! fetchInfo.hasBeenFetched()) {
      fetchList.add(fetchInfo);
      //fetchInfo.setFetched(true);
          }
        }
     
        MessageInfo[] toFetch = new MessageInfo[fetchList.size()];
        toFetch = (MessageInfo[]) fetchList.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.
    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();
      }
    }
   
    loadedMessageCount++;
    if (++updateCounter >= getUpdateMessagesCount()) {
      fireMessageLoadedEvent(MessageLoadedEvent.MESSAGES_LOADED, loadedMessageCount, totalMessageCount);
      updateCounter = 0;      
    }
        }
      } finally {
        folderInfo.getFolderThread().setCurrentActionName("");
      }
    } // end synchronized
  } else {
    // break when either we've been stopped or we're out of messages,
    for (int batchCount = 0; ! stopped && batchCount < messages.size(); batchCount++) {
      mp=(MessageProxy)messages.get(batchCount);
     
      // if the message hasn't been fetched, then fetch fetchBatchSize
      // worth of messages.
      if (! mp.getMessageInfo().hasBeenFetched()) {
        try {
    List fetchList = new ArrayList();
    for (int j = batchCount; fetchList.size() < fetchBatchSize && j < messages.size(); j++) {
      MessageInfo fetchInfo = ((MessageProxy) messages.get(j)).getMessageInfo();
      if (! fetchInfo.hasBeenFetched()) {
        fetchList.add(fetchInfo);
        //fetchInfo.setFetched(true);
      }
    }
   
    MessageInfo[] toFetch = new MessageInfo[fetchList.size()];
    toFetch = (MessageInfo[]) fetchList.toArray(toFetch);
    synchronized(folderInfo.getFolderThread().getRunLock()) {
      folderInfo.getFolderThread().setCurrentActionName("Loading messages.");
      getFolderInfo().fetch(toFetch, fetchProfile);
      folderInfo.getFolderThread().setCurrentActionName("");
    }
        } catch(MessagingException me) {
    if (getFolderInfo().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.
      try {
        synchronized(folderInfo.getFolderThread().getRunLock()) {
    try {
      folderInfo.getFolderThread().setCurrentActionName("Loading messages.");
      if (! mp.isLoaded())
        mp.loadTableInfo();
      if (mp.needsRefresh())
        mp.refreshMessage();
      else if (! mp.matchedFilters()) {
        mp.matchFilters();
      }
    } finally {
      folderInfo.getFolderThread().setCurrentActionName("");
    }
        } // synchronized
View Full Code Here

   */
  void populateUidMap() {
    if (folderTableModel != null) {
      List v = folderTableModel.getAllProxies();
      for (int i = 0; i < v.size(); i++) {
        MessageProxy mp = (MessageProxy) v.get(i);
        try {
          String uid = (String) mp.getMessageInfo().getMessageProperty(UID_HEADER);
          uidsRead.add(uid);
          if (Pooka.isDebug())
            System.out.println("adding " + uid + " to read list.");
        } catch (MessagingException me) {
          Pooka.getUIFactory().showError("Error getting UID for message:  ", me);
View Full Code Here

    if (! (mce instanceof net.suberic.pooka.event.MessageTableInfoChangedEvent)) {
      try {
        if (!mce.getMessage().isSet(Flags.Flag.DELETED) || ! Pooka.getProperty("Pooka.autoExpunge", "true").equalsIgnoreCase("true")) {

          MessageInfo mi = getMessageInfo(mce.getMessage());
          MessageProxy mp = mi.getMessageProxy();
          if (mp != null) {
            if (mce.getMessageChangeType() == MessageChangedEvent.FLAGS_CHANGED) {
              mi.refreshFlags();
            } else if (mce.getMessageChangeType() == MessageChangedEvent.ENVELOPE_CHANGED) {
              mi.refreshHeaders();
            }
            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

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.