simulation_log_pane.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. ////////////////////////////////////////////////////////////////////////////
  2. // System Pre-define Functions
  3. // 95099372-ef3e-11ea-9c81-bf848405c62e
  4. //Callback of data preparation stage before UI is fully loaded.
  5. function OnInitializeData(reload, preview) {
  6. PUI(()=>{
  7. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  8. //The 'pui' variable is valid in all functions of this document.
  9. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  10. });
  11. OnWarningModelHide();
  12. OnMonitorModelHide();
  13. OnLogModelShow();
  14. }
  15. //Callback after UI is fully loaded and displayed.
  16. function OnReady(reload, preview) {
  17. PUI(()=>{
  18. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  19. //The 'pui' variable is valid in all functions of this document.
  20. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  21. });
  22. }
  23. function OnCloseForm() {
  24. }
  25. function OnChangeModel(Idx){
  26. const difModel = {
  27. 'job':() => {
  28. ui.job_btn.valid = true;
  29. ui.rea_btn.valid = false;
  30. //ui.stk_dif_model.index = 0;
  31. },
  32. 'realizations':() => {
  33. ui.job_btn.valid = false;
  34. ui.rea_btn.valid = true;
  35. //ui.stk_dif_model.index = 1;
  36. }
  37. };
  38. return difModel[Idx]();
  39. }
  40. function OnException(err) {
  41. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  42. }
  43. //////////////////////////////////////////////////////////////////////////
  44. // Callback Functions.
  45. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  46. function OnMonitorModelHide(){
  47. ui.monitor_down_btn.visible = false;
  48. ui.monitor_right_btn.visible = true;
  49. ui.monitor_stk.visible = false;
  50. }
  51. function OnMonitorModelShow(){
  52. ui.monitor_down_btn.visible = true;
  53. ui.monitor_right_btn.visible = false;
  54. ui.monitor_stk.visible = true;
  55. }
  56. function OnWarningModelHide(){
  57. ui.warnings_down_btn.visible = false;
  58. ui.warnings_right_btn.visible = true;
  59. ui.warnings_stk.visible = false;
  60. }
  61. function OnWarningModelShow(){
  62. ui.warnings_down_btn.visible = true;
  63. ui.warnings_right_btn.visible = false;
  64. ui.warnings_stk.visible = true;
  65. }
  66. function OnLogModelHide(){
  67. ui.log_down_btn.visible = false;
  68. ui.log_right_btn.visible = true;
  69. ui.log_stk.visible = false;
  70. }
  71. function OnLogModelShow(){
  72. ui.log_down_btn.visible = true;
  73. ui.log_right_btn.visible = false;
  74. ui.log_stk.visible = true;
  75. }
  76. //The message corresponding callback executed by the docker pane.
  77. // when calling [side_pane].fireEvent(type,para) in the main form.
  78. function OnParentDockerMessage(type, para) {
  79. }
  80. //////////////////////////////////////////////////////////////////////////
  81. // Utils Functions.
  82. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  83. function onDragFile(filepath) {
  84. }
  85. function PUI(cb) {
  86. if(pui){cb();}
  87. }
  88. /*Usage of BLOCK_EVENT
  89. BLOCK_EVENT(()=>{
  90. ui.[name].[var] = ...;
  91. });
  92. */
  93. function BLOCK_EVENT(cb) {
  94. ui.block_event = true;
  95. cb();
  96. ui.block_event = false;
  97. }
  98. //////////////////////////////////////////////////////////////////////////
  99. // template codes for cw callback js.
  100. function CW_DeclareVariable(name, setter, getter) {
  101. if(typeof(__DeclareVariable) === 'function') {
  102. __DeclareVariable(name, setter, getter);
  103. }
  104. }
  105. function CW_DeclareOuterVariable(name) {
  106. if(typeof(__DeclareOuterVariable) === 'function') {
  107. __DeclareOuterVariable(name);
  108. }
  109. }