From b89a7ee8b956c96a1dcee995ea840feddc5d4b27 Mon Sep 17 00:00:00 2001 From: Pierre Frisch Date: Thu, 22 Dec 2011 07:25:50 -0800 Subject: First commit of Ninja to ninja-internal Signed-off-by: Valerio Virgillito --- .../new-file-location.reel/new-file-location.css | 50 +++++++ .../new-file-location.reel/new-file-location.html | 41 ++++++ .../new-file-location.reel/new-file-location.js | 28 ++++ .../new-file-options-navigator.css | 95 ++++++++++++ .../new-file-options-navigator.html | 51 +++++++ .../new-file-options-navigator.js | 160 +++++++++++++++++++++ .../newFileDialog/new-file-workflow-controller.js | 59 ++++++++ .../newFileDialog/new-file-workflow-model.js | 121 ++++++++++++++++ 8 files changed, 605 insertions(+) create mode 100644 js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css create mode 100644 js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html create mode 100644 js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.js create mode 100644 js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.css create mode 100644 js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html create mode 100644 js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js create mode 100644 js/io/workflow/newFileDialog/new-file-workflow-controller.js create mode 100644 js/io/workflow/newFileDialog/new-file-workflow-model.js (limited to 'js/io/workflow/newFileDialog') diff --git a/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css new file mode 100644 index 00000000..1e857874 --- /dev/null +++ b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css @@ -0,0 +1,50 @@ +/* + 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. +
*/ + +.newfileLocation .newFileName{ + width:70%; + margin-left:5px; +} + +.newfileLocation .newFileDirectory{ + width:70%; + margin-left:5px; +} + +.newfileLocation .templateSelection{ + float:left; + width:20%; + height:90%; + padding-right: 10px; +} + +.newfileLocation .templateSelection .template{ + width:80%; + height:60%; + background-color: #e1e1e1; + border:1px solid #000000; + box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.8); +} + +.newfileLocation .locationSelection{ + float:left; + width:75%; +} + +.newfileLocation .locationSelection div{ + padding-bottom: 5px; +} + +.newfileLocation .locationSelection span{ + padding-right: 5px; + white-space: nowrap; +} + +.newfileLocation .findDirectory{ + width: 17px; + height:17px; + vertical-align: bottom; +} \ No newline at end of file diff --git a/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html new file mode 100644 index 00000000..1be4e485 --- /dev/null +++ b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html @@ -0,0 +1,41 @@ + + + + + + + + + +
+
+
+
+
+
NAME:
+
+ DIRECTORY: + + +
+
HEIGHT:176 px
+
WIDTH:220 px
+
+
+ + \ No newline at end of file diff --git a/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.js b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.js new file mode 100644 index 00000000..4c90d1a1 --- /dev/null +++ b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.js @@ -0,0 +1,28 @@ +/* +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; +var Component = require("montage/ui/component").Component; +var newFileWorkflowControllerModule = require("js/io/workflow/newFileDialog/new-file-workflow-controller"); + +var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { + + willDraw: { + enumerable: false, + value: function() {} + }, + + draw: { + enumerable: false, + value: function() {} + }, + + didDraw: { + enumerable: false, + value: function() {} + } + +}); \ No newline at end of file diff --git a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.css b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.css new file mode 100644 index 00000000..01f0885e --- /dev/null +++ b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.css @@ -0,0 +1,95 @@ +/* + 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. +
*/ + +.newfile{ + font-size:12px; + width:510px; + height:500px; + padding-left: 15px; + padding-top: 15px; + background-color:#313131; +} + +.newfile .container{ + border: 1px groove #000000; + overflow: auto; + background-color:#5f5f5f; +} + +.newfile .left-nav{ + float:left; + width:27%; + height:90%; + overflow-x:hidden; + overflow-y:auto +} + +.newfile .right-nav{ + float:left; + width:70%; + height:90%; + overflow: hidden; +} + +.newfile .right-top{ + border: 1px groove #000000; + overflow: auto; + min-height:150px; + height:55%; + width:auto; +} + +.newfile .right-bottom{ + border: 1px groove #000000; + overflow: auto; + height:45%; + padding: 10px; +} + +.newfile .driversList{ + padding: 3px; + text-align: center; +} + +.newfile .driversList:hover{ + cursor:pointer; +} + +.newfile .projectTypeHeader{ + border-bottom:1px solid #000000; + padding:5px; + text-align: center; + font-weight: bold; +} + + + +.newfile .highlighted{ + background-color: #343434; +} + + +.newfile .buttons{ + float:right; + margin-top: 7px; +} + + +.newfile .disable{ + color:#5f5f5f; + cursor:auto; +} + +.newfile .hide{ + display: none; +} + +.newfile .treeArrow + .name{ + font-weight: bold; +} + + + diff --git a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html new file mode 100644 index 00000000..a022f841 --- /dev/null +++ b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html @@ -0,0 +1,51 @@ + + + + + + + + + +
+
+
Project Type
+
+
+
+
+
+
+
+
templateIcon
+
selections
+
+
+
+ + +
+
+ + \ No newline at end of file diff --git a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js new file mode 100644 index 00000000..86c2c86b --- /dev/null +++ b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js @@ -0,0 +1,160 @@ +/* +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, + iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"), + treeModule = require("js/components/ui/tree-basic/tree.reel"), + newFileLocationSelectionModule = require("js/io/workflow/newFileDialog/new-file-workflow-controller"); + newFileWorkflowControllerModule = require("js/io/workflow/newFileDialog/new-file-location.reel"); + +var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(Component, { + + newFileModel: { + writable: true, + enumerable:false, + value:null + }, + selectedProjectType:{ + writable: true, + enumerable:false, + value:null + }, + selectedTemplates:{ + writable: true, + enumerable:false, + value:[] + }, + willDraw: { + enumerable: false, + value: function() {} + }, + draw: { + enumerable: false, + value: function() {} + }, + didDraw: { + enumerable: false, + value: function() { + var that = this; + + this.templateList = null; + + //draw left nav project type tree + var tree = treeModule.Tree.create(); + tree.showIcons = false; + tree.directoryBold = true; + tree.treeViewDataObject = this.newFileModel.prepareContents("projectTypes"); + tree.element = this.projectTypeTree; + tree.needsDraw = true; + + var newFileLocation = newFileWorkflowControllerModule.NewFileLocation.create(); + newFileLocation.element = this.locationSelection; + newFileLocation.needsDraw = true; + + this.addIdentifiers(); + + this.element.addEventListener("drawTree", function(evt){that.handleNewFileNavDrawTree(evt);}, false); + this.element.addEventListener("selectedItem", function(evt){that.handleNewFileNavSelectedItem(evt);}, false);//for single selection only + this.cancelButton.addEventListener("click", this, false); + } + + }, + + /** + * Event Listners + */ + + addIdentifiers:{ + value: function(){ + this.element.identifier = "newFileNav"; + this.okButton.identifier = "okButton"; + this.cancelButton.identifier = "cancelButton"; + } + }, + + handleNewFileNavDrawTree:{ + value: function(evt){ + //toggle open or close for directory + if((evt.uriType === "directory") && (!!evt.subTreeContainer)){ + var tree = treeModule.Tree.create(); + tree.showIcons = false; + tree.treeViewDataObject = this.newFileModel.prepareContents(evt.uri); + tree.element = evt.subTreeContainer; + tree.needsDraw = true; + } + } + }, + + handleNewFileNavSelectedItem:{ + value: function(evt){ + var selectionType = this.newFileModel.projectTypeData[evt.uri].type; + if(evt.target.classList.contains("atreeItemContent") && (selectionType === "file")){//populate templates for project type selection + //save project type selection + this.selectedProjectType = evt.uri; + + //render templates + var templates = this.newFileModel.prepareContents(evt.uri); + if(this.templatesContainer.querySelectorAll(".list").length > 0){ + this.templateList.iconsViewDataObject = templates; + }else{ + this.templateList = iconsListModule.IconsList.create(); + this.templateList.iconsViewDataObject = templates; + this.templateList.element = this.templateIcons; + this.templateList.needsDraw = true; + } + } + + if(evt.target.classList.contains("icon")){ + //save template selection + this.selectedTemplates.push[evt.uri];//todo: check for duplicates + + } + +// if(!evt.target.classList.contains("selected")){ +// evt.target.classList.add("selected"); +// } + + //enable ok + } + }, + + handleCancelButtonClick :{ + value:function(evt){ + //clean up memory + //this.cleanup(); + + if(this.popup){ + this.popup.hide(); + } + + } + }, + + + + + dummyProjectTypes:{ + writable:false, + enumerable:false, + value:[{ + "type":"directory", + "name":"Blank Document", + "uri":"newFile" + }, + { + "type":"directory", + "name":"New Project", + "uri":"newProject" + }, + { + "type":"directory", + "name":"From Template", + "uri":"fromTemplate" + }] + } + +}); \ No newline at end of file diff --git a/js/io/workflow/newFileDialog/new-file-workflow-controller.js b/js/io/workflow/newFileDialog/new-file-workflow-controller.js new file mode 100644 index 00000000..5cc68bf9 --- /dev/null +++ b/js/io/workflow/newFileDialog/new-file-workflow-controller.js @@ -0,0 +1,59 @@ +/* +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, + Popup = require("montage/ui/popup/popup.reel").Popup, + newFileOptionsNavigatorModule = require("js/io/workflow/newFileDialog/new-file-options-navigator.reel"), + newFileWorkflowModelModule = require("js/io/workflow/newFileDialog/new-file-workflow-model"); + +//singleton +exports.NewFileWorkflowController = Montage.create(require("montage/ui/component").Component, { + /** + * Register a listener for showPicker event + */ + deserializedFromTemplate:{ + writable:false, + enumerable:true, + value:function(){ + var that = this; + this.eventManager.addEventListener("executeNewFile", function(evt){ + that.showNewFileDialog(); + }, false); + } + }, + + showNewFileDialog:{ + writable:false, + enumerable:true, + value:function(){ + var aModel = null; + //render modal dialog + var newFileNavContent = document.createElement("div"); + newFileNavContent.id = "newFileDialog"; + newFileNavContent.style.width = "650px"; + newFileNavContent.style.height = "350px"; + newFileNavContent.style.color = "#fff"; + + //elements needs to be on DOM to be drawn + document.getElementById('modalContainer').appendChild(newFileNavContent); + + var newFileOptionsNav = newFileOptionsNavigatorModule.NewFileOptionsNavigator.create(); + newFileOptionsNav.newFileModel = newFileWorkflowModelModule.NewFileWorkflowModel; + newFileOptionsNav.element = newFileNavContent; + + //hack - remove after rendering and add in modal dialog + document.getElementById('modalContainer').removeChild(newFileNavContent); + + var popup = Popup.create(); + popup.content = newFileOptionsNav; + popup.modal = true; + popup.show(); + + newFileOptionsNav.popup = popup;//handle to be used for hiding the popup + + } + } +}); \ No newline at end of file diff --git a/js/io/workflow/newFileDialog/new-file-workflow-model.js b/js/io/workflow/newFileDialog/new-file-workflow-model.js new file mode 100644 index 00000000..49c9804d --- /dev/null +++ b/js/io/workflow/newFileDialog/new-file-workflow-model.js @@ -0,0 +1,121 @@ +/* +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. +
*/ + + +//a singleton + +exports.NewFileWorkflowModel = Object.create(Object.prototype, { + prepareContents: { + value: function(id){ + var contents = []; + if(!!this.projectTypeData[id].children && (this.projectTypeData[id].children.length > 0)){ + this.projectTypeData[id].children.forEach(function(elem){ + if(!!this.projectTypeData[elem]){ + contents.push(this.projectTypeData[elem]); + } + }, this); + } + + return contents; + } + }, + projectTypeData:{ + writable:false, + enumerable:false, + value:{//dummy data for testing + "projectTypes":{ + "name":"Project Type", + "type":"directory", + "uri":"projectTypes", + "children":["newFile", "newProject", "fromTemplate"] + }, + "newProject":{ + "type":"directory", + "name":"New Project", + "uri":"newProject", + "children":["animation", "bannerAd", "montageComponent", "androidApp"] + }, + "newFile":{ + "name":"Blank Template", + "uri":"newFile", + "type":"directory", + "children":["htmlTemplate", "javascriptTemplate", "cssTemplate"] + }, + "fromTemplate":{ + "name":"From Template", + "uri":"fromTemplate", + "type":"directory", + "children":["xoomApp", "website", "iosApp"] + }, + "bannerAd":{ + "name":"Banner Ad", + "uri":"bannerAd", + "type":"file", + "children":["176x208", "176x220", "208x320", "230x240", "208x320", "230x240", "208x320", "230x240"] + }, + "animation":{ + "name":"Animation", + "uri":"animation", + "type":"file", + "children":["176x208", "176x220", "208x320", "230x240"] + }, + "montageComponent":{ + "name":"Montage Component", + "uri":"montageComponent", + "type":"file", + "children":["176x208", "176x208", "176x220", "208x320", "230x240","176x208", "176x220", "208x320", "230x240"] + }, + "androidApp":{ + "name":"Android App", + "uri":"androidApp", + "type":"file", + "children":["176x208", "176x220"] + }, + "xoomApp":{ + "name":"Xoom Application", + "uri":"xoomApp", + "type":"file", + "children":["176x208", "176x208", "176x220", "208x320", "176x220", "208x320", "230x240"] + }, + "iosApp":{ + "name":"iOS Application", + "uri":"iosApp", + "type":"file", + "children":["176x208"] + }, + "176x208":{ + "name":"176 x 208", + "uri":"176x208", + "type":"file" + }, + "176x220":{ + "name":"176 x 220", + "uri":"176x220", + "type":"file" + }, + "208x320":{ + "name":"208 x 320", + "uri":"208x320", + "type":"file" + }, + "htmlTemplate":{ + "name":"HTML", + "uri":"htmlTemplate", + "type":"file" + }, + "cssTemplate":{ + "name":"CSS", + "uri":"cssTemplate", + "type":"file" + }, + "javascriptTemplate":{ + "name":"Javascript", + "uri":"javascriptTemplate", + "type":"file" + } + } + } +}); -- cgit v1.2.3