-define([\r
-'fnpjs/layout',\r
-'fnpjs/vbox',\r
-'views/tabs/tabs',\r
-'libs/text!./layout.html',\r
-],\r
-function(layout, vbox, tabs, layoutTemplate) {\r
-\r
-'use strict';\r
-\r
-return function(sandbox) { \r
- var view = new layout.Layout(layoutTemplate);\r
- \r
- var sidebar = new tabs.View({stacked: true});\r
- sidebar.render();\r
- \r
- var box = new vbox.VBox();\r
- \r
- \r
- view.setView('rightColumn', sidebar.$el);\r
- \r
- var eventHandlers = {};\r
- \r
- eventHandlers.documentCanvas = {\r
- ready: function() {\r
- sandbox.getModule('documentCanvas').setDocument(sandbox.getModule('data').getDocument());\r
- view.setView('leftColumn', sandbox.getModule('documentCanvas').getView());\r
- },\r
- \r
- nodeSelected: function(node) {\r
- sandbox.getModule('nodePane').setNode(node);\r
- sandbox.getModule('nodeFamilyTree').setNode(node);\r
- },\r
- \r
- contentChanged: function() {\r
- \r
- },\r
- \r
- nodeHovered: function(node) {\r
- \r
- },\r
- \r
- nodeBlured: function(node) {\r
- \r
- }\r
- };\r
-\r
- eventHandlers.nodePane = {\r
- ready: function() {\r
- //sidebar.addTab({icon: 'pencil'}, 'nodePane', sandbox.getModule('nodePane').getView());\r
- box.appendView(sandbox.getModule('nodePane').getView());\r
- sidebar.addTab({icon: 'pencil'}, 'edit', box.getAsView());\r
- },\r
- \r
- nodeChanged: function(attr, value) {\r
- sandbox.getModule('documentCanvas').modifyCurrentNode(attr, value);\r
- }\r
- };\r
- \r
- eventHandlers.metadataEditor = {\r
- ready: function() {\r
- sandbox.getModule('metadataEditor').setMetadata(sandbox.getModule('data').getDocument());\r
- sidebar.addTab({icon: 'info-sign'}, 'metadataEditor', sandbox.getModule('metadataEditor').getView());\r
- }\r
- };\r
- \r
- eventHandlers.nodeFamilyTree = {\r
- ready: function() {\r
- //sidebar.addTab({icon: 'home'}, 'family', sandbox.getModule('nodeFamilyTree').getView());\r
- box.appendView(sandbox.getModule('nodeFamilyTree').getView());\r
- },\r
- nodeEntered: function(id) {\r
- sandbox.getModule('documentCanvas').highlightNode(id);\r
- },\r
- nodeLeft: function(id) {\r
- sandbox.getModule('documentCanvas').dimNode(id);\r
- },\r
- nodeSelected: function(id) {\r
- sandbox.getModule('documentCanvas').selectNode(id);\r
- }\r
- }\r
- \r
- \r
- \r
- return {\r
- start: function() {\r
- sandbox.getModule('documentCanvas').start();\r
- sandbox.getModule('nodePane').start();\r
- sandbox.getModule('metadataEditor').start();\r
- sandbox.getModule('nodeFamilyTree').start();\r
- \r
- sandbox.publish('ready');\r
- },\r
- handleEvent: function(moduleName, eventName, args) {\r
- if(eventHandlers[moduleName] && eventHandlers[moduleName][eventName]) {\r
- eventHandlers[moduleName][eventName].apply(eventHandlers, args);\r
- }\r
- },\r
- getView: function() { return view.getAsView(); }\r
- \r
- }\r
-}\r
-\r
-});
\ No newline at end of file