From c995742f890149f3a4ab0707732fa8b0465a71ce Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr> Date: Tue, 29 Mar 2016 07:43:40 +0000 Subject: [PATCH] Resolving bug on doc --- src/ui/DocumentationGenerator.java | 17 +- src/ui/ThreadGUIElement.java | 320 ++++++++++++++--------------- 2 files changed, 172 insertions(+), 165 deletions(-) diff --git a/src/ui/DocumentationGenerator.java b/src/ui/DocumentationGenerator.java index f5d7076b25..cbe22875c3 100644 --- a/src/ui/DocumentationGenerator.java +++ b/src/ui/DocumentationGenerator.java @@ -165,7 +165,7 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle TURTLEPanel tp; TDiagramPanel tdp; File file1; - String tmp; + String tmp, tmpForRef; mainLatexDoc = getLatexDocumentationHeader(projectName); @@ -209,6 +209,8 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle tmp = "TURTLE Deployment"; } + tmp = Conversion.replaceAllChar(tmp, '_', "\\_"); + // HTML doc += "<br>\n<h" + firstHeadingNumber + ">" + tmp + "</h" + firstHeadingNumber + ">\n"; docSvg += "<br>\n<h" + firstHeadingNumber + ">" + tmp + "</h" + firstHeadingNumber + ">\n"; @@ -225,6 +227,11 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle tmp = tp.tabbedPane.getTitleAt(j); + tmpForRef = Conversion.replaceAllChar(tmp, '_', ""); + tmpForRef += tmpForRef + i + j; + tmp = Conversion.replaceAllChar(tmp, '_', "\\_"); + + if (tdp instanceof TMLActivityDiagramPanel) { tmp = "Behavior of Task: " + tmp; } @@ -258,16 +265,16 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle // Latex includeLatexDoc += "\\subsection{" + tmp + "}\n"; - includeLatexDoc += "Figures \\ref{fig:" + tmp + "} presents ...\n"; + includeLatexDoc += "Figures \\ref{fig:" + tmpForRef + "} presents ...\n"; includeLatexDoc += "\\begin{figure*}[htb]\n\\centering\n"; includeLatexDoc += "\\includegraphics[width=\\textwidth]{" + imgName + "}\n"; - includeLatexDoc += "\\caption{Diagram \"" + tmp + "\"}\n\\label{fig:" + tmp + "}\n\\end{figure*}\n\n"; + includeLatexDoc += "\\caption{Diagram \"" + tmp + "\"}\n\\label{fig:" + tmpForRef + "}\n\\end{figure*}\n\n"; includeLatexDocSvg += "\\subsection{" + tmp + "}\n"; - includeLatexDocSvg += "Figures \\ref{fig:" + tmp + "} presents ...\n"; + includeLatexDocSvg += "Figures \\ref{fig:" + tmpForRef + "} presents ...\n"; includeLatexDocSvg += "\\begin{figure*}[htb]\n\\centering\n"; includeLatexDocSvg += "\\includegraphics[width=\\textwidth]{" + imgNameSvg + "-svg.pdf}\n"; - includeLatexDocSvg += "\\caption{Diagram \"" + tmp + "\"}\n\\label{fig:" + tmp + "}\n\\end{figure*}\n\n"; + includeLatexDocSvg += "\\caption{Diagram \"" + tmp + "\"}\n\\label{fig:" + tmpForRef + "}\n\\end{figure*}\n\n"; // Capturing the diagram image = tdp.performMinimalCapture(); diff --git a/src/ui/ThreadGUIElement.java b/src/ui/ThreadGUIElement.java index 621701997f..d010d4f9e3 100755 --- a/src/ui/ThreadGUIElement.java +++ b/src/ui/ThreadGUIElement.java @@ -1,48 +1,48 @@ /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille -* -* ludovic.apvrille AT enst.fr -* -* This software is a computer program whose purpose is to allow the -* edition of TURTLE analysis, design and deployment diagrams, to -* allow the generation of RT-LOTOS or Java code from this diagram, -* and at last to allow the analysis of formal validation traces -* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP -* from INRIA Rhone-Alpes. -* -* This software is governed by the CeCILL license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL -* license as circulated by CEA, CNRS and INRIA at the following URL -* "http://www.cecill.info". -* -* As a counterpart to the access to the source code and rights to copy, -* modify and redistribute granted by the license, users are provided only -* with a limited warranty and the software's author, the holder of the -* economic rights, and the successive licensors have only limited -* liability. -* -* In this respect, the user's attention is drawn to the risks associated -* with loading, using, modifying and/or developing or reproducing the -* software by the user in light of its specific status of free software, -* that may mean that it is complicated to manipulate, and that also -* therefore means that it is reserved for developers and experienced -* professionals having in-depth computer knowledge. Users are therefore -* encouraged to load and test the software's suitability as regards their -* requirements in conditions enabling the security of their systems and/or -* data to be ensured and, more generally, to use and operate it in the -* same conditions as regards security. -* -* The fact that you are presently reading this means that you have had -* knowledge of the CeCILL license and that you accept its terms. -* -* /** -* Class ThreadGUIElement -* -* Creation: 27/04/2007 -* @version 1.0 27/04/2007 -* @author Ludovic APVRILLE -* @see -*/ + * + * ludovic.apvrille AT enst.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + * /** + * Class ThreadGUIElement + * + * Creation: 27/04/2007 + * @version 1.0 27/04/2007 + * @author Ludovic APVRILLE + * @see + */ package ui; @@ -56,119 +56,119 @@ import ui.window.*; public class ThreadGUIElement extends Thread { - private String param0, param1, param2; - private Object obj0, obj1, obj2, obj3; - private int function; - private StoppableGUIElement sge; - private JFrameStatistics jfs; - private DocumentationGenerator docgen; - private JDialogCancel jdc; - private Frame frame; - private ExternalCall ec; - - public ThreadGUIElement (Frame _frame, int _function, String _param0, String _param1, String _param2) { - frame = _frame; - function = _function; - param0 = _param0; - param1 = _param1; - param2 = _param2; - } - - public ThreadGUIElement (Frame _frame, int _function, Object _obj0, Object _obj1, Object _obj2, Object _obj3, String _param0, String _param2) { - frame = _frame; - function = _function; - obj0 = _obj0; - obj1 = _obj1; - obj2 = _obj2; - obj3 = _obj3; - param0 = _param0; - param2 = _param2; - } - - public void setExternalCall(ExternalCall _ec) { - ec = _ec; - } - - public void setStoppableGUIElement(StoppableGUIElement _sge) { - sge = _sge; - } - - public void go() { - if (ec != null) { - start(); - jdc = new JDialogCancel(frame, param0, param1, sge); - GraphicLib.centerOnParent(jdc); - jdc.setSize(300, 200); - jdc.setVisible(true); - jdc = null; - } else { - switch(function) { - case 1: - docgen = new DocumentationGenerator((Vector)obj0, (JTabbedPane)obj1, (String)obj2, (String)obj3); - docgen.setFirstHeadingNumber(2); - sge = (StoppableGUIElement)docgen; - break; - case 0: - default: - jfs = new JFrameStatistics(param0, param1); - sge = (StoppableGUIElement)jfs; - } - start(); - jdc = new JDialogCancel(frame, param0, param2, sge); - jdc.setSize(400, 200); - GraphicLib.centerOnParent(jdc); - jdc.setVisible(true); - jdc = null; - } - } - - public void run() { - Thread.currentThread().setPriority(Thread.NORM_PRIORITY - 1); - if (ec != null) { - //System.out.println("Starting computing function"); - ec.computeFunction(function); - //System.out.println("Ending computing function"); - if (jdc != null) { - jdc.stopAll(); - } - } else { - switch(function) { - case 1: - boolean res = docgen.generateDocumentation(); - if (jdc != null) { - jdc.stopAll(); - } - if (res && !docgen.hasBeenStopped()) { - JOptionPane.showMessageDialog(frame, - "All done!", - "Documentation generation", - JOptionPane.INFORMATION_MESSAGE); - } else { - JOptionPane.showMessageDialog(frame, - "The documentation generation could not be performed", - " Error", - JOptionPane.INFORMATION_MESSAGE); - } - break; - case 0: - default: - jfs.goElement(); - //System.out.println("go is done"); - - if (jfs.hasBeenStopped()) { - //System.out.println("Stopped: not showing"); - return; - } - if (jdc != null) { - jdc.stopAll(); - } - jfs.setIconImage(IconManager.img8); - jfs.setSize(600, 600); - GraphicLib.centerOnParent(jfs); - jfs.setVisible(true); - //System.out.println("setting visible"); - } - } - - } -} \ No newline at end of file + private String param0, param1, param2; + private Object obj0, obj1, obj2, obj3; + private int function; + private StoppableGUIElement sge; + private JFrameStatistics jfs; + private DocumentationGenerator docgen; + private JDialogCancel jdc; + private Frame frame; + private ExternalCall ec; + + public ThreadGUIElement (Frame _frame, int _function, String _param0, String _param1, String _param2) { + frame = _frame; + function = _function; + param0 = _param0; + param1 = _param1; + param2 = _param2; + } + + public ThreadGUIElement (Frame _frame, int _function, Object _obj0, Object _obj1, Object _obj2, Object _obj3, String _param0, String _param2) { + frame = _frame; + function = _function; + obj0 = _obj0; + obj1 = _obj1; + obj2 = _obj2; + obj3 = _obj3; + param0 = _param0; + param2 = _param2; + } + + public void setExternalCall(ExternalCall _ec) { + ec = _ec; + } + + public void setStoppableGUIElement(StoppableGUIElement _sge) { + sge = _sge; + } + + public void go() { + if (ec != null) { + start(); + jdc = new JDialogCancel(frame, param0, param1, sge); + GraphicLib.centerOnParent(jdc); + jdc.setSize(300, 200); + jdc.setVisible(true); + jdc = null; + } else { + switch(function) { + case 1: + docgen = new DocumentationGenerator((Vector)obj0, (JTabbedPane)obj1, (String)obj2, (String)obj3); + docgen.setFirstHeadingNumber(2); + sge = (StoppableGUIElement)docgen; + break; + case 0: + default: + jfs = new JFrameStatistics(param0, param1); + sge = (StoppableGUIElement)jfs; + } + start(); + jdc = new JDialogCancel(frame, param0, param2, sge); + jdc.setSize(400, 200); + GraphicLib.centerOnParent(jdc); + jdc.setVisible(true); + jdc = null; + } + } + + public void run() { + Thread.currentThread().setPriority(Thread.NORM_PRIORITY - 1); + if (ec != null) { + //System.out.println("Starting computing function"); + ec.computeFunction(function); + //System.out.println("Ending computing function"); + if (jdc != null) { + jdc.stopAll(); + } + } else { + switch(function) { + case 1: + boolean res = docgen.generateDocumentation(); + if (jdc != null) { + jdc.stopAll(); + } + if (res && !docgen.hasBeenStopped()) { + JOptionPane.showMessageDialog(frame, + "All done!", + "Documentation generation", + JOptionPane.INFORMATION_MESSAGE); + } else { + JOptionPane.showMessageDialog(frame, + "The documentation generation could not be performed", + " Error", + JOptionPane.INFORMATION_MESSAGE); + } + break; + case 0: + default: + jfs.goElement(); + //System.out.println("go is done"); + + if (jfs.hasBeenStopped()) { + //System.out.println("Stopped: not showing"); + return; + } + if (jdc != null) { + jdc.stopAll(); + } + jfs.setIconImage(IconManager.img8); + jfs.setSize(600, 600); + GraphicLib.centerOnParent(jfs); + jfs.setVisible(true); + //System.out.println("setting visible"); + } + } + + } +} -- GitLab