aboutsummaryrefslogtreecommitdiff
path: root/js/components/ui
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/ui')
-rw-r--r--js/components/ui/FilePicker/file-picker-controller.js497
-rw-r--r--js/components/ui/FilePicker/file-picker-model.js122
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css201
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html81
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js1019
-rw-r--r--js/components/ui/color-chip.reel/color-chip.css31
-rw-r--r--js/components/ui/color-chip.reel/color-chip.html36
-rw-r--r--js/components/ui/color-chip.reel/color-chip.js41
-rw-r--r--js/components/ui/file-input.reel/file-input.css34
-rw-r--r--js/components/ui/file-input.reel/file-input.html31
-rw-r--r--js/components/ui/file-input.reel/file-input.js65
-rw-r--r--js/components/ui/icon-list-basic/icon.reel/icon.css42
-rw-r--r--js/components/ui/icon-list-basic/icon.reel/icon.html31
-rw-r--r--js/components/ui/icon-list-basic/icon.reel/icon.js192
-rw-r--r--js/components/ui/icon-list-basic/iconsList.reel/iconsList.css9
-rw-r--r--js/components/ui/icon-list-basic/iconsList.reel/iconsList.html62
-rw-r--r--js/components/ui/icon-list-basic/iconsList.reel/iconsList.js42
-rw-r--r--js/components/ui/input-group.reel/input-group.css33
-rw-r--r--js/components/ui/input-group.reel/input-group.html78
-rw-r--r--js/components/ui/input-group.reel/input-group.js85
-rw-r--r--js/components/ui/modalDialog/modal-dialog-manager.js123
-rw-r--r--js/components/ui/modalDialog/modalDialogHeader.js82
-rw-r--r--js/components/ui/modalDialog/modalDialogHeader.reel/modalDialogHeader.css30
-rw-r--r--js/components/ui/modalDialog/modalDialogHeader.reel/modalDialogHeader.html33
-rw-r--r--js/components/ui/property-control.reel/property-control.css27
-rw-r--r--js/components/ui/property-control.reel/property-control.html40
-rw-r--r--js/components/ui/property-control.reel/property-control.js238
-rw-r--r--js/components/ui/radio-button.reel/radio-button.html32
-rw-r--r--js/components/ui/radio-button.reel/radio-button.js44
-rw-r--r--js/components/ui/row-renderer.reel/row-renderer.html37
-rw-r--r--js/components/ui/row-renderer.reel/row-renderer.js18
-rw-r--r--js/components/ui/tree-basic/tree.reel/tree.css9
-rw-r--r--js/components/ui/tree-basic/tree.reel/tree.html67
-rw-r--r--js/components/ui/tree-basic/tree.reel/tree.js43
-rw-r--r--js/components/ui/tree-basic/treeItem.reel/treeItem.css53
-rw-r--r--js/components/ui/tree-basic/treeItem.reel/treeItem.html35
-rw-r--r--js/components/ui/tree-basic/treeItem.reel/treeItem.js269
37 files changed, 3912 insertions, 0 deletions
diff --git a/js/components/ui/FilePicker/file-picker-controller.js b/js/components/ui/FilePicker/file-picker-controller.js
new file mode 100644
index 00000000..526578d1
--- /dev/null
+++ b/js/components/ui/FilePicker/file-picker-controller.js
@@ -0,0 +1,497 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
8var Montage = require("montage/core/core").Montage,
9 pickerNavigatorReel = require("js/components/ui/FilePicker/pickerNavigator.reel").PickerNavigator,
10 filePickerModelModule = require("js/components/ui/FilePicker/file-picker-model"),
11 fileSystem = require("js/io/system/filesystem").FileSystem,
12 Popup = require("montage/ui/popup/popup.reel").Popup;
13
14//singleton with functions to create a new file picker instance and utilities to format or filter the model data
15var FilePickerController = exports.FilePickerController = Montage.create(require("montage/ui/component").Component, {
16 /**
17 * Register a listener for file open event
18 */
19 deserializedFromTemplate:{
20 writable:false,
21 enumerable:true,
22 value:function(){
23 var that = this;
24 this.eventManager.addEventListener("executeFileOpen", function(evt){
25
26 var callback, pickerMode, currentFilter, allFileFilters,inFileMode, allowNewFileCreation, allowMultipleSelections;
27
28 if(!!evt.callback){
29 callback = evt.callback;
30 }
31 if(!!evt.pickerMode){
32 pickerMode = evt.pickerMode;
33 }
34 if(!!evt.currentFilter){
35 currentFilter = evt.currentFilter;
36 }
37 if(!!evt.inFileMode){
38 inFileMode = evt.inFileMode;
39 }
40 if(!!evt.allFileFilters){
41 allFileFilters = evt.allFileFilters;
42 }
43 if(!!evt.allowNewFileCreation){
44 allowNewFileCreation = evt.allowNewFileCreation;
45 }
46 if(!!evt.allowMultipleSelections){
47 allowMultipleSelections = evt.allowMultipleSelections;
48 }
49
50 that.showFilePicker(callback, pickerMode, currentFilter, allFileFilters,inFileMode, allowNewFileCreation, allowMultipleSelections);
51
52 }, false);
53 }
54 },
55
56 /**
57 * this will be stored in the local storage and in the cloud may be, for the cloud one.
58 */
59 _lastOpenedFolderURI:{
60 writable:true,
61 enumerable:true,
62 value:{
63 lastFolderUri_local:null,
64 lastFolderUri_cloud:null
65 }
66 },
67
68 /**
69 * this will be stored in the local storage and in the cloud may be, for the cloud one.
70 */
71 _lastSavedFolderURI:{
72 writable:true,
73 enumerable:true,
74 value:{
75 lastSavedFolderUri_local:null,
76 lastSavedFolderUri_cloud:null
77 }
78 },
79
80 /**
81 *this function is used to create an instance of a file picker
82 *
83 * parameters:
84 * callback: the call back function which will be used to send the selected URIs back
85 * pickerMode: ["read", "write"] : specifies if the file picker is opened to read a file/folder or to save a file
86 * currentFilter: if a current filter needs to be applied [ex: .psd]
87 * allFileFilters: list of filters that user can use to filter the view
88 * inFileMode: true => allow file selection , false => allow directory selection
89 * allowNewFileCreation: flag to specify whether or not it should return URI(s) to item(s) that do not exist. i.e. a user can type a filename to a new file that doesn't yet exist in the file system.
90 * allowMultipleSelections: allowMultipleSelections
91 *rootDirectories: invoker of this function can mention a subset of the allowed root directories to show in the file picker
92 *
93 * return: none
94 */
95
96 showFilePicker:{
97 writable:false,
98 enumerable:true,
99 value:function(callback, pickerMode, currentFilter, allFileFilters,inFileMode, allowNewFileCreation, allowMultipleSelections){
100
101 var aModel = filePickerModelModule.FilePickerModel.create();
102
103 var topLevelDirectories = null;
104 var driveData = fileSystem.shellApiHandler.getDirectoryContents({uri:"", recursive:false, returnType:"all"});
105 if(driveData.success){
106 topLevelDirectories = (JSON.parse(driveData.content)).children;
107 }else{
108 var errorCause = "";
109 if(driveData.status === null){
110 errorCause = "Service Unavailable"
111 }else{
112 errorCause = driveData.status;
113 }
114 aModel.fatalError = " ** Unable to get files [Error: "+ errorCause +"]";
115 }
116
117 aModel.currentFilter = currentFilter;
118 aModel.inFileMode = inFileMode;
119 aModel.topLevelDirectories = topLevelDirectories;
120
121 if(!!topLevelDirectories && !!topLevelDirectories[0]){
122 aModel.currentRoot = topLevelDirectories[0].uri;
123 }
124
125 //populate the last opened folder first, if none then populate default root
126 var sessionStorage = window.sessionStorage;
127 var storedUri = null;
128
129 if(pickerMode === "write"){
130 storedUri = sessionStorage.getItem("lastSavedFolderURI");
131 }else{
132 storedUri = sessionStorage.getItem("lastOpenedFolderURI");
133 }
134
135 if(!!storedUri){
136 aModel.currentRoot = unescape(storedUri);
137 }
138
139 aModel.fileFilters = allFileFilters;
140 aModel.callback = callback;
141 aModel.pickerMode = pickerMode;
142
143 //dummy data - TODO:remove after testing
144 //aModel.currentFilter = "*.html, *.png";
145 //aModel.currentFilter = "*.jpg";