1 20 21 package org.jdesktop.jdic.desktop.internal.impl; 22 23 import java.util.Iterator ; 24 import java.util.List ; 25 import java.util.ArrayList ; 26 27 import org.jdesktop.jdic.desktop.Message; 28 import org.jdesktop.jdic.desktop.internal.LaunchFailedException; 29 import org.jdesktop.jdic.desktop.internal.MailerService; 30 31 32 38 public class WinMapiMailer implements MailerService { 39 45 public void open() throws LaunchFailedException { 46 WinAPIWrapper.WinOpenMapiMailer(null, null, null, null, null, null); 47 } 48 49 56 public void open(Message msg) throws LaunchFailedException { 57 String [] toArray = ItrToStringArray(msg.getToAddrs()); 58 String [] ccArray = ItrToStringArray(msg.getCcAddrs()); 59 String [] bccArray = ItrToStringArray(msg.getBccAddrs()); 60 String [] attachArray = ItrToStringArray(msg.getAttachments()); 61 62 63 WinAPIWrapper.WinOpenMapiMailer(toArray, ccArray, bccArray, msg.getSubject(), msg.getBody(), attachArray); 64 } 65 66 72 private String [] ItrToStringArray(Iterator inItr) { 73 String [] stringArray = null; 74 int count = 0; 75 List tmpList = null; 76 Iterator tmpItr = null; 77 78 if(inItr != null) { 79 tmpList = new ArrayList (); 80 while(inItr.hasNext()) 81 tmpList.add(inItr.next()); 82 } 83 if(tmpList != null) { 84 tmpItr = tmpList.iterator(); 85 if(tmpItr != null) { 86 stringArray = new String [tmpList.size()]; 87 while(tmpItr.hasNext()) { 88 stringArray[count] = (String ) tmpItr.next(); 89 count++; 90 } 91 } 92 } 93 94 return stringArray; 95 } 96 } 97 | Popular Tags |