1 | package clarin.cmdi.componentregistry.editor.model { |
---|
2 | import mx.collections.ArrayCollection; |
---|
3 | |
---|
4 | public class CMDComment |
---|
5 | { |
---|
6 | //Attributes |
---|
7 | public var componentId:String; |
---|
8 | public var profileId:String; |
---|
9 | public var creatorName:String; |
---|
10 | public var registerDate:String; |
---|
11 | public var filename:String; |
---|
12 | public var commentId:String; |
---|
13 | |
---|
14 | //elements |
---|
15 | public var cmdComments:ArrayCollection = new ArrayCollection(); |
---|
16 | |
---|
17 | public function CMDComment() |
---|
18 | { |
---|
19 | } |
---|
20 | |
---|
21 | public static function createEmptyComment():CMDComment { |
---|
22 | var result:CMDComment = new CMDComment(); |
---|
23 | return result; |
---|
24 | } |
---|
25 | |
---|
26 | public function removeComment(comment:CMDComment):void { |
---|
27 | var index:int = cmdComments.getItemIndex(comment); |
---|
28 | if (index != -1) { |
---|
29 | cmdComments.removeItemAt(index); |
---|
30 | } |
---|
31 | } |
---|
32 | |
---|
33 | public function moveDownComment(com:CMDComment):Boolean { |
---|
34 | var index:int = cmdComments.getItemIndex(com); |
---|
35 | if (index < cmdComments.length - 1) { |
---|
36 | cmdComments.removeItemAt(index); |
---|
37 | cmdComments.addItemAt(com, index + 1); |
---|
38 | return true; |
---|
39 | } |
---|
40 | return false; |
---|
41 | } |
---|
42 | |
---|
43 | public function moveUpComponent(com:CMDComment):Boolean { |
---|
44 | var index:int = cmdComments.getItemIndex(com); |
---|
45 | if (index > 0) { |
---|
46 | cmdComments.removeItemAt(index); |
---|
47 | cmdComments.addItemAt(com, index - 1); |
---|
48 | return true; |
---|
49 | } |
---|
50 | return false; |
---|
51 | } |
---|
52 | } |
---|
53 | } |
---|