From 3a754133dbc138390503341fd2e9beba3e43aa4b Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 27 Jan 2012 12:05:17 -0800 Subject: Merged old FileIO --- user-document-templates/montage-application-cloud/appdelegate.js | 0 user-document-templates/montage-application-cloud/default_html.css | 0 user-document-templates/montage-application-cloud/index.html | 0 user-document-templates/montage-application-cloud/package.json | 0 user-document-templates/montage-application-cloud/styles.css | 0 5 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 user-document-templates/montage-application-cloud/appdelegate.js mode change 100644 => 100755 user-document-templates/montage-application-cloud/default_html.css mode change 100644 => 100755 user-document-templates/montage-application-cloud/index.html mode change 100644 => 100755 user-document-templates/montage-application-cloud/package.json mode change 100644 => 100755 user-document-templates/montage-application-cloud/styles.css (limited to 'user-document-templates') diff --git a/user-document-templates/montage-application-cloud/appdelegate.js b/user-document-templates/montage-application-cloud/appdelegate.js old mode 100644 new mode 100755 diff --git a/user-document-templates/montage-application-cloud/default_html.css b/user-document-templates/montage-application-cloud/default_html.css old mode 100644 new mode 100755 diff --git a/user-document-templates/montage-application-cloud/index.html b/user-document-templates/montage-application-cloud/index.html old mode 100644 new mode 100755 diff --git a/user-document-templates/montage-application-cloud/package.json b/user-document-templates/montage-application-cloud/package.json old mode 100644 new mode 100755 diff --git a/user-document-templates/montage-application-cloud/styles.css b/user-document-templates/montage-application-cloud/styles.css old mode 100644 new mode 100755 -- cgit v1.2.3 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 --- .../montage-application-cloud/appdelegate.js | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'user-document-templates') 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 From 9d0f0e55167e0cb2f73dd056cb35a2e82b45340e Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 1 Feb 2012 14:36:41 -0800 Subject: Changing the user document application to use a main component Signed-off-by: Valerio Virgillito --- .../montage-application-cloud/index.html | 6 +- .../montage-application-cloud/main.reel/main.js | 163 +++++++++++++++++++++ .../montage-application-cloud/package.json | 2 +- 3 files changed, 167 insertions(+), 4 deletions(-) create mode 100644 user-document-templates/montage-application-cloud/main.reel/main.js (limited to 'user-document-templates') diff --git a/user-document-templates/montage-application-cloud/index.html b/user-document-templates/montage-application-cloud/index.html index d1f9634d..ac0405ca 100644 --- a/user-document-templates/montage-application-cloud/index.html +++ b/user-document-templates/montage-application-cloud/index.html @@ -13,7 +13,7 @@ - + diff --git a/user-document-templates/montage-application-cloud/main.reel/main.js b/user-document-templates/montage-application-cloud/main.reel/main.js new file mode 100644 index 00000000..415794d8 --- /dev/null +++ b/user-document-templates/montage-application-cloud/main.reel/main.js @@ -0,0 +1,163 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +//var Button = ("montage/ui/button.reel").Button; + +exports.Main = Montage.create(Component, { + + hasTemplate: { + value: false + }, + + /** + * Adding window hooks to callback into this object from Ninja. + */ + templateDidLoad: { + value: function(){ + window.addComponent = this.addComponentToUserDocument; +// window.addBinding = this.addBindingToUserDocument; + + // Dispatch event when this template has loaded. + var newEvent = document.createEvent( "CustomEvent" ); + newEvent.initCustomEvent( "userTemplateDidLoad", false, true ); + + document.body.dispatchEvent( newEvent ); + + } + }, + + addComponentToUserDocument:{ + value:function(containerElement, componentType){ + var component = null; + switch(componentType.type){ + case "Button": + + //var tmpFix = require("montage/ui/button.reel"); + //var str = "montage/ui/button.reel"; + var stro = componentType.path; + + var button = require(stro); + + var buttonInstance = button[componentType.name]; + + buttonInstance.element = containerElement; + buttonInstance.deserializedFromTemplate(); + + buttonInstance.needsDraw = true; + buttonInstance.label = "Button"; + + return buttonInstance; + break; + case "Checkbox": + component = Checkbox.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Condition": + component = Condition.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "DynamicText": + component = DynamicText.create(); + component.element = containerElement; + component.value = "Label"; + component.needsDraw = true; + break; + case "HotText": + component = HotText.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "HotTextUnit": + component = HotTextUnit.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "FlowController": + component = FlowController.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "ImageContainer": + component = ImageContainer.create(); + component.element = containerElement; + component.element.style.width = "285px"; + component.element.style.height = "235px"; + component.src = "placeholder.jpg"; + component.needsDraw = true; + break; + case "Progress": + component = Progress.create(); + component.element = containerElement; + component.loading = true; + component.needsDraw = true; + break; + case "Repetition": + component = Repetition.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Scrollview": + component = Scrollview.create(); + component.element = containerElement; + component.element.style.width = "200px"; + component.element.style.height = "200px"; + var dummyContent = document.createElement("div"); + dummyContent.innerHTML = ""; + component.element.appendChild(dummyContent); + component.needsDraw = true; + break; + case "Slider": + component = Slider.create(); + component.element = containerElement; +// component.value = 0; +// component._minValue = 0; +// component._maxValue = 100; + component.needsDraw = true; + break; + case "Slot": + component = Slot.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Substitution": + component = Substitution.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "TextArea": + component = TextArea.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Textfield": + component = Textfield.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "Toggle": + component = Toggle.create(); + component.element = containerElement; + component.needsDraw = true; + break; + case "ToggleButton": + component = ToggleButton.create(); + component.element = containerElement; + component.element.classList.add("text"); + component.needsDraw = true; + break; + default: + console.log("Unrecognized component type"); + } + //console.log(component); + return component; + } + } + +}); \ No newline at end of file diff --git a/user-document-templates/montage-application-cloud/package.json b/user-document-templates/montage-application-cloud/package.json index 5466b3d7..4be312d5 100644 --- a/user-document-templates/montage-application-cloud/package.json +++ b/user-document-templates/montage-application-cloud/package.json @@ -3,6 +3,6 @@ "lib": "" }, "mappings": { - "montage": "../../node_modules/montage/" + "montage": "../../node_modules/montage-user/" } } \ No newline at end of file -- cgit v1.2.3 From 7ccadc20c96539988290999982d7483e013732f9 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 2 Feb 2012 14:49:34 -0800 Subject: adding a componentController and callback for lazy loading. Signed-off-by: Valerio Virgillito --- .../montage-application-cloud/main.reel/main.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'user-document-templates') diff --git a/user-document-templates/montage-application-cloud/main.reel/main.js b/user-document-templates/montage-application-cloud/main.reel/main.js index 415794d8..036d6c24 100644 --- a/user-document-templates/montage-application-cloud/main.reel/main.js +++ b/user-document-templates/montage-application-cloud/main.reel/main.js @@ -32,17 +32,24 @@ exports.Main = Montage.create(Component, { }, addComponentToUserDocument:{ - value:function(containerElement, componentType){ + value:function(containerElement, componentType, callback){ var component = null; switch(componentType.type){ case "Button": - //var tmpFix = require("montage/ui/button.reel"); + //var tmpFix = ("montage/ui/button.reel"); //var str = "montage/ui/button.reel"; var stro = componentType.path; - var button = require(stro); +// var button = (stro); + var button = require.async(stro) + .then(function (button) { + callback(); + }) + .end(); + + /* var buttonInstance = button[componentType.name]; buttonInstance.element = containerElement; @@ -52,6 +59,7 @@ exports.Main = Montage.create(Component, { buttonInstance.label = "Button"; return buttonInstance; + */ break; case "Checkbox": component = Checkbox.create(); -- cgit v1.2.3 From 197ae04f7677b7a5890a589ba572e750a229c502 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 2 Feb 2012 18:28:29 -0800 Subject: Using async to load the required component. --- .../montage-application-cloud/main.reel/main.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'user-document-templates') diff --git a/user-document-templates/montage-application-cloud/main.reel/main.js b/user-document-templates/montage-application-cloud/main.reel/main.js index 036d6c24..90262073 100644 --- a/user-document-templates/montage-application-cloud/main.reel/main.js +++ b/user-document-templates/montage-application-cloud/main.reel/main.js @@ -45,7 +45,14 @@ exports.Main = Montage.create(Component, { var button = require.async(stro) .then(function (button) { - callback(); + var btIns = button["Button"]; + + btIns.element = containerElement; + btIns.deserializedFromTemplate(); + + btIns.needsDraw = true; + btIns.label = "Button"; + callback(btIns, containerElement); }) .end(); -- cgit v1.2.3 From 7950424cf704bb221971f4645406b01e6979db18 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 3 Feb 2012 00:38:13 -0800 Subject: Fix the main user component to create distinct instance of component. - Create a distinct instance of button - Cleanup. Signed-off-by: Valerio Virgillito --- .../montage-application-cloud/main.reel/main.js | 32 ++++++---------------- 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'user-document-templates') diff --git a/user-document-templates/montage-application-cloud/main.reel/main.js b/user-document-templates/montage-application-cloud/main.reel/main.js index 90262073..b4ed049f 100644 --- a/user-document-templates/montage-application-cloud/main.reel/main.js +++ b/user-document-templates/montage-application-cloud/main.reel/main.js @@ -37,36 +37,20 @@ exports.Main = Montage.create(Component, { switch(componentType.type){ case "Button": - //var tmpFix = ("montage/ui/button.reel"); - //var str = "montage/ui/button.reel"; - var stro = componentType.path; - -// var button = (stro); - - var button = require.async(stro) + var button = require.async(componentType.path) .then(function (button) { - var btIns = button["Button"]; + var buttonObj = button["Button"]; + var btIns = buttonObj.create(); - btIns.element = containerElement; - btIns.deserializedFromTemplate(); + btIns.element = containerElement; + btIns.deserializedFromTemplate(); - btIns.needsDraw = true; - btIns.label = "Button"; - callback(btIns, containerElement); + btIns.needsDraw = true; + btIns.label = "Button"; + callback(btIns, containerElement); }) .end(); - /* - var buttonInstance = button[componentType.name]; - - buttonInstance.element = containerElement; - buttonInstance.deserializedFromTemplate(); - - buttonInstance.needsDraw = true; - buttonInstance.label = "Button"; - - return buttonInstance; - */ break; case "Checkbox": component = Checkbox.create(); -- cgit v1.2.3 From 796bb5ecf6b0dce700ea3c17bbda2ed49b6a84de Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 3 Feb 2012 15:58:41 -0800 Subject: removing the old v0.6 montage folder and updating the references --- user-document-templates/montage-application-cloud/index.html | 2 +- user-document-templates/montage-application-cloud/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'user-document-templates') diff --git a/user-document-templates/montage-application-cloud/index.html b/user-document-templates/montage-application-cloud/index.html index ac0405ca..0db684cc 100644 --- a/user-document-templates/montage-application-cloud/index.html +++ b/user-document-templates/montage-application-cloud/index.html @@ -13,7 +13,7 @@ - +