Skip to content

Commit f8be8a9

Browse files
committed
WIP
1 parent 7e0a14e commit f8be8a9

2 files changed

Lines changed: 116 additions & 29 deletions

File tree

Tutorial-o-Matic/Tutorial-o-Matic.mm

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<map version="freeplane 1.9.8">
22
<!--To view this file, download free mind mapping software Freeplane from http://freeplane.sourceforge.net -->
3-
<node TEXT="Tutorial-o-Matic" FOLDED="false" ID="ID_696401721" LINK="https://github.com/EdoFro/Freeplane_Tutorial-o-Matic" BACKGROUND_COLOR="#97c7dc">
3+
<node TEXT="Tutorial-o-Matic" FOLDED="false" ID="ID_696401721" CREATED="1632150064080" MODIFIED="1632151614538" LINK="https://github.com/EdoFro/Freeplane_Tutorial-o-Matic" BACKGROUND_COLOR="#97c7dc">
44
<font SIZE="16" BOLD="true" ITALIC="true"/>
55
<attribute_layout NAME_WIDTH="111.75 pt" VALUE_WIDTH="165.75 pt"/>
66
<attribute NAME="name" VALUE="tutorialOMatic"/>
@@ -130,7 +130,7 @@
130130
</map_styles>
131131
</hook>
132132
<hook NAME="AutomaticEdgeColor" COUNTER="13" RULE="ON_BRANCH_CREATION"/>
133-
<node TEXT="description" POSITION="left" ID="ID_1678998363">
133+
<node TEXT="description" POSITION="left" ID="ID_1678998363" CREATED="1632150064153" MODIFIED="1632151614580">
134134
<edge COLOR="#ff0000"/>
135135
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
136136
<html>
@@ -150,9 +150,9 @@
150150
</body>
151151
</html>
152152
</richcontent>
153-
<node TEXT="Tutorial-o-Matic for Freeplane!!&#xa;Tutorial-o-Matic is an AddOn for Freeplane that gives the user the possibility to create his/her own tutorials." ID="ID_1642042079"/>
153+
<node TEXT="Tutorial-o-Matic for Freeplane!!&#xa;Tutorial-o-Matic is an AddOn for Freeplane that gives the user the possibility to create his/her own tutorials." ID="ID_1642042079" CREATED="1632150064153" MODIFIED="1632150064153"/>
154154
</node>
155-
<node TEXT="changes" POSITION="left" ID="ID_461119253">
155+
<node TEXT="changes" POSITION="left" ID="ID_461119253" CREATED="1632150064153" MODIFIED="1632151614582">
156156
<edge COLOR="#0000ff"/>
157157
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
158158
<html>
@@ -167,7 +167,7 @@
167167
</html>
168168
</richcontent>
169169
</node>
170-
<node TEXT="license" FOLDED="true" POSITION="left" ID="ID_624388795">
170+
<node TEXT="license" FOLDED="true" POSITION="left" ID="ID_624388795" CREATED="1632150064154" MODIFIED="1632151614583">
171171
<edge COLOR="#00ff00"/>
172172
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
173173
<html>
@@ -187,7 +187,7 @@
187187
</body>
188188
</html>
189189
</richcontent>
190-
<node ID="ID_444630498"><richcontent TYPE="NODE">
190+
<node ID="ID_444630498" CREATED="1632150064156" MODIFIED="1632150064156"><richcontent TYPE="NODE">
191191

