Changeset 551
- Timestamp:
- 11/20/09 23:18:07 (2 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
LogicMail/src/org/logicprobe/LogicMail/message/MimeMessageContent.java (modified) (1 diff)
-
LogicMail/src/org/logicprobe/LogicMail/message/MimeMessagePart.java (modified) (5 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/model/OutboxMailboxNode.java (modified) (1 diff)
-
LogicMail/src/org/logicprobe/LogicMail/ui/MailboxScreen.java (modified) (1 diff)
-
LogicMailTests/src/org/logicprobe/LogicMail/mail/NetworkMailStoreTest.java (modified) (2 diffs)
-
LogicMailTests/src/org/logicprobe/LogicMail/model/AccountNodeTest.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LogicMail/src/org/logicprobe/LogicMail/message/MimeMessageContent.java
r532 r551 46 46 public abstract class MimeMessageContent implements Serializable { 47 47 private long uniqueId; 48 private ContentPart messagePart;49 50 /**51 * Instantiates a new message content object52 *53 * @param messagePart the message part54 */55 protected MimeMessageContent(ContentPart messagePart) {48 private ContentPart messagePart; 49 50 /** 51 * Instantiates a new message content object 52 * 53 * @param messagePart the message part 54 */ 55 protected MimeMessageContent(ContentPart messagePart) { 56 56 this.uniqueId = UniqueIdGenerator.getInstance().getUniqueId(); 57 this.messagePart = messagePart;58 }59 60 /**61 * Gets the message part representing the placement of62 * this content within the message structure.63 *64 * @return the message part65 */66 public ContentPart getMessagePart() {67 return this.messagePart;68 }69 57 this.messagePart = messagePart; 58 } 59 60 /** 61 * Gets the message part representing the placement of 62 * this content within the message structure. 63 * 64 * @return the message part 65 */ 66 public ContentPart getMessagePart() { 67 return this.messagePart; 68 } 69 70 70 /** 71 71 * Accept a visitor on this message content. 72 72 * @param visitor The visitor instance 73 73 */ 74 public abstract void accept(MimeMessageContentVisitor visitor); 75 76 /** 77 * Gets the raw data representing this message content. 78 * Necessary for saving the content to a file, or 79 * transmitting it to external systems. 80 * 81 * @return Raw data if available, or null otherwise 82 */ 83 public abstract byte[] getRawData(); 74 public abstract void accept(MimeMessageContentVisitor visitor); 84 75 85 /** 86 * Populates the message content object from raw data. 87 * Necessary for recreating the object from a serialized 88 * form. 89 * 90 * @param rawData Raw data for the message content 91 */ 92 protected abstract void putRawData(byte[] rawData); 93 94 /* (non-Javadoc) 95 * @see org.logicprobe.LogicMail.util.Serializable#getUniqueId() 96 */ 97 public long getUniqueId() { 98 return this.uniqueId; 99 } 76 /** 77 * Gets the raw data representing this message content. 78 * Necessary for saving the content to a file, or 79 * transmitting it to external systems. 80 * 81 * @return Raw data if available, or null otherwise 82 */ 83 public abstract byte[] getRawData(); 100 84 101 /* (non-Javadoc) 102 * @see org.logicprobe.LogicMail.util.Serializable#serialize(java.io.DataOutput) 103 */ 104 public void serialize(DataOutput output) throws IOException { 105 output.writeLong(uniqueId); 106 SerializationUtils.serializeClass(messagePart, output); 107 byte[] data = getRawData(); 108 output.writeInt(data.length); 109 output.write(data); 110 } 111 112 /* (non-Javadoc) 113 * @see org.logicprobe.LogicMail.util.Serializable#deserialize(java.io.DataInput) 114 */ 115 public void deserialize(DataInput input) throws IOException { 116 uniqueId = input.readLong(); 117 messagePart = (ContentPart)SerializationUtils.deserializeClass(input); 118 int len = input.readInt(); 119 byte[] data = new byte[len]; 120 input.readFully(data, 0, len); 121 putRawData(data); 122 } 85 /** 86 * Populates the message content object from raw data. 87 * Necessary for recreating the object from a serialized 88 * form. 89 * 90 * @param rawData Raw data for the message content 91 */ 92 protected abstract void putRawData(byte[] rawData); 123 93 124 /* (non-Javadoc) 125 * @see java.lang.Object#hashCode() 126 */ 127 public int hashCode() { 128 final int prime = 31; 129 int result = 1; 130 result = prime * result + (int) (uniqueId ^ (uniqueId >>> 32)); 131 return result; 132 } 94 /* (non-Javadoc) 95 * @see org.logicprobe.LogicMail.util.Serializable#getUniqueId() 96 */ 97 public long getUniqueId() { 98 return this.uniqueId; 99 } 133 100 134 /* (non-Javadoc) 135 * @see java.lang.Object#equals(java.lang.Object) 136 */ 137 public boolean equals(Object obj) { 138 if (this == obj) 139 return true; 140 if (obj == null) 141 return false; 142 if (getClass() != obj.getClass()) 143 return false; 144 MimeMessageContent other = (MimeMessageContent) obj; 145 if (uniqueId != other.uniqueId) 146 return false; 147 return true; 148 } 101 /* (non-Javadoc) 102 * @see org.logicprobe.LogicMail.util.Serializable#serialize(java.io.DataOutput) 103 */ 104 public void serialize(DataOutput output) throws IOException { 105 output.writeLong(uniqueId); 106 SerializationUtils.serializeClass(messagePart, output); 107 byte[] data = getRawData(); 108 output.writeInt(data.length); 109 output.write(data); 110 } 111 112 /* (non-Javadoc) 113 * @see org.logicprobe.LogicMail.util.Serializable#deserialize(java.io.DataInput) 114 */ 115 public void deserialize(DataInput input) throws IOException { 116 uniqueId = input.readLong(); 117 messagePart = (ContentPart)SerializationUtils.deserializeClass(input); 118 int len = input.readInt(); 119 byte[] data = new byte[len]; 120 input.readFully(data, 0, len); 121 putRawData(data); 122 } 123 124 /* (non-Javadoc) 125 * @see java.lang.Object#hashCode() 126 */ 127 public int hashCode() { 128 int prime = 31; 129 int result = 1; 130 result = prime * result + (int) (uniqueId ^ (uniqueId >>> 32)); 131 return result; 132 } 133 134 /* (non-Javadoc) 135 * @see java.lang.Object#equals(java.lang.Object) 136 */ 137 public boolean equals(Object obj) { 138 if (this == obj) 139 return true; 140 if (obj == null) 141 return false; 142 if (getClass() != obj.getClass()) 143 return false; 144 MimeMessageContent other = (MimeMessageContent) obj; 145 if (uniqueId != other.uniqueId) 146 return false; 147 return true; 148 } 149 149 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/message/MimeMessagePart.java
r532 r551 65 65 */ 66 66 public abstract void accept(MimeMessagePartVisitor visitor); 67 67 68 68 /** 69 69 * Gets the tag used to embed protocol-specific address … … 73 73 */ 74 74 public String getTag() { 75 return tag;75 return tag; 76 76 } 77 77 78 78 /** 79 79 * Get the MIME type for this part … … 97 97 */ 98 98 public int getSize() { 99 return size;99 return size; 100 100 } 101 101 102 102 /** 103 103 * Set the parent of this part … … 107 107 this.parent = parent; 108 108 } 109 109 110 110 /** 111 111 * Get the parent of this part … … 117 117 118 118 /* (non-Javadoc) 119 * @see org.logicprobe.LogicMail.util.Serializable#getUniqueId()120 */121 public long getUniqueId() {122 return this.uniqueId;123 }119 * @see org.logicprobe.LogicMail.util.Serializable#getUniqueId() 120 */ 121 public long getUniqueId() { 122 return this.uniqueId; 123 } 124 124 125 /* (non-Javadoc) 126 * @see org.logicprobe.LogicMail.util.Serializable#serialize(java.io.DataOutput) 127 */ 128 public void serialize(DataOutput output) throws IOException { 129 output.writeLong(uniqueId); 130 output.writeUTF(tag); 131 output.writeUTF(mimeType); 132 output.writeUTF(mimeSubtype); 133 output.writeInt(size); 134 } 135 136 /* (non-Javadoc) 137 * @see org.logicprobe.LogicMail.util.Serializable#deserialize(java.io.DataInput) 138 */ 139 public void deserialize(DataInput input) throws IOException { 140 uniqueId = input.readLong(); 141 tag = input.readUTF(); 142 mimeType = input.readUTF(); 143 mimeSubtype = input.readUTF(); 144 size = input.readInt(); 145 } 125 /* (non-Javadoc) 126 * @see org.logicprobe.LogicMail.util.Serializable#serialize(java.io.DataOutput) 127 */ 128 public void serialize(DataOutput output) throws IOException { 129 output.writeLong(uniqueId); 130 output.writeUTF(tag); 131 output.writeUTF(mimeType); 132 output.writeUTF(mimeSubtype); 133 output.writeInt(size); 134 } 146 135 147 /* (non-Javadoc) 148 * @see java.lang.Object#hashCode() 149 */ 150 public int hashCode() { 151 final int prime = 31; 152 int result = 1; 153 result = prime * result + (int) (uniqueId ^ (uniqueId >>> 32)); 154 return result; 155 } 136 /* (non-Javadoc) 137 * @see org.logicprobe.LogicMail.util.Serializable#deserialize(java.io.DataInput) 138 */ 139 public void deserialize(DataInput input) throws IOException { 140 uniqueId = input.readLong(); 141 tag = input.readUTF(); 142 mimeType = input.readUTF(); 143 mimeSubtype = input.readUTF(); 144 size = input.readInt(); 145 } 156 146 157 /* (non-Javadoc) 158 * @see java.lang.Object#equals(java.lang.Object) 159 */ 160 public boolean equals(Object obj) { 161 if (this == obj) 162 return true; 163 if (obj == null) 164 return false; 165 if (getClass() != obj.getClass()) 166 return false; 167 MimeMessagePart other = (MimeMessagePart) obj; 168 if (uniqueId != other.uniqueId) 169 return false; 170 return true; 171 } 147 /* (non-Javadoc) 148 * @see java.lang.Object#hashCode() 149 */ 150 public int hashCode() { 151 int prime = 31; 152 int result = 1; 153 result = prime * result + (int) (uniqueId ^ (uniqueId >>> 32)); 154 return result; 155 } 156 157 /* (non-Javadoc) 158 * @see java.lang.Object#equals(java.lang.Object) 159 */ 160 public boolean equals(Object obj) { 161 if (this == obj) 162 return true; 163 if (obj == null) 164 return false; 165 if (getClass() != obj.getClass()) 166 return false; 167 MimeMessagePart other = (MimeMessagePart) obj; 168 if (uniqueId != other.uniqueId) 169 return false; 170 return true; 171 } 172 172 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/model/OutboxMailboxNode.java
r529 r551 215 215 } 216 216 217 public int getMessageId() { 218 return messageId; 219 } 220 221 public boolean containedWithin(FolderTreeItem folderTreeItem) { 222 return folderTreeItem.getPath().equals(folderPath); 223 } 224 225 public String getMessageUid() { 226 return Integer.toHexString(messageId).toLowerCase(); 227 } 228 229 public long getUniqueId() { 230 // Empty because this special token is not intended to be serialized 231 return 0; 232 } 233 234 public void serialize(DataOutput output) throws IOException { 235 // Empty because this special token is not intended to be serialized 236 } 237 238 public void deserialize(DataInput input) throws IOException { 239 // Empty because this special token is not intended to be serialized 240 } 217 public boolean containedWithin(FolderTreeItem folderTreeItem) { 218 return folderTreeItem.getPath().equals(folderPath); 219 } 220 221 public String getMessageUid() { 222 return Integer.toHexString(messageId).toLowerCase(); 223 } 224 225 public long getUniqueId() { 226 // Empty because this special token is not intended to be serialized 227 return 0; 228 } 229 230 public void serialize(DataOutput output) throws IOException { 231 // Empty because this special token is not intended to be serialized 232 } 233 234 public void deserialize(DataInput input) throws IOException { 235 // Empty because this special token is not intended to be serialized 236 } 241 237 } 242 238 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/MailboxScreen.java
r549 r551 54 54 import org.logicprobe.LogicMail.model.MessageNodeEvent; 55 55 import org.logicprobe.LogicMail.model.MessageNodeListener; 56 import org.logicprobe.LogicMail.ui.ScreenProvider.ShortcutItem;57 56 import org.logicprobe.LogicMail.util.EventObjectRunnable; 58 57 -
trunk/LogicMailTests/src/org/logicprobe/LogicMail/mail/NetworkMailStoreTest.java
r538 r551 324 324 public FolderTreeItem activeFolder; 325 325 public FolderTreeItem inboxFolder; 326 public int firstIndex;327 public int lastIndex;328 326 public FolderMessage[] folderMessages; 329 327 public FolderTreeItem folderTree; 330 328 public Message message; 331 329 public MessageToken messageToken; 332 public MessageFlags messageFlags;333 330 public int refreshedMsgCount; 334 331 … … 348 345 public FolderTreeItem getActiveFolder() { return activeFolder; } 349 346 public FolderMessage[] getFolderMessages(int firstIndex, int lastIndex, MailProgressHandler progressHandler) 350 throws IOException, MailException { this.firstIndex = firstIndex; this.lastIndex = lastIndex;return this.folderMessages; }347 throws IOException, MailException { return this.folderMessages; } 351 348 public FolderMessage[] getFolderMessages(MessageToken[] messageTokens, MailProgressHandler progressHandler) 352 349 throws IOException, MailException { return null; } -
trunk/LogicMailTests/src/org/logicprobe/LogicMail/model/AccountNodeTest.java
r538 r551 207 207 public FolderTreeItem rootFolder = null; 208 208 public FolderTreeItem statusUpdatedRootFolder = null; 209 public boolean folderTreeRequested = false;210 public boolean folderStatusRequested = false;211 public FolderTreeItem folderStatusRequestedItem = null;212 209 213 210 public boolean hasFlags() { … … 240 237 241 238 public void requestFolderTree() { 242 folderTreeRequested = true;243 239 fireFolderTreeUpdated(rootFolder); 244 240 } 245 241 246 242 public void requestFolderStatus(FolderTreeItem[] folders) { 247 folderStatusRequested = true;248 folderStatusRequestedItem = folders[0];249 243 fireFolderStatusChanged(statusUpdatedRootFolder); 250 244 }
Note: See TracChangeset
for help on using the changeset viewer.
