Defines nodes and node structure of media tree (and other trees as well)
e.g. nodeHandlers.playlist defined how a playlist node will behave and which view will be shown
Example (see /sampleScripts/customNodes/viewHandlers_add.js for further examples, and/or the individual node handlers below):
nodeHandlers.myNewHandler = inheritNodeHandler('MyNewHandlerClass', 'Base', { title:// node title (string or funct. returning string) // the following are optional: setTitle: // when renamed using F2 key or in-place edit icon: // node icon (string or funct. returning string) onExpanded: // code to perform on node expand onCollapsed: // code to perform on node collapse hasChildren: // whether there are some children nodes (boolean, default false) hasTreeChildren: // optional - for some nodes we want to limit the hierarchy in TreeView (while keep it in NavigationBar or NodeListView) getChildren: function (node) { // child nodes to be added returnnewPromise(function (resolve, reject) { app.getObject('genre', {name:'rock'}).then(function (object) { node.addChild(object, 'genre'); // this adds new child where object will become dataSource of the new child node and 'genre' says that nodeHandlers.genre will be used as handler for the new node }); }); }, viewAs: ['tracklist'] // says that viewHandlers.tracklist defines the view canDelete: // whether the node can be deleted (boolean, default false) deleteItems: // delete behaviour canReorderNodes: // whether nodes can be reordered (boolean, default false) canDrop: // whether can drop/paste on this node (boolean, default false) getDropMode: // drop mode (e.g. based on shift key) drop: // drop behaviour formatStatus: // to define custom format status (i.e. the text shown on the status bar) toolbarActions: [], // custom actions to add on toolbar, actions have to contain identifier property with action id menu: [], // custom popup-menu hideDefaultMenu:true, // don't append the default popup-menu });
Defines nodes and node structure of media tree (and other trees as well)
e.g. nodeHandlers.playlist defined how a playlist node will behave and which view will be shown
Example (see
/sampleScripts/customNodes/viewHandlers_add.js
for further examples, and/or the individual node handlers below):