Commit baa4e3e1 authored by techird's avatar techird

core framework

parent 3d789914
......@@ -39,11 +39,19 @@
```js
var MyCommand = kity.createClass({
base: Command,
execute: function(Minder minder [,args...]){},
revert: function(Minder minder){},
// 基类缺省实现:
queryState: function(Minder minder){},
queryValue: function(Minder minder){},
// 基类实现:
setContentChanged: function( bool ),
isContentChanged: function() {},
setSelectionChanged: function( bool ) {},
isSelectionChanged: function() {}
}
```
......@@ -82,30 +90,35 @@ Module定义一个模块,表示控制脑图中一个功能的模块(布局
```js
KityMinder.registerModule("ModuleName", function() {
// init or Command define
// this refers to KMinder instance
return {
"init": function(){
"ready": function(){
//todo:基本的初始化工作
},
"commands": {
//todo:command字典,name-action 键值对模式编写
"name": CommandClass
},
"events": {
//todo:事件响应函数绑定列表,事件名-响应函数 键值对模式编写
"click": function(e){
},
"keydown": function(e){
"keydown keyup": function(e){
}
},
"unload": function(){
//todo:模块unload时的一些处理,可缺省
}
}
}); //处理顺序为 init->commands->events顺次执行,在模块卸载时执行unload函数
});
```
## MinderNode
......@@ -214,13 +227,17 @@ MinderTreeNode 维护的树关系和数据只是作为一个脑图的结构和
添加一个或多个节点到节点选择列表中
`.unselect(MinderNode[] nodes | MinderNode node) : this`
`.selectSingle(Minder node) : this`
唯一选中指定节点
`.toggleSelect(MinderNode[] nodes | MinderNode node)`
从节点选择列表中移除一个或多个节点
切换一个或多个节点的选中状态
`.clearSelection() : this`
`.clearSelect(MinderNode[] nodes | MinderNode node) : this`
清除节点选中列表
从节点选择列表中移除一个或多个节点,如果不传节点,全部取消选择
### 事件机制
......@@ -260,7 +277,7 @@ KityMinder 的事件分为:
对 import 事件:
* `e.importData` 获取导入的数据
* `e.getImportData()` 获取导入的数据
对 selectionchange 事件:
......
var Command = kity.createClass( "Command", {
execute: function (minder, args) {
},
revert: function() {
},
queryState: function() {
},
queryValue: function() {
},
setContentChanged: function() {
},
isContentChanged: function() {
},
setSelectionChanged: function() {
},
isSelectionChanged: function() {
}
});
\ No newline at end of file
var KityMinder = kity.createClass("KityMinder", {
constructor: function (id, option) {
// 初始化
this._initModules();
this._initEvents();
}
});
KityMinder.version = '1.0.0.0';
KityMinder.debug = true;
// 模块注册
KityMinder.registerModule = function( name, module ) {
};
// 模块维护
kity.extendClass(KityMinder, {
_initModules: function() {
}
});
// 节点控制
kity.extendClass(KityMinder, {
getRoot: function() {
},
update: function( node ) {
}
});
// 事件机制
kity.extendClass(KityMinder, {
_initEvents: function() {
},
on: function( name, callback ) {
},
once: function( name, callback ) {
},
off: function( name, callback ) {
},
fire: function( name, params ) {
}
});
// 命令机制
kity.extendClass(KityMinder, {
execCommand: function( name ) {
},
queryCommandState: function( name ) {
},
queryCommandValue: function( name ) {
}
});
// 导入导出
kity.extendClass(KityMinder, {
export: function() {
},
import: function() {
}
});
// 选区管理
kity.extendClass(KityMinder, {
getSelectedNodes: function() {
},
select: function( nodes ) {
},
selectSingle: function( node ) {
},
toggleSelect: function( nodes ) {
},
clearSelect: function( nodes ) {
}
});
\ No newline at end of file
var MinderEvent = kity.createClass('MindEvent', {
});
\ No newline at end of file
var MinderNode = kity.createClass("MinderNode", {
constructor: function () {
},
getParent: function() {
},
getChildren: function() {
},
getIndex: function() {
},
insertChild: function(node, index) {
},
removeChild: function(elem) {
},
getChild: function(index) {
},
getData: function(name) {
},
setData: function(name, value) {
},
getRenderContainer: function() {
}
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment