forked from ArchipelProject/TNKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TNMessageView.j
319 lines (273 loc) · 19.3 KB
/
TNMessageView.j
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
/*
* TNMessageView.j
*
* Copyright (C) 2010 Antoine Mercadal <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <Foundation/Foundation.j>
@import <AppKit/CPColor.j>
@import <AppKit/CPImage.j>
@import <AppKit/CPImageView.j>
@import <AppKit/CPView.j>
@import <AppKit/CPTextField.j>
TNMessageViewAvatarPositionRight = @"TNMessageViewAvatarPositionRight";
TNMessageViewAvatarPositionLeft = @"TNMessageViewAvatarPositionLeft";
TNMessageViewBubbleColorNormal = 1;
TNMessageViewBubbleColorAlt = 2;
TNMessageViewBubbleColorNotice = 3;
var TNMessageViewBackgroundColorLeftNormal,
TNMessageViewBackgroundColorLeftAlt,
TNMessageViewBackgroundColorLeftNotice,
TNMessageViewBackgroundColorRightNormal,
TNMessageViewBackgroundColorRightAlt,
TNMessageViewBackgroundColorRightNotice;
/*! @ingroup messageboard
CPView that contains information to display chat information
*/
@implementation TNMessageView : CPView
{
CPImage _imageDefaultAvatar;
CPImageView _imageViewAvatar;
CPString _author;
CPString _message;
CPString _subject;
CPString _timestamp;
CPTextField _fieldAuthor;
CPTextField _fieldTimestamp;
CPView _viewContainer;
int _bgColor;
int _position;
CPTextField _fieldMessage;
}
#pragma mark -
#pragma mark Class methods
+ (void)initialize
{
TNMessageViewBackgroundColorLeftNormal = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:[
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/1.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/2.png"] size:CGSizeMake(1.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/3.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/4.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/5.png"] size:CGSizeMake(1.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/6.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/7.png"] size:CGSizeMake(24.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/8.png"] size:CGSizeMake(1.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/9.png"] size:CGSizeMake(24.0, 16.0)],
]]];
TNMessageViewBackgroundColorLeftAlt = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:[
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/1.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/2.png"] size:CGSizeMake(1.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/3.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/4.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/5.png"] size:CGSizeMake(1.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/6.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/7.png"] size:CGSizeMake(24.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/8.png"] size:CGSizeMake(1.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/9.png"] size:CGSizeMake(24.0, 16.0)],
]]];
TNMessageViewBackgroundColorLeftNotice = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:[
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/1.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/2.png"] size:CGSizeMake(1.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/3.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/4.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/5.png"] size:CGSizeMake(1.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/6.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/7.png"] size:CGSizeMake(24.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/8.png"] size:CGSizeMake(1.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/9.png"] size:CGSizeMake(24.0, 16.0)],
]]];
TNMessageViewBackgroundColorRightNormal = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:[
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/1.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/2.png"] size:CGSizeMake(1.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/3.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/4.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/5.png"] size:CGSizeMake(1.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/6.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/7-alt.png"] size:CGSizeMake(24.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/8.png"] size:CGSizeMake(1.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/Bubble/9-alt.png"] size:CGSizeMake(24.0, 16.0)],
]]];
TNMessageViewBackgroundColorRightAlt = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:[
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/1.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/2.png"] size:CGSizeMake(1.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/3.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/4.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/5.png"] size:CGSizeMake(1.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/6.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/7-alt.png"] size:CGSizeMake(24.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/8.png"] size:CGSizeMake(1.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleAlt/9-alt.png"] size:CGSizeMake(24.0, 16.0)],
]]];
TNMessageViewBackgroundColorRightNotice = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:[
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/1.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/2.png"] size:CGSizeMake(1.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/3.png"] size:CGSizeMake(24.0, 14.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/4.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/5.png"] size:CGSizeMake(1.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/6.png"] size:CGSizeMake(24.0, 1.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/7-alt.png"] size:CGSizeMake(24.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/8.png"] size:CGSizeMake(1.0, 16.0)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:TNMessageView] pathForResource:@"TNMessageBoard/BubbleNotice/9-alt.png"] size:CGSizeMake(24.0, 16.0)],
]]];
}
/*! this class method return the height of a TNMessageView with given text in given width
@param aText the text
@param aWidth the width
@return int value representing the height
*/
+ (int)sizeOfMessageViewWithText:(CPString)aText inWidth:(int)aWidth
{
var messageHeight = [aText sizeWithFont:[CPFont systemFontOfSize:12] inWidth:(aWidth - 100)];
return messageHeight.height + 65;
}
#pragma mark -
#pragma mark Initialization
/*! instanciate a TNMessageView
@param aFrame the frame of the view
@return initialized view
*/
- (void)initWithFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
_author = @"";
_subject = @"";
_message = @"";
_timestamp = @"";
_bgColor = TNMessageViewBubbleColorNormal;
[self setAutoresizingMask:CPViewWidthSizable];
var bundle = [CPBundle bundleForClass:[self class]];
_imageDefaultAvatar = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"TNMessageBoard/user-unknown.png"] size:CGSizeMake(36, 36)];
_position = TNMessageViewAvatarPositionLeft;
_viewContainer = [[CPView alloc] initWithFrame:CGRectMake(50, 10, CGRectGetWidth(aFrame) - 60, 80)]
[_viewContainer setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
_imageViewAvatar = [[CPImageView alloc] initWithFrame:CGRectMake(6, CGRectGetHeight(aFrame) - 46, 36, 36)];
[_imageViewAvatar setImageScaling:CPScaleProportionally];
[_imageViewAvatar setImage:_imageDefaultAvatar];
_fieldAuthor = [[CPTextField alloc] initWithFrame:CGRectMake(20, 10, CGRectGetWidth([_viewContainer frame]) - 30, 20)];
[_fieldAuthor setFont:[CPFont boldSystemFontOfSize:12]];
[_fieldAuthor setTextColor:[CPColor grayColor]];
[_fieldAuthor setAutoresizingMask:CPViewWidthSizable];
[_fieldAuthor setSelectable:YES];
_fieldMessage = [[CPTextField alloc] initWithFrame:CGRectMake(20, 30, CGRectGetWidth([_viewContainer frame]) - 40 , CGRectGetHeight([_viewContainer frame]))];
[_fieldMessage setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[_fieldMessage setLineBreakMode:CPLineBreakByWordWrapping];
[_fieldMessage setSelectable:YES];
_fieldTimestamp = [[CPTextField alloc] initWithFrame:CGRectMake(CGRectGetWidth([_viewContainer frame]) - 210, 10, 190, 20)];
[_fieldTimestamp setAutoresizingMask:CPViewMinXMargin];
[_fieldTimestamp setValue:[CPColor colorWithHexString:@"f2f0e4"] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateNormal];
[_fieldTimestamp setValue:[CPFont systemFontOfSize:9.0] forThemeAttribute:@"font" inState:CPThemeStateNormal];
[_fieldTimestamp setValue:[CPColor colorWithHexString:@"808080"] forThemeAttribute:@"text-color" inState:CPThemeStateNormal];
[_fieldTimestamp setAlignment:CPRightTextAlignment];
[_fieldTimestamp setSelectable:YES];
[_viewContainer addSubview:_fieldAuthor];
[_viewContainer addSubview:_fieldMessage];
[_viewContainer addSubview:_fieldTimestamp];
[self addSubview:_imageViewAvatar];
[self addSubview:_viewContainer];
}
return self;
}
#pragma mark -
#pragma mark CPTableView protocol
/*! CPTableView dataview protocol
*/
- (void)setObjectValue:(id)anObject
{
[_fieldAuthor setStringValue:[anObject objectForKey:@"author"]];
[_fieldMessage setStringValue:[anObject objectForKey:@"message"]];
[_fieldTimestamp setStringValue:[anObject objectForKey:@"date"]];
[_imageViewAvatar setImage:[anObject objectForKey:@"avatar"] || _imageDefaultAvatar];
_position = [anObject objectForKey:@"position"] || TNMessageViewAvatarPositionLeft;
_bgColor = [anObject objectForKey:@"color"] || TNMessageViewBubbleColorNormal;
CPLog.debug(anObject);
[self layout];
}
#pragma mark -
#pragma mark Drawing
/*! called by TNStackView. This will resize the content of the message's CPTextField in heigth
according to it's size its own frame to display this field.
*/
- (void)layout
{
switch (_position)
{
case TNMessageViewAvatarPositionLeft:
[_viewContainer setFrameOrigin:CGPointMake(50, 10)];
[_imageViewAvatar setFrame:CGRectMake(6, CGRectGetHeight([self frame]) - 46, 36, 36)];
[_imageViewAvatar setAutoresizingMask:CPViewMinYMargin];
break;
case TNMessageViewAvatarPositionRight:
[_viewContainer setFrameOrigin:CGPointMake(10, 10)];
[_imageViewAvatar setFrame:CGRectMake(CGRectGetWidth([self frame]) - 46, CGRectGetHeight([self frame]) - 46 , 36, 36)];
[_imageViewAvatar setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin];
break;
}
switch (_bgColor)
{
case TNMessageViewBubbleColorNormal:
[_viewContainer setBackgroundColor:(_position == TNMessageViewAvatarPositionLeft) ? TNMessageViewBackgroundColorLeftNormal : TNMessageViewBackgroundColorRightNormal];
break;
case TNMessageViewBubbleColorAlt:
[_viewContainer setBackgroundColor:(_position == TNMessageViewAvatarPositionLeft) ? TNMessageViewBackgroundColorLeftAlt : TNMessageViewBackgroundColorRightAlt];
break;
case TNMessageViewBubbleColorNotice:
[_viewContainer setBackgroundColor:(_position == TNMessageViewAvatarPositionLeft) ? TNMessageViewBackgroundColorLeftNotice : TNMessageViewBackgroundColorRightNotice];
break;
}
}
@end
@implementation TNMessageView (CPCoding)
/*! CPCoder compliance
*/
- (id)initWithCoder:(CPCoder)aCoder
{
if (self = [super initWithCoder:aCoder])
{
_author = [aCoder decodeObjectForKey:@"_author"];
_bgColor = [aCoder decodeObjectForKey:@"_bgColor"];
_fieldAuthor = [aCoder decodeObjectForKey:@"_fieldAuthor"];
_fieldMessage = [aCoder decodeObjectForKey:@"_fieldMessage"];
_fieldTimestamp = [aCoder decodeObjectForKey:@"_fieldTimestamp"];
_imageDefaultAvatar = [aCoder decodeObjectForKey:@"_imageDefaultAvatar"];
_imageViewAvatar = [aCoder decodeObjectForKey:@"_imageViewAvatar"];
_message = [aCoder decodeObjectForKey:@"_message"];
_position = [aCoder decodeObjectForKey:@"_position"];
_subject = [aCoder decodeObjectForKey:@"_subject"];
_timestamp = [aCoder decodeObjectForKey:@"_timestamp"];
_viewContainer = [aCoder decodeObjectForKey:@"_viewContainer"];
}
return self;
}
/*! CPCoder compliance
*/
- (void)encodeWithCoder:(CPCoder)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeObject:_author forKey:@"_author"];
[aCoder encodeObject:_bgColor forKey:@"_bgColor"];
[aCoder encodeObject:_fieldAuthor forKey:@"_fieldAuthor"];
[aCoder encodeObject:_fieldMessage forKey:@"_fieldMessage"];
[aCoder encodeObject:_fieldTimestamp forKey:@"_fieldTimestamp"];
[aCoder encodeObject:_imageDefaultAvatar forKey:@"_imageDefaultAvatar"];
[aCoder encodeObject:_imageViewAvatar forKey:@"_imageViewAvatar"];
[aCoder encodeObject:_message forKey:@"_message"];
[aCoder encodeObject:_position forKey:@"_position"];
[aCoder encodeObject:_subject forKey:@"_subject"];
[aCoder encodeObject:_timestamp forKey:@"_timestamp"];
[aCoder encodeObject:_viewContainer forKey:@"_viewContainer"];
}
@end