Constructor: [items [levels [links]]]
items – ⍝ vector of character vectors containing the tree node texts
levels – ⍝ the levels of the corresponding items
links – ⍝ the href string to be used when the corresponding element is chosen (clicked)
Public Fields:
Items – ⍝ vector of character vectors containing the tree node texts
Levels – ⍝ the levels of the corresponding items
Links – ⍝ the href string to be used when the corresponding element is chosen (clicked)
MakeIds – ⍝ 1 to generate IDs
onNodeSelect – ⍝ 1 to call APLJax, or the name of the callback function
Public Method to request model data to be returned to the server:
r←name getModel subsel ⍝
Passes the TreeView model back as a variable called 'model' as input to a callback.
Public Methods to be used in Callbacks:
r←addNode name ⍝
Will add a node with id "tv_n", where n starts at 0 and increases each time a node is added
r←removeNode node ⍝
Removes the identified node
r←checkAll ⍝
Check everything below the current node
r←checkNode node ⍝
Check a node
r←uncheckAll ⍝
Uncheck everything below the current node
r←uncheckNode node ⍝
Uncheck a node
r←expandAll ⍝
Expands everything below the current node
r←expandNode node ⍝
Expands everything below a node
r←collapseAll ⍝
Collapses everything below the current node
r←collapseNode node ⍝
Collapses everything below a node
r←selectNode node ⍝
Select a node
r←unselectNode node ⍝
Unselect a node
Relevant Sample Pages:
:Class WidgetDoc : MiPageSample
:include #.MS3SiteUtils
∇ Compose;ns;widget;ref;wref;src;chunk;files;r;split;find
:Access public
Add _.style'#view {display: none}'
r←'<div class="WidgetDoc">'
(ns widget)←Get'namespace widget'
:If 9.1=#.⎕NC⊂ns
ref←#.⍎ns
:If 9=ref.⎕NC widget
wref←ref⍎widget
r,←'<h3 id="WidgetDocTitle">'
:If 0=wref.⎕NC⊂'DocBase'
:OrIf 0∊⍴wref.DocBase ⍝
r,←ns,'.',widget
:Else ⍝
r,←(ns,'.',widget)External wref.DocBase
:EndIf
src←1↓⎕SRC wref
src↓⍨←+/∧\''∘≡¨src
src←#.Strings.dlb¨src
src←src/⍨∧\'⍝'=⊃¨src
src←'¶ +'⎕R' '⊢'¶',¨1↓¨src
src←{1↓¨⍵⊂⍨'¶'=⍵}∊src
src←HtmlSafeText¨#.Strings.dlb¨src
:If 0∊⍴src
r,←'<h3 class="red">No documentation found.</h3>'
:Else
:For chunk :In src
⍝
⍝
⍝
⍝
⍝
⍝
:If ∨/'::'⍷chunk ⍝
:If ∨/find←' - '⍷chunk
split←find⍳1
r,←'<h3>',(chunk↑⍨split-1),'</h3>'
chunk←chunk↓⍨split+2
find←'- '⍷chunk
split←find⍳1
r,←'<p'
:If '-'≠⊃chunk~' '
r,←' class="hang"'
:EndIf
r,←'>',(chunk↑⍨split-1),'–',(split↓chunk),'</p>'
:Else
r,←'<h3>',chunk,'</h3>'
:EndIf
:ElseIf ∨/find←'- '⍷chunk
split←find⍳1
r,←'<p'
:If '-'≠⊃chunk~' '
r,←' class="hang"'
:EndIf
r,←'>',(chunk↑⍨split-1),'–',(split↓chunk),'</p>'
:Else ⍝
find←'⍝'⍷chunk
split←6+find⍳1
r,←'<p class="hang"><code>',(split↑chunk),'</code>',(split↓chunk),'</p>'
:EndIf
:EndFor
:EndIf
files←'relevant'ForControl widget
:If 0∊⍴files
r,←'<h3 class="red">No relevant sample pages found.</h3>'
:Else
r,←'<h3>Relevant Sample Pages:</h3>'
(files←'#samples'New _.Tabs(↓⍉↑{DescrEmbed ⍵}¨files)).Theme←'FF8C00'
r,←files.Render
:EndIf
:Else
r,←'<h3 class="red">Widget "',widget,'" not found in namespace ',ns,'.</h3>'
:EndIf
:Else
r,←'<h3 class="red">Namespace "',ns,'" not found.</h3>'
:EndIf
r,←'</div>'
Add'<h3>Description::' '::'⎕R'' ':'⊢r
∇
:EndClass