plan_production_pane.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. OnPressDataModelHide();
  12. OnPressModelHide();
  13. OnPressBedModelHide();
  14. OnToolingModelHide();
  15. OnCommentsModelHide();
  16. OnWarningsModelHide();
  17. }
  18. //Callback after UI is fully loaded and displayed.
  19. function OnReady(reload, preview) {
  20. PUI(()=>{
  21. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  22. //The 'pui' variable is valid in all functions of this document.
  23. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  24. });
  25. }
  26. function OnCloseForm() {
  27. }
  28. function OnException(err) {
  29. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  30. }
  31. //////////////////////////////////////////////////////////////////////////
  32. // Callback Functions.
  33. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  34. function OnPressDataModelHide(){
  35. ui.pressdata_down_btn.visible = false;
  36. ui.pressdata_right_btn.visible = true;
  37. ui.pressdata_stk.visible = false;
  38. }
  39. function OnPressDataModelShow(){
  40. ui.pressdata_down_btn.visible = true;
  41. ui.pressdata_right_btn.visible = false;
  42. ui.pressdata_stk.visible = true;
  43. }
  44. function OnPressModelHide(){
  45. ui.press_down_btn.visible = false;
  46. ui.press_right_btn.visible = true;
  47. ui.press_stk.visible = false;
  48. }
  49. function OnPressModelShow(){
  50. ui.press_down_btn.visible = true;
  51. ui.press_right_btn.visible = false;
  52. ui.press_stk.visible = true;
  53. }
  54. function OnPressBedModelHide(){
  55. ui.pressbed_down_btn.visible = false;
  56. ui.pressbed_right_btn.visible = true;
  57. ui.pressbed_stk.visible = false;
  58. }
  59. function OnPressBedModelShow(){
  60. ui.pressbed_down_btn.visible = true;
  61. ui.pressbed_right_btn.visible = false;
  62. ui.pressbed_stk.visible = true;
  63. }
  64. function OnToolingModelHide(){
  65. ui.tooling_down_btn.visible = false;
  66. ui.tooling_right_btn.visible = true;
  67. ui.tooling_stk.visible = false;
  68. }
  69. function OnToolingModelShow(){
  70. ui.tooling_down_btn.visible = true;
  71. ui.tooling_right_btn.visible = false;
  72. ui.tooling_stk.visible = true;
  73. }
  74. function OnCommentsModelHide(){
  75. ui.comments_down_btn.visible = false;
  76. ui.comments_right_btn.visible = true;
  77. ui.comments_stk.visible = false;
  78. }
  79. function OnCommentsModelShow(){
  80. ui.comments_down_btn.visible = true;
  81. ui.comments_right_btn.visible = false;
  82. ui.comments_stk.visible = true;
  83. }
  84. function OnWarningsModelHide(){
  85. ui.warnings_down_btn.visible = false;
  86. ui.warnings_right_btn.visible = true;
  87. ui.warnings_stk.visible = false;
  88. }
  89. function OnWarningsModelShow(){
  90. ui.warnings_down_btn.visible = true;
  91. ui.warnings_right_btn.visible = false;
  92. ui.warnings_stk.visible = true;
  93. }
  94. //The message corresponding callback executed by the docker pane.
  95. // when calling [side_pane].fireEvent(type,para) in the main form.
  96. function OnParentDockerMessage(type, para) {
  97. }
  98. //////////////////////////////////////////////////////////////////////////
  99. // Utils Functions.
  100. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  101. function onDragFile(filepath) {
  102. }
  103. function PUI(cb) {
  104. if(pui){cb();}
  105. }
  106. /*Usage of BLOCK_EVENT
  107. BLOCK_EVENT(()=>{
  108. ui.[name].[var] = ...;
  109. });
  110. */
  111. function BLOCK_EVENT(cb) {
  112. ui.block_event = true;
  113. cb();
  114. ui.block_event = false;
  115. }
  116. //////////////////////////////////////////////////////////////////////////
  117. // template codes for cw callback js.
  118. function CW_DeclareVariable(name, setter, getter) {
  119. if(typeof(__DeclareVariable) === 'function') {
  120. __DeclareVariable(name, setter, getter);
  121. }
  122. }
  123. function CW_DeclareOuterVariable(name) {
  124. if(typeof(__DeclareOuterVariable) === 'function') {
  125. __DeclareOuterVariable(name);
  126. }
  127. }