diff options
author | Pierre Frisch | 2011-12-22 07:25:50 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-01-27 11:18:17 -0800 |
commit | b89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch) | |
tree | 0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /js/controllers/elements/controller-factory.js | |
parent | 2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff) | |
download | ninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz |
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'js/controllers/elements/controller-factory.js')
-rw-r--r-- | js/controllers/elements/controller-factory.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js new file mode 100644 index 00000000..a772eb16 --- /dev/null +++ b/js/controllers/elements/controller-factory.js | |||
@@ -0,0 +1,49 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | var Montage = require("montage/core/core").Montage; | ||
8 | |||
9 | var BlockController = require("js/controllers/elements/block-controller").BlockController, | ||
10 | StageController = require("js/controllers/elements/stage-controller").StageController, | ||
11 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, | ||
12 | ImageController = require("js/controllers/elements/image-controller").ImageController, | ||
13 | VideoController = require("js/controllers/elements/video-controller").VideoController, | ||
14 | ComponentController = require("js/controllers/elements/component-controller").ComponentController, | ||
15 | CanvasController = require("js/controllers/elements/canvas-controller").CanvasController; | ||
16 | |||
17 | exports.ControllerFactory = Montage.create(Montage, { | ||
18 | |||
19 | getController: { | ||
20 | value: function(value) { | ||
21 | if(!value) return; | ||
22 | |||
23 | try { | ||
24 | value = value.toLowerCase(); | ||
25 | |||
26 | if(value.indexOf("block") !== -1) { | ||
27 | return BlockController; | ||
28 | } else if(value.indexOf("stage") !== -1) { | ||
29 | return StageController; | ||
30 | } else if(value.indexOf("shape") !== -1) { | ||
31 | return ShapesController; | ||
32 | } else if(value.indexOf("canvas") !== -1) { | ||
33 | return CanvasController; | ||
34 | } else if(value.indexOf("component") !== -1) { | ||
35 | return ComponentController; | ||
36 | } else if(value.indexOf("media") !== -1) { | ||
37 | console.log("create media controller"); | ||
38 | } else if(value.indexOf("image") !== -1) { | ||
39 | return ImageController; | ||
40 | } else if(value.indexOf("video") !== -1) { | ||
41 | return VideoController; | ||
42 | } | ||
43 | } catch (err) { | ||
44 | console.log("Could not create Controller Factory " + err); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | }); \ No newline at end of file | ||