Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
9a703d20
Commit
9a703d20
authored
Dec 18, 2013
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/kitygraph/kityminder
into dev
parents
8569f75a
87230381
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
21 deletions
+112
-21
module.default.test.js
minder_module/module.default.test.js
+25
-0
module.test.js
minder_module/module.test.js
+27
-0
command.js
src/core/command.js
+19
-15
kityminder.js
src/core/kityminder.js
+10
-6
index.html
testcase/index.html
+31
-0
No files found.
minder_module/module.default.test.js
0 → 100644
View file @
9a703d20
var
mindermoduleDefaultTest
=
function
(){
console
.
log
(
"test loaded"
);
var
stroredData
=
"stored"
;
return
{
"commands"
:
{
//todo:command字典,name-action 键值对模式编写
"testCommand"
:
kity
.
createClass
(
"testCommand"
,{
"execute"
:
function
(
km
,
arg1
,
arg2
,
arg3
){
console
.
log
(
arg1
,
arg2
,
arg3
);
}
}
)
},
"events"
:
{
//todo:事件响应函数绑定列表,事件名-响应函数 键值对模式编写
"click"
:
function
(
e
){
},
"keydown keyup"
:
function
(
e
){
}
}
}
}
\ No newline at end of file
minder_module/module.test.js
0 → 100644
View file @
9a703d20
var
mindermoduleTest
=
function
(){
console
.
log
(
"test loaded"
);
var
stroredData
=
"stored"
;
return
{
"ready"
:
function
(){
//todo:基本的初始化工作
console
.
log
(
stroredData
);
},
"commands"
:
{
//todo:command字典,name-action 键值对模式编写
"testCommand"
:
function
(
km
,
arg
){
console
.
log
(
arg
);
}
},
"events"
:
{
//todo:事件响应函数绑定列表,事件名-响应函数 键值对模式编写
"click"
:
function
(
e
){
},
"keydown keyup"
:
function
(
e
){
}
}
}
}
\ No newline at end of file
src/core/command.js
View file @
9a703d20
var
Command
=
kity
.
createClass
(
"Command"
,
{
var
Command
=
kity
.
createClass
(
"Command"
,
{
execute
:
function
(
minder
,
args
)
{
constructor
:
function
(){
},
revert
:
function
()
{
},
},
queryState
:
function
(
)
{
execute
:
function
(
minder
,
args
)
{
},
},
queryValue
:
function
()
{
revert
:
function
()
{
},
},
setContentChanged
:
function
()
{
setContentChanged
:
function
(
val
)
{
},
},
isContentChanged
:
function
()
{
isContentChanged
:
function
()
{
return
false
;
},
},
setSelectionChanged
:
function
(
val
)
{
setSelectionChanged
:
function
()
{
},
},
isSelectionChanged
:
function
()
{
isSelectionChanged
:
function
()
{
return
false
;
}
});
Command
.
queryState
:
function
(
km
)
{
return
0
;
}
}
});
\ No newline at end of file
Command
.
queryValue
:
function
(
km
)
{
return
0
;
}
\ No newline at end of file
src/core/kityminder.js
View file @
9a703d20
...
@@ -30,8 +30,8 @@ KityMinder.registerModule = function( name, module ) {
...
@@ -30,8 +30,8 @@ KityMinder.registerModule = function( name, module ) {
kity
.
extendClass
(
KityMinder
,
{
kity
.
extendClass
(
KityMinder
,
{
_initModules
:
function
()
{
_initModules
:
function
()
{
var
me
=
this
;
var
me
=
this
;
//在对象上挂接
command池子
me
.
commands
=
{};
//
command池子
me
.
commands
=
{};
me
.
actions
=
[];
//操作记录栈
var
_modules
=
KityMinder
.
_modules
;
var
_modules
=
KityMinder
.
_modules
;
if
(
_modules
){
if
(
_modules
){
for
(
var
key
in
_modules
){
for
(
var
key
in
_modules
){
...
@@ -55,7 +55,6 @@ kity.extendClass(KityMinder, {
...
@@ -55,7 +55,6 @@ kity.extendClass(KityMinder, {
if
(
moduleDealsEvents
){
if
(
moduleDealsEvents
){
for
(
var
_key
in
moduleDealsEvents
){
for
(
var
_key
in
moduleDealsEvents
){
var
bindEvs
=
_key
.
split
(
" "
);
var
bindEvs
=
_key
.
split
(
" "
);
console
.
log
(
bindEvs
);
var
func
=
moduleDealsEvents
[
_key
];
var
func
=
moduleDealsEvents
[
_key
];
for
(
var
_i
=
0
;
_i
<
bindEvs
.
length
;
_i
++
){
for
(
var
_i
=
0
;
_i
<
bindEvs
.
length
;
_i
++
){
me
.
on
(
bindEvs
[
_i
],
func
);
me
.
on
(
bindEvs
[
_i
],
func
);
...
@@ -143,15 +142,20 @@ kity.extendClass(KityMinder, {
...
@@ -143,15 +142,20 @@ kity.extendClass(KityMinder, {
// 命令机制
// 命令机制
kity
.
extendClass
(
KityMinder
,
{
kity
.
extendClass
(
KityMinder
,
{
execCommand
:
function
(
name
)
{
execCommand
:
function
(
name
)
{
var
_action
=
new
this
.
commands
[
name
]();
console
.
log
(
_action
);
var
args
=
arguments
;
arguments
[
0
]
=
this
;
_action
[
"execute"
]
&&
_action
[
"execute"
].
apply
(
null
,
args
);
this
.
actions
.
push
(
_action
);
},
},
queryCommandState
:
function
(
name
)
{
queryCommandState
:
function
(
name
)
{
this
.
commands
[
name
].
queryState
(
this
);
},
},
queryCommandValue
:
function
(
name
)
{
queryCommandValue
:
function
(
name
)
{
this
.
commands
[
name
].
queryValue
(
this
);
}
}
});
});
...
...
testcase/index.html
0 → 100644
View file @
9a703d20
<!DOCTYPE html>
<html>
<head>
<title>
KM Loader
</title>
<style>
body
,
div
,
html
{
margin
:
0
;
padding
:
0
;
overflow
:
hidden
;
}
</style>
</head>
<body>
</body>
<script
src=
"../kity/dist/kitygraph.all.js"
></script>
<script
src=
"../src/core/command.js"
></script>
<script
src=
"../minder_module/module.test.js"
></script>
<script
src=
"../minder_module/module.default.test.js"
></script>
<script
src=
"../src/core/km.js"
></script>
<script
src=
"../src/core/minderevent.js"
></script>
<script
src=
"../src/core/mindernode.js"
></script>
<script
src=
"../src/core/kityminder.js"
></script>
<script>
KityMinder
.
registerModule
(
"test"
,
mindermoduleTest
);
KityMinder
.
registerModule
(
"defaulttest"
,
mindermoduleDefaultTest
);
var
myMinder
=
new
KityMinder
();
myMinder
.
execCommand
(
"testCommand"
,
"test1"
,
function
(){
alert
(
a
)},{
a
:
1
,
b
:
2
});
myMinder
.
queryCommandState
(
"testCommand"
);
myMinder
.
queryCommandValue
(
"testCommand"
);
</script>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment