From c6d1a1da9e7cdf477daf32410d80691eb1e828d5 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 31 Jan 2012 13:54:35 -0800 Subject: Montage Native Widgets: Cleanup of current components Cleaning up the current components support files: - Clean the component tree - Clean the app delegate and panel Signed-off-by: Valerio Virgillito --- js/data/pi/pi-data.js | 4 ++ js/panels/Components/Components.xml | 22 ---------- .../ComponentsPanelBase.js | 36 +++++++++------- .../montage-application-cloud/appdelegate.js | 48 +++++++++++----------- 4 files changed, 50 insertions(+), 60 deletions(-) diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js index f162e919..189d1dae 100644 --- a/js/data/pi/pi-data.js +++ b/js/data/pi/pi-data.js @@ -505,6 +505,10 @@ exports.PiData = Montage.create( Montage, { ] } ] + }, + + componentPi: { + value: [] } }); diff --git a/js/panels/Components/Components.xml b/js/panels/Components/Components.xml index b3056330..e076602e 100644 --- a/js/panels/Components/Components.xml +++ b/js/panels/Components/Components.xml @@ -2,27 +2,5 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index 41afefa5..c8624b29 100644 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js @@ -59,15 +59,20 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component addComponentToStage:{ value:function(componentType, dropX, dropY){ - var compW = 100, - compH = 100, - elementType = "div", - componentContainer, - componentElement; +// var compW = 100, +// compH = 100, +// elementType = "div", +// componentContainer, +// componentElement; + var componentEl; if(componentType == "Button"){ - compW = 118; - compH = 52; + componentEl = NJUtils.makeNJElement("button", componentType, "component");//, {"type": "button"}); + componentEl.setAttribute("type", "button"); + componentEl.innerHTML = "Button"; + console.log(componentEl); +// compW = 118; +// compH = 52; }else if(componentType == "Checkbox"){ compW = 53; compH = 53; @@ -117,28 +122,31 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component compH = 25; } + + /* componentContainer = NJUtils.makeNJElement("div", componentType, "component"); componentContainer.elementModel.isComponent = true; - + */ var styles = { 'position': 'absolute', 'top' : dropY + 'px', 'left' : dropX + 'px', - 'width' : compW + 'px', - 'height' : compH + 'px', +// 'width' : compW + 'px', +// 'height' : compH + 'px', '-webkit-transform-style' : 'preserve-3d', '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' }; - componentElement = NJUtils.makeNJElement(elementType, "ComponentDiv", "block"); - - componentContainer.appendChild(componentElement); + //componentElement = NJUtils.makeNJElement(elementType, "ComponentDiv", "block"); - NJevent("elementAdding", {"el": componentContainer, "data":styles}); + //componentContainer.appendChild(componentElement); + NJevent("elementAdding", {"el": componentEl, "data":styles}); + /* var componentRef = this.application.ninja.currentDocument._window.addComponent(componentElement, componentType); this.application.ninja.currentDocument._userComponentSet[componentContainer.uuid] = componentRef; + */ } } diff --git a/user-document-templates/montage-application-cloud/appdelegate.js b/user-document-templates/montage-application-cloud/appdelegate.js index 64ce6f59..fad60394 100644 --- a/user-document-templates/montage-application-cloud/appdelegate.js +++ b/user-document-templates/montage-application-cloud/appdelegate.js @@ -7,30 +7,30 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; -var Button = require("montage/ui/button.reel").Button, - Checkbox = require("montage/ui/checkbox.reel").Checkbox, - Condition = require("montage/ui/condition.reel").Condition, - DynamicText = require("montage/ui/dynamic-text.reel").DynamicText, - - FlowController = require("montage/ui/flow-controller.reel").FlowController, - - HotText = require("montage/ui/hottext.reel").HotText, - HotTextUnit = require("montage/ui/hottextunit.reel").HotTextUnit, - - ImageContainer = require("montage/ui/photo-editor.reel").PhotoEditor, - Progress = require("montage/ui/progress.reel").Progress, - - Repetition = require("montage/ui/repetition.reel").Repetition, - Scrollview = require("montage/ui/scrollview.reel").Scrollview, - Slider = require("montage/ui/slider.reel").Slider, - Slot = require("montage/ui/slot.reel").Slot, - Substitution = require("montage/ui/substitution.reel").Substitution, - - TextArea = require("montage/ui/textarea.reel").TextArea, - Textfield = require("montage/ui/textfield.reel").Textfield, - - Toggle = require("montage/ui/toggle.reel").Toggle, - ToggleButton = require("montage/ui/button.reel").ToggleButton; +//var Button = ("montage/ui/button.reel").Button, +// Checkbox = ("montage/ui/checkbox.reel").Checkbox, +// Condition = ("montage/ui/condition.reel").Condition, +// DynamicText = ("montage/ui/dynamic-text.reel").DynamicText, +// +// FlowController = ("montage/ui/flow-controller.reel").FlowController, +// +// HotText = ("montage/ui/hottext.reel").HotText, +// HotTextUnit = ("montage/ui/hottextunit.reel").HotTextUnit, +// +// ImageContainer = ("montage/ui/photo-editor.reel").PhotoEditor, +// Progress = ("montage/ui/progress.reel").Progress, +// +// Repetition = ("montage/ui/repetition.reel").Repetition, +// Scrollview = ("montage/ui/scrollview.reel").Scrollview, +// Slider = ("montage/ui/slider.reel").Slider, +// Slot = ("montage/ui/slot.reel").Slot, +// Substitution = ("montage/ui/substitution.reel").Substitution, +// +// TextArea = ("montage/ui/textarea.reel").TextArea, +// Textfield = ("montage/ui/textfield.reel").Textfield, +// +// Toggle = ("montage/ui/toggle.reel").Toggle, +// ToggleButton = ("montage/ui/button.reel").ToggleButton; exports.MyAppDelegate = Montage.create(Component, { templateDidLoad: { -- cgit v1.2.3