- Freemind export store order and position using extended properties.

- Fix order calculation algorith during import.
- Optimize JABX context initialization.
This commit is contained in:
Paulo Gustavo Veiga
2011-04-08 17:53:32 -03:00
parent ae071f7fcb
commit dd072ed958
17 changed files with 435 additions and 352 deletions

View File

@@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="This is the root node" ID="ID_0"><node TEXT="Child Level 1 Right 1" POSITION="right" ID="ID_1"/><node TEXT="Child Level 1 Left 1" POSITION="left" ID="ID_2"><node TEXT="Child Level 2 Left 11" POSITION="left" ID="ID_3"/><node TEXT="Child Level 2 Left 12" POSITION="left" ID="ID_4"/></node><node TEXT="Child Level 1 Right 2" POSITION="right" ID="ID_5"/><node TEXT="Child Level 1 Left 2" POSITION="left" ID="ID_6"><node TEXT="Child Level 2 Left 21 " POSITION="left" ID="ID_7"/><node TEXT="Child Level 2 Left 22" POSITION="left" ID="ID_8"/></node></node></map>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="This is the root node" ID="ID_0"><node WORDER="3" wCOORDS="200,-100" TEXT="Child Level 1 Right 1" POSITION="right" ID="ID_1"/><node WORDER="3" wCOORDS="-200,-100" TEXT="Child Level 1 Left 1" POSITION="left" ID="ID_2"><node WORDER="0" wCOORDS="-400,200" TEXT="Child Level 2 Left 11" POSITION="left" ID="ID_3"/><node WORDER="1" wCOORDS="-400,200" TEXT="Child Level 2 Left 12" POSITION="left" ID="ID_4"/></node><node WORDER="0" wCOORDS="200,0" TEXT="Child Level 1 Right 2" POSITION="right" ID="ID_5"/><node WORDER="0" wCOORDS="-200,0" TEXT="Child Level 1 Left 2" POSITION="left" ID="ID_6"><node WORDER="0" wCOORDS="-400,200" TEXT="Child Level 2 Left 21 " POSITION="left" ID="ID_7"/><node WORDER="1" wCOORDS="-400,200" TEXT="Child Level 2 Left 22" POSITION="left" ID="ID_8"/></node></node></map>

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="pela" name="basic"><topic id="0" central="true" shape="rounded rectagle" text="This is the root node"><topic id="1" position="200,-100" order="3" shape="line" text="Child Level 1 Right 1"/><topic id="2" position="-200,-100" order="3" shape="line" text="Child Level 1 Left 1"><topic id="3" position="-400,200" order="0" shape="line" text="Child Level 2 Left 11"/><topic id="4" position="-400,200" order="1" shape="line" text="Child Level 2 Left 12"/></topic><topic id="5" position="200,0" order="0" shape="line" text="Child Level 1 Right 2"/><topic id="6" position="-200,0" order="0" shape="line" text="Child Level 1 Left 2"><topic id="7" position="-400,200" order="0" shape="line" text="Child Level 2 Left 21 "/><topic id="8" position="-400,200" order="1" shape="line" text="Child Level 2 Left 22"/></topic></topic></map>

View File

