unageanu-jiji 1.1.4 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. data/ChangeLog +24 -1
  2. data/README +0 -0
  3. data/base/shared_lib/moving_average.rb +34 -33
  4. data/base/shared_lib/system/cross.rb +76 -0
  5. data/base/shared_lib/system/position_manager.rb +160 -0
  6. data/base/shared_lib/system/signal.rb +347 -0
  7. data/html/css/datatable.css +4 -4
  8. data/html/css/default.css +57 -5
  9. data/html/css/treeview.css +205 -0
  10. data/html/img/bin_closed.png +0 -0
  11. data/html/img/bin_empty.png +0 -0
  12. data/html/img/button_add_small.gif +0 -0
  13. data/html/img/button_add_small_gray.gif +0 -0
  14. data/html/img/button_add_small_over.gif +0 -0
  15. data/html/img/button_mkcol.gif +0 -0
  16. data/html/img/button_mkcol_gray.gif +0 -0
  17. data/html/img/button_mkcol_over.gif +0 -0
  18. data/html/img/button_remove_small.gif +0 -0
  19. data/html/img/button_remove_small_gray.gif +0 -0
  20. data/html/img/button_remove_small_over.gif +0 -0
  21. data/html/img/button_rename.gif +0 -0
  22. data/html/img/button_rename_gray.gif +0 -0
  23. data/html/img/button_rename_over.gif +0 -0
  24. data/html/img/control_play.png +0 -0
  25. data/html/img/control_play_blue.png +0 -0
  26. data/html/img/folder.png +0 -0
  27. data/html/img/folder_brick.png +0 -0
  28. data/html/img/folder_user.png +0 -0
  29. data/html/{js/codepress/images → img}/line-numbers.png +0 -0
  30. data/html/img/page_white_ruby.png +0 -0
  31. data/html/img/sidebar_agent_edit.png +0 -0
  32. data/html/img/sidebar_agent_edit_over.png +0 -0
  33. data/html/img/sidebar_agent_edit_s.png +0 -0
  34. data/html/img/yui/treeview-sprite.gif +0 -0
  35. data/html/index.html +34 -18
  36. data/html/js/agent-editor/agent-editor-page.js +324 -0
  37. data/html/js/agent-editor/agent-editor.js +363 -0
  38. data/html/js/agent-editor/agent-list-tree.js +251 -0
  39. data/html/js/agent-selector.js +23 -28
  40. data/html/js/app.js +63 -91
  41. data/html/js/bt-create-page.js +25 -19
  42. data/html/js/container-min.js +1 -1
  43. data/html/js/container.js +944 -0
  44. data/html/js/edit_area/autocompletion.js +11 -13
  45. data/html/js/edit_area/edit_area.css +79 -40
  46. data/html/js/edit_area/edit_area.js +255 -226
  47. data/html/js/edit_area/edit_area_compressor.php +4 -4
  48. data/html/js/edit_area/edit_area_full.gz +0 -0
  49. data/html/js/edit_area/edit_area_full.js +31 -31
  50. data/html/js/edit_area/edit_area_full_with_plugins.gz +0 -0
  51. data/html/js/edit_area/edit_area_full_with_plugins.js +31 -31
  52. data/html/js/edit_area/edit_area_functions.js +448 -341
  53. data/html/js/edit_area/edit_area_loader.js +409 -397
  54. data/html/js/edit_area/elements_functions.js +120 -123
  55. data/html/js/edit_area/highlight.js +305 -197
  56. data/html/js/edit_area/images/goto.png +0 -0
  57. data/html/js/edit_area/images/help.png +0 -0
  58. data/html/js/edit_area/images/redo.png +0 -0
  59. data/html/js/edit_area/images/save.png +0 -0
  60. data/html/js/edit_area/images/search.png +0 -0
  61. data/html/js/edit_area/images/undo.png +0 -0
  62. data/html/js/edit_area/images/word_wrap.gif +0 -0
  63. data/html/js/edit_area/keyboard.js +5 -5
  64. data/html/js/edit_area/langs/bg.js +73 -0
  65. data/html/js/edit_area/langs/cs.js +2 -0
  66. data/html/js/edit_area/langs/de.js +2 -0
  67. data/html/js/edit_area/langs/dk.js +2 -0
  68. data/html/js/edit_area/langs/en.js +2 -0
  69. data/html/js/edit_area/langs/eo.js +2 -0
  70. data/html/js/edit_area/langs/es.js +2 -0
  71. data/html/js/edit_area/langs/fi.js +67 -0
  72. data/html/js/edit_area/langs/fr.js +2 -0
  73. data/html/js/edit_area/langs/hr.js +2 -0
  74. data/html/js/edit_area/langs/it.js +2 -0
  75. data/html/js/edit_area/langs/ja.js +2 -0
  76. data/html/js/edit_area/langs/mk.js +2 -0
  77. data/html/js/edit_area/langs/nl.js +2 -0
  78. data/html/js/edit_area/langs/pl.js +2 -0
  79. data/html/js/edit_area/langs/pt.js +2 -0
  80. data/html/js/edit_area/langs/ru.js +2 -0
  81. data/html/js/edit_area/langs/sk.js +2 -0
  82. data/html/js/edit_area/langs/zh.js +67 -0
  83. data/html/js/edit_area/manage_area.js +362 -205
  84. data/html/js/edit_area/plugins/charmap/langs/bg.js +12 -0
  85. data/html/js/edit_area/plugins/charmap/langs/zh.js +6 -0
  86. data/html/js/edit_area/plugins/test/langs/bg.js +10 -0
  87. data/html/js/edit_area/plugins/test/langs/zh.js +4 -0
  88. data/html/js/edit_area/reg_syntax/java.js +56 -0
  89. data/html/js/edit_area/reg_syntax/ruby.js +9 -9
  90. data/html/js/edit_area/reg_syntax.js +15 -13
  91. data/html/js/edit_area/regexp.js +36 -32
  92. data/html/js/edit_area/resize_area.js +43 -47
  93. data/html/js/edit_area/search_replace.js +29 -29
  94. data/html/js/edit_area/template.html +6 -4
  95. data/html/js/json-broker-client.js +23 -17
  96. data/html/js/result-page.js +107 -57
  97. data/html/js/rt-setting-page.js +38 -15
  98. data/html/js/sidebar.js +41 -27
  99. data/html/js/templates.js +167 -32
  100. data/html/js/utils.js +143 -7
  101. data/html/js/yui/treeview.js +3671 -0
  102. data/html/swf/chart.swf +0 -0
  103. data/html/test/agent_editor_spec.js +815 -0
  104. data/html/test/index.html +40 -0
  105. data/html/test/jsspec/JSSpec.css +224 -0
  106. data/html/test/jsspec/JSSpec.js +1549 -0
  107. data/html/test/jsspec/diff_match_patch.js +1 -0
  108. data/html/test/utils_spec.js +111 -0
  109. data/lib/jiji/agent/agent.rb +69 -12
  110. data/lib/jiji/agent/agent_manager.rb +18 -12
  111. data/lib/jiji/agent/agent_registry.rb +35 -121
  112. data/lib/jiji/collector.rb +16 -6
  113. data/lib/jiji/command.rb +46 -5
  114. data/lib/jiji/dao/file_system_dao.rb +158 -0
  115. data/lib/jiji/dao/timed_data_dao.rb +2 -0
  116. data/lib/jiji/dao/trade_result_dao.rb +1 -1
  117. data/lib/jiji/error.rb +24 -8
  118. data/lib/jiji/migration/migrator1_2_0.rb +67 -0
  119. data/lib/jiji/models.rb +82 -24
  120. data/lib/jiji/operator.rb +55 -51
  121. data/lib/jiji/output.rb +85 -29
  122. data/lib/jiji/output_manager.rb +84 -0
  123. data/lib/jiji/plugin/embedded/single_click_client.rb +2 -2
  124. data/lib/jiji/plugin/securities_plugin.rb +0 -1
  125. data/lib/jiji/process.rb +229 -208
  126. data/lib/jiji/process_manager.rb +190 -96
  127. data/lib/jiji/registry.rb +87 -19
  128. data/lib/jiji/server.rb +1 -0
  129. data/lib/jiji/service/agent_service.rb +147 -48
  130. data/lib/jiji/service/output_service.rb +37 -17
  131. data/lib/jiji/service/process_service.rb +3 -5
  132. data/lib/jiji/service/trade_result_service.rb +4 -5
  133. data/lib/jiji/util/file_lock.rb +4 -4
  134. data/lib/jiji/util/include_proxy.rb +17 -0
  135. data/lib/jiji/util/json_broker.rb +6 -4
  136. data/lib/jiji/util/util.rb +1 -1
  137. data/swf/chart/fx/chart/Chart.as +7 -0
  138. data/swf/chart/fx/chart/ui/graph/GraphManager.as +15 -2
  139. data/test/ProcessTest/agents/foo.rb +10 -0
  140. data/test/ProcessTest/conf/configuration.yaml +3 -0
  141. data/test/agent/agent_tests.rb +10 -0
  142. data/test/agent/test_AgentManager.rb +28 -12
  143. data/test/agent/test_AgentRegistry.rb +194 -99
  144. data/test/agent/test_PeriodicallyAgent.rb +1 -2
  145. data/test/agent/test_Permitter.rb +1 -2
  146. data/test/all_tests.rb +7 -19
  147. data/test/dao/dao_tests.rb +9 -0
  148. data/test/dao/test_FileSystemDao.rb +431 -0
  149. data/test/dao/test_RateDao.rb +5 -7
  150. data/test/dao/test_TradeResultDao.rb +1 -2
  151. data/test/migration/migration_tests.rb +10 -0
  152. data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  153. data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  154. data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  155. data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  156. data/test/migration/migrator1_2_0test_data/basic/props.yaml +85 -0
  157. data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  158. data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  159. data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  160. data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  161. data/test/migration/migrator1_2_0test_data/illegal_props/props.yaml +1 -0
  162. data/test/migration/migrator1_2_0test_data/no_outs/props.yaml +85 -0
  163. data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  164. data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  165. data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
  166. data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
  167. data/test/migration/test_Migrator.rb +1 -1
  168. data/test/migration/test_Migrator1_0_3.rb +1 -1
  169. data/test/migration/test_Migrator1_1_0.rb +1 -1
  170. data/test/migration/test_Migrator1_2_0.rb +94 -0
  171. data/test/plugin/embedded/test_SingleClickClient.rb +1 -2
  172. data/test/plugin/plugin_tests.rb +8 -0
  173. data/test/plugin/test_Loader.rb +1 -1
  174. data/test/shared/rate.csv +144 -0
  175. data/test/shared/shared_tests.rb +9 -0
  176. data/test/shared/test_Cross.rb +144 -0
  177. data/test/shared/test_PositionManager.rb +285 -0
  178. data/test/shared/test_Signal.rb +65 -0
  179. data/test/test_Output.rb +28 -21
  180. data/test/test_OutputManager.rb +162 -0
  181. data/test/test_Output_registry.rb +6 -17
  182. data/test/test_Process.rb +434 -222
  183. data/test/test_ProcessManager.rb +458 -101
  184. data/test/test_utils.rb +71 -8
  185. data/test/util/test_BlockToSession.rb +1 -2
  186. data/test/util/test_CSV.rb +1 -2
  187. data/test/util/test_SynchronizeInterceptor.rb +1 -2
  188. data/test/util/util_tests.rb +9 -0
  189. metadata +127 -47
  190. data/html/js/agent-editor-page.js +0 -440
  191. data/html/js/codepress/codepress.css +0 -21
  192. data/html/js/codepress/codepress.html +0 -35
  193. data/html/js/codepress/codepress.js +0 -138
  194. data/html/js/codepress/engines/gecko.js +0 -293
  195. data/html/js/codepress/engines/khtml.js +0 -0
  196. data/html/js/codepress/engines/msie.js +0 -304
  197. data/html/js/codepress/engines/older.js +0 -0
  198. data/html/js/codepress/engines/opera.js +0 -260
  199. data/html/js/codepress/images/line-numbers.gif +0 -0
  200. data/html/js/codepress/index.html +0 -443
  201. data/html/js/codepress/languages/asp.css +0 -71
  202. data/html/js/codepress/languages/asp.js +0 -117
  203. data/html/js/codepress/languages/autoit.css +0 -13
  204. data/html/js/codepress/languages/autoit.js +0 -32
  205. data/html/js/codepress/languages/csharp.css +0 -9
  206. data/html/js/codepress/languages/csharp.js +0 -25
  207. data/html/js/codepress/languages/css.css +0 -10
  208. data/html/js/codepress/languages/css.js +0 -23
  209. data/html/js/codepress/languages/generic.css +0 -9
  210. data/html/js/codepress/languages/generic.js +0 -25
  211. data/html/js/codepress/languages/html.css +0 -13
  212. data/html/js/codepress/languages/html.js +0 -59
  213. data/html/js/codepress/languages/java.css +0 -7
  214. data/html/js/codepress/languages/java.js +0 -24
  215. data/html/js/codepress/languages/javascript.css +0 -8
  216. data/html/js/codepress/languages/javascript.js +0 -30
  217. data/html/js/codepress/languages/perl.css +0 -11
  218. data/html/js/codepress/languages/perl.js +0 -27
  219. data/html/js/codepress/languages/php.css +0 -12
  220. data/html/js/codepress/languages/php.js +0 -61
  221. data/html/js/codepress/languages/ruby.css +0 -10
  222. data/html/js/codepress/languages/ruby.js +0 -26
  223. data/html/js/codepress/languages/sql.css +0 -10
  224. data/html/js/codepress/languages/sql.js +0 -30
  225. data/html/js/codepress/languages/text.css +0 -5
  226. data/html/js/codepress/languages/text.js +0 -9
  227. data/html/js/codepress/languages/vbscript.css +0 -71
  228. data/html/js/codepress/languages/vbscript.js +0 -117
  229. data/html/js/codepress/languages/xsl.css +0 -15
  230. data/html/js/codepress/languages/xsl.js +0 -103
  231. data/html/js/codepress/license.txt +0 -458
  232. data/html/js/edit_area/images/Thumbs.db +0 -0
  233. data/test/plugin/test_gem/a/lib/jiji_plugin_test.rb +0 -6
@@ -0,0 +1,251 @@
1
+ // ネームスペース
2
+ namespace( "fx.ui" );
3
+
4
+ //エージェント一覧ツリー
5
+ fx.ui.AgentFileListTree = function() {
6
+ this.elementId = null; // @Inject
7
+ this.agentEditor = container.Inject;
8
+ this.tree = null; // YUI Tree
9
+ this.nodeId = 0; // ノードの連番
10
+ }
11
+ fx.ui.AgentFileListTree.prototype = {
12
+ init : function() {
13
+ if ( this.tree ) return
14
+
15
+ this.tree = new YAHOO.widget.TreeView(this.elementId);
16
+
17
+ this.createBranch( {name:"エージェント", path:fx.constants.AGENTS_DIR, type:"directory"},
18
+ null, false, this.listFiles, true );
19
+ this.createBranch( {name:"共有ライブラリ", path:fx.constants.SHARED_LIB_DIR, type:"directory"},
20
+ null, false, this.listFiles, true );
21
+ this.tree.draw();
22
+ var self = this;
23
+ this.tree.subscribe( "clickEvent", function( ev, node ) {
24
+ return self.onClick( ev );
25
+ } );
26
+ },
27
+ /**
28
+ * 枝ノードを追加する。
29
+ * @param {Object} data 枝ノードのデータ
30
+ * @param {Object} parent 親ノード。nullの場合rootに追加
31
+ * @param {boolean} insertFirst ノードの最初に追加するか?falseの場合末尾に追加。
32
+ * @param {Function} provider 次の一覧を返す関数 nullの場合、子を持たない。
33
+ * @param {boolean} expand 枝を開くかどうか
34
+ */
35
+ createBranch: function( data, parent, insertFirst, provider, expand ) {
36
+ var thiz = this;
37
+ if ( !parent ) parent = this.tree.getRoot();
38
+
39
+ var id = this.nodeId++;
40
+ var node = new YAHOO.widget.HTMLNode(
41
+ this.createNode(data, id), null, false, true);
42
+ node.data = {"node-id":"node:"+id, data:data, path:data.path};
43
+ data.id = id;
44
+
45
+ if ( provider ) {
46
+ node.setDynamicLoad (function(parentNode, onCompleteCallback) {
47
+ provider.call( thiz, parentNode, onCompleteCallback);
48
+ });
49
+ }
50
+ if ( insertFirst && parent.hasChildren(false) ) {
51
+ node.insertBefore(parent.children[0]);
52
+ } else {
53
+ parent.appendChild(node);
54
+ }
55
+ if ( this.visible ) {
56
+ parent.refresh();
57
+ parent.expand();
58
+ }
59
+ if ( provider && expand ) {
60
+ node.expand();
61
+ }
62
+ return node;
63
+ },
64
+ /**
65
+ * ノードを作成する
66
+ */
67
+ createNode : function(data, id) {
68
+ var type = data.type;
69
+ if ( data.path == fx.constants.AGENTS_DIR ) type = "agents";
70
+ if ( data.path == fx.constants.SHARED_LIB_DIR ) type = "shared_lib";
71
+ return fx.template.Templates.agentEditor.tree.node.evaluate( {
72
+ name : data.name,
73
+ id : id,
74
+ type : type,
75
+ selected : this.agentEditor.isSelected( data.path ) ? "selected" : ""
76
+ });
77
+ },
78
+ /**
79
+ * 子要素を一覧する
80
+ */
81
+ listFiles : function(parentNode, onCompleteCallback) {
82
+ var self = this;
83
+ var data = parentNode.data;
84
+ this.agentEditor.list( data.data.path, function( list ) {
85
+ for(var i=0,l=list.length;i<l;i++) {
86
+ var childData = list[i];
87
+ self.createBranch( childData,parentNode, false,
88
+ childData.type == "directory" ? self.listFiles : null, false );
89
+ }
90
+ onCompleteCallback();
91
+ }, function() {
92
+ onCompleteCallback();
93
+ });
94
+ },
95
+
96
+ /**
97
+ * ノードを破棄する
98
+ */
99
+ remove: function( id ) {
100
+ var node = this.findNodeById( id );
101
+ if ( node ) {
102
+ var p = node.parent;
103
+ this.tree.removeNode( node, true );
104
+ if ( p && !p.hasChildren(false) ) {
105
+ p.expanded = false;
106
+ }
107
+ }
108
+ },
109
+
110
+ /**
111
+ * ノードの表示内容を更新する
112
+ */
113
+ updateNode: function( path ) {
114
+ var node = this.tree.getNodeByProperty( "path", path );
115
+ var expanded = node.expanded;
116
+ this.tree.removeChildren( node );
117
+ if ( expanded ) node.expand();
118
+ },
119
+
120
+ /**
121
+ * ツリーを描画する。
122
+ */
123
+ draw: function() {
124
+ this.tree.draw();
125
+ this.visible = true;
126
+ },
127
+ /**
128
+ * ノードを順に特定するインデックスを作る。
129
+ */
130
+ createIndex : function( node, buff ) {
131
+ if ( node.parent ) this.createIndex( node.parent, buff );
132
+ buff.push( node.index );
133
+ return buff;
134
+ },
135
+ /*
136
+ * クリックされたら呼び出される。
137
+ */
138
+ onClick : function(ev) {
139
+ var data = ev.node.data.data;
140
+ if (!data.index) data.index = this.createIndex( ev.node, [] );
141
+
142
+ // if ( !this.prevSelect ) {
143
+ // this.prevSelect = { time : new Date().getTime(), target:data.path };
144
+ // } else {
145
+ // var diff = new Date().getTime() - this.prevSelect.time;
146
+ // if ( this.prevSelect.target == data.path
147
+ // && diff > 300 && diff < 600 ) {
148
+ // // リネーム開始
149
+ // if ( data.path == "agents" || data.path == "shared_lib" ) return false;
150
+ // this.agentEditor.clear();
151
+ // this.agentEditor.select(data);
152
+ // editNode();
153
+ // return false;
154
+ // }
155
+ // this.prevSelect = null;
156
+ // }
157
+
158
+ // 選択変更
159
+ // 選択がない
160
+ if ( ev.event.ctrlKey ) {
161
+ // CTRL + クリック
162
+ if ( this.agentEditor.isSelected( data.path ) ) {
163
+ this.agentEditor.unselect(data);
164
+ } else {
165
+ this.agentEditor.select(data);
166
+ }
167
+ this.rangeSelectStart = null;
168
+ } else if ( ev.event.shiftKey ) {
169
+ // SHIFT + クリック
170
+ var selections = this.agentEditor.getSelections();
171
+ // 基点が決まっていない場合、基点を決める
172
+ if ( !this.rangeSelectStart ) {
173
+ if ( selections.size() > 0 ) {
174
+ // 選択されているアイテムの中で一番上のものを範囲選択の基点とする。
175
+ selections = this.sortByIndex(selections);
176
+ this.rangeSelectStart = selections[0];
177
+ } else {
178
+ // 選択がなければ、クリックと同じ動作
179
+ this.agentEditor.clear();
180
+ this.agentEditor.select(data);
181
+ this.rangeSelectStart = null;
182
+ }
183
+ }
184
+ // 基点から、クリックした位置までの要素を選択。
185
+ this.agentEditor.clear();
186
+ var range = this.sortByIndex([this.rangeSelectStart,data]);
187
+ var current = this.findNodeByPath( range[0].path );
188
+ var end = this.findNodeByPath( range[1].path );
189
+ while( current && current != end ) {
190
+ var tmp = current.data.data;
191
+ if (!tmp.index) tmp.index = this.createIndex( current, [] );
192
+ this.agentEditor.select(tmp);
193
+ if ( current.expanded && current.children.length > 0 ) {
194
+ current = current.children[0];
195
+ continue;
196
+ }
197
+ if (current.nextSibling) {
198
+ current = current.nextSibling;
199
+ continue;
200
+ }
201
+ tmp = current.parent;
202
+ current = null;
203
+ while ( tmp ) {
204
+ if ( tmp.nextSibling ) {
205
+ current = tmp.nextSibling;
206
+ break;
207
+ } else {
208
+ tmp = tmp.parent;
209
+ }
210
+ }
211
+ }
212
+ if ( current ) {
213
+ var tmp = current.data.data;
214
+ if (!tmp.index) tmp.index = this.createIndex( current,[] );
215
+ this.agentEditor.select(tmp);
216
+ }
217
+ } else {
218
+ this.agentEditor.clear();
219
+ this.agentEditor.select(data);
220
+ this.rangeSelectStart = null;
221
+ }
222
+ return false;
223
+ },
224
+
225
+ sortByIndex : function( array ) {
226
+ return array.sort( function( a,b ) {
227
+ var n = Math.min( a.index.length, b.index.length );
228
+ for ( var i=0; i<n; i++ ) {
229
+ var x = a.index[i] - b.index[i];
230
+ if (x != 0) return x;
231
+ }
232
+ return a.index.length - b.index.length
233
+ } );
234
+ },
235
+ /**
236
+ * パスに対応するノードを検索する。
237
+ * @param {String} path パス
238
+ * @return パスに対応するノード
239
+ */
240
+ findNodeByPath: function( path ) {
241
+ return this.tree.getNodeByProperty( "path", path );
242
+ },
243
+ /**
244
+ * IDに対応するノードを検索する。
245
+ * @param {String} nodeId ノードID
246
+ * @return IDに対応するノード
247
+ */
248
+ findNodeById: function( nodeId ) {
249
+ return this.tree.getNodeByProperty( "node-id", "node:" + nodeId );
250
+ }
251
+ }
@@ -6,14 +6,12 @@ namespace( "fx.agent.ui" )
6
6
  // エージェント選択UI
7
7
  fx.agent.ui.AgentSelector = function( id ) {
8
8
 
9
- this.id = id; //@Inject
10
- this.agentServiceStub = null; //@Inject
11
-
9
+ this.id = id;
10
+ this.agentServiceStub = container.Inject;
12
11
  this.agentClassListTable = null;
13
12
  this.agentListTable = null;
14
13
  this.agentPropertyEditor = null;
15
-
16
- this.dialog = null; // @Inject
14
+ this.dialog = container.Inject;
17
15
 
18
16
  // データ
19
17
  this.agentClasses = null;
@@ -101,10 +99,7 @@ fx.agent.ui.AgentSelector.prototype = {
101
99
  add: function(){
102
100
  // エージェント一覧、プロパティエディタを表示
103
101
  var self = this;
104
- var msg = "追加するエージェントを選択してください。"
105
- + '<div style="margin-top:10px;border: 1px solid #FFFFFF;">'
106
- + ' <div id="agent_class_list"></div>'
107
- + '</div>';
102
+ var msg = fx.template.Templates.agentSelector.addMsg;
108
103
  this.dialog.show( "input", {
109
104
  message : msg,
110
105
  init : function( dialog ) {
@@ -121,14 +116,14 @@ fx.agent.ui.AgentSelector.prototype = {
121
116
  }, null ); // TODO
122
117
  },
123
118
  buttons : [
124
- { type:"ok",
119
+ { type:"ok",
125
120
  alt: fx.template.Templates.common.button.ok,
126
121
  key: "Enter", action: function(dialog){
127
122
 
128
123
  var selectedRowIds = self.agentClassListTable.table.getSelectedRows();
129
124
  var error = null;
130
125
  if ( selectedRowIds <= 0 ) {
131
- error = "エージェントが選択されていません。";
126
+ error = fx.template.Templates.common.errorMsg.notSelected;
132
127
  }
133
128
  if ( !error ) {
134
129
  var agents = [];
@@ -171,7 +166,7 @@ fx.agent.ui.AgentSelector.prototype = {
171
166
  // 名前を追加。
172
167
  for ( var i=0; i<newAgents.length; i++) {
173
168
  var k = 1;
174
- while ( set["名称未設定エージェント"+k] ) { k++; }
169
+ while ( set[fx.template.Templates.agentSelector.defaultName+k] ) { k++; }
175
170
 
176
171
  // 初期値からプロパティ値を作成
177
172
  var defs = newAgents[i].properties;
@@ -181,13 +176,13 @@ fx.agent.ui.AgentSelector.prototype = {
181
176
  for ( var j=0, s=defs.length;j<s;j++ ) {
182
177
  def[defs[j]["id"]] = defs[j];
183
178
  prop[defs[j]["id"]] = defs[j]["default"] || "";
184
- error = error || this.agentPropertyEditor.validate[defs[j].type].call(
179
+ error = error || this.agentPropertyEditor.validate[defs[j].type].call(
185
180
  this.agentPropertyEditor, prop[defs[j]["id"]], defs[j].restrict );
186
181
  }
187
-
182
+
188
183
  var a = {
189
184
  "id": UUID.generate(),
190
- "name": "名称未設定エージェント"+k,
185
+ "name": fx.template.Templates.agentSelector.defaultName+k,
191
186
  "class":newAgents[i].class_name + "@" + newAgents[i].file_name,
192
187
  "class_name":newAgents[i].class_name,
193
188
  "file_name":newAgents[i].file_name,
@@ -215,7 +210,7 @@ fx.agent.ui.AgentSelector.prototype = {
215
210
  }
216
211
  // 確認
217
212
  var self = this;
218
- var msg = "削除します。よろしいですか?";
213
+ var msg = fx.template.Templates.common.errorMsg.deleteConfirm;
219
214
  this.dialog.show( "input", {
220
215
  message : msg,
221
216
  buttons : [
@@ -252,7 +247,7 @@ fx.agent.ui.AgentSelector.prototype = {
252
247
  if ( selectedRowIds.length <= 0 ) {
253
248
  // 選択なし
254
249
  removeEnable = false;
255
- self.agentPropertyEditor.clear( "エージェントを選択してください。" );
250
+ self.agentPropertyEditor.clear( fx.template.Templates.common.errorMsg.selectAgent );
256
251
  } else if ( selectedRowIds.length == 1 ) {
257
252
  removeEnable = true;
258
253
  // エディタも更新する。
@@ -264,7 +259,7 @@ fx.agent.ui.AgentSelector.prototype = {
264
259
  self.agentPropertyEditor.set( data );
265
260
  } else {
266
261
  removeEnable = false;
267
- self.agentPropertyEditor.clear( "エージェントを選択してください。" );
262
+ self.agentPropertyEditor.clear( fx.template.Templates.common.errorMsg.selectAgent );
268
263
  }
269
264
  } else {
270
265
  removeEnable = true;
@@ -287,7 +282,7 @@ fx.agent.ui.AgentSelector.prototype = {
287
282
  this.agentListTable.update( this.agentPropertyEditor.target, newData );
288
283
  this.agentPropertyEditor.target = null;
289
284
  this.agentPropertyEditor.end();
290
-
285
+
291
286
  this.checkDuplicateName();
292
287
  }
293
288
  },
@@ -460,7 +455,7 @@ fx.agent.ui.AgentPropertyEditor.prototype = {
460
455
  props += fx.template.Templates.agentPropertyEditor.property.evaluate({
461
456
  "name": agent.property_def[i].name.escapeHTML(),
462
457
  "id": agent.property_def[i].id,
463
- "default": agent.properties[agent.property_def[i].id] != null
458
+ "default": agent.properties[agent.property_def[i].id] != null
464
459
  ? agent.properties[agent.property_def[i].id] : agent.property_def[i]["default"]
465
460
  });
466
461
  }
@@ -531,7 +526,7 @@ fx.agent.ui.AgentPropertyEditor.prototype = {
531
526
  },
532
527
  end : function() {
533
528
  this.editing = null;
534
- this.clear( "エージェントを選択してください。" );
529
+ this.clear( fx.template.Templates.common.errorMsg.selectAgent );
535
530
  },
536
531
  /**
537
532
  * 何も編集していない状態にする。
@@ -564,7 +559,7 @@ fx.agent.ui.AgentPropertyEditor.prototype = {
564
559
  var rs = this.agentsSelector.agentListTable.table.getRecordSet().getRecords( 0, this.agentsSelector.agentListTable.length() );
565
560
  for ( var i=0,n=rs.length;i<n;i++) {
566
561
  if ( rs[i].getData().name == value && this.editing.id != rs[i].getData().id ) {
567
- error = "名前が重複しています。";
562
+ error = fx.template.Templates.common.errorMsg.dupricateName;
568
563
  break;
569
564
  }
570
565
  }
@@ -576,13 +571,13 @@ fx.agent.ui.AgentPropertyEditor.prototype = {
576
571
  var error = this.validate.nullable( value, restrict );
577
572
  if ( value ) {
578
573
  if ( restrict.length > 0 && value.length >= restrict.length ) {
579
- error = "値が長すぎます。";
574
+ error = fx.template.Templates.common.errorMsg.tooLong;
580
575
  }
581
576
  if ( util.CONTROLL_CODE.test( value ) ) {
582
- error = "使用できない文字が含まれています。";
577
+ error = fx.template.Templates.common.errorMsg.illegalChar;
583
578
  }
584
579
  if ( restrict.format && !new RegExp( restrict.format ).test( value ) ) {
585
- error = "値のフォーマットが不正です。";
580
+ error = fx.template.Templates.common.errorMsg.illegalFormat;
586
581
  }
587
582
  }
588
583
  return error;
@@ -593,17 +588,17 @@ fx.agent.ui.AgentPropertyEditor.prototype = {
593
588
  if ( value ) {
594
589
  if ( (restrict.max != null && Number( value ) > restrict.max )
595
590
  || ( restrict.min != null && Number( value ) < restrict.min ) ) {
596
- error = "値が範囲外です。";
591
+ error = fx.template.Templates.common.errorMsg.outOfRange;
597
592
  }
598
593
  if ( !/^[\-\.\d]+$/.test( value ) ) {
599
- error = "数値を入力してください。";
594
+ error = fx.template.Templates.common.errorMsg.notNumber;
600
595
  }
601
596
  }
602
597
  return error;
603
598
  },
604
599
  nullable : function( value, restrict ) {
605
600
  if ( !value && !restrict.nullable ) {
606
- return "値が入力されていません。";
601
+ return fx.template.Templates.common.errorMsg.notInput;
607
602
  } else {
608
603
  return null;
609
604
  }
data/html/js/app.js CHANGED
@@ -5,17 +5,17 @@ namespace( "fx" );
5
5
 
6
6
  // 定数
7
7
  fx.constants = {
8
- SERVICE_URI : "./json"
8
+ SERVICE_URI : "./json",
9
+ AGENTS_DIR : "agents",
10
+ SHARED_LIB_DIR : "shared_lib"
9
11
  }
10
12
 
11
- fx.initialize = function(){
12
- fx.container = new container.Container( function( binder ){
13
-
13
+ // モジュール
14
+ fx.modules = {
15
+ // UIモジュール
16
+ ui : function(binder) {
14
17
  // App
15
- binder.bind( fx.Application ).to( "app" ).inject({
16
- pageManager: container.component("pageManager"),
17
- sideBar: container.component("sideBar")
18
- });
18
+ binder.bind( fx.Application ).to( "app" );
19
19
 
20
20
  // page manager
21
21
  binder.bind( util.PageManager ).to( "pageManager" ).initialize( function( obj, container ) {
@@ -24,47 +24,22 @@ fx.initialize = function(){
24
24
 
25
25
  // pages
26
26
  binder.bind( fx.ui.pages.RtSettingPage ).to( "pages" ).inject({
27
- id : "rt_setting",
28
- elementId : "page-rt-setting",
29
- agentSelector: container.component("rtSettingAgentSelector"),
30
- processServiceStub: container.component("processServiceStub"),
31
- topicPath: container.component("topicPath"),
32
- tradeEnable: container.component("tradeEnable"),
33
- dialog : container.component("dialog")
34
- }).initialize( function( obj, container ) {
35
- obj.initialize( );
36
- });
27
+ id : "rt_setting",
28
+ elementId : "page-rt-setting"
29
+ }).initialize("initialize");
37
30
  binder.bind( fx.ui.pages.AgentEditorPage ).to( "pages" ).inject({
38
- id : "agent_edit",
39
- elementId : "page-agent-edit",
40
- agentServiceStub: container.component("agentServiceStub"),
41
- agentFileListTable: container.component("agentFileListTable"),
42
- topicPath: container.component("topicPath"),
43
- dialog : container.component("dialog")
31
+ id : "agent_edit",
32
+ elementId : "page-agent-edit",
33
+ editorElementId : "agent_editor"
44
34
  });
45
35
  binder.bind( fx.ui.pages.BtCreatePage ).to( "pages" ).inject({
46
36
  id : "bt_create",
47
- elementId : "page-bt-create",
48
- agentSelector: container.component("btCreateAgentSelector"),
49
- processServiceStub: container.component("processServiceStub"),
50
- rateServiceStub: container.component("rateServiceStub"),
51
- topicPath: container.component("topicPath"),
52
- sideBar: container.component("sideBar"),
53
- dialog : container.component("dialog")
54
- }).initialize( function( obj, container ) {
55
- obj.initialize( );
56
- });
37
+ elementId : "page-bt-create"
38
+ }).initialize("initialize");
57
39
  binder.bind( fx.ui.pages.ResultPage ).to( "pages" ).inject({
58
40
  id : "result",
59
- elementId : "page-result",
60
- processServiceStub: container.component("processServiceStub"),
61
- pageManager: container.component("resultPageManager"),
62
- topicPath: container.component("topicPath"),
63
- sideBar: container.component("sideBar"),
64
- dialog : container.component("dialog")
65
- }).initialize( function( obj, container ) {
66
- obj.initialize( );
67
- });
41
+ elementId : "page-result"
42
+ }).initialize("initialize");
68
43
 
69
44
  // page manager (結果一覧ページ用)
70
45
  binder.bind( util.PageManager ).to( "resultPageManager" ).initialize( function( obj, container ) {
@@ -72,62 +47,40 @@ fx.initialize = function(){
72
47
  });
73
48
  binder.bind( fx.ui.pages.LogResultPage ).to( "result_pages" ).inject({
74
49
  id : "log",
75
- elementId : "subpage-log",
76
- outputServiceStub: container.component("outputServiceStub")
50
+ elementId : "subpage-log"
77
51
  });
78
52
  binder.bind( fx.ui.pages.TradeResultPage ).to( "result_pages" ).inject({
79
53
  id : "trade",
80
- elementId : "subpage-trade",
81
- tradeResultServiceStub: container.component("tradeResultServiceStub"),
82
- dialog : container.component("dialog")
54
+ elementId : "subpage-trade"
83
55
  });
84
56
  binder.bind( fx.ui.pages.InfoResultPage ).to( "result_pages" ).inject({
85
57
  id : "info",
86
- elementId : "subpage-info",
87
- processServiceStub: container.component("processServiceStub"),
88
- agentSelector: container.component("subpageInfoAgentSelector"),
89
- dialog : container.component("dialog")
90
- }).initialize( function( obj, container ) {
91
- obj.initialize( );
92
- });
58
+ elementId : "subpage-info"
59
+ }).initialize("initialize");
93
60
  binder.bind( fx.ui.pages.GraphSettingResultPage ).to( "result_pages" ).inject({
94
61
  id : "graph",
95
- elementId : "subpage-graph",
96
- processServiceStub: container.component("processServiceStub"),
97
- outputServiceStub: container.component("outputServiceStub"),
98
- dialog : container.component("dialog")
62
+ elementId : "subpage-graph"
99
63
  });
100
64
 
101
65
  // agent editor
102
66
  binder.bind( fx.agent.ui.AgentSelector ).to( "rtSettingAgentSelector" ).inject({
103
- id: "rt-setting_as",
104
- agentServiceStub: container.component("agentServiceStub"),
105
- dialog : container.component("dialog")
67
+ id: "rt-setting_as"
106
68
  });
107
69
  binder.bind( fx.agent.ui.AgentSelector ).to( "btCreateAgentSelector" ).inject({
108
- id: "bt-create_as",
109
- agentServiceStub: container.component("agentServiceStub"),
110
- dialog : container.component("dialog")
70
+ id: "bt-create_as"
111
71
  });
112
72
  binder.bind( fx.agent.ui.AgentSelector ).to( "subpageInfoAgentSelector" ).inject({
113
- id: "subpage-info_as",
114
- agentServiceStub: container.component("agentServiceStub"),
115
- dialog : container.component("dialog")
73
+ id: "subpage-info_as"
116
74
  });
117
75
 
118
76
  // agent-edit
119
- binder.bind( fx.ui.AgentFileListTable ).to( "agentFileListTable" ).inject({
77
+ binder.bind( fx.ui.AgentFileListTree ).to( "agentFileListTree" ).inject({
120
78
  elementId : "agent-file-list"
121
79
  });
122
80
 
123
81
  // side-bar
124
82
  binder.bind( fx.ui.SideBar ).to( "sideBar" ).inject({
125
- elementId : "back-tests",
126
- pageManager: container.component("pageManager"),
127
- processServiceStub: container.component("processServiceStub"),
128
- dialog : container.component("dialog")
129
- }).initialize( function( obj, container ) {
130
- obj.initialize();
83
+ elementId : "back-tests"
131
84
  });
132
85
 
133
86
  // topicPath
@@ -137,27 +90,31 @@ fx.initialize = function(){
137
90
 
138
91
  // tradeEnable
139
92
  binder.bind( fx.ui.TradeEnable ).to( "tradeEnable" ).inject({
140
- elementId : "head_trade_enable",
141
- processServiceStub: container.component("processServiceStub")
142
- }).initialize( function( obj, container ) {
143
- obj.init();
144
- });
93
+ elementId : "head_trade_enable"
94
+ }).initialize("init");
145
95
 
146
96
  // dialog
147
97
  binder.bind( util.Dialog ).to( "dialog" );
98
+ },
99
+
100
+ // 非UI
101
+ core : function( binder ) {
102
+
103
+ // ctrl
104
+ binder.bind( fx.AgentEditor ).to( "agentEditor" ).initialize("init");
148
105
 
149
106
  // stub
150
107
  binder.bindProvider( function() {
151
108
  return JSONBrokerClientFactory.createFromList(
152
109
  fx.constants.SERVICE_URI + "/agent",
153
110
  ["list_agent_class",
154
- "put_file",
155
- "delete_files",
111
+ "put_file", "add_file", "mkcol",
112
+ "remove",
113
+ "move", "rename",
156
114
  "list_agent",
157
115
  "add_agent",
158
116
  "remove_agent",
159
- "off",
160
- "on",
117
+ "off", "on",
161
118
  "list_files",
162
119
  "get_file"] );
163
120
  } ).to("agentServiceStub");
@@ -177,7 +134,7 @@ fx.initialize = function(){
177
134
  binder.bindProvider( function() {
178
135
  return JSONBrokerClientFactory.createFromList(
179
136
  fx.constants.SERVICE_URI + "/output",
180
- [ "get_log", "list_outputs", "set_properties" ] );
137
+ [ "get_log", "list_outputs", "set_properties", "delete_output" ] );
181
138
  } ).to("outputServiceStub");
182
139
  binder.bindProvider( function() {
183
140
  return JSONBrokerClientFactory.createFromList(
@@ -189,16 +146,22 @@ fx.initialize = function(){
189
146
  fx.constants.SERVICE_URI + "/rate",
190
147
  [ "range" ] );
191
148
  } ).to("rateServiceStub");
149
+ }
150
+ }
151
+
152
+ fx.initialize = function(){
153
+ fx.container = new container.Container( function( binder ){
154
+ fx.modules.ui( binder );
155
+ fx.modules.core( binder );
192
156
  });
193
157
  fx.app = fx.container.get( "app" );
194
158
  fx.app.initialize();
195
-
196
159
  }
197
160
 
198
161
 
199
162
  fx.Application = function() {
200
- this.agentSelector = null; //@Inject
201
- this.pageManager = null; //@Inject
163
+ this.pageManager = container.Inject;
164
+ this.sideBar = container.Inject;
202
165
  }
203
166
  fx.Application.prototype = {
204
167
 
@@ -206,8 +169,8 @@ fx.Application.prototype = {
206
169
  * 初期化
207
170
  */
208
171
  initialize : function ( ) {
209
-
210
172
  var self = this;
173
+ this.sideBar.initialize();
211
174
  this.sideBar.to("sidebar_result_rmt");
212
175
  },
213
176
 
@@ -221,6 +184,15 @@ fx.Application.prototype = {
221
184
  }
222
185
  }
223
186
 
224
- function debug(str) {
225
- document.getElementById('debug').innerHTML += str + "<br/>";
187
+ function debug(obj) {
188
+ var out = document.getElementById('debug');
189
+ if ( typeof obj == "string" ) {
190
+ out.innerHTML += obj + "<br/>";
191
+ } else {
192
+ out.innerHTML += "---<br/>";
193
+ out.innerHTML += obj + "<br/>";
194
+ for ( var i in obj ) {
195
+ out.innerHTML += i + " : " + obj[i] + "<br/>";
196
+ }
197
+ }
226
198
  }