toolAF_bar_pane.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. }
  12. //Callback after UI is fully loaded and displayed.
  13. function OnReady(reload, preview) {
  14. PUI(()=>{
  15. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  16. //The 'pui' variable is valid in all functions of this document.
  17. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  18. });
  19. }
  20. function OnCloseForm() {
  21. }
  22. function OnException(err) {
  23. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  24. }
  25. //////////////////////////////////////////////////////////////////////////
  26. // Callback Functions.
  27. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  28. function OnTopMenu(idx) {
  29. unit.form.toolAF.OnTopMenu(idx);
  30. //ui.stack_tool.index = 0;
  31. ui.mp_btn.valid = ui.env_pb.valid = ui.seclect_pb.valid = false;
  32. //model.ide_info(idx);
  33. if (idx === 1) {
  34. ui.mp_btn.valid = true;
  35. }
  36. if (idx === 2) {
  37. ui.env_pb.valid = true;
  38. }
  39. if (idx === 3) {
  40. ui.mp_btn.valid = true;
  41. }
  42. }
  43. function OnOpen(){
  44. ui.stack_switch.index = 0;
  45. ui.stack_tool.visible = true;
  46. }
  47. function OnClose(){
  48. ui.stack_switch.index = 1;
  49. ui.stack_tool.visible = false;
  50. }
  51. //The message corresponding callback executed by the docker pane.
  52. // when calling [side_pane].fireEvent(type,para) in the main form.
  53. function OnParentDockerMessage(type, para) {
  54. }
  55. //////////////////////////////////////////////////////////////////////////
  56. // Utils Functions.
  57. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  58. function onDragFile(filepath) {
  59. }
  60. function PUI(cb) {
  61. if(pui){cb();}
  62. }
  63. /*Usage of BLOCK_EVENT
  64. BLOCK_EVENT(()=>{
  65. ui.[name].[var] = ...;
  66. });
  67. */
  68. function BLOCK_EVENT(cb) {
  69. ui.block_event = true;
  70. cb();
  71. ui.block_event = false;
  72. }
  73. //////////////////////////////////////////////////////////////////////////
  74. // template codes for cw callback js.
  75. function CW_DeclareVariable(name, setter, getter) {
  76. if(typeof(__DeclareVariable) === 'function') {
  77. __DeclareVariable(name, setter, getter);
  78. }
  79. }
  80. function CW_DeclareOuterVariable(name) {
  81. if(typeof(__DeclareOuterVariable) === 'function') {
  82. __DeclareOuterVariable(name);
  83. }
  84. }