}
var commands = {
- highlightDocumentElement: function(element, origin) {
- ///'nodeBreadCrumbs', 'nodeFamilyTree'
- ['documentCanvas', 'nodeFamilyTree'].forEach(function(moduleName) {
- if(!origin || moduleName !== origin) {
- sandbox.getModule(moduleName).highlightElement(element);
- }
- });
- },
- dimDocumentElement: function(element, origin) {
- //'nodeBreadCrumbs', 'nodeFamilyTree'
- ['documentCanvas', 'nodeFamilyTree'].forEach(function(moduleName) {
- if(!origin || moduleName !== origin) {
- sandbox.getModule(moduleName).dimElement(element);
- }
- });
- },
jumpToDocumentElement: function(element) {
sandbox.getModule('documentCanvas').jumpToElement(element);
},
if(fragment && fragment.node) {
elementParent = fragment.node.getNearestElementNode();
- sandbox.getModule('nodePane').setNodeElement(elementParent);
- sandbox.getModule('nodeFamilyTree').setElement(fragment.node);
sandbox.getModule('nodeBreadCrumbs').setNodeElement(elementParent);
sandbox.getModule('metadataEditor').setNodeElement(elementParent);
} else {
- sandbox.getModule('nodePane').setNodeElement(null);
- sandbox.getModule('nodeFamilyTree').setElement(null);
sandbox.getModule('nodeBreadCrumbs').setNodeElement(null);
sandbox.getModule('metadataEditor').setNodeElement(null);
}
sandbox.getModule('indicator').clearMessage({message: msg[what]});
if(status === 'success' && what === 'remote') {
- sandbox.getModule('mainBar').setVersion(data.version);
documentSummary.setDraftField('-');
sandbox.getModule('mainBar').setCommandEnabled('drop-draft', false);
sandbox.getModule('mainBar').setCommandEnabled('save', false);
documentReverted: function(version) {
documentIsDirty = false;
sandbox.getModule('indicator').clearMessage({message:'Wersja ' + version + ' przywrócona'});
- sandbox.getModule('mainBar').setVersion(version);
}
};
eventHandlers.mainBar = {
ready: function() {
- sandbox.getModule('mainBar').setVersion(sandbox.getModule('data').getDocument().properties.version);
views.mainLayout.setView('topPanel', sandbox.getModule('mainBar').getView());
},
'cmd.save': function() {
commands.refreshCanvasSelection(selection);
}
};
-
- eventHandlers.nodePane = {
- ready: function() {
- views.currentNodePaneLayout.appendView(sandbox.getModule('nodePane').getView());
- }
- };
eventHandlers.metadataEditor = {
ready: function() {
}
};
- eventHandlers.nodeFamilyTree = {
- ready: function() {
- views.currentNodePaneLayout.appendView(sandbox.getModule('nodeFamilyTree').getView());
- },
- nodeEntered: function(node) {
- commands.highlightDocumentElement(node, 'nodeFamilyTree');
- },
- nodeLeft: function(node) {
- commands.dimDocumentElement(node, 'nodeFamilyTree');
- },
- nodeClicked: function(node) {
- commands.jumpToDocumentElement(node);
- }
- };
-
eventHandlers.documentToolbar = {
ready: function() {
views.visualEditing.setView('toolbar', sandbox.getModule('documentToolbar').getView());
ready: function() {
views.visualEditing.setView('statusBar', sandbox.getModule('nodeBreadCrumbs').getView());
},
- elementEntered: function(element) {
- commands.highlightDocumentElement(element, 'nodeBreadCrumbs');
- },
- elementLeft: function(element) {
- commands.dimDocumentElement(element, 'nodeBreadCrumbs');
- },
elementClicked: function(element) {
commands.jumpToDocumentElement(element);
}