aboutsummaryrefslogtreecommitdiff
path: root/js/panels/objects/object.reel/object.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/objects/object.reel/object.js')
-rw-r--r--js/panels/objects/object.reel/object.js104
1 files changed, 104 insertions, 0 deletions
diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js
new file mode 100644
index 00000000..6f8f5c92
--- /dev/null
+++ b/js/panels/objects/object.reel/object.js
@@ -0,0 +1,104 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No 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
7/**
8 @requires montage/core/core
9 @requires montage/ui/component
10 */
11var Montage = require("montage/core/core").Montage,
12 Component = require("montage/ui/component").Component;
13
14exports.Object = Montage.create(Component, {
15 _needsPropertyInspection : { value: null },
16 iconElement : { value: null },
17 type : { value: null },
18
19 _sourceObject : { value: null },
20 sourceObject : {
21 get: function() {
22 return this._sourceObject;
23 },
24 set: function(object) {
25 if(this._sourceObject === object) { return false; }
26
27 this._sourceObject = object;
28
29 if(object._montage_metadata) {
30 this.montageMetaData = object._montage_metadata;
31 this.type = this.application.ninja.objectsController.getObjectCategory(object);
32 }
33
34 this._needsPropertyInspection = this.needsDraw = true;
35 }
36
37 },
38
39 _identifier : {
40 value: null
41 },
42 identifier : {
43 get: function() {
44 return this._identifier;
45 },
46 set: function(value) {
47 if(this._identifier === value || !value) { return false; }
48
49 this._identifier = value;
50
51 this.needsDraw = true;
52 }
53
54 },
55
56 _montageMetaData : {
57 value: null
58 },
59 montageMetaData : {
60 get: function() {
61 return this._montageLabel;
62 },
63 set: function(data) {
64 if(this._montageMetaData === data) { return false; }
65
66 this._montageMetaData = data;
67
68 if(data.label) {
69 this.name = data.label;
70 this.needsDraw = true;
71 }
72 }
73
74 },
75
76 /* ---------------------
77 Event Handlers
78 --------------------- */
79
80 handleClick: {
81 value: function(e) {
82 this.parentComponent.parentComponent.displayHUDForObject(this.sourceObject);
83 }
84 },
85
86 prepareForDraw : {
87 value: function() {
88 this.iconElement.addEventListener('click', this, false);
89 }
90 },
91
92 draw : {
93 value: function() {
94 if(this.type) {
95 this.iconElement.classList.add('object-icon-'+this.type.toLowerCase());
96 } else{
97 this.iconElement.classList.add('object-icon-default');
98 }
99
100
101 }
102 }
103
104}); \ No newline at end of file