192192
<html>
193193
<head>
@@ -262,7 +262,7 @@
262262
</richcontent>
263263
</node>
264264
</node>
265-
<node TEXT="preferences.xml" POSITION="left" ID="ID_1967714695">
265+
<node TEXT="preferences.xml" POSITION="left" ID="ID_1967714695" CREATED="1632150064157" MODIFIED="1632151614586">
266266
<edge COLOR="#ff00ff"/>
267267
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
268268
<html>
@@ -280,7 +280,7 @@
280280
</html>
281281
</richcontent>
282282
</node>
283-
<node TEXT="default.properties" POSITION="left" ID="ID_1398497950">
283+
<node TEXT="default.properties" POSITION="left" ID="ID_1398497950" CREATED="1632150064157" MODIFIED="1632151614588">
284284
<edge COLOR="#00ffff"/>
285285
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
286286
<html>
@@ -303,7 +303,7 @@ For each menu item with an icon add an attribute with the icon key (use develope
303303
</html>
304304
</richcontent>
305305
</node>
306-
<node TEXT="translations" POSITION="left" ID="ID_546877695">
306+
<node TEXT="translations" POSITION="left" ID="ID_546877695" CREATED="1632150064157" MODIFIED="1632151614590">
307307
<edge COLOR="#7c0000"/>
308308
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
309309
<html>
@@ -328,14 +328,14 @@ For each menu item with an icon add an attribute with the icon key (use develope
328328
</body>
329329
</html>
330330
</richcontent>
331-
<node TEXT="en" ID="ID_1998059292">
331+
<node TEXT="en" ID="ID_1998059292" CREATED="1632150064157" MODIFIED="1632150064157">
332332
<attribute_layout NAME_WIDTH="162 pt" VALUE_WIDTH="281.24999 pt"/>
333333
<attribute NAME="addons.${name}" VALUE="Tutorial-o-Matic"/>
334334
<attribute NAME="addons.${name}.ActionInstruction1" VALUE="&lt;html&gt;In submenu &lt;b&gt;{0}&lt;/b&gt; &lt;br&gt;click on &lt;b&gt;{1}&lt;/b&gt;&lt;/html&gt;"/>
335335
<attribute NAME="addons.${name}.ActionInstruction2" VALUE="&lt;html&gt;You can also use de keyboard shortcut &lt;b&gt;{0}&lt;/b&gt; for this command&lt;/html&gt;"/>
336336
</node>
337337
</node>
338-
<node TEXT="deinstall" POSITION="left" ID="ID_378917294">
338+
<node TEXT="deinstall" POSITION="left" ID="ID_378917294" CREATED="1632150064157" MODIFIED="1632151614592">
339339
<edge COLOR="#00007c"/>
340340
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
341341
<html>
@@ -352,8 +352,10 @@ For each menu item with an icon add an attribute with the icon key (use develope
352352
<attribute_layout NAME_WIDTH="42.75 pt" VALUE_WIDTH="207.74999 pt"/>
353353
<attribute NAME="delete" VALUE="${installationbase}/addons/${name}.script.xml"/>
354354
<attribute NAME="delete" VALUE="${installationbase}/addons/${name}/lib/Tutorial-o-Matic.jar"/>
355+
<attribute NAME="delete" VALUE="${installationbase}/addons/${name}/lib/markedj-1.0.16.jar"/>
356+
<attribute NAME="delete" VALUE="${installationbase}/addons/${name}/lib/jsoup-1.10.2.jar"/>
355357
</node>
356-
<node TEXT="scripts" POSITION="right" ID="ID_1037882722">
358+
<node TEXT="scripts" POSITION="right" ID="ID_1037882722" CREATED="1632150064158" MODIFIED="1632151614598">
357359
<edge COLOR="#007c00"/>
358360
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
359361
<html>
@@ -473,7 +475,7 @@ For each menu item with an icon add an attribute with the icon key (use develope
473475
</html>
474476
</richcontent>
475477
</node>
476-
<node TEXT="lib" POSITION="right" ID="ID_1814812956">
478+
<node TEXT="lib" POSITION="right" ID="ID_1814812956" CREATED="1632150064158" MODIFIED="1632151614659">
477479
<edge COLOR="#7c007c"/>
478480
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
479481
<html>
@@ -511,9 +513,11 @@ For each menu item with an icon add an attribute with the icon key (use develope
511513
</body>
512514
</html>
513515
</richcontent>
514-
<node TEXT="Tutorial-o-Matic.jar" ID="ID_1864463328"/>
516+
<node TEXT="Tutorial-o-Matic.jar" ID="ID_1864463328" CREATED="1632150064158" MODIFIED="1632150064158"/>
517+
<node TEXT="markedj-1.0.16.jar" ID="ID_1060333872" CREATED="1632150064158" MODIFIED="1632150064158"/>
518+
<node TEXT="jsoup-1.10.2.jar" ID="ID_1151792763" CREATED="1632150064158" MODIFIED="1632150064158"/>
515519
</node>
516-
<node TEXT="zips" POSITION="right" ID="ID_1623122610">
520+
<node TEXT="zips" POSITION="right" ID="ID_1623122610" CREATED="1632150064158" MODIFIED="1632151614672">
517521
<edge COLOR="#007c7c"/>
518522
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
519523
<html>
@@ -551,11 +555,11 @@ For each menu item with an icon add an attribute with the icon key (use develope
551555
</body>
552556
</html>
553557
</richcontent>
554-
<node TEXT="doc" ID="ID_281158802"/>
555-
<node TEXT="icons" ID="ID_211861022"/>
556-
<node TEXT="templates" ID="ID_553385296"/>
558+
<node TEXT="doc" ID="ID_281158802" CREATED="1632150064158" MODIFIED="1632150064158"/>
559+
<node TEXT="icons" ID="ID_211861022" CREATED="1632150064158" MODIFIED="1632150064158"/>
560+
<node TEXT="templates" ID="ID_553385296" CREATED="1632150064158" MODIFIED="1632150064158"/>
557561
</node>
558-
<node TEXT="images" POSITION="right" ID="ID_1856886559">
562+
<node TEXT="images" POSITION="right" ID="ID_1856886559" CREATED="1632150064158" MODIFIED="1632151614689">
559563
<edge COLOR="#7c7c00"/>
560564
<richcontent TYPE="NOTE" CONTENT-TYPE="xml/">
561565
<html>
@@ -590,12 +594,12 @@ For each menu item with an icon add an attribute with the icon key (use develope
590594
</html>
591595
</richcontent>
592596
</node>
593-
<node TEXT="DevTools - MoM" POSITION="right" ID="ID_989188638">
597+
<node TEXT="DevTools - MoM" POSITION="right" ID="ID_989188638" CREATED="1632150064159" MODIFIED="1632150064159">
594598
<edge COLOR="#ff0000"/>
595-
<node TEXT="Build add-on" ID="ID_1016684737" LINK="menuitem:_addons.devtools.checkAddOn_on_single_node">
599+
<node TEXT="Build add-on" ID="ID_1016684737" CREATED="1632150064159" MODIFIED="1632150064159" LINK="menuitem:_addons.devtools.checkAddOn_on_single_node">
596600
<icon BUILTIN="emoji-1F527"/>
597601
</node>
598-
<node TEXT="Package add-on for publication" ID="ID_806418866" LINK="menuitem:_addons.devtools.releaseAddOn_on_single_node">
602+
<node TEXT="Package add-on for publication" ID="ID_806418866" CREATED="1632150064159" MODIFIED="1632150064159" LINK="menuitem:_addons.devtools.releaseAddOn_on_single_node">
599603
<icon BUILTIN="emoji-1F5DC"/>
600604
</node>
601605
</node>

Tutorial-o-Matic/src/main/groovy/ToM_ui.groovy

Lines changed: 90 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
package edofro.tutorialomatic
22

3-
import groovy.swing.SwingBuilder
4-
// import javax.swing.*
3+
import edofro.tutorialomatic.TabPane
4+
55
import java.util.Timer
6+
67
import java.awt.Color
78
import java.awt.Font
8-
// import java.awt.Insets
9+
import java.awt.Insets
10+
import java.awt.GridBagConstraints
11+
import java.awt.Dimension
12+
//import java.awt.* //Insets
13+
import java.awt.GridBagLayout
14+
15+
// import javax.swing.*
916
import javax.swing.border.EmptyBorder
17+
import javax.swing.border.LineBorder;
18+
19+
import groovy.swing.SwingBuilder
1020

1121
import org.freeplane.core.ui.components.UITools as ui
1222
// import org.freeplane.core.util.MenuUtils as menuUtils
1323

24+
import io.github.gitbucket.markedj.Marked
25+
1426
class ToM_ui{
1527

28+
static final myPaneName = 'PanelDeContenido'
29+
static SwingBuilder swing = new SwingBuilder()
30+
1631

1732
def static showTextMessage(msg, lapseTime){
18-
SwingBuilder swing = new SwingBuilder()
1933
def win = swing.dialog(
2034
undecorated : true,
2135
modal : false,
@@ -33,16 +47,85 @@ class ToM_ui{
3347
border : new EmptyBorder(0, 15, 10, 15),
3448
)
3549
}
36-
3750
def timer = new Timer()
38-
3951
timer.runAfter(lapseTime){
4052
win.setVisible( false )
4153
win.dispose()
4254
}
43-
4455
win.setVisible( true )
4556
}
57+
58+
def static getContainerGBC(){
59+
GridBagConstraints gbc = new GridBagConstraints();
60+
gbc.gridx = 0;
61+
gbc.gridy = GridBagConstraints.RELATIVE ;
62+
gbc.weighty = 1;
63+
gbc.weightx = 1; // <----------------
64+
gbc.fill = GridBagConstraints.HORIZONTAL; // <----------------
65+
gbc.anchor = GridBagConstraints.PAGE_START // FIRST_LINE_START // PAGE_START
66+
//gbc.ipadx = 50
67+
//gbc.ipady = 50
68+
gbc.insets = new Insets(10,2,0,2)
69+
return gbc
70+
}
71+
72+
def static getHtmlFromNote(nodo){
73+
def noteType = nodo.noteContentType
74+
def html
75+
switch (noteType){
76+
case ['auto','html']:
77+
html = nodo.plainNote.startsWith('=')?nodo.note.plain:nodo.note.html
78+
break
79+
case 'markdown':
80+
html = "<html> ${Marked.marked(nodo.note.plain)} </html>"
81+
break
82+
default:
83+
html = "Node's note not recognized"
84+
break
85+
}
86+
return html
87+
}
88+
89+
def static createInstructionsPane(nodo){
90+
return createInstructionsPane(getHtmlFromNote(nodo))
91+
}
4692

93+
def static createInstructionsPane(String html){
94+
swing.editorPane(
95+
editable : false,
96+
contentType : "text/html",
97+
text : html,
98+
//margin : new Insets(30,10,30,10),
99+
border : new EmptyBorder(6, 10, 6, 10), //new LineBorder(Color.black, 1),
100+
//preferredSize: new Dimension(408, 500),
101+
//lineWrap : true
102+
)
103+
}
104+
105+
def static resizeContentPanel(com, H){
106+
com.parent.preferredSize = new Dimension(408, H)
107+
}
108+
109+
def static getTabContentPane(tabName,gbCons){
110+
def contentPane
111+
if( !TabPane.hasTab(tabName)) {
112+
contentPane = swing.panel(
113+
name: myPaneName,
114+
layout: new GridBagLayout(),
115+
background: Color.gray
116+
){}
117+
def panel = swing.panel(
118+
layout: new GridBagLayout(),
119+
preferredSize: new Dimension(408, 50000),
120+
){}
121+
panel.add(contentPane,gbCons)
122+
def sp = swing.scrollPane(){}
123+
sp.viewport.add(panel)
124+
TabPane.addTab(tabName, sp)
125+
} else {
126+
contentPane = TabPane.getTab(tabName)?.viewport.components[0].components.find{it.name == myPaneName}
127+
}
128+
return contentPane
129+
}
47130

48131
}

0 commit comments

Comments
 (0)