@@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="Fonts" ID="ID_0"><node TEXT="Styles" POSITION="right" ID="ID_1"><node TEXT="Bold" POSITION="right" ID="ID_2"><font SIZE="12" NAME="Arial" BOLD="true"/></node><node TEXT="Italic" POSITION="right" ID="ID_3"><font SIZE="12" NAME="Arial" ITALIC="true"/></node></node><node TEXT="Sizes" POSITION="left" ID="ID_4"><node TEXT="Normal----" POSITION="left" ID="ID_5"><font SIZE="8" NAME="Arial"/></node><node TEXT="Normal---" POSITION="left" ID="ID_6"><font SIZE="9" NAME="Arial"/></node><node TEXT="Normal--" POSITION="left" ID="ID_7"><font SIZE="10" NAME="Arial"/></node><node TEXT="Normal-" POSITION="left" ID="ID_8"><font SIZE="11" NAME="Arial"/></node><node TEXT="Normal" POSITION="left" ID="ID_9"/><node TEXT="Nomal+" POSITION="left" ID="ID_10"><font SIZE="13" NAME="Arial"/></node><node TEXT="Normal++" POSITION="left" ID="ID_11"><font SIZE="14" NAME="Arial"/></node><node TEXT="Normal+++" POSITION="left" ID="ID_12"><font SIZE="15" NAME="Arial"/></node><node TEXT="Normal++++" POSITION="left" ID="ID_13"><font SIZE="16" NAME="Arial"/></node></node></node></map>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="Fonts" ID="ID_0"><node WORDER="1" wCOORDS="200,-50" TEXT="Styles" POSITION="right" ID="ID_1"><node WORDER="0" wCOORDS="400,200" TEXT="Bold" POSITION="right" ID="ID_2"><font SIZE="12" NAME="Arial" BOLD="true"/></node><node WORDER="1" wCOORDS="400,200" TEXT="Italic" POSITION="right" ID="ID_3"><font SIZE="12" NAME="Arial" ITALIC="true"/></node></node><node WORDER="1" wCOORDS="-200,-50" TEXT="Sizes" POSITION="left" ID="ID_4"><node WORDER="0" wCOORDS="-400,200" TEXT="Normal----" POSITION="left" ID="ID_5"><font SIZE="8" NAME="Arial"/></node><node WORDER="1" wCOORDS="-400,200" TEXT="Normal---" POSITION="left" ID="ID_6"><font SIZE="9" NAME="Arial"/></node><node WORDER="2" wCOORDS="-400,200" TEXT="Normal--" POSITION="left" ID="ID_7"><font SIZE="10" NAME="Arial"/></node><node WORDER="3" wCOORDS="-400,200" TEXT="Normal-" POSITION="left" ID="ID_8"><font SIZE="11" NAME="Arial"/></node><node WORDER="4" wCOORDS="-400,200" TEXT="Normal" POSITION="left" ID="ID_9"/><node WORDER="5" wCOORDS="-400,200" TEXT="Nomal+" POSITION="left" ID="ID_10"><font SIZE="13" NAME="Arial"/></node><node WORDER="6" wCOORDS="-400,200" TEXT="Normal++" POSITION="left" ID="ID_11"><font SIZE="14" NAME="Arial"/></node><node WORDER="7" wCOORDS="-400,200" TEXT="Normal+++" POSITION="left" ID="ID_12"><font SIZE="15" NAME="Arial"/></node><node WORDER="8" wCOORDS="-400,200" TEXT="Normal++++" POSITION="left" ID="ID_13"><font SIZE="16" NAME="Arial"/></node></node></node></map>

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="pela" name="basic"><topic id="0" central="true" shape="rounded rectagle" text="Fonts"><topic id="1" position="200,-50" order="1" shape="line" text="Styles"><topic id="2" position="400,200" order="0" fontStyle="Arial;12;;bold;;" shape="line" text="Bold"/><topic id="3" position="400,200" order="1" fontStyle="Arial;12;;;italic;" shape="line" text="Italic"/></topic><topic id="4" position="-200,-50" order="1" shape="line" text="Sizes"><topic id="5" position="-400,200" order="0" fontStyle="Arial;8;;;;" shape="line" text="Normal----"/><topic id="6" position="-400,200" order="1" fontStyle="Arial;9;;;;" shape="line" text="Normal---"/><topic id="7" position="-400,200" order="2" fontStyle="Arial;10;;;;" shape="line" text="Normal--"/><topic id="8" position="-400,200" order="3" fontStyle="Arial;11;;;;" shape="line" text="Normal-"/><topic id="9" position="-400,200" order="4" shape="line" text="Normal"/><topic id="10" position="-400,200" order="5" fontStyle="Arial;13;;;;" shape="line" text="Nomal+"/><topic id="11" position="-400,200" order="6" fontStyle="Arial;14;;;;" shape="line" text="Normal++"/><topic id="12" position="-400,200" order="7" fontStyle="Arial;15;;;;" shape="line" text="Normal+++"/><topic id="13" position="-400,200" order="8" fontStyle="Arial;16;;;;" shape="line" text="Normal++++"/></topic></topic></map>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="Node Links" LINK="http://www.google.com" ID="ID_0"><icon BUILTIN="closed"/><node TEXT="Link Topic" POSITION="right" LINK="http://www.bing.com" ID="ID_1" FOLDED="true"><icon BUILTIN="info"/><node TEXT="Link Topic Topic" POSITION="right" LINK="http://bing.com" ID="ID_2"><icon BUILTIN="messagebox_warning"/></node></node></node></map>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="Node Links" LINK="http://www.google.com" ID="ID_0"><icon BUILTIN="closed"/><node WORDER="1" wCOORDS="200,-50" TEXT="Link Topic" POSITION="right" LINK="http://www.bing.com" ID="ID_1" FOLDED="true"><icon BUILTIN="info"/><node WORDER="0" wCOORDS="400,200" TEXT="Link Topic Topic" POSITION="right" LINK="http://bing.com" ID="ID_2"><icon BUILTIN="messagebox_warning"/></node></node></node></map>

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="pela" name="basic"><topic id="0" central="true" shape="rounded rectagle" text="Node Links"><icon id="onoff_delete"/><link url="http://www.google.com"/><topic shrink="true" id="1" position="200,-50" order="1" shape="line" text="Link Topic"><icon id="sign_info"/><link url="http://www.bing.com"/><topic id="2" position="400,200" order="0" shape="line" text="Link Topic Topic"><icon id="sign_warning"/><link url="http://bing.com"/></topic></topic></topic></map>

