@@ -19,8 +19,11 @@ class ToM{
1919 showMenu : ' ToM_showMenu' ,
2020 toc : ' ToM_TOC' ,
2121 goto : ' ToM_goto' ,
22+ action : ' ToM_menuAction' ,
2223 ]
2324
25+ static final exeHowIcons = [' emoji-1F507' , ' emoji-2328' , ' emoji-1F5B1' ]
26+
2427 // region: getting tutorial components nodes
2528
2629 def static getNextTutNodes (n , boolean included = false ){
@@ -76,6 +79,9 @@ class ToM{
7679 case styles. goto:
7780 addGotoPane(myPanel, tutNode. children)
7881 break
82+ case styles. action:
83+ addActionPane(myPanel, tutNode)
84+ break
7985 default :
8086 ui. informationMessage(' node style not defined' )
8187 break
@@ -190,6 +196,44 @@ class ToM{
190196 }
191197 }
192198
199+ def static addActionPane (myP , nodo ){
200+ def infoAcciones = []
201+ nodo. children. findAll{n -> toma. hasAction(n)}. each{n ->
202+ def infoAccion = toma. getActionInfoMap(n)
203+ infoAcciones << infoAccion
204+ }
205+ def msgHtml = nodo. note? tomui. getHtmlFromNote(nodo): null
206+ def bttnText = ' Execute'
207+ def bttnToolTip = " Click to execute the command on the selected nodes"
208+ def enabled = enableBttn(nodo)
209+ def exeHow = exeActionsHow(nodo)
210+ def bttnAction = { e ->
211+ def bttn = e. source
212+ bttn. setEnabled(enabled)
213+ toma. executeActions(infoAcciones, exeHow)
214+ }
215+
216+ def buttonPanel = ToM_ui . getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false )
217+ myP. add(buttonPanel, tomui. GBC )
218+ }
219+
220+ def static exeActionsHow (nodo ){
221+ def iconos = nodo. icons. icons
222+ def iconitos = iconos. intersect(exeHowIcons)
223+ if (iconitos){
224+ def index = exeHowIcons. indexOf(iconitos[0 ])
225+ return toma. ex. values()[index]
226+ } else {
227+ return toma. ex. showHotKeys
228+ }
229+ }
230+
231+ def static enableBttn (nodo ){
232+ def iconos = nodo. icons. icons
233+ return ! iconos. contains(' emoji-1F56F' )
234+ }
235+
236+
193237 // end:
194238
195239}
0 commit comments