Skip to content

Commit 85b9d03

Browse files
committed
refactoring
ordené métodos en regiones. cambia nombre de algunos métodos otros
1 parent a41ac92 commit 85b9d03

8 files changed

Lines changed: 237 additions & 198 deletions

File tree

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

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@
148148
To translate the description you have to define a translation for the key 'addons.${name}.description'.
149149
</p>
150150
</body>
151-
</html>
152-
</richcontent>
151+
</html></richcontent>
153152
<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"/>
154153
</node>
155154
<node TEXT="changes" POSITION="left" ID="ID_461119253">
@@ -164,8 +163,7 @@
164163
Change log of this add-on: append one node for each noteworthy version and put the details for each version into a child node.
165164
</p>
166165
</body>
167-
</html>
168-
</richcontent>
166+
</html></richcontent>
169167
<node TEXT="v0.0.1" FOLDED="true" ID="ID_1147464075">
170168
<node TEXT="Demo version" ID="ID_1739689712"/>
171169
</node>
@@ -197,8 +195,7 @@
197195
The License text has to be entered as a child of the <i>'license'</i>&nbsp;node, either as plain text or as HTML.
198196
</p>
199197
</body>
200-
</html>
201-
</richcontent>
198+
</html></richcontent>
202199
<node TEXT="MIT License&#xa;&#xa;Copyright (c) 2021 Eduardo Frohlich.&#xa;&#xa;Permission is hereby granted, free of charge, to any person obtaining a copy&#xa;of this software and associated documentation files (the &quot;Software&quot;), to deal&#xa;in the Software without restriction, including without limitation the rights&#xa;to use, copy, modify, merge, publish, distribute, sublicense, and/or sell&#xa;copies of the Software, and to permit persons to whom the Software is&#xa;furnished to do so, subject to the following conditions:&#xa;&#xa;The above copyright notice and this permission notice shall be included in all&#xa;copies or substantial portions of the Software.&#xa;&#xa;THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&#xa;IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&#xa;FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&#xa;AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&#xa;LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&#xa;OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&#xa;SOFTWARE." ID="ID_444630498"/>
203200
</node>
204201
<node TEXT="preferences.xml" POSITION="left" ID="ID_1967714695">
@@ -216,8 +213,7 @@
216213
<font color="#000000" face="SansSerif, sans-serif">Every property in the configuration should receive a default value in <i>default.properties</i>&nbsp;node.</font>
217214
</p>
218215
</body>
219-
</html>
220-
</richcontent>
216+
</html></richcontent>
221217
</node>
222218
<node TEXT="default.properties" POSITION="left" ID="ID_1398497950">
223219
<edge COLOR="#00ffff"/>
@@ -239,8 +235,7 @@ For each menu item with an icon add an attribute with the icon key (use develope
239235
</li>
240236
</ul>
241237
</body>
242-
</html>
243-
</richcontent>
238+
</html></richcontent>
244239
</node>
245240
<node TEXT="translations" POSITION="left" ID="ID_546877695">
246241
<edge COLOR="#7c0000"/>
@@ -265,8 +260,7 @@ For each menu item with an icon add an attribute with the icon key (use develope
265260
</li>
266261
</ul>
267262
</body>
268-
</html>
269-
</richcontent>
263+
</html></richcontent>
270264
<node TEXT="en" ID="ID_1998059292">
271265
<attribute_layout NAME_WIDTH="162 pt" VALUE_WIDTH="281.24999 pt"/>
272266
<attribute NAME="addons.${name}" VALUE="Tutorial-o-Matic"/>
@@ -289,8 +283,7 @@ For each menu item with an icon add an attribute with the icon key (use develope
289283
List of files and/or directories to remove on uninstall
290284
</p>
291285
</body>
292-
</html>
293-
</richcontent>
286+
</html></richcontent>
294287
<attribute_layout NAME_WIDTH="42.75 pt" VALUE_WIDTH="295.49999 pt"/>
295288
<attribute NAME="delete" VALUE="${installationbase}/addons/${name}.script.xml"/>
296289
<attribute NAME="delete" VALUE="${installationbase}/addons/${name}/lib/Tutorial-o-Matic.jar"/>
@@ -418,8 +411,7 @@ For each menu item with an icon add an attribute with the icon key (use develope
418411
&nbsp;&nbsp;- In any case set execute_scripts_without_asking to true unless you want to annoy users.
419412
</p>
420413
</body>
421-
</html>
422-
</richcontent>
414+
</html></richcontent>
423415
<node TEXT="openDemoMap.groovy" ID="ID_1629939217">
424416
<attribute_layout NAME_WIDTH="200.24999 pt" VALUE_WIDTH="200.24999 pt"/>
425417
<attribute NAME="menuTitleKey" VALUE="addons.${name}.openDemoMap"/>
@@ -481,8 +473,7 @@ For each menu item with an icon add an attribute with the icon key (use develope
481473
&nbsp;- The files will be processed in the sequence as seen in the map.
482474
</p>
483475
</body>
484-
</html>
485-
</richcontent>
476+
</html></richcontent>
486477
<node TEXT="Tutorial-o-Matic.jar" ID="ID_1864463328"/>
487478
<node TEXT="markedj-1.0.16.jar" ID="ID_1060333872"/>
488479
<node TEXT="jsoup-1.10.2.jar" ID="ID_1151792763"/>
@@ -523,8 +514,7 @@ For each menu item with an icon add an attribute with the icon key (use develope
523514
&nbsp;- The files will be processed in the sequence as seen in the map.
524515
</p>
525516
</body>
526-
</html>
527-
</richcontent>
517+
</html></richcontent>
528518
<node TEXT="doc" ID="ID_281158802"/>
529519
<node TEXT="icons" ID="ID_211861022"/>
530520
<node TEXT="templates" ID="ID_553385296"/>
@@ -561,8 +551,7 @@ For each menu item with an icon add an attribute with the icon key (use develope
561551
Images can be added automatically by releaseAddOn.groovy or must be uploaded into the map via the script <i>Tools-&gt;Scripts-&gt;Insert Binary</i>&nbsp;since they have to be (base64) encoded as simple strings.
562552
</p>
563553
</body>
564-
</html>
565-
</richcontent>
554+
</html></richcontent>
566555
</node>
567556
<node TEXT="shortcuts" POSITION="right" ID="ID_989188638">
568557
<edge COLOR="#ff0000"/>
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import edofro.tutorialomatic.ToM_ui as tomui
22
import edofro.tutorialomatic.ToM as tom
33

4-
//opens tutorial map
5-
def sep = File.separator
6-
def userDir = c.userDirectory.path
7-
def mapFileName = "SimpleTutorialSample.mm"
8-
def pathName = userDir + sep + "doc" + sep + "Tutorial-o-Matic" + sep + mapFileName
9-
def tutMap = tom.getMapFromPath(pathName, false) //usar mapa indicado (pero oculto)
4+
//region: opens tutorial map
105

11-
tom.showTutorials( tutMap )
6+
def sep = File.separator
7+
def userDir = c.userDirectory.path
8+
def mapFileName = "SimpleTutorialSample.mm"
9+
def pathName = userDir + sep + "doc" + sep + "Tutorial-o-Matic" + sep + mapFileName
10+
def tutMap = tom.getMapFromPath(pathName, false) //usar mapa indicado (pero oculto)
1211

13-
return 'tutorial started'
12+
tom.showTutorials( tutMap )
13+
14+
return 'tutorial started'
15+
16+
//end:
Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
//opens demo map
22

3-
def mapFile = "SimpleTutorialSample.mm"
4-
def dir = c.userDirectory.path
5-
def sep = File.separator
6-
def helpFile = "Tutorial-o-Matic" + sep + mapFile
7-
def pathName = dir + sep + "doc" + sep + helpFile
3+
//region: defining path
4+
def mapFile = "SimpleTutorialSample.mm"
5+
def dir = c.userDirectory.path
6+
def sep = File.separator
7+
def helpFile = "Tutorial-o-Matic" + sep + mapFile
8+
def pathName = dir + sep + "doc" + sep + helpFile
9+
// end:
810

11+
//region: opening mindmap file
12+
if(exists(pathName)){
13+
c.mapLoader(pathName).withView().load()
14+
}
15+
//end:
916

10-
if(exists(pathName)){
11-
c.mapLoader(pathName).withView().load()
12-
}
1317

14-
def exists(String path){new File(path).isFile()}
18+
//region: methods
19+
20+
def exists(String path){new File(path).isFile()}
21+
22+
//end:

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package edofro.tutorialomatic
22

3-
//import edofro.tutorialomatic.TabPane
43
import edofro.tutorialomatic.ToM_ui as tomui
5-
64
import java.awt.event.*
75

8-
9-
6+
// Listener for Tutorial Tab pane so it gets resized (enough length) each time its width gets modified
107
class CustomComponentListener implements ComponentListener {
118
public void componentResized(ComponentEvent e) { //https://docs.oracle.com/javase/8/docs/api/java/awt/event/ComponentEvent.html
129
def comp = e.component
@@ -18,7 +15,7 @@ class CustomComponentListener implements ComponentListener {
1815
public void componentMoved(ComponentEvent e) {
1916
// e.source.title = " moved. "
2017
}
21-
public void componentShown(ComponentEvent e) {
18+
public void componentShown(ComponentEvent e) {
2219
// e.source.title = " shown. "
2320
}
2421
public void componentHidden(ComponentEvent e) {

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ import org.freeplane.core.ui.components.UITools as ui
44
import org.freeplane.core.util.MenuUtils as menuUtils
55

66
class TabPane{
7+
//region: properties
78
def static tabPane = ui.freeplaneTabbedPanel
89

10+
//end:
11+
12+
//region: methods
913

1014
def static removeTab(String tabName, boolean hideTabPane = false){
1115
def index = tabPane.indexOfTab(tabName)
@@ -21,7 +25,7 @@ class TabPane{
2125
return true
2226
} else return false
2327
}
24-
28+
2529
def static showTab(String tabName){
2630
//if tabPanel is not showing --> show
2731
if(!tabPane.isShowing()) {
@@ -33,24 +37,24 @@ class TabPane{
3337
tabPane.previousTab = previousTab
3438
} else {
3539
tabPane.metaClass.previousTab = previousTab
36-
}
40+
}
3741
// look if tab exists
3842
def index = tabPane.indexOfTab(tabName)
3943
if (index>=0) {
4044
tabPane.selectedIndex = index
4145
return true
4246
} else return false
4347
}
44-
48+
4549
def static addTab(String tabName, componente){
4650
tabPane.addTab(tabName, componente)
4751
}
48-
52+
4953
def static hasTab(String tabName){
5054
def index = tabPane.indexOfTab(tabName)
5155
return ( index >= 0 )
5256
}
53-
57+
5458
def static getTab(String tabName){
5559
def index = tabPane.indexOfTab(tabName)
5660
if (index>=0) {
@@ -59,9 +63,9 @@ class TabPane{
5963
return null
6064
}
6165
}
62-
66+
6367
def static repaint(){
6468
tabPane.repaint()
6569
}
66-
70+
//end:
6771
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class ToM{
165165
def tocToolTip = 'Click to show the Table of Contents of the tutorial'
166166
def tocBttnAction = { e -> showTOC(myP,lastNode) }
167167

168-
def nextButtonPanel = tomui.getNextButtonPanel(tabName, closeLabel, closeToolTip, nextLabel, nextToolTip , bttnAction, tocLabel, tocToolTip, tocBttnAction)
168+
def nextButtonPanel = tomui.createNextButtonPanel(tabName, closeLabel, closeToolTip, nextLabel, nextToolTip , bttnAction, tocLabel, tocToolTip, tocBttnAction)
169169
myP.add(nextButtonPanel, tomui.GBC)
170170
}
171171

@@ -192,7 +192,7 @@ class ToM{
192192
}
193193
}
194194

195-
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, true)
195+
def buttonPanel = tomui.createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, true)
196196
buttonPanel.metaClass.pending = false
197197
myP.add(buttonPanel, tomui.GBC)
198198
} else {
@@ -209,7 +209,7 @@ class ToM{
209209
def bttnText = nodo.text
210210
def bttnToolTip = "Click to go to '${bttnText}' section"
211211
def bttnAction = { e -> fillPage(myP, targetNode, true, true) }
212-
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
212+
def buttonPanel = tomui.createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
213213
myP.add(buttonPanel, tomui.GBC)
214214
}
215215
}
@@ -229,7 +229,7 @@ class ToM{
229229
c.script(scrText, "groovy").executeOn(c.selected)
230230
}
231231

232-
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
232+
def buttonPanel = tomui.createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
233233
buttonPanel.metaClass.pending = false
234234
myP.add(buttonPanel, tomui.GBC)
235235
} else {
@@ -264,7 +264,7 @@ class ToM{
264264
toma.executeActions(infoAcciones, exeHow)
265265
}
266266

267-
def buttonPanel = ToM_ui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
267+
def buttonPanel = ToM_ui.createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
268268
myP.add(buttonPanel, tomui.GBC)
269269
}
270270

@@ -309,7 +309,7 @@ class ToM{
309309
//guarda idDictionary en mapa
310310
setIdDictionary(mapa, idDictionary)
311311
}
312-
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
312+
def buttonPanel = tomui.createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
313313
myP.add(buttonPanel, tomui.GBC)
314314
}
315315

@@ -349,7 +349,7 @@ class ToM{
349349
uiMsg("nodos $nodos")
350350
c.select(nodos)
351351
}
352-
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
352+
def buttonPanel = tomui.createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
353353
myP.add(buttonPanel, tomui.GBC)
354354
}
355355

@@ -388,7 +388,7 @@ class ToM{
388388
bttn.setEnabled(enabled)
389389
def mapa = getMapFromPath(pathName, true) //usar mapa indicado (pero oculto)
390390
}
391-
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
391+
def buttonPanel = tomui.createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
392392
myP.add(buttonPanel, tomui.GBC)
393393
}
394394

@@ -403,7 +403,7 @@ class ToM{
403403
pageNode.pathToRoot*.folded = false
404404
c.select(pageNode)
405405
}
406-
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
406+
def buttonPanel = tomui.createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
407407
myP.add(buttonPanel, tomui.GBC)
408408
}
409409

0 commit comments

Comments
 (0)