unageanu-jiji 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +0 -0
- data/README +0 -0
- data/bin/jiji.rb +6 -0
- data/html/css/calendar.css +432 -0
- data/html/css/datatable.css +299 -0
- data/html/css/default.css +557 -0
- data/html/css/dialog.css +77 -0
- data/html/img/auto_trade_off.gif +0 -0
- data/html/img/auto_trade_on.gif +0 -0
- data/html/img/back_bottom.gif +0 -0
- data/html/img/back_middle.gif +0 -0
- data/html/img/back_top.gif +0 -0
- data/html/img/bt-create-title-1.gif +0 -0
- data/html/img/bt-create-title-2.gif +0 -0
- data/html/img/bt-create-title-3.gif +0 -0
- data/html/img/button_add.gif +0 -0
- data/html/img/button_add_gray.gif +0 -0
- data/html/img/button_add_over.gif +0 -0
- data/html/img/button_apply.gif +0 -0
- data/html/img/button_apply_gray.gif +0 -0
- data/html/img/button_apply_over.gif +0 -0
- data/html/img/button_calendar.gif +0 -0
- data/html/img/button_calendar_over.gif +0 -0
- data/html/img/button_cancel.gif +0 -0
- data/html/img/button_cancel.jpg +0 -0
- data/html/img/button_cancel_gray.gif +0 -0
- data/html/img/button_cancel_over.gif +0 -0
- data/html/img/button_cancel_over.jpg +0 -0
- data/html/img/button_close.gif +0 -0
- data/html/img/button_close_gray.gif +0 -0
- data/html/img/button_close_over.gif +0 -0
- data/html/img/button_ok.gif +0 -0
- data/html/img/button_ok_gray.gif +0 -0
- data/html/img/button_ok_over.gif +0 -0
- data/html/img/button_remove.gif +0 -0
- data/html/img/button_remove_gray.gif +0 -0
- data/html/img/button_remove_over.gif +0 -0
- data/html/img/button_start.gif +0 -0
- data/html/img/button_start_over.gif +0 -0
- data/html/img/button_update.gif +0 -0
- data/html/img/button_update_gray.gif +0 -0
- data/html/img/button_update_over.gif +0 -0
- data/html/img/circle.gif +0 -0
- data/html/img/delta.gif +0 -0
- data/html/img/dialog_info.jpg +0 -0
- data/html/img/dialog_input.jpg +0 -0
- data/html/img/dialog_warn.jpg +0 -0
- data/html/img/dt-arrow-dn.png +0 -0
- data/html/img/dt-arrow-up.png +0 -0
- data/html/img/foot.jpg +0 -0
- data/html/img/h3_bt-create_0.gif +0 -0
- data/html/img/h3_bt-create_1.gif +0 -0
- data/html/img/h3_bt-create_2.gif +0 -0
- data/html/img/h3_result_0.gif +0 -0
- data/html/img/h3_result_1.gif +0 -0
- data/html/img/h3_result_2.gif +0 -0
- data/html/img/h3_result_3.gif +0 -0
- data/html/img/h3_result_4.gif +0 -0
- data/html/img/h3_result_5.gif +0 -0
- data/html/img/h3_result_6.gif +0 -0
- data/html/img/h3_rt-setting_0.gif +0 -0
- data/html/img/h3_rt-setting_1.gif +0 -0
- data/html/img/head.jpg +0 -0
- data/html/img/line_white.gif +0 -0
- data/html/img/loading.gif +0 -0
- data/html/img/panel_100_bottom.gif +0 -0
- data/html/img/panel_100_middle.gif +0 -0
- data/html/img/panel_100_top.gif +0 -0
- data/html/img/panel_140_650_b.gif +0 -0
- data/html/img/panel_140_650_m.gif +0 -0
- data/html/img/panel_140_650_t.gif +0 -0
- data/html/img/panel_140_660_b.gif +0 -0
- data/html/img/panel_140_660_m.gif +0 -0
- data/html/img/panel_140_660_t.gif +0 -0
- data/html/img/panel_140_b.gif +0 -0
- data/html/img/panel_140_m.gif +0 -0
- data/html/img/panel_140_t.gif +0 -0
- data/html/img/panel_260_b.gif +0 -0
- data/html/img/panel_260_m.gif +0 -0
- data/html/img/panel_260_t.gif +0 -0
- data/html/img/panel_300_b.gif +0 -0
- data/html/img/panel_300_m.gif +0 -0
- data/html/img/panel_300_t.gif +0 -0
- data/html/img/panel_320_b.gif +0 -0
- data/html/img/panel_320_m.gif +0 -0
- data/html/img/panel_320_t.gif +0 -0
- data/html/img/panel_360_b.gif +0 -0
- data/html/img/panel_360_m.gif +0 -0
- data/html/img/panel_360_t.gif +0 -0
- data/html/img/panel_380_b.gif +0 -0
- data/html/img/panel_380_m.gif +0 -0
- data/html/img/panel_380_t.gif +0 -0
- data/html/img/panel_500_b.gif +0 -0
- data/html/img/panel_500_m.gif +0 -0
- data/html/img/panel_500_t.gif +0 -0
- data/html/img/panel_620_b.gif +0 -0
- data/html/img/panel_620_m.gif +0 -0
- data/html/img/panel_620_t.gif +0 -0
- data/html/img/panel_780_b.gif +0 -0
- data/html/img/panel_780_m.gif +0 -0
- data/html/img/panel_780_t.gif +0 -0
- data/html/img/problem.gif +0 -0
- data/html/img/progressbar.gif +0 -0
- data/html/img/result-title-1-1.gif +0 -0
- data/html/img/result-title-1-2.gif +0 -0
- data/html/img/result-title-2-1.gif +0 -0
- data/html/img/result-title-2-2.gif +0 -0
- data/html/img/result-title-3-1.gif +0 -0
- data/html/img/result-title-4-1.gif +0 -0
- data/html/img/rt-setting-title-1.gif +0 -0
- data/html/img/rt-setting-title-2.gif +0 -0
- data/html/img/s.gif +0 -0
- data/html/img/scroll.gif +0 -0
- data/html/img/separator.gif +0 -0
- data/html/img/sidebar_agent.png +0 -0
- data/html/img/sidebar_agent_edit.png +0 -0
- data/html/img/sidebar_agent_edit_agent.png +0 -0
- data/html/img/sidebar_agent_edit_agent_over.png +0 -0
- data/html/img/sidebar_agent_edit_agent_s.png +0 -0
- data/html/img/sidebar_agent_edit_over.png +0 -0
- data/html/img/sidebar_agent_edit_s.png +0 -0
- data/html/img/sidebar_agent_edit_shared_lib.png +0 -0
- data/html/img/sidebar_agent_edit_shared_lib_over.png +0 -0
- data/html/img/sidebar_agent_edit_shared_lib_s.png +0 -0
- data/html/img/sidebar_back.gif +0 -0
- data/html/img/sidebar_bt.png +0 -0
- data/html/img/sidebar_bt_create.png +0 -0
- data/html/img/sidebar_bt_create_over.png +0 -0
- data/html/img/sidebar_bt_create_s.png +0 -0
- data/html/img/sidebar_bt_result.png +0 -0
- data/html/img/sidebar_bt_result_over.png +0 -0
- data/html/img/sidebar_bt_result_s.png +0 -0
- data/html/img/sidebar_result_rmt.png +0 -0
- data/html/img/sidebar_result_rmt_over.png +0 -0
- data/html/img/sidebar_result_rmt_s.png +0 -0
- data/html/img/sidebar_rt.png +0 -0
- data/html/img/sidebar_rt_setting.png +0 -0
- data/html/img/sidebar_rt_setting_over.png +0 -0
- data/html/img/sidebar_rt_setting_s.png +0 -0
- data/html/img/sprite.png +0 -0
- data/html/img/submenu_agents.png +0 -0
- data/html/img/submenu_agents_over.png +0 -0
- data/html/img/submenu_agents_s.png +0 -0
- data/html/img/submenu_graph.png +0 -0
- data/html/img/submenu_graph_over.png +0 -0
- data/html/img/submenu_graph_s.png +0 -0
- data/html/img/submenu_info.png +0 -0
- data/html/img/submenu_info_over.png +0 -0
- data/html/img/submenu_info_s.png +0 -0
- data/html/img/submenu_log.png +0 -0
- data/html/img/submenu_log_over.png +0 -0
- data/html/img/submenu_log_s.png +0 -0
- data/html/img/submenu_operation.png +0 -0
- data/html/img/submenu_operation_over.png +0 -0
- data/html/img/submenu_operation_s.png +0 -0
- data/html/img/submenu_trade.png +0 -0
- data/html/img/submenu_trade_over.png +0 -0
- data/html/img/submenu_trade_s.png +0 -0
- data/html/img/td_over.gif +0 -0
- data/html/img/td_over_d.gif +0 -0
- data/html/img/td_selected.gif +0 -0
- data/html/img/thead.gif +0 -0
- data/html/img/transparent.gif +0 -0
- data/html/index.html +480 -0
- data/html/js/W3CDTF.js +131 -0
- data/html/js/agent-editor-page.js +350 -0
- data/html/js/agent-selector.js +642 -0
- data/html/js/app.js +226 -0
- data/html/js/bt-create-page.js +186 -0
- data/html/js/codepress/codepress.css +21 -0
- data/html/js/codepress/codepress.html +35 -0
- data/html/js/codepress/codepress.js +138 -0
- data/html/js/codepress/engines/gecko.js +293 -0
- data/html/js/codepress/engines/khtml.js +0 -0
- data/html/js/codepress/engines/msie.js +304 -0
- data/html/js/codepress/engines/older.js +0 -0
- data/html/js/codepress/engines/opera.js +260 -0
- data/html/js/codepress/images/line-numbers.gif +0 -0
- data/html/js/codepress/images/line-numbers.png +0 -0
- data/html/js/codepress/index.html +443 -0
- data/html/js/codepress/languages/asp.css +71 -0
- data/html/js/codepress/languages/asp.js +117 -0
- data/html/js/codepress/languages/autoit.css +13 -0
- data/html/js/codepress/languages/autoit.js +32 -0
- data/html/js/codepress/languages/csharp.css +9 -0
- data/html/js/codepress/languages/csharp.js +25 -0
- data/html/js/codepress/languages/css.css +10 -0
- data/html/js/codepress/languages/css.js +23 -0
- data/html/js/codepress/languages/generic.css +9 -0
- data/html/js/codepress/languages/generic.js +25 -0
- data/html/js/codepress/languages/html.css +13 -0
- data/html/js/codepress/languages/html.js +59 -0
- data/html/js/codepress/languages/java.css +7 -0
- data/html/js/codepress/languages/java.js +24 -0
- data/html/js/codepress/languages/javascript.css +8 -0
- data/html/js/codepress/languages/javascript.js +30 -0
- data/html/js/codepress/languages/perl.css +11 -0
- data/html/js/codepress/languages/perl.js +27 -0
- data/html/js/codepress/languages/php.css +12 -0
- data/html/js/codepress/languages/php.js +61 -0
- data/html/js/codepress/languages/ruby.css +10 -0
- data/html/js/codepress/languages/ruby.js +26 -0
- data/html/js/codepress/languages/sql.css +10 -0
- data/html/js/codepress/languages/sql.js +30 -0
- data/html/js/codepress/languages/text.css +5 -0
- data/html/js/codepress/languages/text.js +9 -0
- data/html/js/codepress/languages/vbscript.css +71 -0
- data/html/js/codepress/languages/vbscript.js +117 -0
- data/html/js/codepress/languages/xsl.css +15 -0
- data/html/js/codepress/languages/xsl.js +103 -0
- data/html/js/codepress/license.txt +458 -0
- data/html/js/container-min.js +1 -0
- data/html/js/container-utils.js +78 -0
- data/html/js/dialog.js +270 -0
- data/html/js/edit_area/autocompletion.js +493 -0
- data/html/js/edit_area/edit_area.css +507 -0
- data/html/js/edit_area/edit_area.js +510 -0
- data/html/js/edit_area/edit_area_compressor.php +408 -0
- data/html/js/edit_area/edit_area_full.gz +0 -0
- data/html/js/edit_area/edit_area_full.js +38 -0
- data/html/js/edit_area/edit_area_full_with_plugins.gz +0 -0
- data/html/js/edit_area/edit_area_full_with_plugins.js +39 -0
- data/html/js/edit_area/edit_area_functions.js +1098 -0
- data/html/js/edit_area/edit_area_loader.js +1070 -0
- data/html/js/edit_area/elements_functions.js +337 -0
- data/html/js/edit_area/highlight.js +283 -0
- data/html/js/edit_area/images/Thumbs.db +0 -0
- data/html/js/edit_area/images/autocompletion.gif +0 -0
- data/html/js/edit_area/images/close.gif +0 -0
- data/html/js/edit_area/images/fullscreen.gif +0 -0
- data/html/js/edit_area/images/go_to_line.gif +0 -0
- data/html/js/edit_area/images/help.gif +0 -0
- data/html/js/edit_area/images/highlight.gif +0 -0
- data/html/js/edit_area/images/load.gif +0 -0
- data/html/js/edit_area/images/move.gif +0 -0
- data/html/js/edit_area/images/newdocument.gif +0 -0
- data/html/js/edit_area/images/opacity.png +0 -0
- data/html/js/edit_area/images/processing.gif +0 -0
- data/html/js/edit_area/images/redo.gif +0 -0
- data/html/js/edit_area/images/reset_highlight.gif +0 -0
- data/html/js/edit_area/images/save.gif +0 -0
- data/html/js/edit_area/images/search.gif +0 -0
- data/html/js/edit_area/images/smooth_selection.gif +0 -0
- data/html/js/edit_area/images/spacer.gif +0 -0
- data/html/js/edit_area/images/statusbar_resize.gif +0 -0
- data/html/js/edit_area/images/undo.gif +0 -0
- data/html/js/edit_area/keyboard.js +145 -0
- data/html/js/edit_area/langs/cs.js +65 -0
- data/html/js/edit_area/langs/de.js +65 -0
- data/html/js/edit_area/langs/dk.js +65 -0
- data/html/js/edit_area/langs/en.js +65 -0
- data/html/js/edit_area/langs/eo.js +65 -0
- data/html/js/edit_area/langs/es.js +62 -0
- data/html/js/edit_area/langs/fr.js +65 -0
- data/html/js/edit_area/langs/hr.js +65 -0
- data/html/js/edit_area/langs/it.js +65 -0
- data/html/js/edit_area/langs/ja.js +65 -0
- data/html/js/edit_area/langs/mk.js +65 -0
- data/html/js/edit_area/langs/nl.js +65 -0
- data/html/js/edit_area/langs/pl.js +65 -0
- data/html/js/edit_area/langs/pt.js +65 -0
- data/html/js/edit_area/langs/ru.js +65 -0
- data/html/js/edit_area/langs/sk.js +65 -0
- data/html/js/edit_area/license_apache.txt +7 -0
- data/html/js/edit_area/license_bsd.txt +10 -0
- data/html/js/edit_area/license_lgpl.txt +458 -0
- data/html/js/edit_area/manage_area.js +466 -0
- data/html/js/edit_area/plugins/charmap/charmap.js +90 -0
- data/html/js/edit_area/plugins/charmap/css/charmap.css +64 -0
- data/html/js/edit_area/plugins/charmap/images/charmap.gif +0 -0
- data/html/js/edit_area/plugins/charmap/jscripts/map.js +373 -0
- data/html/js/edit_area/plugins/charmap/langs/cs.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/de.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/dk.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/en.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/eo.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/es.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/fr.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/hr.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/it.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/ja.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/mk.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/nl.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/pl.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/pt.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/ru.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/sk.js +6 -0
- data/html/js/edit_area/plugins/charmap/popup.html +24 -0
- data/html/js/edit_area/plugins/test/css/test.css +3 -0
- data/html/js/edit_area/plugins/test/images/Thumbs.db +0 -0
- data/html/js/edit_area/plugins/test/images/test.gif +0 -0
- data/html/js/edit_area/plugins/test/langs/cs.js +4 -0
- data/html/js/edit_area/plugins/test/langs/de.js +4 -0
- data/html/js/edit_area/plugins/test/langs/dk.js +4 -0
- data/html/js/edit_area/plugins/test/langs/en.js +4 -0
- data/html/js/edit_area/plugins/test/langs/eo.js +4 -0
- data/html/js/edit_area/plugins/test/langs/es.js +4 -0
- data/html/js/edit_area/plugins/test/langs/fr.js +4 -0
- data/html/js/edit_area/plugins/test/langs/hr.js +4 -0
- data/html/js/edit_area/plugins/test/langs/it.js +4 -0
- data/html/js/edit_area/plugins/test/langs/ja.js +4 -0
- data/html/js/edit_area/plugins/test/langs/mk.js +4 -0
- data/html/js/edit_area/plugins/test/langs/nl.js +4 -0
- data/html/js/edit_area/plugins/test/langs/pl.js +4 -0
- data/html/js/edit_area/plugins/test/langs/pt.js +4 -0
- data/html/js/edit_area/plugins/test/langs/ru.js +4 -0
- data/html/js/edit_area/plugins/test/langs/sk.js +4 -0
- data/html/js/edit_area/plugins/test/test.js +110 -0
- data/html/js/edit_area/plugins/test/test2.js +1 -0
- data/html/js/edit_area/reg_syntax.js +164 -0
- data/html/js/edit_area/reg_syntax/basic.js +69 -0
- data/html/js/edit_area/reg_syntax/brainfuck.js +44 -0
- data/html/js/edit_area/reg_syntax/c.js +62 -0
- data/html/js/edit_area/reg_syntax/coldfusion.js +119 -0
- data/html/js/edit_area/reg_syntax/cpp.js +65 -0
- data/html/js/edit_area/reg_syntax/css.js +84 -0
- data/html/js/edit_area/reg_syntax/html.js +50 -0
- data/html/js/edit_area/reg_syntax/js.js +93 -0
- data/html/js/edit_area/reg_syntax/pas.js +82 -0
- data/html/js/edit_area/reg_syntax/perl.js +88 -0
- data/html/js/edit_area/reg_syntax/php.js +156 -0
- data/html/js/edit_area/reg_syntax/python.js +144 -0
- data/html/js/edit_area/reg_syntax/robotstxt.js +24 -0
- data/html/js/edit_area/reg_syntax/ruby.js +67 -0
- data/html/js/edit_area/reg_syntax/sql.js +55 -0
- data/html/js/edit_area/reg_syntax/tsql.js +87 -0
- data/html/js/edit_area/reg_syntax/vb.js +52 -0
- data/html/js/edit_area/reg_syntax/xml.js +56 -0
- data/html/js/edit_area/regexp.js +135 -0
- data/html/js/edit_area/resize_area.js +82 -0
- data/html/js/edit_area/search_replace.js +174 -0
- data/html/js/edit_area/template.html +99 -0
- data/html/js/json-broker-client.js +61 -0
- data/html/js/page-manager.js +93 -0
- data/html/js/prototype.js +4184 -0
- data/html/js/result-page.js +707 -0
- data/html/js/rt-setting-page.js +122 -0
- data/html/js/sidebar.js +246 -0
- data/html/js/templates.js +208 -0
- data/html/js/utils.js +716 -0
- data/html/js/uuid.js +103 -0
- data/html/swf/chart.swf +0 -0
- data/lib/jiji/agent/agent.rb +93 -0
- data/lib/jiji/agent/agent_manager.rb +133 -0
- data/lib/jiji/agent/agent_registry.rb +248 -0
- data/lib/jiji/agent/permitter.rb +128 -0
- data/lib/jiji/agent/util.rb +16 -0
- data/lib/jiji/collector.rb +219 -0
- data/lib/jiji/command.rb +129 -0
- data/lib/jiji/configuration.rb +80 -0
- data/lib/jiji/dao/rate_dao.rb +149 -0
- data/lib/jiji/dao/timed_data_dao.rb +334 -0
- data/lib/jiji/dao/trade_result_dao.rb +128 -0
- data/lib/jiji/error.rb +33 -0
- data/lib/jiji/models.rb +169 -0
- data/lib/jiji/observer.rb +105 -0
- data/lib/jiji/operator.rb +405 -0
- data/lib/jiji/output.rb +165 -0
- data/lib/jiji/process.rb +182 -0
- data/lib/jiji/process_manager.rb +189 -0
- data/lib/jiji/registry.rb +255 -0
- data/lib/jiji/server.rb +115 -0
- data/lib/jiji/service/agent_service.rb +131 -0
- data/lib/jiji/service/hello_service.rb +10 -0
- data/lib/jiji/service/output_service.rb +58 -0
- data/lib/jiji/service/process_service.rb +78 -0
- data/lib/jiji/service/rate_service.rb +33 -0
- data/lib/jiji/service/system_service.rb +14 -0
- data/lib/jiji/service/trade_result_service.rb +32 -0
- data/lib/jiji/single_click_client.rb +95 -0
- data/lib/jiji/util/block_to_session.rb +70 -0
- data/lib/jiji/util/cache.rb +79 -0
- data/lib/jiji/util/csv_append_support.rb +15 -0
- data/lib/jiji/util/file_lock.rb +86 -0
- data/lib/jiji/util/fix_yaml_bug.rb +11 -0
- data/lib/jiji/util/iterator.rb +70 -0
- data/lib/jiji/util/json_broker.rb +53 -0
- data/lib/jiji/util/json_rpc_requestor.rb +30 -0
- data/lib/jiji/util/synchronize_interceptor.rb +41 -0
- data/lib/jiji/util/thread_use_generator.rb +52 -0
- data/lib/jiji/util/util.rb +179 -0
- data/swf/build.xml +23 -0
- data/swf/chart/FxChart-config.xml +9 -0
- data/swf/chart/FxChart.mxml +17 -0
- data/swf/chart/fx/chart/Chart.as +155 -0
- data/swf/chart/fx/chart/ctrl/AutoUpdate.as +96 -0
- data/swf/chart/fx/chart/ctrl/Controller.as +258 -0
- data/swf/chart/fx/chart/ctrl/Event.as +75 -0
- data/swf/chart/fx/chart/model/Model.as +226 -0
- data/swf/chart/fx/chart/model/TimedData.as +40 -0
- data/swf/chart/fx/chart/ui/AbstractChartUI.as +59 -0
- data/swf/chart/fx/chart/ui/AbstractDrawChartUI.as +63 -0
- data/swf/chart/fx/chart/ui/Constants.as +233 -0
- data/swf/chart/fx/chart/ui/InformationWindow.as +224 -0
- data/swf/chart/fx/chart/ui/LayerManager.as +95 -0
- data/swf/chart/fx/chart/ui/Loading.as +32 -0
- data/swf/chart/fx/chart/ui/Pointer.as +59 -0
- data/swf/chart/fx/chart/ui/RangeInfoWindow.as +84 -0
- data/swf/chart/fx/chart/ui/RenderingContext.as +54 -0
- data/swf/chart/fx/chart/ui/ScaleSelector.as +95 -0
- data/swf/chart/fx/chart/ui/Scroll.as +240 -0
- data/swf/chart/fx/chart/ui/ScrollBar.as +378 -0
- data/swf/chart/fx/chart/ui/Stage.as +97 -0
- data/swf/chart/fx/chart/ui/TradeDetailWindow.as +146 -0
- data/swf/chart/fx/chart/ui/TradeResult.as +334 -0
- data/swf/chart/fx/chart/ui/Window.as +96 -0
- data/swf/chart/fx/chart/ui/candle/Axis.as +112 -0
- data/swf/chart/fx/chart/ui/candle/Candle.as +79 -0
- data/swf/chart/fx/chart/ui/candle/CandleChart.as +81 -0
- data/swf/chart/fx/chart/ui/graph/Graph.as +198 -0
- data/swf/chart/fx/chart/ui/graph/GraphManager.as +177 -0
- data/swf/chart/fx/chart/ui/resource/buy.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/cursor_hand.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/diff_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_buy.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_buy_1.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_buy_2.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_buy_3.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_sell.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_sell_1.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_sell_2.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_sell_3.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/draw_buy.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/draw_sell.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/end_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/fixed.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/loading.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/max_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/min_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_a.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_handle.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_handle_a.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_handle_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_left.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_left_a.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_left_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_right.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_right_a.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_right_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_handle.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_info_handle.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_d.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_down.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_g.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_up.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_outer.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_outer_left.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_outer_right.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_d.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_down.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_g.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_up.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_slider_left.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_slider_right.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/sell.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/start_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/stripe.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/stripe_b.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/stripe_r.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/unfixed.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_buy.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_buy_1.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_buy_2.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_buy_3.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_sell.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_sell_1.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_sell_2.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_sell_3.gif +0 -0
- data/swf/chart/fx/net/StubFactory.as +113 -0
- data/swf/chart/fx/util/ListenerSupport.as +55 -0
- data/swf/chart/fx/util/PositionManager.as +94 -0
- data/swf/chart/fx/util/ScaleFormatter.as +156 -0
- data/swf/chart/fx/util/Util.as +61 -0
- data/swf/chart/log.as +40 -0
- data/swf/lib/corelib.swc +0 -0
- data/test/BackCollectorTest/basic/2008-08-04/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-04/USDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-04/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-05/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-05/USDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-05/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-06/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-06/USDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-06/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-07/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-07/USDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-07/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-05.csv +5 -0
- data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-05.csv +5 -0
- data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-05.csv +5 -0
- data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-04/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-04/USDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-04/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-06/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-06/USDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-06/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-07/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-07/USDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-07/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/lack/AUDJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/lack/AUDJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/lack/AUDJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/lack/USDJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/lack/USDJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/lack/USDJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/lack/ZARJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/lack/ZARJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/lack/ZARJPY/raw/2008-08-07.csv +5 -0
- data/test/ProcessManagerTest/agents/moving_average.rb +95 -0
- data/test/ProcessManagerTest/conf/configuration.yaml +19 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-21.csv +5853 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-22.csv +5821 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-23.csv +5921 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-24.csv +5956 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-25.csv +5796 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-21.csv +5853 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-22.csv +5821 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-23.csv +5921 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-24.csv +5956 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-25.csv +5796 -0
- data/test/all_tests.rb +26 -0
- data/test/service/all_service_tests.rb +10 -0
- data/test/service/test_AgentService.rb +185 -0
- data/test/service/test_OutputService.rb +33 -0
- data/test/service/test_RateService.rb +56 -0
- data/test/test_AgentManager.rb +307 -0
- data/test/test_AgentRegistory.rb +566 -0
- data/test/test_BackTestCollector.rb +281 -0
- data/test/test_BlockToSession.rb +74 -0
- data/test/test_CSV.rb +85 -0
- data/test/test_Collector.rb +246 -0
- data/test/test_Configuration.rb +61 -0
- data/test/test_Configuration_a.yaml +6 -0
- data/test/test_Operator.rb +501 -0
- data/test/test_Output.rb +169 -0
- data/test/test_Output_registry.rb +49 -0
- data/test/test_PeriodicallyAgent.rb +180 -0
- data/test/test_Permitter.rb +217 -0
- data/test/test_Process.rb +186 -0
- data/test/test_ProcessManager.rb +312 -0
- data/test/test_RateDao.rb +697 -0
- data/test/test_SingleClickClient.rb +115 -0
- data/test/test_SynchronizeInterceptor.rb +75 -0
- data/test/test_TradeResultDao.rb +487 -0
- data/test/test_configuration.yaml +16 -0
- data/test/testutils.rb +37 -0
- metadata +750 -0
@@ -0,0 +1 @@
|
|
1
|
+
if(typeof container=="undefined"){container={}}container.VERSION="0.3.0";container.Container=function(B){var A=new container.Binder({});B(A);this.defs=A.defs;this.creating=[];this.typeCache={};this.nameCache={};var C=this;this.eachComponentDef(function(E){if(E&&E[container.Annotation.Container]&&E[container.Annotation.Container][container.Annotation.Scope]==container.Scope.EagerSingleton){C.create(E)}if(E&&E[container.Annotation.Container]&&E[container.Annotation.Container][container.Annotation.Name]){var D=E[container.Annotation.Container][container.Annotation.Name];if(!C.nameCache[D]){C.nameCache[D]=[]}C.nameCache[D].push(E)}})};container.Container.prototype={get:function(A){if(A instanceof container.Type){if(!this.typeCache[A]){this._createTypeCahce(A)}if(this.typeCache[A].length>0){return this.create(this.typeCache[A][0])}else{throw container.createError(new Error(),container.ErrorCode.ComponentNotFound,"compoent not found.",{"type":A})}}else{if(this.nameCache[A]&&this.nameCache[A].length>0){return this.create(this.nameCache[A][0])}else{throw container.createError(new Error(),container.ErrorCode.ComponentNotFound,"compoent not found.",{"name":A})}}},gets:function(D){var C=[];if(D instanceof container.Type){if(!this.typeCache[D]){this._createTypeCahce(D)}var A=this.typeCache[D];for(var B=0;B<A.length;B++){C.push(this.create(A[B]))}}else{if(this.nameCache[D]){var A=this.nameCache[D];for(var B=0;B<A.length;B++){C.push(this.create(A[B]))}}}return C},destroy:function(){var A=this;this.eachComponentDef(function(D){if(!D.instance){return }var E=D.instance;var B=D[container.Annotation.Container];if(!B||!B[container.Annotation.Destroy]){return }var C=B[container.Annotation.Destroy];if(typeof C=="string"){E[C].apply(E,[this])}else{if(typeof C=="function"){C(E,A)}else{throw container.createError(new Error(),container.ErrorCode.IllegalDefinition,"illegal destroy method. string or function is supported.",{"def":D})}}D.instance=null})},create:function(A){if(A.instance){return A.instance}if(this._isCreating(A)){throw container.createError(new Error(),container.ErrorCode.CircularReference,"circulative component creation.",{"def":A})}try{this.creating.push(A);var E=A.constractor(this);A.instance=E;var C=A[container.Annotation.Container]||{};if(C[container.Annotation.Inject]){var H=C[container.Annotation.Inject];for(var I in H){if(H[I] instanceof container.inner.Component){E[I]=this.get(H[I].name)}else{if(H[I] instanceof container.inner.Components){E[I]=this.gets(H[I].name)}else{if(H[I] instanceof container.inner.Provider){E[I]=H[I].func(E,this)}else{E[I]=H[I]}}}}}if(C[container.Annotation.Initialize]){var G=C[container.Annotation.Initialize];if(typeof G=="string"){E[G].apply(E,[this])}else{if(typeof G=="function"){G(E,this)}else{throw container.createError(new Error(),container.ErrorCode.IllegalDefinition,"illegal initialize method. string or function is supported.",{"def":A})}}}if(C[container.Annotation.Intercept]){var B=C[container.Annotation.Intercept];for(var F=0;F<B.length;F++){this.applyInterceptor(E,B[F][0],B[F][1])}}if(this.defs.interceptors&&A.componentType!="function"){for(var F=0;F<this.defs.interceptors.length;F++){var D=this.defs.interceptors[F];if(!D.nameMatcher){continue}if(D.nameMatcher instanceof container.Type&&D.nameMatcher.isImplementor(E)){this.applyInterceptor(E,D.interceptor,D.methodMatcher)}else{if(D.nameMatcher instanceof container.Matcher&&C[container.Annotation.Name]&&D.nameMatcher.match(C[container.Annotation.Name])){this.applyInterceptor(E,D.interceptor,D.methodMatcher)}}}}if(C[container.Annotation.Scope]==container.Scope.Prototype){A.instance=undefined}return E}catch(J){A.instance=undefined;throw J}finally{this.creating.pop()}},applyInterceptor:function(D,C,B){if(!C||!B){return }for(var A in D){if(typeof D[A]=="function"&&B.match(A)){(function(){var E=A;var F=D[E];D[E]=function(){var G=new container.MethodInvocation(E,F,D,arguments);return C(G)}})()}}},eachComponentDef:function(B){for(var A=0;A<this.defs.objects.length;A++){if(B){B.apply(null,[this.defs.objects[A]])}}},_createTypeCahce:function(C){var B=[];var A=this;this.eachComponentDef(function(D){if(A._isCreating(D)&&!D.instance){return }var E=A.create(D);if(C.isImplementor(E)){B.push(D)}});this.typeCache[C]=B},_isCreating:function(B){for(var A=0;A<this.creating.length;A++){if(B===this.creating[A]){return true}}return false}};container.Binder=function(A,B){this.defs=A;this.namespace=B};container.Binder.prototype={bind:function(A){return this._bind("object",A.prototype.meta,function(){return new A()})},bindMethod:function(C,B){var A=this;return this._bind("function",null,function(D){var E=D.get(C);if(!E){throw D.createError(new Error(),D.ErrorCode.ComponentNotFound,"component not found.",{"name":name})}return A._createBindMethod(E,B)})},bindMethods:function(C,B){var A=this;return this._bind("function",null,function(D){var G=D.gets(C);var F=[];for(var E=0;E<G.length;E++){F.push(A._createBindMethod(G[E],B))}return F})},bindProvider:function(A){return this._bind("object",null,A)},bindInstance:function(A){return this._bind("object",A.meta,function(){return A})},bindInterceptor:function(D,A,B){var C=this._getInterceptorDefs();C.push({"interceptor":D,"nameMatcher":A,"methodMatcher":B})},ns:function(B,A){if(this.namespace){B=this.namespace+"."+B}A(new container.Binder(this.defs,B))},_bind:function(A,E,B){var D=this._clone(E);D.constractor=B;D.componentType=A;var C=this._getObjectDefs();C.push(D);return new container.Builder(D,this.namespace)},_getObjectDefs:function(){if(!this.defs.objects){this.defs.objects=[]}return this.defs.objects},_getInterceptorDefs:function(){if(!this.defs.interceptors){this.defs.interceptors=[]}return this.defs.interceptors},_createBindMethod:function(B,A){return function(){return B[A].apply(B,arguments)}},_clone:function(F){var C={};if(F&&F[container.Annotation.Container]){F=F[container.Annotation.Container];var E=[container.Annotation.Name,container.Annotation.Inject,container.Annotation.Initialize,container.Annotation.Destroy,container.Annotation.Scope];for(var B=0;B<E.length;B++){C[E[B]]=F[E[B]]}C[container.Annotation.Intercept]=[];if(F[container.Annotation.Intercept]){var D=F[container.Annotation.Intercept];for(var B=0;B<D.length;B++){C[container.Annotation.Intercept].push(D[B])}}}var A={};A[container.Annotation.Container]=C;return A}};container.Builder=function(B,A){if(!B[container.Annotation.Container]){B[container.Annotation.Container]={}}this.def=B[container.Annotation.Container];if(!this.def[container.Annotation.Intercept]){this.def[container.Annotation.Intercept]=[]}this.namespace=A};container.Builder.prototype={to:function(A){if(this.namespace){A=this.namespace+"."+A}this.def[container.Annotation.Name]=A;return this},inject:function(A){this.def[container.Annotation.Inject]=A;return this},initialize:function(A){this.def[container.Annotation.Initialize]=A;return this},destroy:function(A){this.def[container.Annotation.Destroy]=A;return this},scope:function(A){this.def[container.Annotation.Scope]=A;return this},intercept:function(B,A){this.def[container.Annotation.Intercept].push([B,A]);return this}};container.Matcher=function(A,B){if(A&&!(A instanceof Array||A instanceof RegExp||A instanceof Function)){throw container.createError(new Error(),container.ErrorCode.IllegalArgument,"Illegal includes.",{})}if(B&&!(B instanceof Array||B instanceof RegExp||B instanceof Function)){throw container.createError(new Error(),container.ErrorCode.IllegalArgument,"Illegal excludes.",{})}this.excludes=B;this.includes=A};container.Matcher.prototype={match:function(A){if(this.excludes&&this.getEvaluator(this.excludes)(A)){return false}if(this.includes&&this.getEvaluator(this.includes)(A)){return true}return false},getEvaluator:function(A){if(A instanceof Array){return function(C){for(var B=0;B<A.length;B++){if(A[B] instanceof RegExp&&A[B].test(C)){return true}}return false}}else{if(A instanceof RegExp){return function(B){return A.test(B)}}else{if(A instanceof Function){return A}}}}};container.MethodInvocation=function(B,C,D,A){this.name=B;this.original=C;this.arg=A;this.target=D};container.MethodInvocation.prototype={getThis:function(){return this.target},proceed:function(){return this.original.apply(this.target,this.arg)},getArguments:function(){return this.arg},getOriginalMethod:function(){return this.original},getMethodName:function(){return this.name}};container.inner={};container.inner.Component=function(A){this.name=A};container.inner.Components=function(A){this.name=A};container.inner.Provider=function(A){this.func=A};container.createError=function(B,D,C,A){B.errorCode=D;B.message=C;B.options=A;B.name="container.Exception";return B};container.ErrorCode={IllegalArgument:1,ComponentNotFound:100,IllegalDefinition:101,CircularReference:102};container.Annotation={Container:"@Container",Name:"@Name",Inject:"@Inject",Initialize:"@Initialize",Destroy:"@Destroy",Intercept:"@Intercept",Scope:"@Scope"};container.Scope={Singleton:"Singleton",Prototype:"Prototype",EagerSingleton:"EagerSingleton"};container.any=function(){return new container.Matcher(/.*/)};container.component=function(A){return new container.inner.Component(A)};container.components=function(A){return new container.inner.Components(A)};container.provides=function(A){return new container.inner.Provider(A)};container.Type=function(){};container.Type.prototype={equals:function(A){},isImplementor:function(A){}};container.types={has:function(){return new container.inner.types.And(container.types._createTypes(arguments))},hasAny:function(){return new container.inner.types.Or(container.types._createTypes(arguments))},not:function(A){return new container.inner.types.Not(container.types._createType(A))},_createTypes:function(C){var B=[];for(var A=0;A<C.length;A++){B.push(container.types._createType(C[A]))}return B},_createType:function(A){if(A instanceof RegExp){return new container.inner.types.RegexpMethod(A)}else{if(A instanceof container.Type){return A}else{if(typeof A=="string"){return new container.inner.types.Method(A)}else{throw"illegal argument."}}}}};container.inner.types={};container.inner.types.Method=function(A){this.name=A};container.inner.types.Method.prototype=new container.Type();container.inner.types.Method.prototype.equals=function(A){if(!A||!(A instanceof container.inner.types.Method)){return false}return this.name==A.name};container.inner.types.Method.prototype.isImplementor=function(A){return typeof A[this.name]=="function"};container.inner.types.Method.prototype.toString=function(){return"!container.inner.types.Method:"+this.name};container.inner.types.RegexpMethod=function(A){this.exp=A};container.inner.types.RegexpMethod.prototype=new container.Type();container.inner.types.RegexpMethod.prototype.equals=function(A){if(!A||!(A instanceof container.inner.types.RegexpMethod)){return false}return this.exp.ignoreCase==A.exp.ignoreCase&&this.exp.global==A.exp.global&&this.exp.source==A.exp.source};container.inner.types.RegexpMethod.prototype.isImplementor=function(B){for(var A in B){if(typeof B[A]=="function"&&this.exp.test(A)){return true}}return false};container.inner.types.RegexpMethod.prototype.toString=function(){return"!container.inner.types.RegexpMethod:/"+this.exp.source+"/"+this.exp.ignoreCase+"/"+this.exp.global};container.inner.types.And=function(A){this.types=A};container.inner.types.And.prototype=new container.Type();container.inner.types.And.prototype.equals=function(D){if(!D||!(D instanceof container.inner.types.And)){return false}if(this.types.length!=D.types.length){return false}for(var C=0;C<this.types.length;C++){var B=this.types[C];var A=D.types[C];if(!B.equals(A)){return false}}return true};container.inner.types.And.prototype.isImplementor=function(B){for(var A=0;A<this.types.length;A++){if(!this.types[A].isImplementor(B)){return false}}return true};container.inner.types.And.prototype.toString=function(){var B="!container.inner.types.And:[";for(var A=0;A<this.types.length;A++){B+=this.types[A].toString()+","}B+="]";return B};container.inner.types.Or=function(A){this.types=A};container.inner.types.Or.prototype=new container.Type();container.inner.types.Or.prototype.equals=function(D){if(!D||!(D instanceof container.inner.types.Or)){return false}if(this.types.length!=D.types.length){return false}for(var C=0;C<this.types.length;C++){var B=this.types[C];var A=D.types[C];if(!B.equals(A)){return false}}return true};container.inner.types.Or.prototype.isImplementor=function(B){for(var A=0;A<this.types.length;A++){if(this.types[A].isImplementor(B)){return true}}return false};container.inner.types.Or.prototype.toString=function(){var B="!container.inner.types.Or:[";for(var A=0;A<this.types.length;A++){B+=this.types[A].toString()+","}B+="]";return B};container.inner.types.Not=function(A){this.type=A};container.inner.types.Not.prototype=new container.Type();container.inner.types.Not.prototype.equals=function(A){if(!A||!(A instanceof container.inner.types.Not)){return false}return this.type.equals(A.type)};container.inner.types.Not.prototype.isImplementor=function(A){return !this.type.isImplementor(A)};container.inner.types.Not.prototype.toString=function(){return"!container.inner.types.Not:["+this.type.toString()+"]"}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
if(typeof container=="undefined"){
|
2
|
+
container={}
|
3
|
+
}
|
4
|
+
if(typeof container.utils=="undefined"){
|
5
|
+
container.utils={}
|
6
|
+
}
|
7
|
+
|
8
|
+
|
9
|
+
/**
|
10
|
+
* コンポーネントのフィールドの変更を捕捉するリスナを設定する。
|
11
|
+
*/
|
12
|
+
container.utils.ListenerBinder = function() {
|
13
|
+
this.recipe = {}; // @Inject
|
14
|
+
}
|
15
|
+
container.utils.ListenerBinder.prototype = {
|
16
|
+
meta: {
|
17
|
+
"@Container": {
|
18
|
+
"@Scope": container.Scope.EagerSingleton,
|
19
|
+
"@Initialize": function( binder, container ) { binder.bind( container ); }
|
20
|
+
}
|
21
|
+
},
|
22
|
+
|
23
|
+
/**
|
24
|
+
* コンポーネント定義を元にモデルのリスナを設定する。
|
25
|
+
* @param {Object} c コンテナ
|
26
|
+
*/
|
27
|
+
bind: function( c ) {
|
28
|
+
for ( var i in this.recipe ) {
|
29
|
+
if ( typeof i == "function" ) { continue; }
|
30
|
+
var result = new RegExp( "(.*)#(.*)$").exec( i );
|
31
|
+
if ( result && result.length >= 3 ) {
|
32
|
+
var fn = this.recipe[i];
|
33
|
+
var component = c.get( result[1] );
|
34
|
+
var listeners = c.gets( container.types.has( fn ) );
|
35
|
+
if ( component && listeners && result[2]) {
|
36
|
+
this.addListeners( component, result[2], listeners, fn );
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
},
|
41
|
+
|
42
|
+
/**
|
43
|
+
* 更新リスナを追加する。
|
44
|
+
* @param {Object} target リスナを追加するモデル
|
45
|
+
* @param {String} key イベントキー
|
46
|
+
* @param {Function} listener リスナ関数の配列
|
47
|
+
* @param {String} functionName 関数名
|
48
|
+
*/
|
49
|
+
addListeners: function ( target, key, listeners, functionName ) {
|
50
|
+
if ( !target.__listeners ) {
|
51
|
+
|
52
|
+
// ターゲットを拡張する。
|
53
|
+
target.__listeners = {}; // リスナの記録先を確保。
|
54
|
+
var org = target.set;
|
55
|
+
|
56
|
+
// setを上書き。変更を受けてリスナをキックする関数にする。
|
57
|
+
target.set = function( key, value, opt ) {
|
58
|
+
opt = opt ? opt : {};
|
59
|
+
opt.value = value;
|
60
|
+
var result = null;
|
61
|
+
if ( org ) {
|
62
|
+
result = org.apply( target, [key, value, opt] );
|
63
|
+
} else {
|
64
|
+
this[key] = value;
|
65
|
+
}
|
66
|
+
if ( this.__listeners[key] ) {
|
67
|
+
var fn = this.__listeners[key]["function"];
|
68
|
+
for (var i=0; i < this.__listeners[key]["lis"].length; i++ ) {
|
69
|
+
this.__listeners[key]["lis"][i][fn]( opt );
|
70
|
+
}
|
71
|
+
}
|
72
|
+
return result;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
// リスナをターゲットの属性として追加。
|
76
|
+
target.__listeners[key] = {"lis":listeners, "function": functionName};
|
77
|
+
}
|
78
|
+
}
|
data/html/js/dialog.js
ADDED
@@ -0,0 +1,270 @@
|
|
1
|
+
// ネームスペース
|
2
|
+
namespace( "util" );
|
3
|
+
|
4
|
+
util.Dialog = function() {
|
5
|
+
|
6
|
+
this.dialog = document.createElement('div');
|
7
|
+
this.dialog.id = 'dialog';
|
8
|
+
this.dialog.innerHTML =
|
9
|
+
"<div id='dialog-header'>"
|
10
|
+
+ " <div id='dialog-title'></div>"
|
11
|
+
+ " <div id='dialog-close'></div>"
|
12
|
+
+ "</div>"
|
13
|
+
+ "<div id='dialog-body'>"
|
14
|
+
+ " <div id='dialog-content'>"
|
15
|
+
+ " </div>"
|
16
|
+
+ " <div id='dialog-separator'>"
|
17
|
+
+ " </div>"
|
18
|
+
+ " <div>"
|
19
|
+
+ " <div id='dialog-buttons'>"
|
20
|
+
+ " </div>"
|
21
|
+
+ " <div style='clear:both;'/>"
|
22
|
+
+ " </div>"
|
23
|
+
+ "</div>";
|
24
|
+
document.body.appendChild(this.dialog);
|
25
|
+
this.header = document.getElementById("dialog-header");
|
26
|
+
this.title = document.getElementById("dialog-title");
|
27
|
+
this.content = document.getElementById("dialog-content");
|
28
|
+
this.buttons = document.getElementById("dialog-buttons");
|
29
|
+
|
30
|
+
var self = this;
|
31
|
+
this.close = document.getElementById("dialog-close");
|
32
|
+
this.close.onclick = function() {
|
33
|
+
self.hideDialog();
|
34
|
+
};
|
35
|
+
this.mask = document.createElement('div');
|
36
|
+
this.mask.id = 'dialog-mask';
|
37
|
+
document.body.appendChild(this.mask);
|
38
|
+
|
39
|
+
this.dialog.style.visibility = "hidden";
|
40
|
+
this.mask.style.visibility = "hidden";
|
41
|
+
}
|
42
|
+
util.Dialog.prototype = {
|
43
|
+
TIME : 5,
|
44
|
+
SPEED : 10,
|
45
|
+
WRAPPER : 'content',
|
46
|
+
|
47
|
+
show : function( type, params ) {
|
48
|
+
if(!type) {
|
49
|
+
type = 'input';
|
50
|
+
}
|
51
|
+
|
52
|
+
// ダイアログを初期化
|
53
|
+
this.content.innerHTML = params.message;
|
54
|
+
if ( params.headerVisible ) {
|
55
|
+
if ( params.title ) {
|
56
|
+
this.title.innerHTML = params.title;
|
57
|
+
}
|
58
|
+
this.close.style.display = "block";
|
59
|
+
} else {
|
60
|
+
this.header.style.display = "none";
|
61
|
+
}
|
62
|
+
|
63
|
+
var keybind = { "Tab" : function(){} };
|
64
|
+
this.buttons.innerHTML = "";
|
65
|
+
if ( params.buttons ) {
|
66
|
+
for ( var i = 0; i < params.buttons.length ; i++ ) {
|
67
|
+
this.createButton( params.buttons[i], keybind );
|
68
|
+
}
|
69
|
+
} else {
|
70
|
+
this.createButton( {
|
71
|
+
id : "close",
|
72
|
+
alt : "閉じる",
|
73
|
+
accesskey: "C",
|
74
|
+
key: "Enter"}, keybind);
|
75
|
+
}
|
76
|
+
new util.KeyBind( keybind, this.dialog ) ;
|
77
|
+
|
78
|
+
// ダイアログを表示
|
79
|
+
this.mask.style.visibility = "visible";
|
80
|
+
this.dialog.style.visibility = "visible";
|
81
|
+
|
82
|
+
this.dialog.style.opacity = .00;
|
83
|
+
this.dialog.style.filter = 'alpha(opacity=0)';
|
84
|
+
this.dialog.alpha = 0;
|
85
|
+
|
86
|
+
var width = this.pageWidth();
|
87
|
+
var height = this.pageHeight();
|
88
|
+
var left = this.leftPosition();
|
89
|
+
var top = this.topPosition();
|
90
|
+
|
91
|
+
var dialogwidth = this.dialog.offsetWidth;
|
92
|
+
var dialogheight = this.dialog.offsetHeight;
|
93
|
+
var topposition = top + (height / 3) - (dialogheight / 2);
|
94
|
+
var leftposition = left + (width / 2) - (dialogwidth / 2);
|
95
|
+
|
96
|
+
this.dialog.style.top = topposition + "px";
|
97
|
+
this.dialog.style.left = leftposition + "px";
|
98
|
+
this.dialog.className = type + " dialog";
|
99
|
+
|
100
|
+
var content = document.getElementById(this.WRAPPER);
|
101
|
+
this.mask.style.height = content.offsetHeight + 'px';
|
102
|
+
var self = this;
|
103
|
+
this.timer = setInterval(function(){ self.fadeDialog(1); }, this.TIME);
|
104
|
+
|
105
|
+
if ( params.init ) {
|
106
|
+
params.init.call( null, this );
|
107
|
+
}
|
108
|
+
|
109
|
+
// リンクとコントロールを無効化
|
110
|
+
this.cache = [];
|
111
|
+
var f = function( elms ) {
|
112
|
+
for( var i = 0 ; i < elms.length; i++ ) {
|
113
|
+
var old = {
|
114
|
+
target: elms[i],
|
115
|
+
disabled: elms[i].disabled,
|
116
|
+
accesskey: elms[i].accessKey,
|
117
|
+
tabIndex : elms[i].tabIndex
|
118
|
+
};
|
119
|
+
elms[i].disabled = true;
|
120
|
+
elms[i].accessKey = null;
|
121
|
+
elms[i].tabIndex = -1;
|
122
|
+
self.cache.push( old );
|
123
|
+
}
|
124
|
+
}
|
125
|
+
this.eachElements( "input", f);
|
126
|
+
this.eachElements( "textarea", f);
|
127
|
+
this.eachElements( "a", f);
|
128
|
+
this.eachElements( "object", function(elms){
|
129
|
+
for( var i = 0 ; i < elms.length; i++ ) {
|
130
|
+
elms[i].style.visibility = "hidden";
|
131
|
+
}
|
132
|
+
});
|
133
|
+
},
|
134
|
+
|
135
|
+
createButton: function( params, keybind ) {
|
136
|
+
|
137
|
+
var type = params["type"];
|
138
|
+
var a = params["action"];
|
139
|
+
var action = function() {
|
140
|
+
if ( a ) {
|
141
|
+
if ( a.call( null, self ) == false ){
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
self.hideDialog();
|
146
|
+
};
|
147
|
+
var b = document.createElement('div');
|
148
|
+
b.className= params["key"] == "Enter" ? "button default " + type : "button " + type;
|
149
|
+
b.id = "dialog_" + type;
|
150
|
+
this.buttons.appendChild(b);
|
151
|
+
|
152
|
+
var self = this;
|
153
|
+
var button = new util.Button("dialog_" + type,
|
154
|
+
type, action, params["alt"], params["accesskey"]);
|
155
|
+
button.setEnable( true );
|
156
|
+
|
157
|
+
if(params["key"]) keybind[params["key"]] = action;
|
158
|
+
},
|
159
|
+
|
160
|
+
//ダイアログを非表示にする。
|
161
|
+
hideDialog : function () {
|
162
|
+
clearInterval(this.timer);
|
163
|
+
var self = this;
|
164
|
+
this.timer = setInterval( function(){ self.fadeDialog(0); } , this.TIME);
|
165
|
+
},
|
166
|
+
|
167
|
+
fadeDialog : function (flag) {
|
168
|
+
if(flag == null) {
|
169
|
+
flag = 1;
|
170
|
+
}
|
171
|
+
var value;
|
172
|
+
if(flag == 1) {
|
173
|
+
value = this.dialog.alpha + this.SPEED;
|
174
|
+
} else {
|
175
|
+
value = this.dialog.alpha - this.SPEED;
|
176
|
+
}
|
177
|
+
this.dialog.alpha = value;
|
178
|
+
this.dialog.style.opacity = (value / 100);
|
179
|
+
this.dialog.style.filter = 'alpha(opacity=' + value + ')';
|
180
|
+
if(value >= 99) {
|
181
|
+
clearInterval(this.timer);
|
182
|
+
this.timer = null;
|
183
|
+
} else if(value <= 1) {
|
184
|
+
// リンクとコントロールを有効化
|
185
|
+
for( var i = 0 ; i < this.cache.length; i++ ) {
|
186
|
+
var c = this.cache[i];
|
187
|
+
c.target.accesskey = c.accesskey;
|
188
|
+
c.target.tabIndex = c.tabIndex;
|
189
|
+
c.target.disabled = c.disabled;
|
190
|
+
}
|
191
|
+
this.cache = null;
|
192
|
+
|
193
|
+
this.eachElements( "object", function(elms){
|
194
|
+
for( var i = 0 ; i < elms.length; i++ ) {
|
195
|
+
elms[i].style.visibility = "visible";
|
196
|
+
}
|
197
|
+
});
|
198
|
+
|
199
|
+
this.dialog.style.visibility = "hidden";
|
200
|
+
this.mask.style.visibility = "hidden";
|
201
|
+
clearInterval(this.timer);
|
202
|
+
}
|
203
|
+
},
|
204
|
+
|
205
|
+
eachElements: function ( tag, f ) {
|
206
|
+
var elements = document.body.childNodes;
|
207
|
+
for( var i = 0; i < elements.length; i++ ) {
|
208
|
+
if ( elements[i] != this.dialog && elements[i].getElementsByTagName ) {
|
209
|
+
var elms = elements[i].getElementsByTagName( tag );
|
210
|
+
f(elms);
|
211
|
+
}
|
212
|
+
}
|
213
|
+
},
|
214
|
+
|
215
|
+
/**
|
216
|
+
* ウインドウの幅
|
217
|
+
*/
|
218
|
+
pageWidth: function pageWidth() {
|
219
|
+
if ( window.innerWidth != null ) {
|
220
|
+
return window.innerWidth;
|
221
|
+
} else if ( document.documentElement && document.documentElement.clientWidth ) {
|
222
|
+
return document.documentElement.clientWidth;
|
223
|
+
} else if ( document.body != null ) {
|
224
|
+
return document.body.clientWidth;
|
225
|
+
}
|
226
|
+
return null;
|
227
|
+
},
|
228
|
+
|
229
|
+
/**
|
230
|
+
* ウインドウの高さ
|
231
|
+
*/
|
232
|
+
pageHeight: function () {
|
233
|
+
if ( window.innerHeight != null ) {
|
234
|
+
return window.innerHeight;
|
235
|
+
} else if ( document.documentElement && document.documentElement.clientHeight ) {
|
236
|
+
return document.documentElement.clientHeight;
|
237
|
+
} else if ( document.body != null ) {
|
238
|
+
return document.body.clientHeight;
|
239
|
+
}
|
240
|
+
return null;
|
241
|
+
},
|
242
|
+
|
243
|
+
/**
|
244
|
+
* 縦方向スクロールの位置
|
245
|
+
*/
|
246
|
+
topPosition: function() {
|
247
|
+
if ( typeof window.pageYOffset != 'undefined') {
|
248
|
+
return window.pageYOffset;
|
249
|
+
} else if ( document.documentElement && document.documentElement.scrollTop ) {
|
250
|
+
return document.documentElement.scrollTop;
|
251
|
+
} else if ( document.body.scrollTop ) {
|
252
|
+
return document.body.scrollTop;
|
253
|
+
}
|
254
|
+
return 0;
|
255
|
+
},
|
256
|
+
|
257
|
+
/**
|
258
|
+
* 横方向スクロールの位置
|
259
|
+
*/
|
260
|
+
leftPosition: function() {
|
261
|
+
if ( typeof window.pageXOffset != 'undefined') {
|
262
|
+
return window.pageXOffset;
|
263
|
+
} else if ( document.documentElement && document.documentElement.scrollLeft ) {
|
264
|
+
return document.documentElement.scrollLeft;
|
265
|
+
} else if ( document.body.scrollLeft ) {
|
266
|
+
return document.body.scrollLeft;
|
267
|
+
}
|
268
|
+
return 0;
|
269
|
+
}
|
270
|
+
}
|
@@ -0,0 +1,493 @@
|
|
1
|
+
/**
|
2
|
+
* Autocompletion class
|
3
|
+
*
|
4
|
+
* An auto completion box appear while you're writing. It's possible to force it to appear with Ctrl+Space short cut
|
5
|
+
*
|
6
|
+
* Loaded as a plugin inside editArea (everything made here could have been made in the plugin directory)
|
7
|
+
* But is definitly linked to syntax selection (no need to do 2 different files for color and auto complete for each syntax language)
|
8
|
+
* and add a too important feature that many people would miss if included as a plugin
|
9
|
+
*
|
10
|
+
* - init param: autocompletion_start
|
11
|
+
* - Button name: "autocompletion"
|
12
|
+
*/
|
13
|
+
|
14
|
+
var EditArea_autocompletion= {
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Get called once this file is loaded (editArea still not initialized)
|
18
|
+
*
|
19
|
+
* @return nothing
|
20
|
+
*/
|
21
|
+
init: function(){
|
22
|
+
// alert("test init: "+ this._someInternalFunction(2, 3));
|
23
|
+
|
24
|
+
if(editArea.settings["autocompletion"])
|
25
|
+
this.enabled= true;
|
26
|
+
else
|
27
|
+
this.enabled= false;
|
28
|
+
this.current_word = false;
|
29
|
+
this.shown = false;
|
30
|
+
this.selectIndex = -1;
|
31
|
+
this.forceDisplay = false;
|
32
|
+
this.isInMiddleWord = false;
|
33
|
+
this.autoSelectIfOneResult = false;
|
34
|
+
this.delayBeforeDisplay = 100;
|
35
|
+
this.checkDelayTimer = false;
|
36
|
+
this.curr_syntax_str = '';
|
37
|
+
|
38
|
+
this.file_syntax_datas = {};
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* Returns the HTML code for a specific control string or false if this plugin doesn't have that control.
|
42
|
+
* A control can be a button, select list or any other HTML item to present in the EditArea user interface.
|
43
|
+
* Language variables such as {$lang_somekey} will also be replaced with contents from
|
44
|
+
* the language packs.
|
45
|
+
*
|
46
|
+
* @param {string} ctrl_name: the name of the control to add
|
47
|
+
* @return HTML code for a specific control or false.
|
48
|
+
* @type string or boolean
|
49
|
+
*/
|
50
|
+
/*,get_control_html: function(ctrl_name){
|
51
|
+
switch( ctrl_name ){
|
52
|
+
case 'autocompletion':
|
53
|
+
// Control id, button img, command
|
54
|
+
return parent.editAreaLoader.get_button_html('autocompletion_but', 'autocompletion.gif', 'toggle_autocompletion', false, this.baseURL);
|
55
|
+
break;
|
56
|
+
}
|
57
|
+
return false;
|
58
|
+
}*/
|
59
|
+
/**
|
60
|
+
* Get called once EditArea is fully loaded and initialised
|
61
|
+
*
|
62
|
+
* @return nothing
|
63
|
+
*/
|
64
|
+
,onload: function(){
|
65
|
+
if(this.enabled)
|
66
|
+
{
|
67
|
+
var icon= document.getElementById("autocompletion");
|
68
|
+
if(icon)
|
69
|
+
editArea.switchClassSticky(icon, 'editAreaButtonSelected', true);
|
70
|
+
}
|
71
|
+
|
72
|
+
this.container = document.createElement('div');
|
73
|
+
this.container.id = "auto_completion_area";
|
74
|
+
editArea.container.insertBefore( this.container, editArea.container.firstChild );
|
75
|
+
|
76
|
+
// add event detection for hiding suggestion box
|
77
|
+
editArea.add_event( document, "click", function(){ editArea.plugins['autocompletion']._hide();} );
|
78
|
+
editArea.add_event( editArea.textarea, "blur", function(){ editArea.plugins['autocompletion']._hide();} );
|
79
|
+
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Is called each time the user touch a keyboard key.
|
84
|
+
*
|
85
|
+
* @param (event) e: the keydown event
|
86
|
+
* @return true - pass to next handler in chain, false - stop chain execution
|
87
|
+
* @type boolean
|
88
|
+
*/
|
89
|
+
,onkeydown: function(e){
|
90
|
+
if(!this.enabled)
|
91
|
+
return true;
|
92
|
+
|
93
|
+
if (EA_keys[e.keyCode])
|
94
|
+
letter=EA_keys[e.keyCode];
|
95
|
+
else
|
96
|
+
letter=String.fromCharCode(e.keyCode);
|
97
|
+
// shown
|
98
|
+
if( this._isShown() )
|
99
|
+
{
|
100
|
+
// if escape, hide the box
|
101
|
+
if(letter=="Esc")
|
102
|
+
{
|
103
|
+
this._hide();
|
104
|
+
return false;
|
105
|
+
}
|
106
|
+
// Enter
|
107
|
+
else if( letter=="Entrer")
|
108
|
+
{
|
109
|
+
var as = this.container.getElementsByTagName('A');
|
110
|
+
// select a suggested entry
|
111
|
+
if( this.selectIndex >= 0 && this.selectIndex < as.length )
|
112
|
+
{
|
113
|
+
as[ this.selectIndex ].onmousedown();
|
114
|
+
return false
|
115
|
+
}
|
116
|
+
// simply add an enter in the code
|
117
|
+
else
|
118
|
+
{
|
119
|
+
this._hide();
|
120
|
+
return true;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
else if( letter=="Tab" || letter=="Down")
|
124
|
+
{
|
125
|
+
this._selectNext();
|
126
|
+
return false;
|
127
|
+
}
|
128
|
+
else if( letter=="Up")
|
129
|
+
{
|
130
|
+
this._selectBefore();
|
131
|
+
return false;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
// hidden
|
135
|
+
else
|
136
|
+
{
|
137
|
+
|
138
|
+
}
|
139
|
+
|
140
|
+
// show current suggestion list and do autoSelect if possible (no matter it's shown or hidden)
|
141
|
+
if( letter=="Space" && CtrlPressed(e) )
|
142
|
+
{
|
143
|
+
parent.console.log('SHOW SUGGEST');
|
144
|
+
this.forceDisplay = true;
|
145
|
+
this.autoSelectIfOneResult = true;
|
146
|
+
this._checkLetter();
|
147
|
+
return false;
|
148
|
+
}
|
149
|
+
|
150
|
+
// wait a short period for check that the cursor isn't moving
|
151
|
+
setTimeout("editArea.plugins['autocompletion']._checkDelayAndCursorBeforeDisplay();", editArea.check_line_selection_timer +5 );
|
152
|
+
this.checkDelayTimer = false;
|
153
|
+
return true;
|
154
|
+
}
|
155
|
+
/**
|
156
|
+
* Executes a specific command, this function handles plugin commands.
|
157
|
+
*
|
158
|
+
* @param {string} cmd: the name of the command being executed
|
159
|
+
* @param {unknown} param: the parameter of the command
|
160
|
+
* @return true - pass to next handler in chain, false - stop chain execution
|
161
|
+
* @type boolean
|
162
|
+
*/
|
163
|
+
,execCommand: function(cmd, param){
|
164
|
+
switch( cmd ){
|
165
|
+
case 'toggle_autocompletion':
|
166
|
+
var icon= document.getElementById("autocompletion");
|
167
|
+
if(!this.enabled)
|
168
|
+
{
|
169
|
+
if(icon != null){
|
170
|
+
editArea.restoreClass(icon);
|
171
|
+
editArea.switchClassSticky(icon, 'editAreaButtonSelected', true);
|
172
|
+
}
|
173
|
+
this.enabled= true;
|
174
|
+
}
|
175
|
+
else
|
176
|
+
{
|
177
|
+
this.enabled= false;
|
178
|
+
if(icon != null)
|
179
|
+
editArea.switchClassSticky(icon, 'editAreaButtonNormal', false);
|
180
|
+
}
|
181
|
+
return true;
|
182
|
+
}
|
183
|
+
return true;
|
184
|
+
}
|
185
|
+
,_checkDelayAndCursorBeforeDisplay: function()
|
186
|
+
{
|
187
|
+
this.checkDelayTimer = setTimeout("if(editArea.textarea.selectionStart == "+ editArea.textarea.selectionStart +") EditArea_autocompletion._checkLetter();", this.delayBeforeDisplay - editArea.check_line_selection_timer - 5 );
|
188
|
+
}
|
189
|
+
// hide the suggested box
|
190
|
+
,_hide: function(){
|
191
|
+
this.container.style.display="none";
|
192
|
+
this.selectIndex = -1;
|
193
|
+
this.shown = false;
|
194
|
+
this.forceDisplay = false;
|
195
|
+
this.autoSelectIfOneResult = false;
|
196
|
+
}
|
197
|
+
// display the suggested box
|
198
|
+
,_show: function(){
|
199
|
+
if( !this._isShown() )
|
200
|
+
{
|
201
|
+
this.container.style.display="block";
|
202
|
+
this.selectIndex = -1;
|
203
|
+
this.shown = true;
|
204
|
+
}
|
205
|
+
}
|
206
|
+
// is the suggested box displayed?
|
207
|
+
,_isShown: function(){
|
208
|
+
return this.shown;
|
209
|
+
}
|
210
|
+
// setter and getter
|
211
|
+
,_isInMiddleWord: function( new_value ){
|
212
|
+
if( typeof( new_value ) == "undefined" )
|
213
|
+
return this.isInMiddleWord;
|
214
|
+
else
|
215
|
+
this.isInMiddleWord = new_value;
|
216
|
+
}
|
217
|
+
// select the next element in the suggested box
|
218
|
+
,_selectNext: function()
|
219
|
+
{
|
220
|
+
var as = this.container.getElementsByTagName('A');
|
221
|
+
|
222
|
+
// clean existing elements
|
223
|
+
for( var i=0; i<as.length; i++ )
|
224
|
+
{
|
225
|
+
if( as[i].className )
|
226
|
+
as[i].className = as[i].className.replace(/ focus/g, '');
|
227
|
+
}
|
228
|
+
|
229
|
+
this.selectIndex++;
|
230
|
+
this.selectIndex = ( this.selectIndex >= as.length || this.selectIndex < 0 ) ? 0 : this.selectIndex;
|
231
|
+
as[ this.selectIndex ].className += " focus";
|
232
|
+
}
|
233
|
+
// select the previous element in the suggested box
|
234
|
+
,_selectBefore: function()
|
235
|
+
{
|
236
|
+
var as = this.container.getElementsByTagName('A');
|
237
|
+
|
238
|
+
// clean existing elements
|
239
|
+
for( var i=0; i<as.length; i++ )
|
240
|
+
{
|
241
|
+
if( as[i].className )
|
242
|
+
as[i].className = as[ i ].className.replace(/ focus/g, '');
|
243
|
+
}
|
244
|
+
|
245
|
+
this.selectIndex--;
|
246
|
+
|
247
|
+
this.selectIndex = ( this.selectIndex >= as.length || this.selectIndex < 0 ) ? as.length-1 : this.selectIndex;
|
248
|
+
as[ this.selectIndex ].className += " focus";
|
249
|
+
}
|
250
|
+
,_select: function( content )
|
251
|
+
{
|
252
|
+
cursor_forced_position = content.indexOf( '{@}' );
|
253
|
+
content = content.replace(/{@}/g, '' );
|
254
|
+
if(editArea.nav['isIE'])
|
255
|
+
editArea.getIESelection();
|
256
|
+
|
257
|
+
// retrive the number of matching characters
|
258
|
+
var start_index = Math.max( 0, editArea.textarea.selectionEnd - content.length );
|
259
|
+
|
260
|
+
line_string = editArea.textarea.value.substring( start_index, editArea.textarea.selectionEnd + 1);
|
261
|
+
limit = line_string.length -1;
|
262
|
+
nbMatch = 0;
|
263
|
+
for( i =0; i<limit ; i++ )
|
264
|
+
{
|
265
|
+
if( line_string.substring( limit - i - 1, limit ) == content.substring( 0, i + 1 ) )
|
266
|
+
nbMatch = i + 1;
|
267
|
+
}
|
268
|
+
// if characters match, we should include them in the selection that will be replaced
|
269
|
+
if( nbMatch > 0 )
|
270
|
+
parent.editAreaLoader.setSelectionRange(editArea.id, editArea.textarea.selectionStart - nbMatch , editArea.textarea.selectionEnd);
|
271
|
+
|
272
|
+
parent.editAreaLoader.setSelectedText(editArea.id, content );
|
273
|
+
range= parent.editAreaLoader.getSelectionRange(editArea.id);
|
274
|
+
|
275
|
+
if( cursor_forced_position != -1 )
|
276
|
+
new_pos = range["end"] - ( content.length-cursor_forced_position );
|
277
|
+
else
|
278
|
+
new_pos = range["end"];
|
279
|
+
parent.editAreaLoader.setSelectionRange(editArea.id, new_pos, new_pos);
|
280
|
+
this._hide();
|
281
|
+
}
|
282
|
+
|
283
|
+
|
284
|
+
/**
|
285
|
+
* Parse the AUTO_COMPLETION part of syntax definition files
|
286
|
+
*/
|
287
|
+
,_parseSyntaxAutoCompletionDatas: function(){
|
288
|
+
//foreach syntax loaded
|
289
|
+
for(var lang in parent.editAreaLoader.load_syntax)
|
290
|
+
{
|
291
|
+
if(!parent.editAreaLoader.syntax[lang]['autocompletion']) // init the regexp if not already initialized
|
292
|
+
{
|
293
|
+
parent.editAreaLoader.syntax[lang]['autocompletion']= {};
|
294
|
+
// the file has auto completion datas
|
295
|
+
if(parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION'])
|
296
|
+
{
|
297
|
+
// parse them
|
298
|
+
for(var i in parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION'])
|
299
|
+
{
|
300
|
+
datas = parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION'][i];
|
301
|
+
tmp = {};
|
302
|
+
if(datas["CASE_SENSITIVE"]!="undefined" && datas["CASE_SENSITIVE"]==false)
|
303
|
+
tmp["modifiers"]="i";
|
304
|
+
else
|
305
|
+
tmp["modifiers"]="";
|
306
|
+
tmp["prefix_separator"]= datas["REGEXP"]["prefix_separator"];
|
307
|
+
tmp["match_prefix_separator"]= new RegExp( datas["REGEXP"]["prefix_separator"] +"$", tmp["modifiers"]);
|
308
|
+
tmp["match_word"]= new RegExp("(?:"+ datas["REGEXP"]["before_word"] +")("+ datas["REGEXP"]["possible_words_letters"] +")$", tmp["modifiers"]);
|
309
|
+
tmp["match_next_letter"]= new RegExp("^("+ datas["REGEXP"]["letter_after_word_must_match"] +")$", tmp["modifiers"]);
|
310
|
+
tmp["keywords"]= {};
|
311
|
+
console.log( datas["KEYWORDS"] );
|
312
|
+
for( var prefix in datas["KEYWORDS"] )
|
313
|
+
{
|
314
|
+
tmp["keywords"][prefix]= {
|
315
|
+
prefix: prefix,
|
316
|
+
prefix_name: prefix,
|
317
|
+
prefix_reg: new RegExp("(?:"+ parent.editAreaLoader.get_escaped_regexp( prefix ) +")(?:"+ tmp["prefix_separator"] +")$", tmp["modifiers"] ),
|
318
|
+
datas: []
|
319
|
+
};
|
320
|
+
for( var j=0; j<datas["KEYWORDS"][prefix].length; j++ )
|
321
|
+
{
|
322
|
+
tmp["keywords"][prefix]['datas'][j]= {
|
323
|
+
is_typing: datas["KEYWORDS"][prefix][j][0],
|
324
|
+
// if replace with is empty, replace with the is_typing value
|
325
|
+
replace_with: datas["KEYWORDS"][prefix][j][1] ? datas["KEYWORDS"][prefix][j][1].replace('�', datas["KEYWORDS"][prefix][j][0] ) : '',
|
326
|
+
comment: datas["KEYWORDS"][prefix][j][2] ? datas["KEYWORDS"][prefix][j][2] : ''
|
327
|
+
};
|
328
|
+
|
329
|
+
// the replace with shouldn't be empty
|
330
|
+
if( tmp["keywords"][prefix]['datas'][j]['replace_with'].length == 0 )
|
331
|
+
tmp["keywords"][prefix]['datas'][j]['replace_with'] = tmp["keywords"][prefix]['datas'][j]['is_typing'];
|
332
|
+
|
333
|
+
// if the comment is empty, display the replace_with value
|
334
|
+
if( tmp["keywords"][prefix]['datas'][j]['comment'].length == 0 )
|
335
|
+
tmp["keywords"][prefix]['datas'][j]['comment'] = tmp["keywords"][prefix]['datas'][j]['replace_with'].replace(/{@}/g, '' );
|
336
|
+
}
|
337
|
+
|
338
|
+
}
|
339
|
+
tmp["max_text_length"]= datas["MAX_TEXT_LENGTH"];
|
340
|
+
parent.editAreaLoader.syntax[lang]['autocompletion'][i] = tmp;
|
341
|
+
}
|
342
|
+
}
|
343
|
+
}
|
344
|
+
}
|
345
|
+
}
|
346
|
+
|
347
|
+
,_checkLetter: function(){
|
348
|
+
// check that syntax hasn't changed
|
349
|
+
if( this.curr_syntax_str != editArea.settings['syntax'] )
|
350
|
+
{
|
351
|
+
if( !parent.editAreaLoader.syntax[editArea.settings['syntax']]['autocompletion'] )
|
352
|
+
this._parseSyntaxAutoCompletionDatas();
|
353
|
+
this.curr_syntax= parent.editAreaLoader.syntax[editArea.settings['syntax']]['autocompletion'];
|
354
|
+
this.curr_syntax_str = editArea.settings['syntax'];
|
355
|
+
console.log( this.curr_syntax );
|
356
|
+
}
|
357
|
+
|
358
|
+
if( editArea.is_editable )
|
359
|
+
{
|
360
|
+
time=new Date;
|
361
|
+
t1= time.getTime();
|
362
|
+
if(editArea.nav['isIE'])
|
363
|
+
editArea.getIESelection();
|
364
|
+
this.selectIndex = -1;
|
365
|
+
start=editArea.textarea.selectionStart;
|
366
|
+
var str = editArea.textarea.value;
|
367
|
+
var results= new Array();
|
368
|
+
|
369
|
+
|
370
|
+
for(var i in this.curr_syntax)
|
371
|
+
{
|
372
|
+
var last_chars = str.substring(Math.max(0, start-this.curr_syntax[i]["max_text_length"]), start);
|
373
|
+
var matchNextletter = str.substring(start, start+1).match( this.curr_syntax[i]["match_next_letter"]);
|
374
|
+
// if not writting in the middle of a word or if forcing display
|
375
|
+
if( matchNextletter || this.forceDisplay )
|
376
|
+
{
|
377
|
+
// check if the last chars match a separator
|
378
|
+
var match_prefix_separator = last_chars.match(this.curr_syntax[i]["match_prefix_separator"]);
|
379
|
+
|
380
|
+
// check if it match a possible word
|
381
|
+
var match_word= last_chars.match(this.curr_syntax[i]["match_word"]);
|
382
|
+
|
383
|
+
//console.log( match_word );
|
384
|
+
if( match_word )
|
385
|
+
{
|
386
|
+
var begin_word= match_word[1];
|
387
|
+
var match_curr_word= new RegExp("^"+ parent.editAreaLoader.get_escaped_regexp( begin_word ), this.curr_syntax[i]["modifiers"]);
|
388
|
+
console.log( match_curr_word );
|
389
|
+
for(var prefix in this.curr_syntax[i]["keywords"])
|
390
|
+
{
|
391
|
+
// parent.console.log( this.curr_syntax[i]["keywords"][prefix] );
|
392
|
+
for(var j=0; j<this.curr_syntax[i]["keywords"][prefix]['datas'].length; j++)
|
393
|
+
{
|
394
|
+
// parent.console.log( this.curr_syntax[i]["keywords"][prefix]['datas'][j]['is_typing'] );
|
395
|
+
// the key word match or force display
|
396
|
+
if( this.curr_syntax[i]["keywords"][prefix]['datas'][j]['is_typing'].match(match_curr_word) )
|
397
|
+
{
|
398
|
+
// parent.console.log('match');
|
399
|
+
hasMatch = false;
|
400
|
+
var before = last_chars.substr( 0, last_chars.length - begin_word.length );
|
401
|
+
|
402
|
+
// no prefix to match => it's valid
|
403
|
+
if( !match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length == 0 )
|
404
|
+
{
|
405
|
+
if( ! before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) )
|
406
|
+
hasMatch = true;
|
407
|
+
}
|
408
|
+
// we still need to check the prefix if there is one
|
409
|
+
else if( this.curr_syntax[i]["keywords"][prefix]['prefix'].length > 0 )
|
410
|
+
{
|
411
|
+
if( before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) )
|
412
|
+
hasMatch = true;
|
413
|
+
}
|
414
|
+
|
415
|
+
if( hasMatch )
|
416
|
+
results[results.length]= [ this.curr_syntax[i]["keywords"][prefix], this.curr_syntax[i]["keywords"][prefix]['datas'][j] ];
|
417
|
+
}
|
418
|
+
}
|
419
|
+
}
|
420
|
+
}
|
421
|
+
// it doesn't match any possible word but we want to display something
|
422
|
+
// we'll display to list of all available words
|
423
|
+
else if( this.forceDisplay || match_prefix_separator )
|
424
|
+
{
|
425
|
+
for(var prefix in this.curr_syntax[i]["keywords"])
|
426
|
+
{
|
427
|
+
for(var j=0; j<this.curr_syntax[i]["keywords"][prefix]['datas'].length; j++)
|
428
|
+
{
|
429
|
+
hasMatch = false;
|
430
|
+
// no prefix to match => it's valid
|
431
|
+
if( !match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length == 0 )
|
432
|
+
{
|
433
|
+
hasMatch = true;
|
434
|
+
}
|
435
|
+
// we still need to check the prefix if there is one
|
436
|
+
else if( match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length > 0 )
|
437
|
+
{
|
438
|
+
var before = last_chars; //.substr( 0, last_chars.length );
|
439
|
+
if( before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) )
|
440
|
+
hasMatch = true;
|
441
|
+
}
|
442
|
+
|
443
|
+
if( hasMatch )
|
444
|
+
results[results.length]= [ this.curr_syntax[i]["keywords"][prefix], this.curr_syntax[i]["keywords"][prefix]['datas'][j] ];
|
445
|
+
}
|
446
|
+
}
|
447
|
+
}
|
448
|
+
}
|
449
|
+
}
|
450
|
+
|
451
|
+
// there is only one result, and we can select it automatically
|
452
|
+
if( results.length == 1 && this.autoSelectIfOneResult )
|
453
|
+
{
|
454
|
+
console.log( results );
|
455
|
+
this._select( results[0][1]['replace_with'] );
|
456
|
+
}
|
457
|
+
else if( results.length == 0 )
|
458
|
+
{
|
459
|
+
this._hide();
|
460
|
+
}
|
461
|
+
else
|
462
|
+
{
|
463
|
+
// build the suggestion box content
|
464
|
+
var lines=[];
|
465
|
+
for(var i=0; i<results.length; i++)
|
466
|
+
{
|
467
|
+
var line= "<li><a href=\"#\" class=\"entry\" onmousedown=\"EditArea_autocompletion._select('"+ results[i][1]['replace_with'].replace(new RegExp('"', "g"), """) +"');return false;\">"+ results[i][1]['comment'];
|
468
|
+
if(results[i][0]['prefix_name'].length>0)
|
469
|
+
line+='<span class="prefix">'+ results[i][0]['prefix_name'] +'</span>';
|
470
|
+
line+='</a></li>';
|
471
|
+
lines[lines.length]=line;
|
472
|
+
}
|
473
|
+
// sort results
|
474
|
+
this.container.innerHTML = '<ul>'+ lines.sort().join('') +'</ul>';
|
475
|
+
|
476
|
+
var cursor = $("cursor_pos");
|
477
|
+
this.container.style.top = ( cursor.cursor_top + editArea.lineHeight ) +"px";
|
478
|
+
this.container.style.left = ( cursor.cursor_left + 8 ) +"px";
|
479
|
+
this._show();
|
480
|
+
}
|
481
|
+
|
482
|
+
this.autoSelectIfOneResult = false;
|
483
|
+
time=new Date;
|
484
|
+
t2= time.getTime();
|
485
|
+
|
486
|
+
//parent.console.log( begin_word +"\n"+ (t2-t1) +"\n"+ html );
|
487
|
+
}
|
488
|
+
}
|
489
|
+
};
|
490
|
+
|
491
|
+
// Load as a plugin
|
492
|
+
editArea.settings['plugins'][ editArea.settings['plugins'].length ] = 'autocompletion';
|
493
|
+
editArea.add_plugin('autocompletion', EditArea_autocompletion);
|