actionsbuilder.parameters.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. var ActionsBuilder;
  2. (function (ActionsBuilder) {
  3. var Parameters = (function () {
  4. /*
  5. * Constructor
  6. */
  7. function Parameters(viewer) {
  8. var _this = this;
  9. this._action = null;
  10. // Get HTML elements
  11. this.parametersContainer = document.getElementById("ParametersElementID");
  12. this.parametersHelpElement = document.getElementById("ParametersHelpElementID");
  13. // Configure this
  14. this._viewer = viewer;
  15. // Configure events
  16. window.addEventListener("resize", function (event) {
  17. _this.onResize(event);
  18. });
  19. }
  20. /*
  21. * Clears the parameters fileds in the parameters view
  22. */
  23. Parameters.prototype.clearParameters = function () {
  24. if (this.parametersContainer.children === null) {
  25. return;
  26. }
  27. while (this.parametersContainer.children.length > 0) {
  28. this.parametersContainer.removeChild(this.parametersContainer.firstChild);
  29. }
  30. };
  31. /*
  32. * Creates parameters fields
  33. * @param action: the action to configure
  34. */
  35. Parameters.prototype.createParameters = function (action) {
  36. // Clear parameters fields and draw help description
  37. this._action = action;
  38. this.clearParameters();
  39. if (action === null) {
  40. return;
  41. }
  42. this._createHelpSection(action);
  43. this._createNodeSection(action);
  44. // Get properties
  45. var properties = action.properties;
  46. var propertiesResults = action.propertiesResults;
  47. var targetParameterSelect = null;
  48. var targetParameterNameSelect = null;
  49. var propertyPathSelect = null;
  50. var propertyPathOptionalSelect = null;
  51. var booleanSelect = null;
  52. var propertyInput = null;
  53. var propertyPathIndice = -1;
  54. if (properties.length === 0) {
  55. return;
  56. }
  57. // Draw properties
  58. for (var i = 0; i < properties.length; i++) {
  59. // Create separator
  60. var separator = document.createElement("hr");
  61. separator.noShade = true;
  62. separator.className = "ParametersElementSeparatorClass";
  63. this.parametersContainer.appendChild(separator);
  64. // Create parameter text
  65. var parameterName = document.createElement("a");
  66. parameterName.text = properties[i].text;
  67. parameterName.className = "ParametersElementTitleClass";
  68. this.parametersContainer.appendChild(parameterName);
  69. if (properties[i].text === "parameter" || properties[i].text === "target" || properties[i].text === "parent") {
  70. if (properties[i].targetType === null) {
  71. var parameterInput = document.createElement("input");
  72. parameterInput.value = propertiesResults[i].value;
  73. parameterInput.className = "ParametersElementInputClass";
  74. this.parametersContainer.appendChild(parameterInput);
  75. // Configure event
  76. parameterInput.onkeyup = this._propertyInputChanged(parameterInput, i);
  77. }
  78. else {
  79. // Create target select element
  80. targetParameterSelect = document.createElement("select");
  81. targetParameterSelect.className = "ParametersElementSelectClass";
  82. this.parametersContainer.appendChild(targetParameterSelect);
  83. // Create target name select element
  84. targetParameterNameSelect = document.createElement("select");
  85. targetParameterNameSelect.className = "ParametersElementSelectClass";
  86. this.parametersContainer.appendChild(targetParameterNameSelect);
  87. // Events and configure
  88. (this._parameterTargetChanged(targetParameterSelect, targetParameterNameSelect, propertyPathSelect, propertyPathOptionalSelect, i))(null);
  89. targetParameterSelect.value = propertiesResults[i].targetType;
  90. targetParameterNameSelect.value = propertiesResults[i].value;
  91. targetParameterSelect.onchange = this._parameterTargetChanged(targetParameterSelect, targetParameterNameSelect, propertyPathSelect, propertyPathOptionalSelect, i);
  92. targetParameterNameSelect.onchange = this._parameterTargetNameChanged(targetParameterSelect, targetParameterNameSelect, i);
  93. }
  94. }
  95. else if (properties[i].text === "propertyPath") {
  96. propertyPathIndice = i;
  97. // Create property path select
  98. propertyPathSelect = document.createElement("select");
  99. propertyPathSelect.className = "ParametersElementSelectClass";
  100. this.parametersContainer.appendChild(propertyPathSelect);
  101. // Create additional select
  102. propertyPathOptionalSelect = document.createElement("select");
  103. propertyPathOptionalSelect.className = "ParametersElementSelectClass";
  104. this.parametersContainer.appendChild(propertyPathOptionalSelect);
  105. // Events and configure
  106. (this._propertyPathSelectChanged(targetParameterSelect, propertyPathSelect, propertyPathOptionalSelect, null, null, i))(null);
  107. var property = this._action.propertiesResults[i].value.split(".");
  108. if (property.length > 0) {
  109. if (property.length === 1) {
  110. propertyPathSelect.value = property[0];
  111. }
  112. else {
  113. var completePropertyPath = "";
  114. for (var j = 0; j < property.length - 1; j++) {
  115. completePropertyPath += property[j];
  116. completePropertyPath += (j === property.length - 2) ? "" : ".";
  117. }
  118. propertyPathSelect.value = completePropertyPath;
  119. this._viewer.utils.setElementVisible(propertyPathOptionalSelect, true);
  120. }
  121. this._fillAdditionalPropertyPath(targetParameterSelect, propertyPathSelect, propertyPathOptionalSelect);
  122. propertyPathOptionalSelect.value = property[property.length - 1];
  123. if (propertyPathOptionalSelect.options.length === 0 || propertyPathOptionalSelect.options[0].textContent === "") {
  124. this._viewer.utils.setElementVisible(propertyPathOptionalSelect, false);
  125. }
  126. }
  127. targetParameterSelect.onchange = this._parameterTargetChanged(targetParameterSelect, targetParameterNameSelect, propertyPathSelect, propertyPathOptionalSelect, i - 1);
  128. propertyPathSelect.onchange = this._propertyPathSelectChanged(targetParameterSelect, propertyPathSelect, propertyPathOptionalSelect, null, null, i);
  129. propertyPathOptionalSelect.onchange = this._additionalPropertyPathSelectChanged(propertyPathSelect, propertyPathOptionalSelect, i);
  130. }
  131. else if (properties[i].text === "operator") {
  132. var conditionOperatorSelect = document.createElement("select");
  133. conditionOperatorSelect.className = "ParametersElementSelectClass";
  134. this.parametersContainer.appendChild(conditionOperatorSelect);
  135. // Configure event
  136. (this._conditionOperatorSelectChanged(conditionOperatorSelect, i))(null);
  137. conditionOperatorSelect.value = propertiesResults[i].value;
  138. conditionOperatorSelect.onchange = this._conditionOperatorSelectChanged(conditionOperatorSelect, i);
  139. }
  140. else if (properties[i].text === "sound") {
  141. var soundSelect = document.createElement("select");
  142. soundSelect.className = "ParametersElementSelectClass";
  143. this.parametersContainer.appendChild(soundSelect);
  144. // Configure event
  145. (this._soundSelectChanged(soundSelect, i))(null);
  146. soundSelect.value = propertiesResults[i].value;
  147. soundSelect.onchange = this._soundSelectChanged(soundSelect, i);
  148. }
  149. else {
  150. var isBoolean = propertiesResults[i].value === "true" || propertiesResults[i].value === "false";
  151. var object = this._getObjectFromType(targetParameterSelect.value);
  152. if (object !== null) {
  153. var property = this._action.propertiesResults[i - 1].value.split(".");
  154. for (var j = 0; j < property.length && object !== undefined; j++) {
  155. object = object[property[j]];
  156. if (j === property.length - 1) {
  157. isBoolean = isBoolean || typeof object === "boolean";
  158. }
  159. }
  160. }
  161. booleanSelect = document.createElement("select");
  162. booleanSelect.className = "ParametersElementSelectClass";
  163. this.parametersContainer.appendChild(booleanSelect);
  164. // Configure event
  165. (this._booleanSelectChanged(booleanSelect, i))(null);
  166. booleanSelect.value = propertiesResults[i].value;
  167. booleanSelect.onchange = this._booleanSelectChanged(booleanSelect, i);
  168. propertyInput = document.createElement("input");
  169. propertyInput.value = propertiesResults[i].value;
  170. propertyInput.className = "ParametersElementInputClass";
  171. this.parametersContainer.appendChild(propertyInput);
  172. // Configure event
  173. propertyInput.onkeyup = this._propertyInputChanged(propertyInput, i);
  174. if (propertyPathIndice !== -1 && properties[i].text === "value") {
  175. propertyPathSelect.onchange = this._propertyPathSelectChanged(targetParameterSelect, propertyPathSelect, propertyPathOptionalSelect, booleanSelect, propertyInput, propertyPathIndice);
  176. }
  177. if (isBoolean) {
  178. this._viewer.utils.setElementVisible(booleanSelect, true);
  179. this._viewer.utils.setElementVisible(propertyInput, false);
  180. }
  181. else {
  182. this._viewer.utils.setElementVisible(booleanSelect, false);
  183. this._viewer.utils.setElementVisible(propertyInput, true);
  184. }
  185. }
  186. }
  187. };
  188. /*
  189. * Resizes the parameters view
  190. * @param: the resize event
  191. */
  192. Parameters.prototype.onResize = function (event) {
  193. var tools = document.getElementById("ToolsButtonsID");
  194. this.parametersContainer.style.height = window.innerHeight - tools.getBoundingClientRect().height - 25 - 200 + "px";
  195. this.parametersHelpElement.style.height = 200 + "px";
  196. };
  197. /*
  198. * Returns the boolean select change event
  199. * @param booleanSelect: the boolean select element
  200. * @param indice: the properties result indice
  201. */
  202. Parameters.prototype._booleanSelectChanged = function (booleanSelect, indice) {
  203. var _this = this;
  204. return function (ev) {
  205. if (booleanSelect.options.length === 0) {
  206. var values = ["true", "false"];
  207. for (var i = 0; i < values.length; i++) {
  208. var option = document.createElement("option");
  209. option.value = option.text = values[i];
  210. booleanSelect.add(option);
  211. }
  212. }
  213. else {
  214. _this._action.propertiesResults[indice].value = booleanSelect.value;
  215. }
  216. };
  217. };
  218. /*
  219. * Returns the sound select change event
  220. * @param soundSelect: the sound select element
  221. * @param indice: the properties result indice
  222. */
  223. Parameters.prototype._soundSelectChanged = function (soundSelect, indice) {
  224. var _this = this;
  225. return function (ev) {
  226. if (soundSelect.options.length === 0) {
  227. for (var i = 0; i < ActionsBuilder.SceneElements.SOUNDS.length; i++) {
  228. var option = document.createElement("option");
  229. option.value = option.text = ActionsBuilder.SceneElements.SOUNDS[i];
  230. soundSelect.add(option);
  231. }
  232. _this._sortList(soundSelect);
  233. }
  234. else {
  235. _this._action.propertiesResults[indice].value = soundSelect.value;
  236. }
  237. };
  238. };
  239. /*
  240. * Returns the condition opeator select changed event
  241. * @param conditionOperatorSelect: the condition operator select element
  242. * @param indice: the properties result indice
  243. */
  244. Parameters.prototype._conditionOperatorSelectChanged = function (conditionOperatorSelect, indice) {
  245. var _this = this;
  246. return function (ev) {
  247. if (conditionOperatorSelect.options.length === 0) {
  248. for (var i = 0; i < ActionsBuilder.SceneElements.OPERATORS.length; i++) {
  249. var option = document.createElement("option");
  250. option.value = option.text = ActionsBuilder.SceneElements.OPERATORS[i];
  251. //conditionOperatorSelect.options.add(option);
  252. conditionOperatorSelect.add(option);
  253. }
  254. }
  255. else {
  256. _this._action.propertiesResults[indice].value = conditionOperatorSelect.value;
  257. }
  258. };
  259. };
  260. /*
  261. * Returns the property input changed event
  262. * @param propertyInput: the property input
  263. * @param indice: the properties result indice
  264. */
  265. Parameters.prototype._propertyInputChanged = function (propertyInput, indice) {
  266. var _this = this;
  267. return function (ev) {
  268. _this._action.propertiesResults[indice].value = propertyInput.value;
  269. };
  270. };
  271. /*
  272. * Returns the propertyPath select changed event
  273. * @param targetParameterSelect: the target/parameter select element
  274. * @param propertyPathSelect: the propertyPath select element
  275. * @param additionalPropertyPathSelect: the additional propertyPath select element
  276. * @param indice: the properties indice in action.properties
  277. */
  278. Parameters.prototype._propertyPathSelectChanged = function (targetParameterSelect, propertyPathSelect, additionalPropertyPathSelect, booleanSelect, propertyInput, indice) {
  279. var _this = this;
  280. return function (event) {
  281. if (propertyPathSelect.options.length === 0) {
  282. // Configure start values
  283. var properties = _this._getPropertiesFromType(targetParameterSelect.value);
  284. if (properties !== null) {
  285. for (var i = 0; i < properties.length; i++) {
  286. var option = document.createElement("option");
  287. option.value = option.text = properties[i];
  288. propertyPathSelect.add(option);
  289. }
  290. }
  291. }
  292. else {
  293. // Set property
  294. _this._action.propertiesResults[indice].value = propertyPathSelect.value;
  295. if (booleanSelect !== null && propertyInput !== null) {
  296. var object = _this._getObjectFromType(targetParameterSelect.value);
  297. var isBoolean = false;
  298. if (object !== null) {
  299. var property = _this._action.propertiesResults[indice].value.split(".");
  300. for (var j = 0; j < property.length; j++) {
  301. object = object[property[j]];
  302. if (j === property.length - 1) {
  303. isBoolean = isBoolean || typeof object === "boolean";
  304. }
  305. }
  306. }
  307. if (isBoolean) {
  308. _this._viewer.utils.setElementVisible(booleanSelect, true);
  309. _this._viewer.utils.setElementVisible(propertyInput, false);
  310. }
  311. else {
  312. _this._viewer.utils.setElementVisible(booleanSelect, false);
  313. _this._viewer.utils.setElementVisible(propertyInput, true);
  314. }
  315. }
  316. }
  317. // Configure addition property
  318. _this._fillAdditionalPropertyPath(targetParameterSelect, propertyPathSelect, additionalPropertyPathSelect);
  319. // Sort
  320. _this._sortList(propertyPathSelect);
  321. };
  322. };
  323. Parameters.prototype._fillAdditionalPropertyPath = function (targetParameterSelect, propertyPathSelect, additionalPropertyPathSelect) {
  324. additionalPropertyPathSelect.options.length = 0;
  325. var object = this._getObjectFromType(targetParameterSelect.value);
  326. if (object !== null) {
  327. var propertyPath = propertyPathSelect.value.split(".");
  328. for (var i = 0; i < propertyPath.length; i++) {
  329. object = object[propertyPath[i]];
  330. }
  331. }
  332. if (object === null || object === undefined || (typeof (object)).toLowerCase() === "string") {
  333. this._viewer.utils.setElementVisible(additionalPropertyPathSelect, false);
  334. return;
  335. }
  336. // Add options
  337. var emptyOption = document.createElement("option");
  338. emptyOption.value = emptyOption.text = "";
  339. additionalPropertyPathSelect.add(emptyOption);
  340. for (var thing in object) {
  341. var type = ActionsBuilder.SceneElements.GetInstanceOf(object[thing]);
  342. var index = ActionsBuilder.SceneElements.TYPES.indexOf(type);
  343. if (index !== -1) {
  344. var option = document.createElement("option");
  345. option.value = option.text = thing;
  346. additionalPropertyPathSelect.add(option);
  347. emptyOption.text += thing + ", ";
  348. }
  349. }
  350. if (additionalPropertyPathSelect.options.length === 0 || additionalPropertyPathSelect.options[0].textContent === "") {
  351. this._viewer.utils.setElementVisible(additionalPropertyPathSelect, false);
  352. }
  353. else {
  354. this._viewer.utils.setElementVisible(additionalPropertyPathSelect, true);
  355. }
  356. };
  357. /*
  358. * Returns the additional propertyPath select changed event
  359. * @param propertyPathSelect: the propertyPath select element
  360. * @param additionalPropertyPathSelect: the additional propertyPath select element
  361. * @param indice: the properties indice in action.properties
  362. */
  363. Parameters.prototype._additionalPropertyPathSelectChanged = function (propertyPathSelect, additionalPropertyPathSelect, indice) {
  364. var _this = this;
  365. return function (event) {
  366. var property = propertyPathSelect.value;
  367. var additionalProperty = additionalPropertyPathSelect.value;
  368. if (additionalProperty !== "") {
  369. property += ".";
  370. property += additionalPropertyPathSelect.value;
  371. }
  372. _this._action.propertiesResults[indice].value = property;
  373. };
  374. };
  375. /*
  376. * Returns the parameter/target select changed event
  377. * @param targetParameterSelect: the target/parameter select element
  378. * @param targetParameterNameSelect: the target/parameter name select element
  379. * @param propertyPathSelect: the propertyPath select element
  380. * @param additionalPropertyPathSelect: the additional propertyPath select element
  381. * @param indice: the properties indice in action.properties
  382. */
  383. Parameters.prototype._parameterTargetChanged = function (targetParameterSelect, targetParameterNameSelect, propertyPathSelect, additionalPropertyPathSelect, indice) {
  384. var _this = this;
  385. return function (event) {
  386. if (targetParameterSelect.options.length === 0) {
  387. // Configure start values
  388. var options = [
  389. { text: "Mesh", targetType: "MeshProperties" },
  390. { text: "Light", targetType: "LightProperties" },
  391. { text: "Camera", targetType: "CameraProperties" },
  392. { text: "Scene", targetType: "SceneProperties" }
  393. ];
  394. targetParameterSelect.options.length = 0;
  395. for (var i = 0; i < options.length; i++) {
  396. var option = document.createElement("option");
  397. option.text = options[i].text;
  398. option.value = options[i].targetType;
  399. targetParameterSelect.add(option);
  400. }
  401. targetParameterSelect.value = _this._action.propertiesResults[indice].targetType;
  402. }
  403. else {
  404. _this._action.propertiesResults[indice].targetType = targetParameterSelect.value;
  405. var names = _this._getListFromType(targetParameterSelect.value);
  406. if (names !== null && names.length > 0) {
  407. _this._action.propertiesResults[indice].value = names[0];
  408. }
  409. else {
  410. _this._action.propertiesResults[indice].value = "";
  411. }
  412. if (propertyPathSelect !== null) {
  413. _this._action.propertiesResults[indice + 1].value = ""; // propertyPath
  414. }
  415. }
  416. // Configure target names
  417. var targetParameterProperties = _this._getTargetFromType(targetParameterSelect.value);
  418. targetParameterNameSelect.options.length = 0;
  419. if (targetParameterProperties !== null) {
  420. for (var i = 0; i < targetParameterProperties.length; i++) {
  421. var option = document.createElement("option");
  422. option.text = option.value = targetParameterProperties[i];
  423. targetParameterNameSelect.add(option);
  424. }
  425. }
  426. targetParameterNameSelect.value = _this._action.propertiesResults[indice].value;
  427. // Clear property path
  428. if (propertyPathSelect !== null) {
  429. propertyPathSelect.options.length = 0;
  430. additionalPropertyPathSelect.options.length = 0;
  431. _this._propertyPathSelectChanged(targetParameterSelect, propertyPathSelect, additionalPropertyPathSelect, null, null, indice + 1)(null);
  432. }
  433. _this._sortList(targetParameterNameSelect);
  434. _this._sortList(targetParameterSelect);
  435. };
  436. };
  437. /*
  438. * Returns the parameter/target name select changed
  439. * @param indice: the properties indice to change
  440. */
  441. Parameters.prototype._parameterTargetNameChanged = function (targetParameterSelect, targetParameterNameSelect, indice) {
  442. var _this = this;
  443. return function (event) {
  444. _this._action.propertiesResults[indice].value = targetParameterNameSelect.value;
  445. };
  446. };
  447. /*
  448. * Returns the array of objects names in function of its type
  449. * @param type: the target type
  450. */
  451. Parameters.prototype._getTargetFromType = function (type) {
  452. if (type === "MeshProperties" || type === "Mesh") {
  453. return ActionsBuilder.SceneElements.MESHES;
  454. }
  455. if (type === "LightProperties" || type === "Light") {
  456. return ActionsBuilder.SceneElements.LIGHTS;
  457. }
  458. if (type === "CameraProperties" || type === "Camera") {
  459. return ActionsBuilder.SceneElements.CAMERAS;
  460. }
  461. return null;
  462. };
  463. /*
  464. * Returns the properties in function of its type
  465. * @param type: the target type
  466. */
  467. Parameters.prototype._getPropertiesFromType = function (type) {
  468. if (type === "MeshProperties" || type === "Mesh") {
  469. return ActionsBuilder.SceneElements.MESH_PROPERTIES;
  470. }
  471. if (type === "LightProperties" || type === "Light") {
  472. return ActionsBuilder.SceneElements.LIGHT_PROPERTIES;
  473. }
  474. if (type === "CameraProperties" || type === "Camera") {
  475. return ActionsBuilder.SceneElements.CAMERA_PROPERTIES;
  476. }
  477. if (type === "SceneProperties" || type === "Scene") {
  478. return ActionsBuilder.SceneElements.SCENE_PROPERTIES;
  479. }
  480. return null;
  481. };
  482. Parameters.prototype._getListFromType = function (type) {
  483. if (type === "MeshProperties" || type === "Mesh") {
  484. return ActionsBuilder.SceneElements.MESHES;
  485. }
  486. if (type === "LightProperties" || type === "Light") {
  487. return ActionsBuilder.SceneElements.LIGHTS;
  488. }
  489. if (type === "CameraProperties" || type === "Camera") {
  490. return ActionsBuilder.SceneElements.CAMERAS;
  491. }
  492. return null;
  493. };
  494. /*
  495. * Returns the object in function of the given type
  496. * @param type: the target type
  497. */
  498. Parameters.prototype._getObjectFromType = function (type) {
  499. if (type === "MeshProperties" || type === "Mesh") {
  500. this._currentObject = ActionsBuilder.SceneElements.MESH;
  501. return ActionsBuilder.SceneElements.MESH;
  502. }
  503. if (type === "LightProperties" || type === "Light") {
  504. this._currentObject = ActionsBuilder.SceneElements.LIGHT;
  505. return ActionsBuilder.SceneElements.LIGHT;
  506. }
  507. if (type === "CameraProperties" || type === "Camera") {
  508. this._currentObject = ActionsBuilder.SceneElements.CAMERA;
  509. return ActionsBuilder.SceneElements.CAMERA;
  510. }
  511. if (type === "SceneProperties" || type === "Scene") {
  512. this._currentObject = ActionsBuilder.SceneElements.SCENE;
  513. return ActionsBuilder.SceneElements.SCENE;
  514. }
  515. return null;
  516. };
  517. /*
  518. * Creates the node section (top of parameters)
  519. * @param action: the action element to get color, text, name etc.
  520. */
  521. Parameters.prototype._createNodeSection = function (action) {
  522. var element = document.createElement("div");
  523. element.style.background = this._viewer.getSelectedNodeColor(action.type, action.node.detached);
  524. element.className = "ParametersElementNodeClass";
  525. var text = document.createElement("a");
  526. text.text = action.name;
  527. text.className = "ParametersElementNodeTextClass";
  528. element.appendChild(text);
  529. this.parametersContainer.appendChild(element);
  530. };
  531. /*
  532. * Creates the help section
  533. * @param action : the action containing the description
  534. */
  535. Parameters.prototype._createHelpSection = function (action) {
  536. // Get description
  537. var element = ActionsBuilder.Elements.GetElementFromName(action.name);
  538. if (element !== null) {
  539. this.parametersHelpElement.textContent = element.description;
  540. }
  541. };
  542. /*
  543. * Alphabetically sorts a HTML select element options
  544. * @param element : the HTML select element to sort
  545. */
  546. Parameters.prototype._sortList = function (element) {
  547. var options = [];
  548. for (var i = element.options.length - 1; i >= 0; i--) {
  549. options.push(element.removeChild(element.options[i]));
  550. }
  551. options.sort(function (a, b) {
  552. return a.innerHTML.localeCompare(b.innerHTML);
  553. });
  554. for (var i = 0; i < options.length; i++) {
  555. element.add(options[i]);
  556. }
  557. };
  558. return Parameters;
  559. }());
  560. ActionsBuilder.Parameters = Parameters;
  561. })(ActionsBuilder || (ActionsBuilder = {}));
  562. //# sourceMappingURL=actionsbuilder.parameters.js.map