View File

@@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="Shapes" ID="ID_0"><node TEXT="Node Styles" POSITION="right" ID="ID_1"><node TEXT="Fork" POSITION="right" ID="ID_2"><edge COLOR="#808080"/></node><node TEXT="Bubble" STYLE="bubble" POSITION="right" ID="ID_3"><edge COLOR="#808080"/></node><node TEXT="As parent" POSITION="right" ID="ID_4"><edge COLOR="#808080"/></node><node TEXT="Combined" POSITION="right" ID="ID_5"><edge COLOR="#808080"/></node></node><node TEXT="Node Background Color" POSITION="left" ID="ID_6" BACKGROUND_COLOR="#f20707"><node TEXT="Fork" POSITION="left" ID="ID_7" BACKGROUND_COLOR="#0000cc"><edge COLOR="#808080"/></node><node TEXT="Bubble" STYLE="bubble" POSITION="left" ID="ID_8" BACKGROUND_COLOR="#ccffcc"><edge COLOR="#808080"/></node><node TEXT="As parent" POSITION="left" ID="ID_9" BACKGROUND_COLOR="#00ffff"><edge COLOR="#808080"/></node><node TEXT="Combined" POSITION="left" ID="ID_10" BACKGROUND_COLOR="#990099"><edge COLOR="#808080"/></node></node><node TEXT="Node Text Color" POSITION="left" ID="ID_11" BACKGROUND_COLOR="#f20707"><node TEXT="Fork" POSITION="left" ID="ID_12" COLOR="#ffff00" BACKGROUND_COLOR="#0000cc"><edge COLOR="#808080"/></node><node TEXT="Bubble" STYLE="bubble" POSITION="left" ID="ID_13" COLOR="#ff6666" BACKGROUND_COLOR="#ccffcc"><edge COLOR="#808080"/></node><node TEXT="As parent" POSITION="left" ID="ID_14" COLOR="#009999" BACKGROUND_COLOR="#00ffff"><edge COLOR="#808080"/></node><node TEXT="Combined" POSITION="left" ID="ID_15" COLOR="#009999" BACKGROUND_COLOR="#990099"><edge COLOR="#808080"/></node></node></node></map>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="Shapes" ID="ID_0"><node WORDER="1" wCOORDS="200,-50" TEXT="Node Styles" POSITION="right" ID="ID_1"><node WORDER="0" wCOORDS="400,200" TEXT="Fork" POSITION="right" ID="ID_2"><edge COLOR="#808080"/></node><node WORDER="1" wCOORDS="400,200" TEXT="Bubble" STYLE="bubble" POSITION="right" ID="ID_3"><edge COLOR="#808080"/></node><node WORDER="2" wCOORDS="400,200" TEXT="As parent" POSITION="right" ID="ID_4"><edge COLOR="#808080"/></node><node WORDER="3" wCOORDS="400,200" TEXT="Combined" POSITION="right" ID="ID_5"><edge COLOR="#808080"/></node></node><node WORDER="3" wCOORDS="-200,-100" TEXT="Node Background Color" POSITION="left" ID="ID_6" BACKGROUND_COLOR="#f20707"><node WORDER="0" wCOORDS="-400,200" TEXT="Fork" POSITION="left" ID="ID_7" BACKGROUND_COLOR="#0000cc"><edge COLOR="#808080"/></node><node WORDER="1" wCOORDS="-400,200" TEXT="Bubble" STYLE="bubble" POSITION="left" ID="ID_8" BACKGROUND_COLOR="#ccffcc"><edge COLOR="#808080"/></node><node WORDER="2" wCOORDS="-400,200" TEXT="As parent" POSITION="left" ID="ID_9" BACKGROUND_COLOR="#00ffff"><edge COLOR="#808080"/></node><node WORDER="3" wCOORDS="-400,200" TEXT="Combined" POSITION="left" ID="ID_10" BACKGROUND_COLOR="#990099"><edge COLOR="#808080"/></node></node><node WORDER="0" wCOORDS="-200,0" TEXT="Node Text Color" POSITION="left" ID="ID_11" BACKGROUND_COLOR="#f20707"><node WORDER="0" wCOORDS="-400,200" TEXT="Fork" POSITION="left" ID="ID_12" COLOR="#ffff00" BACKGROUND_COLOR="#0000cc"><edge COLOR="#808080"/></node><node WORDER="1" wCOORDS="-400,200" TEXT="Bubble" STYLE="bubble" POSITION="left" ID="ID_13" COLOR="#ff6666" BACKGROUND_COLOR="#ccffcc"><edge COLOR="#808080"/></node><node WORDER="2" wCOORDS="-400,200" TEXT="As parent" POSITION="left" ID="ID_14" COLOR="#009999" BACKGROUND_COLOR="#00ffff"><edge COLOR="#808080"/></node><node WORDER="3" wCOORDS="-400,200" TEXT="Combined" POSITION="left" ID="ID_15" COLOR="#009999" BACKGROUND_COLOR="#990099"><edge COLOR="#808080"/></node></node></node></map>

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="pela" name="basic"><topic id="0" central="true" shape="rounded rectagle" text="Shapes"><topic id="1" position="200,-50" order="1" shape="line" text="Node Styles"><topic id="2" position="400,200" order="0" brColor="#808080" shape="line" text="Fork"/><topic id="3" position="400,200" order="1" brColor="#808080" shape="rounded rectagle" text="Bubble"/><topic id="4" position="400,200" order="2" brColor="#808080" shape="line" text="As parent"/><topic id="5" position="400,200" order="3" brColor="#808080" shape="line" text="Combined"/></topic><topic id="6" position="-200,-100" order="3" bgColor="#f20707" shape="line" text="Node Background Color"><topic id="7" position="-400,200" order="0" brColor="#808080" bgColor="#0000cc" shape="line" text="Fork"/><topic id="8" position="-400,200" order="1" brColor="#808080" bgColor="#ccffcc" shape="rounded rectagle" text="Bubble"/><topic id="9" position="-400,200" order="2" brColor="#808080" bgColor="#00ffff" shape="line" text="As parent"/><topic id="10" position="-400,200" order="3" brColor="#808080" bgColor="#990099" shape="line" text="Combined"/></topic><topic id="11" position="-200,0" order="0" bgColor="#f20707" shape="line" text="Node Text Color"><topic id="12" position="-400,200" order="0" brColor="#808080" bgColor="#0000cc" fontStyle=";;#ffff00;;;" shape="line" text="Fork"/><topic id="13" position="-400,200" order="1" brColor="#808080" bgColor="#ccffcc" fontStyle=";;#ff6666;;;" shape="rounded rectagle" text="Bubble"/><topic id="14" position="-400,200" order="2" brColor="#808080" bgColor="#00ffff" fontStyle=";;#009999;;;" shape="line" text="As parent"/><topic id="15" position="-400,200" order="3" brColor="#808080" bgColor="#990099" fontStyle=";;#009999;;;" shape="line" text="Combined"/></topic></topic></map>

