diff options
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 | ||