1 package org.columba.mail.gui.message.viewer; 19 20 import java.util.List ; 21 22 import org.columba.mail.folder.IMailbox; 23 import org.columba.ristretto.message.MimePart; 24 import org.columba.ristretto.message.MimeTree; 25 import org.columba.ristretto.message.StreamableMimePart; 26 27 public class AttachmentModel { 28 29 private IMailbox folder; 30 31 private Object uid; 32 33 private List displayedMimeParts; 34 35 private MimeTree collection; 36 37 public AttachmentModel() { 38 39 } 40 41 public synchronized void setFolder(IMailbox folder) { 42 this.folder = folder; 43 } 44 45 public synchronized void setUid(Object uid) { 46 this.uid = uid; 47 } 48 49 public IMailbox getFolder() { 50 return folder; 51 } 52 53 public Object getUid() { 54 return uid; 55 } 56 57 62 public MimeTree getCollection() { 63 return collection; 64 } 65 66 72 public void setCollection(MimeTree collection) { 73 this.collection = collection; 74 75 displayedMimeParts = collection.getAllLeafs(); 77 78 StreamableMimePart bodyPart = (StreamableMimePart) collection 80 .getFirstTextPart("plain"); 81 82 if (bodyPart != null) { 83 MimePart bodyParent = bodyPart.getParent(); 84 85 if (bodyParent != null) { 86 if (bodyParent.getHeader().getMimeType().getSubtype().equals( 87 "alternative")) { 88 List bodyParts = bodyParent.getChilds(); 89 displayedMimeParts.removeAll(bodyParts); 90 } else { 91 displayedMimeParts.remove(bodyPart); 92 } 93 } else { 94 displayedMimeParts.remove(bodyPart); 95 } 96 } 97 } 98 99 104 public List getDisplayedMimeParts() { 105 return displayedMimeParts; 106 } 107 108 114 public void setDisplayedMimeParts(List displayedMimeParts) { 115 this.displayedMimeParts = displayedMimeParts; 116 } 117 } | Popular Tags |