BasicButtonControl.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. define(function () {
  2. "use strict";
  3. function Control() {
  4. };
  5. Control.prototype.draw = function (oControlHost) {
  6. var div = oControlHost.container;
  7. div.innerHTML = "<button>" + oControlHost.configuration["Button label"] + "</button>";
  8. this.m_btn = div.querySelector("*");
  9. this.m_btn.onclick = this.f_onClick.bind(this, oControlHost);
  10. this.m_btn.style.backgroundColor = oControlHost.configuration["Background Color"];
  11. this.m_btn.style.color = oControlHost.configuration["Font Color"];
  12. this.m_btn.style.fontFamily = oControlHost.configuration["Font Family"];
  13. this.m_btn.style.fontSize = oControlHost.configuration["Font Size"];
  14. this.m_btn.style.borderColor = "#ffffff";
  15. this.m_btn.style.border = "thin solid";
  16. this.m_btn.style.cursor = "pointer";
  17. this.m_btn.style.borderRadius = "0px";
  18. this.m_btn.style.width = oControlHost.configuration["Button Width"];
  19. this.m_btn.style.height = oControlHost.configuration["Button Height"];
  20. };
  21. Control.prototype.getParameters = function (oControlHost) {
  22. return [ {
  23. "parameter": oControlHost.configuration["Parameter"],
  24. "values": [ {
  25. "use" : oControlHost.configuration["Button value"], "display" : oControlHost.configuration["Button label"]
  26. }]
  27. }
  28. ];
  29. };
  30. Control.prototype.f_onClick = function (oControlHost) {
  31. oControlHost.valueChanged();
  32. oControlHost.next();
  33. };
  34. return Control;
  35. });