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.js115
1 files changed, 115 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..1426f800
--- /dev/null
+++ b/js/panels/objects/object.reel/object.js
@@ -0,0 +1,115 @@
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
20 _name : { value: null },
21 name: {
22 get: function() {
23 return this._name;
24 },
25 set: function(val) {
26 this.name = val;
27 }
28 },
29
30 _sourceObject : { value: null },
31 sourceObject : {
32 get: function() {
33 return this._sourceObject;
34 },
35 set: function(object) {
36 if(this._sourceObject === object) { return false; }
37
38 this._sourceObject = object;
39
40 if(object._montage_metadata) {
41 this.montageMetaData = object._montage_metadata;
42 this.type = this.application.ninja.objectsController.getObjectCategory(object);
43 }
44
45 this._needsPropertyInspection = this.needsDraw = true;
46 }
47
48 },
49
50 _identifier : {
51 value: null
52 },
53 identifier : {
54 get: function() {
55 return this._identifier;
56 },
57 set: function(value) {
58 if(this._identifier === value || !value) { return false; }
59
60 this._identifier = value;
61
62 this.needsDraw = true;
63 }
64
65 },
66
67 _montageMetaData : {
68 value: null
69 },
70 montageMetaData : {
71 get: function() {
72 return this._montageLabel;
73 },
74 set: function(data) {
75 if(this._montageMetaData === data) { return false; }
76
77 this._montageMetaData = data;
78
79 if(data.label) {
80 this.name = data.label;
81 this.needsDraw = true;
82 }
83 }
84
85 },
86
87 /* ---------------------
88 Event Handlers
89 --------------------- */
90
91 handleClick: {
92 value: function(e) {
93 this.parentComponent.parentComponent.displayHUDForObject(this.sourceObject);
94 }
95 },
96
97 prepareForDraw : {
98 value: function() {
99 this.iconElement.addEventListener('click', this, false);
100 }
101 },
102
103 draw : {
104 value: function() {
105 if(this.type) {
106 this.iconElement.classList.add('object-icon-'+this.type.toLowerCase());
107 } else{
108 this.iconElement.classList.add('object-icon-default');
109 }
110
111
112 }
113 }
114
115}); \ No newline at end of file