Skip to content
Snippets Groups Projects
Commit 78f39b24 authored by Ludovic Apvrille's avatar Ludovic Apvrille
Browse files

updatedocgenerator

parent c7e8346b
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
This diff is collapsed.
...@@ -60,6 +60,7 @@ import ui.dd.*; ...@@ -60,6 +60,7 @@ import ui.dd.*;
import ui.tmlad.*; import ui.tmlad.*;
import ui.tmlcd.*; import ui.tmlcd.*;
import ui.tmldd.*; import ui.tmldd.*;
import ui.avatarsmd.*;
public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIElement { public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIElement {
...@@ -69,6 +70,8 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle ...@@ -69,6 +70,8 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
private int firstHeadingNumber = 1; private int firstHeadingNumber = 1;
private static String title = "TTool project:"; private static String title = "TTool project:";
private String fileName = "doc.html"; private String fileName = "doc.html";
private String texFileName = "doc.tex";
private String texIncludeFileName = "diag.tex";
private String path; private String path;
private String projectName; private String projectName;
...@@ -80,6 +83,8 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle ...@@ -80,6 +83,8 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
private String doc; private String doc;
private String mainLatexDoc;
private String includeLatexDoc;
public DocumentationGenerator(Vector _panels, JTabbedPane _mainTabbedPane, String _path, String _projectName) { public DocumentationGenerator(Vector _panels, JTabbedPane _mainTabbedPane, String _path, String _projectName) {
...@@ -103,6 +108,14 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle ...@@ -103,6 +108,14 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
return doc; return doc;
} }
public String getMainLatexDocumentation() {
return mainLatexDoc;
}
public String getIncludeLatexDocumentation() {
return includeLatexDoc;
}
public void setTitle(String _title) { public void setTitle(String _title) {
title = _title; title = _title;
} }
...@@ -146,6 +159,10 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle ...@@ -146,6 +159,10 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
File file1; File file1;
String tmp; String tmp;
mainLatexDoc = getLatexDocumentationHeader(projectName);
includeLatexDoc = getIncludeLatexDocumentationHeader(projectName);
doc = ""; doc = "";
doc += "<html>\n"; doc += "<html>\n";
doc += getDocumentationHeader(projectName); doc += getDocumentationHeader(projectName);
...@@ -160,7 +177,7 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle ...@@ -160,7 +177,7 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
tmp = mainTabbedPane.getTitleAt(i); tmp = mainTabbedPane.getTitleAt(i);
panelName = tmp; panelName = tmp;
if (tp instanceof TMLDesignPanel) { /*if (tp instanceof TMLDesignPanel) {
tmp = "DIPLODOCUS Application Modeling: " + tmp; tmp = "DIPLODOCUS Application Modeling: " + tmp;
} }
if (tp instanceof TMLComponentDesignPanel) { if (tp instanceof TMLComponentDesignPanel) {
...@@ -168,7 +185,7 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle ...@@ -168,7 +185,7 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
} }
if (tp instanceof TMLArchiPanel) { if (tp instanceof TMLArchiPanel) {
tmp = "DIPLODOCUS Architecture / Mapping Modeling: " + tmp; tmp = "DIPLODOCUS Architecture / Mapping Modeling: " + tmp;
} }*/
if (tp instanceof DesignPanel) { if (tp instanceof DesignPanel) {
tmp = "TURTLE Design"; tmp = "TURTLE Design";
} }
...@@ -192,6 +209,10 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle ...@@ -192,6 +209,10 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
tmp = "Behavior of Task: " + tmp; tmp = "Behavior of Task: " + tmp;
} }
if (tdp instanceof AvatarSMDPanel) {
tmp = "Behavior of Block: " + tmp;
}
if (tdp instanceof TActivityDiagramPanel) { if (tdp instanceof TActivityDiagramPanel) {
tmp = "Behavior of TClass: " + tmp; tmp = "Behavior of TClass: " + tmp;
} }
...@@ -226,12 +247,26 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle ...@@ -226,12 +247,26 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
doc+="</body>\n</html>"; doc+="</body>\n</html>";
try { try {
FileUtils.saveFile(path+fileName, doc); FileUtils.saveFile(path+fileName, doc);
} catch (FileException fe) { } catch (FileException fe) {
System.out.println("HTML file could not be saved"); System.out.println("HTML file could not be saved");
return false; return false;
} }
try {
FileUtils.saveFile(path+texFileName, mainLatexDoc);
} catch (FileException fe) {
System.out.println("Main latex file could not be saved");
return false;
}
try {
FileUtils.saveFile(path+texIncludeFileName, includeLatexDoc);
} catch (FileException fe) {
System.out.println("Main latex file could not be saved");
return false;
}
finished = true; finished = true;
return true; return true;
...@@ -258,5 +293,39 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle ...@@ -258,5 +293,39 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
return tmpdoc; return tmpdoc;
} }
public String getLatexDocumentationHeader(String _projectName) {
GregorianCalendar calendar = (GregorianCalendar)GregorianCalendar.getInstance();
Date date = calendar.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm");
String formattedDate = formatter.format(date);
String tmpdoc="";
tmpdoc += "%----- Automatically generated by TTool version ";
tmpdoc += DefaultText.getVersion();
tmpdoc += " generation date: " + formattedDate;
tmpdoc += "----\n";
tmpdoc += "\\documentclass[11pt,a4paper]{article}\n\n\begin{document}\n";
tmpdoc += "\\title{" + projectName + "}\n";
tmpdoc += "\\date{\\today}\n";
tmpdoc += "\\maketitle\n\n";
tmpdoc += "\\include{"+texIncludeFileName+"}\n";
tmpdoc += "\\end{document}\n\n";
return tmpdoc;
}
public String getIncludeLatexDocumentationHeader(String _projectName) {
GregorianCalendar calendar = (GregorianCalendar)GregorianCalendar.getInstance();
Date date = calendar.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm");
String formattedDate = formatter.format(date);
String tmpdoc="";
tmpdoc += "%----- Automatically generated by TTool version ";
tmpdoc += DefaultText.getVersion();
tmpdoc += " generation date: " + formattedDate;
tmpdoc += "----\n\n";
return tmpdoc;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment