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
@@ -4,6 +4,7 @@
4
4
  <head>
5
5
  <title>EditArea</title>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
7
8
  [__CSSRULES__]
8
9
  [__JSCODE__]
9
10
  </head>
@@ -11,7 +12,7 @@
11
12
  <div id='editor'>
12
13
  <div class='area_toolbar' id='toolbar_1'>[__TOOLBAR__]</div>
13
14
  <div class='area_toolbar' id='tab_browsing_area'><ul id='tab_browsing_list' class='menu'> <li> </li> </ul></div>
14
- <div id='result'>
15
+ <div id='result' >
15
16
  <div id='no_file_selected'></div>
16
17
  <div id='container'>
17
18
  <div id='cursor_pos' class='edit_area_cursor'>&nbsp;</div>
@@ -20,9 +21,9 @@
20
21
  <div id='line_number' selec='none'></div>
21
22
  <div id='content_highlight'></div>
22
23
  <div id='test_font_size'></div>
24
+ <div id='selection_field_text'></div>
23
25
  <textarea id='textarea' wrap='off' onchange='editArea.execCommand("onchange");' onfocus='javascript:editArea.textareaFocused=true;' onblur='javascript:editArea.textareaFocused=false;'>
24
26
  </textarea>
25
-
26
27
  </div>
27
28
  </div>
28
29
  <div class='area_toolbar' id='toolbar_2'>
@@ -88,12 +89,13 @@
88
89
  {$ctrl}+y: {$redo}<br />
89
90
  {$ctrl}+e: {$help}<br />
90
91
  {$ctrl}+q, {$esc}: {$close_popup}<br />
92
+ <!--
91
93
  {$accesskey} E: {$toggle}<br />
94
+ -->
92
95
  <br />
93
96
  <em>{$about_notice}</em>
94
- <br /><div class='copyright'>&copy; Christophe Dolivet 2007-2008</div>
97
+ <br /><div class='copyright'>&copy; Christophe Dolivet 2007-2009</div>
95
98
  </div>
96
99
  </div>
97
- </div>
98
100
  </body>
99
101
  </html>
@@ -1,6 +1,9 @@
1
1
 
2
2
  JSONBrokerClientFactory = {
3
3
 
4
+ /**同期/非同期切り替え*/
5
+ async : true,
6
+
4
7
  /**
5
8
  * JSONBrokerのクライアントスタブを生成する。
6
9
  * @param {String} url JSONBrokerのURL
@@ -38,24 +41,27 @@ JSONBrokerClientFactory = {
38
41
  };
39
42
  },
40
43
  _call: function( url, method, args, successCallback, errorCallBack ) {
41
- var sendData = //'request='
42
- encodeURIComponent('{ "method":"' + method + '", "params":' + YAHOO.lang.JSON.stringify(args) + '}');
43
- var callback = {
44
- success: function( response ) {
45
- var data = YAHOO.lang.JSON.parse(response.responseText);
46
- if ( !data[0] || data[0]["error"] ) {
47
- if ( errorCallBack ) {
48
- errorCallBack( data );
49
- }
50
- } else {
51
- if ( successCallback ) {
52
- successCallback(data[0]["result"]);
53
- }
44
+ var sendData = encodeURIComponent(
45
+ '{ "method":"' + method + '", "params":' + YAHOO.lang.JSON.stringify(args) + '}');
46
+ return new Ajax.Request(url, {
47
+ method: "POST",
48
+ postBody : sendData,
49
+ evalJSON: false,
50
+ asynchronous : JSONBrokerClientFactory.async,
51
+ onSuccess : function( response ) {
52
+ try {
53
+ var data = YAHOO.lang.JSON.parse(response.responseText);
54
+ if ( !data[0] || data[0]["error"] ) {
55
+ if ( errorCallBack ) errorCallBack( data[0]["error"], data[0]["detail"] );
56
+ } else {
57
+ if ( successCallback ) successCallback(data[0]["result"]);
58
+ }
59
+ } catch ( ex ) {
60
+ if ( errorCallBack ) errorCallBack( ex.message || ex.description || String(ex), {} );
54
61
  }
55
62
  },
56
- failure: errorCallBack
57
- };
58
- // リクエストの送付
59
- var ajax = YAHOO.util.Connect.asyncRequest('POST', url, callback, sendData );
63
+ onFailure : errorCallBack,
64
+ onException : errorCallBack
65
+ });
60
66
  }
61
67
  }
@@ -6,15 +6,17 @@ namespace( "fx.ui.pages" )
6
6
  fx.ui.pages.ResultPage = function() {
7
7
 
8
8
  this.elementPrefix = null;
9
- this.elementId = null; // @Inject
10
- this.processServiceStub = null; //@Inject
9
+ this.elementId = null;
10
+ this.processServiceStub = container.Inject;
11
11
 
12
12
  // 現在表示中のプロセスID // toで画面遷移したタイミングで設定される。
13
13
  this.currentProcessId = null;
14
14
 
15
15
  this.submenu = null;
16
- this.dialog = null; // @Inject
17
- this.topicPath = null; // @Inject
16
+ this.dialog = container.Inject;
17
+ this.topicPath = container.Inject;
18
+ this.sideBar = container.Inject;
19
+ this.pageManager = container.Inject("resultPageManager");
18
20
  }
19
21
  fx.ui.pages.ResultPage.prototype = {
20
22
 
@@ -77,9 +79,9 @@ fx.ui.pages.ResultPage.prototype = {
77
79
  this.submenu.to( "trade", param );
78
80
 
79
81
  if ( param["id"] == "rmt" ) {
80
- this.topicPath.set( "リアルトレード:状況を見る" );
82
+ this.topicPath.set( fx.template.Templates.result.topicPath.real );
81
83
  } else {
82
- this.topicPath.set( "バックテスト:結果を見る:" + param["name"] );
84
+ this.topicPath.set( fx.template.Templates.result.topicPath.backtest + param["name"] );
83
85
  }
84
86
  }
85
87
  }
@@ -87,7 +89,7 @@ fx.ui.pages.ResultPage.prototype = {
87
89
  // ログ画面
88
90
  fx.ui.pages.LogResultPage = function() {
89
91
  this.elementId = null; // @Inject
90
- this.outputServiceStub = null; //@Inject
92
+ this.outputServiceStub = container.Inject;
91
93
 
92
94
  var self = this;
93
95
  this.updateButton = new util.Button("subpage-log__update", "update", function() {
@@ -126,8 +128,8 @@ fx.ui.pages.LogResultPage.prototype = {
126
128
  //トレード結果画面
127
129
  fx.ui.pages.TradeResultPage = function() {
128
130
  this.elementId = null; // @Inject
129
- this.tradeResultServiceStub = null; //@Inject
130
- this.dialog = null; // @Inject
131
+ this.tradeResultServiceStub = container.Inject;
132
+ this.dialog = container.Inject;
131
133
  var self = this;
132
134
  this.tradeListTable = new fx.ui.TradeListTable( "subpage-trade__list" );
133
135
  this.tradeListTable.initialize();
@@ -190,7 +192,7 @@ fx.ui.pages.TradeResultPage.prototype = {
190
192
  endDate = new Date( Number(ye), Number(me)-1, Number(de) ).getTime()/1000;
191
193
  } else {
192
194
  this.dialog.show( "warn", {
193
- message : "表示範囲に数値が入力されていません。",
195
+ message : fx.template.Templates.common.errorMsg.notNumber,
194
196
  buttons : [
195
197
  { type:"ok", alt: fx.template.Templates.common.button.ok, key: "Enter" }
196
198
  ]
@@ -247,7 +249,7 @@ fx.ui.pages.TradeResultPage.prototype = {
247
249
  p = list[i]
248
250
  this.collect( p, all );
249
251
  // エージェント別
250
- var t = p.trader || "(不明)";
252
+ var t = p.trader || fx.template.Templates.result.aggregate.unknownAgent;
251
253
  if ( !traders[t] ) {
252
254
  traders[t] = this.init();
253
255
  }
@@ -397,53 +399,57 @@ fx.ui.TradeListTable = function(elementId) {
397
399
  fx.ui.TradeListTable.prototype = util.merge( util.BasicTable, {
398
400
  initialize: function() {
399
401
  var self = this;
402
+ var columnTemplate = fx.template.Templates.common.column;
400
403
  var columnDefs = [
401
- {key:"profit_or_loss", label:"損益", sortable:true, resizeable:true,width:70, formatter: function( cell, record, column, data){
404
+ {key:"profit_or_loss", label:columnTemplate.profitOrLoss, sortable:true, resizeable:true,width:70, formatter: function( cell, record, column, data){
402
405
  cell.innerHTML = "<div style='text-align:right;'>"
403
406
  + fx.ui.pages.TradeResultPage.prototype.decorateProfitOrLoss(data)
404
407
  + "<div>"
405
408
  } },
406
- {key:"swap", label:"スワップ", sortable:true, resizeable:true, width:40, formatter: function( cell, record, column, data){
409
+ {key:"swap", label:columnTemplate.swap, sortable:true, resizeable:true, width:40, formatter: function( cell, record, column, data){
407
410
  cell.innerHTML = "<div style='text-align:right;'>"
408
411
  + fx.ui.pages.TradeResultPage.prototype.decorateProfitOrLoss( data || 0 )
409
412
  + "<div>"
410
413
  } },
411
- {key:"sell_or_buy", label:"種類", sortable:true, resizeable:true,width:20, formatter: function( cell, record, column, data){
412
- cell.innerHTML = data == "sell" ? "売" : "買";
414
+ {key:"sell_or_buy", label:columnTemplate.sellOrBuy, sortable:true, resizeable:true,width:20, formatter: function( cell, record, column, data){
415
+ cell.innerHTML = data == "sell"
416
+ ? fx.template.Templates.common.sell
417
+ : fx.template.Templates.common.buy;
413
418
  } },
414
- {key:"state", label:"状態", sortable:true, resizeable:true,width:50, formatter: function( cell, record, column, data){
419
+ {key:"state", label:columnTemplate.state, sortable:true, resizeable:true,width:50, formatter: function( cell, record, column, data){
420
+ var ps = fx.template.Templates.common.positionState;
415
421
  switch ( data ) {
416
422
  case 0 :
417
- cell.innerHTML = "注文中"; break;
423
+ cell.innerHTML = ps.order; break;
418
424
  case 1 :
419
- cell.innerHTML = "所有中"; break;
425
+ cell.innerHTML = ps.having; break;
420
426
  case 2 :
421
- cell.innerHTML = "決済注文中"; break;
427
+ cell.innerHTML = ps.settle; break;
422
428
  case 3 :
423
- cell.innerHTML = "決済済"; break;
429
+ cell.innerHTML = ps.settled; break;
424
430
  case 4 :
425
- cell.innerHTML = "ロスト"; break;
431
+ cell.innerHTML = ps.lost; break;
426
432
  default :
427
- cell.innerHTML = "不明"; break;
433
+ cell.innerHTML = ps.unknown; break;
428
434
  }
429
435
  }},
430
- {key:"pair", label:"通貨ペア", sortable:true, resizeable:true, formatter: function( cell, record, column, data){
436
+ {key:"pair", label:columnTemplate.pair, sortable:true, resizeable:true, formatter: function( cell, record, column, data){
431
437
  cell.innerHTML = String(data).escapeHTML();
432
438
  }, width:50 },
433
- {key:"rate", label:"レート", sortable:true, resizeable:true,width:50 },
434
- {key:"fix_rate", label:"決済レート", sortable:true, resizeable:true,width:50,formatter: function( cell, record, column, data){
439
+ {key:"rate", label:columnTemplate.rate, sortable:true, resizeable:true,width:50 },
440
+ {key:"fix_rate", label:columnTemplate.fixRate, sortable:true, resizeable:true,width:50,formatter: function( cell, record, column, data){
435
441
  cell.innerHTML = data ? data : "-";
436
442
  } },
437
- {key:"count", label:"数量", sortable:true, resizeable:true,width:30 },
438
- {key:"trader", label:"エージェント", sortable:true, resizeable:true,width:50,formatter: function( cell, record, column, data){
443
+ {key:"count", label:columnTemplate.count, sortable:true, resizeable:true,width:30 },
444
+ {key:"trader", label:columnTemplate.trader, sortable:true, resizeable:true,width:50,formatter: function( cell, record, column, data){
439
445
  cell.innerHTML = data ? data.escapeHTML() : "-";
440
446
  } },
441
- {key:"date", label:"取引日時", sortable:true, resizeable:true,width:118, formatter: function( cell, record, column, data){
447
+ {key:"date", label:columnTemplate.date, sortable:true, resizeable:true,width:118, formatter: function( cell, record, column, data){
442
448
  var d = new Date(data*1000);
443
449
  cell.innerHTML = util.formatDate(d);
444
450
  //cell.innerHTML = '<a href="javascript:util.getSwf(\'chart\').setDate( ' + data + ' );scrollTo( 0, 0 );">' + util.formatDate(d) + '</a>';
445
451
  } },
446
- {key:"fix_date", label:"決済日時", sortable:true, resizeable:true,width:118, formatter: function( cell, record, column, data){
452
+ {key:"fix_date", label:columnTemplate.fixDate, sortable:true, resizeable:true,width:118, formatter: function( cell, record, column, data){
447
453
  if (data) {
448
454
  var d = new Date(data*1000);
449
455
  cell.innerHTML = util.formatDate(d);
@@ -479,45 +485,46 @@ fx.ui.AgentResultListTable = function(elementId) {
479
485
  fx.ui.AgentResultListTable.prototype = util.merge( util.BasicTable, {
480
486
  initialize: function() {
481
487
  var self = this;
488
+ var columnTemplate = fx.template.Templates.common.column;
482
489
  var columnDefs = [
483
- {key:"agentName", label:"名前", sortable:true, resizeable:true, formatter: function( cell, record, column, data){
490
+ {key:"agentName", label:columnTemplate.name, sortable:true, resizeable:true, formatter: function( cell, record, column, data){
484
491
  cell.innerHTML = String(data).escapeHTML();
485
492
  }, width:100 },
486
- {key:"totalProfitOrLoss", label:"損益合計", sortable:true, resizeable:true,width:70, formatter: function( cell, record, column, data){
493
+ {key:"totalProfitOrLoss", label:columnTemplate.totalProfitOrLoss, sortable:true, resizeable:true,width:70, formatter: function( cell, record, column, data){
487
494
  cell.innerHTML = "<div style='text-align:right;'>"
488
495
  + fx.ui.pages.TradeResultPage.prototype.decorateProfitOrLoss(data)
489
496
  + "<div>";
490
497
  } },
491
- {key:"totalSwap", label:"累計スワップ", sortable:true, resizeable:true,width:40, formatter: function( cell, record, column, data){
498
+ {key:"totalSwap", label:columnTemplate.totalSwap, sortable:true, resizeable:true,width:40, formatter: function( cell, record, column, data){
492
499
  cell.innerHTML = "<div style='text-align:right;'>"
493
500
  + fx.ui.pages.TradeResultPage.prototype.decorateProfitOrLoss( data || 0 )
494
501
  + "<div>";
495
502
  } },
496
- {key:"total", label:"取引回数/約定済み", sortable:true, resizeable:true,width:30, formatter: function( cell, record, column, data){
503
+ {key:"total", label:columnTemplate.tradeSummary, sortable:true, resizeable:true,width:30, formatter: function( cell, record, column, data){
497
504
  cell.innerHTML = data + "/" + record.getData().commited;
498
505
  } },
499
- {key:"sell", label:"売/買", sortable:true, resizeable:true,width:30, formatter: function( cell, record, column, data){
506
+ {key:"sell", label:columnTemplate.sellOrBuy, sortable:true, resizeable:true,width:30, formatter: function( cell, record, column, data){
500
507
  cell.innerHTML = data + "/" + record.getData().buy;
501
508
  } },
502
- {key:"winRate", label:"勝率", sortable:true, resizeable:true,width:40, formatter: function( cell, record, column, data){
509
+ {key:"winRate", label:columnTemplate.winRate, sortable:true, resizeable:true,width:40, formatter: function( cell, record, column, data){
503
510
  cell.innerHTML = "<div style='text-align:right;'>" + data + "%<div>";
504
511
  } },
505
- {key:"maxProfit", label:"最大利益", sortable:true, resizeable:true,width:60, formatter: function( cell, record, column, data){
512
+ {key:"maxProfit", label:columnTemplate.maxProfit, sortable:true, resizeable:true,width:60, formatter: function( cell, record, column, data){
506
513
  cell.innerHTML = "<div style='text-align:right;'>"
507
514
  + fx.ui.pages.TradeResultPage.prototype.decorateProfitOrLoss(data)
508
515
  + "<div>";
509
516
  } },
510
- {key:"maxLoss", label:"最大損失", sortable:true, resizeable:true,width:60, formatter: function( cell, record, column, data){
517
+ {key:"maxLoss", label:columnTemplate.maxLoss, sortable:true, resizeable:true,width:60, formatter: function( cell, record, column, data){
511
518
  cell.innerHTML = "<div style='text-align:right;'>"
512
519
  + fx.ui.pages.TradeResultPage.prototype.decorateProfitOrLoss(data)
513
520
  + "<div>";
514
521
  } },
515
- {key:"avgProfitOrLoss", label:"平均損益", sortable:true, resizeable:true,width:50, formatter: function( cell, record, column, data){
522
+ {key:"avgProfitOrLoss", label:columnTemplate.avgProfitOrLoss, sortable:true, resizeable:true,width:50, formatter: function( cell, record, column, data){
516
523
  cell.innerHTML = "<div style='text-align:right;'>"
517
524
  + fx.ui.pages.TradeResultPage.prototype.decorateProfitOrLoss(data)
518
525
  + "<div>";
519
526
  } },
520
- {key:"profitRatio", label:"損益率", sortable:true, resizeable:true,width:40 }
527
+ {key:"profitRatio", label:columnTemplate.profitRatio, sortable:true, resizeable:true,width:40 }
521
528
  ];
522
529
  self.ds = new YAHOO.util.DataSource([]);
523
530
  self.ds.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
@@ -539,9 +546,9 @@ fx.ui.AgentResultListTable.prototype = util.merge( util.BasicTable, {
539
546
  //テスト情報画面
540
547
  fx.ui.pages.InfoResultPage = function() {
541
548
  this.elementId = null; // @Inject
542
- this.processServiceStub = null; //@Inject
543
- this.agentSelector = null; // @Inject
544
- this.dialog = null; // @Inject
549
+ this.processServiceStub = container.Inject;
550
+ this.agentSelector = container.Inject("subpageInfoAgentSelector");
551
+ this.dialog = container.Inject;
545
552
  }
546
553
  fx.ui.pages.InfoResultPage.prototype = {
547
554
  /**
@@ -581,7 +588,9 @@ fx.ui.pages.InfoResultPage.prototype = {
581
588
  this.processServiceStub.get( this.currentProcessId, function( p ) {
582
589
  if ( self.currentProcessId == "rmt" ) {
583
590
  infoEl.innerHTML = fx.template.Templates.submenu.info.rmtInfo.evaluate( {
584
- enable: p.trade_enable ? "する" : "しない"
591
+ enable: p.trade_enable
592
+ ? fx.template.Templates.result.tradeEnable.yes
593
+ : fx.template.Templates.result.tradeEnable.no
585
594
  });
586
595
  } else {
587
596
  var s = new Date( p.start_date*1000 );
@@ -603,9 +612,9 @@ fx.ui.pages.InfoResultPage.prototype = {
603
612
  //グラフ表示設定画面
604
613
  fx.ui.pages.GraphSettingResultPage = function() {
605
614
  this.elementId = null; // @Inject
606
- this.processServiceStub = null; //@Inject
607
- this.outputServiceStub = null; //@Inject
608
- this.dialog = null; // @Inject
615
+ this.processServiceStub = container.Inject;
616
+ this.outputServiceStub = container.Inject;
617
+ this.dialog = container.Inject;
609
618
  }
610
619
  fx.ui.pages.GraphSettingResultPage.prototype = {
611
620
 
@@ -637,39 +646,52 @@ fx.ui.pages.GraphSettingResultPage.prototype = {
637
646
 
638
647
  var self = this;
639
648
  this.processServiceStub.get( this.currentProcessId, function( p ) {
640
- self.agentNameMap = {};
641
- for ( var i=0,n=p.agents.length;i<n;i++ ) {
642
- self.agentNameMap[p.agents[i].id] = p.agents[i].name
643
- }
644
649
  self.outputServiceStub.list_outputs( self.currentProcessId, function( outs ) {
645
650
  var str = "";
646
651
  var index = 0;
647
652
  var tmp = [];
648
653
  for ( var i in outs ) {
649
654
  var itemBody = "";
650
- for ( var j in outs[i] ) {
651
- tmp.push( [i,j, outs[i][j]] );
655
+ var outputs = outs[i]["outputs"] || {};
656
+ var agentName = outs[i]["agent_name"] || "";
657
+ for ( var j in outputs ) {
658
+ tmp.push( [i,j, outputs[j]] );
652
659
  var colorsBody = "";
653
- for ( var k = 0; k < ( outs[i][j].column_count || 1 ); k++ ) {
660
+ for ( var k = 0; k < ( outputs[j].column_count || 1 ); k++ ) {
654
661
  colorsBody += '<div id="submenu-graph_color_' + index + '_' + k + '"></div>';
655
662
  }
656
663
  itemBody += fx.template.Templates.submenu.graph.item.evaluate( {
657
664
  name: j.escapeHTML(),
658
- agentName: i.escapeHTML(),
659
- checked: outs[i][j]["visible"] == false ? "" : 'checked="checked"',
665
+ checked: outputs[j]["visible"] == false ? "" : 'checked="checked"',
660
666
  id : index,
661
667
  colors: colorsBody
662
668
  } );
663
669
  index += 1;
664
670
  }
671
+ if ( !itemBody ) itemBody = fx.template.Templates.submenu.graph.noGraphItem;
665
672
  str += fx.template.Templates.submenu.graph.agent.evaluate( {
666
- agentName: self.agentNameMap[i].escapeHTML() || "(不明)",
673
+ agentName: agentName.escapeHTML() || fx.template.Templates.result.aggregate.unknownAgent,
674
+ remove : self.currentProcessId == "rmt" && !outs[i]["alive"] ? fx.template.Templates.submenu.graph.remove.evaluate( {id:i} ) : "",
675
+ id : i,
667
676
  items: itemBody
668
677
  } );
669
678
  }
670
- el.innerHTML = str || '<div style="margin:10px 0px 0px 0px;">( グラフはありません。)</div>';
679
+ el.innerHTML = str || fx.template.Templates.submenu.graph.noAgent;
671
680
 
672
681
  // イベントを割り当て
682
+ // 削除
683
+ if ( self.currentProcessId == "rmt" ) {
684
+ for ( var i in outs ) {
685
+ (function() {
686
+ var agentId = i;
687
+ var elm = document.getElementById( "output_" + agentId + "_delete" );
688
+ if (!elm) return;
689
+ elm.onclick = function() {
690
+ self.remove( self.currentProcessId, agentId );
691
+ };
692
+ })();
693
+ }
694
+ }
673
695
  self.pickers = [];
674
696
  for ( var i=0; i<index; i++ ) {
675
697
  (function() {
@@ -712,6 +734,34 @@ fx.ui.pages.GraphSettingResultPage.prototype = {
712
734
  updateSetting: function( target, properties ) {
713
735
  this.outputServiceStub.set_properties(
714
736
  this.currentProcessId, target, properties, null, null ); // TODO
737
+ },
738
+ /**
739
+ * 出力を削除する。
740
+ */
741
+ remove : function( processId, agentId ) {
742
+ var self = this;
743
+ this.dialog.show( "input", {
744
+ message : fx.template.Templates.submenu.graph.removeMsg,
745
+ buttons : [
746
+ { type:"ok",
747
+ alt: fx.template.Templates.common.button.ok,
748
+ key: "Enter",
749
+ action: function(dialog){
750
+ self.outputServiceStub.delete_output( processId, agentId, function(p) {
751
+ var elm = document.getElementById( "output_" + agentId );
752
+ elm.parentNode.removeChild(elm);
753
+ elm = document.getElementById( "output_t_" + agentId );
754
+ elm.parentNode.removeChild(elm);
755
+
756
+ // グラフに転送
757
+ util.getSwf("chart").removeGraph( agentId );
758
+ }, function(){} ); // TODO
759
+ return true;
760
+ }
761
+ },
762
+ { type:"cancel", alt: fx.template.Templates.common.button.cancel, key: "Esc" }
763
+ ]
764
+ } );
715
765
  }
716
766
  }
717
767
 
@@ -5,12 +5,12 @@ namespace( "fx.ui.pages" )
5
5
  // バックテスト新規作成
6
6
  fx.ui.pages.RtSettingPage = function() {
7
7
  this.elementId = null // @Inject
8
- this.processServiceStub = null; //@Inject
8
+ this.processServiceStub = container.Inject;
9
9
 
10
- this.agentSelector = null; //@Inject
11
- this.dialog = null; // @Inject
12
- this.topicPath = null; // @Inject
13
- this.tradeEnable = null; // @Inject
10
+ this.agentSelector = container.Inject("rtSettingAgentSelector");
11
+ this.dialog = container.Inject;
12
+ this.topicPath = container.Inject;
13
+ this.tradeEnable = container.Inject;
14
14
 
15
15
  // ボタン
16
16
  var self = this;
@@ -42,7 +42,7 @@ fx.ui.pages.RtSettingPage.prototype = {
42
42
  msg.innerHTML = "";
43
43
  msg.style.display = "none";
44
44
 
45
- this.topicPath.set( "リアルトレード:設定" );
45
+ this.topicPath.set( fx.template.Templates.rtsetting.topicPath );
46
46
 
47
47
  // 既存の設定情報を取得
48
48
  this.reloadAgents();
@@ -64,7 +64,7 @@ fx.ui.pages.RtSettingPage.prototype = {
64
64
  // エラーチェック
65
65
  if ( this.agentSelector.hasError() ) {
66
66
  this.dialog.show( "warn", {
67
- message : "エージェントの設定に問題があります。",
67
+ message : fx.template.Templates.common.errorMsg.illegalAgentSetting,
68
68
  buttons : [
69
69
  { type:"ok", alt: fx.template.Templates.common.button.ok, key: "Enter" }
70
70
  ]
@@ -76,28 +76,51 @@ fx.ui.pages.RtSettingPage.prototype = {
76
76
  // ダイアログを開く
77
77
  var self = this;
78
78
  this.dialog.show( "input", {
79
- message : "設定を反映します。よろしいですか?<br/>",
79
+ message : fx.template.Templates.rtsetting.apply.msg,
80
80
  buttons : [
81
- { type:"ok",
82
- alt: fx.template.Templates.common.button.ok,
81
+ { type:"ok",
82
+ alt: fx.template.Templates.common.button.ok,
83
83
  key: "Enter",
84
84
  action: function(dialog){
85
85
  var enable = document.getElementById("rt-setting_trade-enable").checked;
86
- self.updateSetting( enable, agents, function() {
86
+ self.updateSetting( enable, agents, function(result) {
87
+
88
+ // 失敗した操作があればメッセージを表示
89
+ var error = "";
90
+ for ( var i in result ) {
91
+ var operation = fx.template.Templates.rtsetting.update.op.remove;
92
+ switch (result[i]["operation"]) {
93
+ case "add" : operation = fx.template.Templates.rtsetting.update.op.add; break;
94
+ case "update" : operation = fx.template.Templates.rtsetting.update.op.update; break;
95
+ }
96
+ error += fx.template.Templates.rtsetting.update.errorDetail.evaluate({
97
+ "operation": operation,
98
+ "name" : result[i]["info"]["name"],
99
+ "cause" : result[i]["cause"]
100
+ });
101
+ }
102
+ if ( error ) {
103
+ self.dialog.show( "warn", {
104
+ message : fx.template.Templates.rtsetting.update.error.evaluate({
105
+ "error":error.escapeHTML()})
106
+ });
107
+ }
108
+
87
109
  // 更新時刻を表示
88
110
  var dateStr = util.formatDate( new Date() );
89
111
  var msg = document.getElementById("rt-setting_msg");
90
- msg.innerHTML = "※設定を反映しました。( " + dateStr + " )";
112
+ msg.innerHTML =fx.template.Templates.rtsetting.apply.success.evaluate( {dateStr:dateStr} );
91
113
  msg.style.display = "block";
92
114
 
93
115
  // 自動更新設定を更新
94
116
  self.tradeEnable.set( enable );
95
117
 
96
- }, function(error){
118
+ }, function(error, detail){
97
119
  self.dialog.show( "warn", {
98
- message : fx.template.Templates.rtsetting.apply.error.evaluate({"error":error[0].error.escapeHTML()})
120
+ message : fx.template.Templates.rtsetting.apply.error.evaluate({
121
+ "error":(String(error) + "\n" + String(detail["backtrace"])).escapeHTML()})
99
122
  });
100
- });
123
+ });
101
124
  } },
102
125
  { type:"cancel", alt: fx.template.Templates.common.button.cancel, key: "Esc" }
103
126
  ]