View File

@@ -29,45 +29,65 @@ public class ImportExportTest {
@Test(dataProvider = "Data-Provider-Function")
public void exportImportExportTest(@NotNull final File freeMindFile, @NotNull final File recFile) throws ImporterException, IOException, ExportException {
public void exportImportExportTest(@NotNull final File freeMindFile, @NotNull final File wiseFile, @NotNull final File freeRecFile) throws ImporterException, IOException, ExportException {
FileInputStream fileInputStream = new FileInputStream(freeMindFile.getAbsolutePath());
final FileInputStream fileInputStream = new FileInputStream(freeMindFile.getAbsolutePath());
final MindMap mindMap = importer.importMap("basic", "basic", fileInputStream);
if (recFile.exists()) {
// Compare mindmap output ...
if (wiseFile.exists()) {
// Compare rec and file ...
final String recContent = readFile(wiseFile);
// Load rec file co
final FileInputStream fis = new FileInputStream(recFile);
final InputStreamReader isr = new InputStreamReader(fis);
final BufferedReader br = new BufferedReader(isr);
// Export mile content ...
Assert.assertEquals(mindMap.getUnzippedXml(), recContent);
final StringBuilder recContent = new StringBuilder();
String line = br.readLine();
while (line != null) {
recContent.append(line);
line = br.readLine();
} else {
final FileOutputStream fos = new FileOutputStream(wiseFile);
fos.write(mindMap.getUnzippedXml().getBytes());
fos.close();
}
}
fis.close();
// Compare freemind output ...
if (freeRecFile.exists()) {
// Compare rec and file ...
final String recContent = readFile(freeRecFile);
// Export mile content ...
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
exporter.export(mindMap, bos);
final String exportContent = new String(bos.toByteArray());
Assert.assertEquals(recContent.toString(), exportContent);
Assert.assertEquals(exportContent, recContent);
} else {
final FileOutputStream fos = new FileOutputStream(recFile);
final FileOutputStream fos = new FileOutputStream(freeRecFile);
exporter.export(mindMap, fos);
fos.close();
}
}
private String readFile(@NotNull File file) throws IOException {
// Load rec file co
final FileInputStream fis = new FileInputStream(file);
final InputStreamReader isr = new InputStreamReader(fis);
final BufferedReader br = new BufferedReader(isr);
final StringBuilder result = new StringBuilder();
String line = br.readLine();
while (line != null) {
result.append(line);
line = br.readLine();
}
fis.close();
return result.toString();
}
//This function will provide the parameter data
@DataProvider(name = "Data-Provider-Function")
public Object[][] parameterIntTestProvider() {
@@ -84,7 +104,8 @@ public class ImportExportTest {
for (int i = 0; i < freeMindFiles.length; i++) {
File freeMindFile = freeMindFiles[i];
final String name = freeMindFile.getName();
result[i] = new Object[]{freeMindFile, new File(DATA_DIR_PATH, name.substring(0, name.lastIndexOf(".")) + ".mmr")};
String testName = name.substring(0, name.lastIndexOf("."));
result[i] = new Object[]{freeMindFile, new File(DATA_DIR_PATH, testName + ".wxml"), new File(DATA_DIR_PATH, testName + ".mmr")};
}
return result;