Skip to content

Commit

Permalink
added inspectPane
Browse files Browse the repository at this point in the history
- TOC button on last page
- inspectPane
  • Loading branch information
EdoFro committed Nov 24, 2021
1 parent bfeb1e2 commit a854e8d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
30 changes: 25 additions & 5 deletions Tutorial-o-Matic/src/main/groovy/ToM.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ToM{
copyPaste : 'ToM_copy' ,
select : 'ToM_select' ,
openMap : 'ToM_openMap' ,
openTutMap: 'ToM_openTutMap',
]

static final exeHowIcons = ['emoji-1F507', 'emoji-2328', 'emoji-1F5B1']
Expand Down Expand Up @@ -107,14 +108,17 @@ class ToM{
case styles.openMap:
addOpenMapPane(myPanel, tutNode)
break
case styles.openTutMap:
addInspectPane(myPanel, tutNode)
break
default:
ui.informationMessage('node style not defined')
break
}
startingNewPage = false
if(interruptLoop) break
}
if(!interruptLoop) addNextPagePane(myPanel, null)
if(!interruptLoop) addNextPagePane(myPanel, nextTutNodes[-1], false, false)
tomui.adjustHeight(myPanel, doClear)
}

Expand Down Expand Up @@ -144,14 +148,14 @@ class ToM{
addPageTitle(myP, nodo.text)
}

def static addNextPagePane(myP, lastNode, boolean included = false){
def static addNextPagePane(myP, lastNode, boolean included = false, boolean showNextButton = true){
def closeLabel = 'Stop tutorial'
def closeToolTip = 'Click to stop the tutorial and close the tutorial tab'
def nextLabel = 'Next page'
def nextToolTip = 'Click to continue to the next page of the tutorial'
def bttnAction = lastNode? { e -> fillPage(myP, lastNode, included, true) } : null
def tocLabel = 'Table of Contents'
def tocToolTip = 'Click to show the Table of Contents of the tutorial'
def bttnAction = showNextButton? { e -> fillPage(myP, lastNode, included, true) } : null
def tocLabel = 'Table of Contents'
def tocToolTip = 'Click to show the Table of Contents of the tutorial'
def tocBttnAction = { e -> showTOC(myP,lastNode) }

def nextButtonPanel = tomui.getNextButtonPanel(tabName, closeLabel, closeToolTip, nextLabel, nextToolTip , bttnAction, tocLabel, tocToolTip, tocBttnAction)
Expand Down Expand Up @@ -412,6 +416,22 @@ class ToM{
myP.add(buttonPanel, tomui.GBC)
}

def static addInspectPane(myP, nodo){
def msgHtml = "Click to inspect this page in the tutorial map"
def bttnText = "inspect"
def bttnToolTip = "Click to select the page's source nodes"
def bttnAction = { e ->
def pageNode = nodo.parent
def m = c.mapLoader(nodo.map.file).withView()//.selectNodeById(pageNodeId)
m.load()
pageNode.pathToRoot*.folded = false
c.select(pageNode)
}
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
myP.add(buttonPanel, tomui.GBC)
}


// end:

// region: Getting map
Expand Down
2 changes: 1 addition & 1 deletion Tutorial-o-Matic/src/main/groovy/ToM_ui.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class ToM_ui{
toolTipText : closeToolTip,
actionPerformed : {closeTab(tabName)},
)
if(tocButtonAction && nextButtonAction){
if(tocButtonAction /* && nextButtonAction */ ){
button(
label : tocLabel,
constraints : CENTER,
Expand Down

0 comments on commit a854e8d

Please sign in to comment.