aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/document-entry.reel/document-entry.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/layout/document-entry.reel/document-entry.js')
-rw-r--r--js/components/layout/document-entry.reel/document-entry.js110
1 files changed, 110 insertions, 0 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js
new file mode 100644
index 00000000..6f265c91
--- /dev/null
+++ b/js/components/layout/document-entry.reel/document-entry.js
@@ -0,0 +1,110 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component;
9
10//var documentManagerModule = ("js/document/documentManager");
11
12exports.DocumentEntry = Montage.create(Component, {
13
14 dirty: { value: null },
15
16 _uuid: {
17 value: null,
18 enumerable: false
19 },
20
21 _document: {
22 enumerable: false,
23 value: null
24 },
25
26 document: {
27 enumerable: false,
28 get: function() {
29 return this._document;
30 },
31 set: function(value) {
32
33 if (this._document === value) {
34 return;
35 }
36
37 this._document = value;
38 this._uuid = value.uuid;
39 //this.needsDraw = true;
40 }
41 },
42
43 _name: { value: null },
44
45 name: {
46 enumerable: false,
47 get: function() {
48 return this._name;
49 },
50 set: function(value) {
51
52 if (this._name === value) {
53 return;
54 }
55
56 this._name = value;
57 this.needsDraw = true;
58 }
59 },
60
61 _active: {
62 enumerable: false,
63 value: null
64 },
65
66 active: {
67 get: function() {
68 return this._active;
69 },
70 set: function(value) {
71 var previousValue = this._active;
72 this._active = value;
73
74 if (previousValue !== this._active) {
75 this.needsDraw = true;
76 }
77 }
78 },
79
80
81 prepareForDraw: {
82 enumerable: false,
83 value: function() {
84 //this.element.addEventListener("click", this, false);
85 }
86 },
87
88
89 draw: {
90 enumerable: false,
91 value: function() {
92 this.label.innerText = this._name ? this._name : "";
93
94 this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab");
95 }
96 },
97
98 handleClick: {
99 value: function(event) {
100 if(event._event.target.nodeName === "IMG") {
101 documentManagerModule.DocumentManager.closeDocument(this._uuid);
102 } else {
103 if(!this._document.isActive) {
104 documentManagerModule.DocumentManager.switchDocument(this._uuid);
105 }
106 }
107 }
108 }
109
110});