attribution.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. import * as Models from '../ivprog_elements';
  2. import { LocalizedStrings } from '../../services/localizedStringsService';
  3. import * as VariableValueMenu from './variable_value_menu';
  4. import * as VariableValueMenuManagement from './variable_value_menu';
  5. import * as CommandsManagement from '../commands';
  6. import * as ExpressionManagement from './generic_expression';
  7. import * as CodeGenerator from '../code_generator';
  8. import { renderAlgorithm } from '../algorithm';
  9. export function createFloatingCommand () {
  10. return $('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x <&#8212; 1 + 1 </span></div>');
  11. }
  12. export function renderCommand (command, function_obj) {
  13. var el = $('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_attributed"></div> <span class="text_attr_receives span_command_spec">'+LocalizedStrings.getUI('text_receives')+'</span> '
  14. + '<div class="expression_elements"></div> <span class="textual_expression"></span> <i class="ui icon i cursor button_write_expression"></i> <i class="ui icon unlock button_alternate_expression"></i> </div>');
  15. el.data('command', command);
  16. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  17. if (!command.expression || command.expression.length < 1) {
  18. var exp = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19. command.expression.push(exp);
  20. }
  21. addHandlers(command, function_obj, el);
  22. ExpressionManagement.renderExpression(command, function_obj, el.find('.expression_elements'), command.expression);
  23. if (command.lockexpression) {
  24. if (command.expression) {
  25. try {
  26. var text = CodeGenerator.elementExpressionCode(command.expression);
  27. if (text) {
  28. $(el.find('.expression_elements')[0]).toggle();
  29. $(el.find('.textual_expression')[0]).text(text);
  30. $(el.find('.textual_expression')[0]).toggle();
  31. $(el.find('.button_alternate_expression')[0]).toggleClass('unlock').toggleClass('lock');
  32. }
  33. } catch (e) {
  34. command.lockexpression = false;
  35. }
  36. }
  37. }
  38. el.find('.unlock').popup({
  39. content : LocalizedStrings.getUI("text_lock_expression"),
  40. delay: {
  41. show: 750,
  42. hide: 0
  43. }
  44. });
  45. el.find('.lock').popup({
  46. content : LocalizedStrings.getUI("text_unlock_expression"),
  47. delay: {
  48. show: 750,
  49. hide: 0
  50. }
  51. });
  52. el.find('.button_write_expression').popup({
  53. content : LocalizedStrings.getUI("text_edit_expression"),
  54. delay: {
  55. show: 750,
  56. hide: 0
  57. }
  58. });
  59. return el;
  60. }
  61. export function manageExpressionElements (command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  62. var index_to_move = expression_element.itens.indexOf(ref_object);
  63. switch (selectedItem.data('exp')) {
  64. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  65. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [expression_element.itens[index_to_move],
  66. Models.ARITHMETIC_TYPES.plus,
  67. new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  68. expression_element.itens[index_to_move] = exp;
  69. break;
  70. case Models.EXPRESSION_ELEMENTS.op_exp:
  71. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus,
  72. expression_element.itens[index_to_move] ]);
  73. expression_element.itens[index_to_move] = exp;
  74. break;
  75. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  76. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  77. expression_element.itens[index_to_move] = exp;
  78. break;
  79. }
  80. renderExpressionElements(command, function_obj, dom_object);
  81. }
  82. function renderExpressionElements (command, function_obj, el) {
  83. var expression_div = el.find('.expression_elements');
  84. var command_container;
  85. if (el.hasClass("command_container") == false) {
  86. var hier = el.parentsUntil(".command_container");
  87. for (var i = 0; i < hier.length; i++) {
  88. if ($(hier[i]).hasClass("command_container")) {
  89. command_container = $(hier[i]);
  90. break;
  91. }
  92. if ($(hier[i]).hasClass("expression_elements")) {
  93. expression_div = $(hier[i]);
  94. break;
  95. }
  96. }
  97. }
  98. if (command_container) {
  99. expression_div = command_container.find('.expression_elements');
  100. }
  101. expression_div.text('');
  102. for (var i = 0; i < command.expression.length; i++) {
  103. var temp = $('<div class="expression_element"></div>');
  104. temp.data('ref_element', command.expression[i]);
  105. temp.data('ref_index', i);
  106. expression_div.append(temp);
  107. renderElement(command, function_obj, temp, command.expression[i]);
  108. }
  109. }
  110. function renderOperator (command, function_obj, temp_op, expression_element, index_op) {
  111. var context_menu = '<div class="ui dropdown"><div class="text">';
  112. switch (expression_element.itens[index_op]) {
  113. case Models.ARITHMETIC_TYPES.plus:
  114. context_menu += '+';
  115. break;
  116. case Models.ARITHMETIC_TYPES.minus:
  117. context_menu += '-';
  118. break;
  119. case Models.ARITHMETIC_TYPES.multiplication:
  120. context_menu += '*';
  121. break;
  122. case Models.ARITHMETIC_TYPES.division:
  123. context_menu += '/';
  124. break;
  125. case Models.ARITHMETIC_TYPES.module:
  126. context_menu += '%';
  127. break;
  128. case Models.ARITHMETIC_TYPES.none:
  129. context_menu += '...';
  130. break;
  131. }
  132. context_menu += '</div><div class="menu">';
  133. context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.plus+'">+</div>';
  134. context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.minus+'">-</div>';
  135. context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.multiplication+'">*</div>';
  136. context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.division+'">/</div>';
  137. context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.module+'">%</div>';
  138. context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.none+'" data-text="...">Nenhum</div>';
  139. context_menu += '</div></div>';
  140. context_menu = $(context_menu);
  141. temp_op.append(context_menu);
  142. context_menu.dropdown({
  143. onChange: function(value, text, $selectedItem) {
  144. expression_element.itens[index_op] = value;
  145. }
  146. });
  147. }
  148. function renderMenuAddExpression (command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  149. if (el.hasClass("command_container") == false) {
  150. var hier = el.parentsUntil(".commands_list_div");
  151. for (var i = 0; i < hier.length; i++) {
  152. if ($(hier[i]).hasClass("command_container")) {
  153. el = $(hier[i]);
  154. break;
  155. }
  156. }
  157. }
  158. if (dom_append_menu.hasClass("expression_elements") == false) {
  159. var hier = el.parentsUntil(".commands_list_div");
  160. for (var i = 0; i < hier.length; i++) {
  161. if ($(hier[i]).hasClass("expression_elements")) {
  162. dom_append_menu = $(hier[i]);
  163. break;
  164. }
  165. }
  166. }
  167. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  168. context_menu += '<div class="item" data-value="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  169. context_menu += '<div class="item" data-value="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  170. context_menu += '<div class="item" data-value="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  171. context_menu += '</div></div>';
  172. context_menu = $(context_menu);
  173. dom_append_menu.append(context_menu);
  174. context_menu.dropdown({
  175. onChange: function(value, text, $selectedItem) {
  176. switch (value) {
  177. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  178. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true),
  179. Models.ARITHMETIC_TYPES.plus,
  180. new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  181. expression_append_new_expression.push(exp);
  182. break;
  183. case Models.EXPRESSION_ELEMENTS.op_exp:
  184. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus,
  185. new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  186. expression_append_new_expression.push(exp);
  187. break;
  188. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  189. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  190. expression_append_new_expression.push(exp);
  191. break;
  192. }
  193. renderExpressionElements(command, function_obj, el);
  194. }
  195. });
  196. }
  197. function renderElement (command, function_obj, el, expression_element) {
  198. switch (expression_element.type_exp) {
  199. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  200. var temp_op = $('<div class="component_element"></div>');
  201. var temp_exp_1 = $('<div class="component_element"></div>');
  202. var temp_exp_2 = $('<div class="component_element"></div>');
  203. el.append(temp_exp_1);
  204. el.append(temp_op);
  205. el.append(temp_exp_2);
  206. if (expression_element.itens[0].type) {
  207. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  208. } else {
  209. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  210. }
  211. renderOperator(command, function_obj, temp_op, expression_element, 1);
  212. if (expression_element.itens[2].type) {
  213. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  214. } else {
  215. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  216. }
  217. break;
  218. case Models.EXPRESSION_ELEMENTS.op_exp:
  219. var temp_op = $('<div class="component_element"></div>');
  220. var temp_exp = $('<div class="component_element"></div>');
  221. el.append(temp_op);
  222. el.append(temp_exp);
  223. renderOperator(command, function_obj, temp_op, expression_element, 0);
  224. if (expression_element.itens[1].type) {
  225. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  226. } else {
  227. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  228. }
  229. break;
  230. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  231. var temp_par_1 = $('<div class="component_element"> ( </div>');
  232. var temp_exp = $('<div class="component_element"></div>');
  233. var temp_par_2 = $('<div class="component_element"> ) </div>');
  234. el.append(temp_par_1);
  235. el.append(temp_exp);
  236. for (var j = 0; j < expression_element.itens.length; j++) {
  237. if (expression_element.itens[j].type) {
  238. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  239. } else {
  240. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  241. }
  242. }
  243. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  244. el.append(temp_par_2);
  245. break;
  246. }
  247. }
  248. function renderExpression (command, function_obj, el) {
  249. var expression_div = el.find('.expression_elements');
  250. expression_div.text('');
  251. var menu_add_item = $('<div class="menu_add_item"></div>');
  252. menu_add_item.data('index_add', 0);
  253. expression_div.append(menu_add_item);
  254. for (var i = 0; i < command.expression.length; i++) {
  255. if (command.expression[i].type) {
  256. var temp = $('<div class="expression_element"></div>');
  257. temp.data('ref_element', command.expression[i]);
  258. temp.data('ref_index', i);
  259. expression_div.append(temp);
  260. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  261. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  262. var temp = $('<div class="expression_element">'+command.expression[i]+'</div>');
  263. temp.data('ref_element', command.expression[i]);
  264. temp.data('ref_index', i);
  265. expression_div.append(temp);
  266. } else {
  267. var temp = '<div class="expression_element">';
  268. switch(command.expression[i]) {
  269. case Models.ARITHMETIC_TYPES.plus:
  270. temp += '+';
  271. break;
  272. case Models.ARITHMETIC_TYPES.minus:
  273. temp += '-';
  274. break;
  275. case Models.ARITHMETIC_TYPES.multiplication:
  276. temp += '*';
  277. break;
  278. case Models.ARITHMETIC_TYPES.division:
  279. temp += '/';
  280. break;
  281. case Models.ARITHMETIC_TYPES.module:
  282. temp += '%';
  283. break;
  284. }
  285. temp += '</div>';
  286. temp = $(temp);
  287. temp.data('ref_element', command.expression[i]);
  288. temp.data('ref_index', i);
  289. expression_div.append(temp);
  290. }
  291. var menu_add_item_seq = $('<div class="menu_add_item"></div>');
  292. var index_temp = (i + 1);
  293. menu_add_item_seq.data('index_add', index_temp);
  294. expression_div.append(menu_add_item_seq);
  295. }
  296. addMenuItens(command, function_obj, el);
  297. }
  298. function addMenuItens (command, function_obj, expression_div) {
  299. var divs_expression = expression_div.find('.menu_add_item');
  300. for (var i = 0; i < divs_expression.length; i++) {
  301. var temp = $(divs_expression[i]).data('index_add');
  302. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  303. context_menu += '<div class="item" data-option="value" data-index="'+temp+'">'+LocalizedStrings.getUI('text_value')+'</div>';
  304. context_menu += '<div class="item" data-option="operator" data-index="'+temp+'">'+LocalizedStrings.getUI('text_operator')+'</div>';
  305. context_menu += '<div class="item" data-option="parentheses" data-index="'+temp+'">'+LocalizedStrings.getUI('text_parentheses')+'</div>';
  306. context_menu += '</div></div>';
  307. context_menu = $(context_menu);
  308. $(divs_expression[i]).append(context_menu);
  309. context_menu.dropdown({
  310. on: 'hover',
  311. onChange: function(value, text, $selectedItem) {
  312. switch ($selectedItem.data('option')) {
  313. case "value":
  314. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  315. renderExpression(command, function_obj, expression_div);
  316. break;
  317. case "operator":
  318. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  319. renderExpression(command, function_obj, expression_div);
  320. break;
  321. case "parentheses":
  322. command.expression.splice($selectedItem.data('index'), 0, "(");
  323. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  324. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  325. renderExpression(command, function_obj, expression_div);
  326. break;
  327. }
  328. }
  329. });
  330. }
  331. }
  332. function addHandlers (command, function_obj, attribution_dom) {
  333. attribution_dom.find('.button_write_expression').on('click', function() {
  334. window.expressionEdition = true;
  335. window.inputExpression = null;
  336. var afterWhichElement;
  337. var lockButton = $(attribution_dom.find('.button_alternate_expression')[0]);
  338. var editButton = $(this);
  339. afterWhichElement = attribution_dom.find('.expression_elements');
  340. if (command.lockexpression) {
  341. afterWhichElement = attribution_dom.find('.textual_expression');
  342. }
  343. var text = "";
  344. if (command.expression) {
  345. if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
  346. text = "";
  347. } else {
  348. try {
  349. text = CodeGenerator.elementExpressionCode(command.expression);
  350. } catch(ex) {
  351. text = "";
  352. }
  353. }
  354. }
  355. var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
  356. var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
  357. var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
  358. input.val(text);
  359. input.focusout(function(evt) {
  360. console.log('focosout event!');
  361. ok_button.click();
  362. evt.preventDefault();
  363. return true;
  364. });
  365. input.keyup(function(evt) {
  366. if (evt.keyCode == 27) { // esc
  367. cancel_button.click();
  368. }
  369. if (evt.keyCode == 13) { // enter
  370. ok_button.click();
  371. }
  372. });
  373. ok_button.click(function() {
  374. var parsed = null;
  375. parsed = ExpressionManagement.expressionParserToVisual(input.val(), function_obj, input);
  376. if (parsed) {
  377. window.expressionEdition = false;
  378. command.expression = parsed;
  379. renderAlgorithm();
  380. }
  381. });
  382. cancel_button.mousedown(function(evt) {
  383. var parsed = ExpressionManagement.expressionParserToVisual(text, function_obj, input);
  384. if (parsed) {
  385. window.expressionEdition = false;
  386. command.expression = parsed;
  387. renderAlgorithm();
  388. }
  389. });
  390. input.insertAfter(afterWhichElement);
  391. input.focus();
  392. cancel_button.insertAfter(input);
  393. ok_button.insertAfter(input);
  394. var len = text.length;
  395. input[0].setSelectionRange(len, len);
  396. afterWhichElement.css('display', 'none');
  397. lockButton.css('display', 'none');
  398. editButton.css('display', 'none');
  399. ok_button.popup({
  400. content : LocalizedStrings.getUI("text_edit_expression_confirm"),
  401. delay: {
  402. show: 750,
  403. hide: 0
  404. }
  405. });
  406. cancel_button.popup({
  407. content : LocalizedStrings.getUI("text_edit_expression_cancel"),
  408. delay: {
  409. show: 750,
  410. hide: 0
  411. }
  412. });
  413. });
  414. $(attribution_dom.find('.textual_expression')[0]).toggle();
  415. attribution_dom.find('.button_alternate_expression').on('click', function() {
  416. if (command.expression) {
  417. var text = CodeGenerator.elementExpressionCode(command.expression);
  418. if (text) {
  419. $(attribution_dom.find('.expression_elements')[0]).toggle();
  420. $(attribution_dom.find('.textual_expression')[0]).text(text);
  421. $(attribution_dom.find('.textual_expression')[0]).toggle();
  422. $(this).toggleClass('unlock').toggleClass('lock');
  423. command.lockexpression = !command.lockexpression;
  424. }
  425. if (command.lockexpression) {
  426. attribution_dom.find('.lock').popup({
  427. content : LocalizedStrings.getUI("text_unlock_expression"),
  428. delay: {
  429. show: 750,
  430. hide: 0
  431. }
  432. });
  433. } else {
  434. attribution_dom.find('.unlock').popup({
  435. content : LocalizedStrings.getUI("text_lock_expression"),
  436. delay: {
  437. show: 750,
  438. hide: 0
  439. }
  440. });
  441. }
  442. }
  443. });
  444. attribution_dom.find('.button_remove_command').on('click', function() {
  445. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  446. attribution_dom.fadeOut(400, function() {
  447. attribution_dom.remove();
  448. });
  449. }
  450. });
  451. attribution_dom.find('.button_refresh_attribution').on('click', function() {
  452. renderExpressionElements(command, function_obj, attribution_dom);
  453. });
  454. }
  455. export function renderMenuOperations (command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  456. /*console.log("recebido o seguinte DOM: ");
  457. console.log(dom_object);
  458. if (dom_object.hasClass('var_attributed')) {
  459. return;
  460. } else {
  461. var hier = dom_object.parentsUntil(".command_container");
  462. for (var i = 0; i < hier.length; i++) {
  463. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  464. return;
  465. }
  466. }
  467. }
  468. dom_object.find('.context_menu_clear').remove();
  469. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  470. for (var tm in Models.ARITHMETIC_TYPES) {
  471. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  472. }
  473. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  474. menu_operations += '</div></div>';
  475. menu_operations = $(menu_operations);
  476. dom_object.append(menu_operations);
  477. menu_operations.dropdown({
  478. onChange: function(value, text, $selectedItem) {
  479. switch ($($selectedItem).data('option')) {
  480. case "clear":
  481. $(dom_object).text('');
  482. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  483. break;
  484. default:
  485. createExpressionAround(command, ref_object, dom_object, function_obj);
  486. menu_operations.find('.text').text('');
  487. }
  488. }
  489. });*/
  490. }
  491. function createExpressionAround (command, ref_object, dom_object, function_obj) {
  492. $('<span> ( </span>').insertBefore(dom_object);
  493. $('<span> ) </span>').insertAfter(dom_object);
  494. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  495. }