From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- js/panels/PanelContainer.reel/PanelContainer.html | 21 ++++++++++++++++ js/panels/PanelContainer.reel/PanelContainer.js | 29 ++++++++++++++--------- 2 files changed, 39 insertions(+), 11 deletions(-) (limited to 'js/panels/PanelContainer.reel') diff --git a/js/panels/PanelContainer.reel/PanelContainer.html b/js/panels/PanelContainer.reel/PanelContainer.html index 1c144bf4..b22b3609 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.html +++ b/js/panels/PanelContainer.reel/PanelContainer.html @@ -17,6 +17,9 @@ "prototype": "js/panels/Panel.reel", "properties": { "element": {"#": "panel_0"} + }, + "bindings": { + "currentDocument": {"<-": "@owner.currentDocument"} } }, @@ -24,6 +27,9 @@ "prototype": "js/panels/Panel.reel", "properties": { "element": {"#": "panel_1"} + }, + "bindings": { + "currentDocument": {"<-": "@owner.currentDocument"} } }, @@ -31,6 +37,9 @@ "prototype": "js/panels/Panel.reel", "properties": { "element": {"#": "panel_2"} + }, + "bindings": { + "currentDocument": {"<-": "@owner.currentDocument"} } }, @@ -38,6 +47,9 @@ "prototype": "js/panels/Panel.reel", "properties": { "element": {"#": "panel_3"} + }, + "bindings": { + "currentDocument": {"<-": "@owner.currentDocument"} } }, @@ -45,6 +57,9 @@ "prototype": "js/panels/Panel.reel", "properties": { "element": {"#": "panel_4"} + }, + "bindings": { + "currentDocument": {"<-": "@owner.currentDocument"} } }, @@ -52,6 +67,9 @@ "prototype": "js/panels/Panel.reel", "properties": { "element": {"#": "panel_5"} + }, + "bindings": { + "currentDocument": {"<-": "@owner.currentDocument"} } }, @@ -60,6 +78,9 @@ "name": "Panel", "properties": { "element": {"#": "panel_6"} + }, + "bindings": { + "currentDocument": {"<-": "@owner.currentDocument"} } }, diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js index 8d1d6a5e..dc501a99 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer.reel/PanelContainer.js @@ -16,7 +16,24 @@ exports.PanelContainer = Montage.create(Component, { value: null }, - // This will hold the current loaded panels. + _currentDocument: { + value : null, + enumerable : false + }, + + currentDocument : { + get : function() { + return this._currentDocument; + }, + set : function(value) { + if (value === this._currentDocument) { + return; + } + + this._currentDocument = value; + } + }, + panels: { value: [] }, @@ -65,8 +82,6 @@ exports.PanelContainer = Montage.create(Component, { this.application.localStorage.setItem("panels", this.currentPanelState); - - this.eventManager.addEventListener( "onOpenDocument", this, false); this.eventManager.addEventListener( "closeDocument", this, false); } }, @@ -89,14 +104,6 @@ exports.PanelContainer = Montage.create(Component, { } }, - handleOnOpenDocument: { - value: function(){ - this.panels.forEach(function(obj) { - obj.disabled = false; - }); - } - }, - handleCloseDocument: { value: function(){ if(!this.application.ninja.documentController.activeDocument) { -- cgit v1.2.3 From 31b094ee21102f99a4021d505bc3a28527c9e23d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 01:33:20 -0700 Subject: Fixing the close document. Signed-off-by: Valerio Virgillito --- js/panels/PanelContainer.reel/PanelContainer.js | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'js/panels/PanelContainer.reel') diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js index dc501a99..7cb03255 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer.reel/PanelContainer.js @@ -81,8 +81,6 @@ exports.PanelContainer = Montage.create(Component, { } this.application.localStorage.setItem("panels", this.currentPanelState); - - this.eventManager.addEventListener( "closeDocument", this, false); } }, @@ -104,16 +102,6 @@ exports.PanelContainer = Montage.create(Component, { } }, - handleCloseDocument: { - value: function(){ - if(!this.application.ninja.documentController.activeDocument) { - this.panels.forEach(function(obj) { - obj.disabled = true; - }); - } - } - }, - handleDropped: { value: function(e) { var draggedIndex, droppedIndex = 0, len = this.panels.length; -- cgit v1.2.3