/**
 *    Copyright 2013 Thomas Naeff (github.com/thnaeff)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package ch.thn.gedcom.printer;

import ch.thn.gedcom.GedcomFormatter;
import ch.thn.gedcom.data.GedcomLine;
import ch.thn.util.tree.printable.PrintableTreeNode;
import ch.thn.util.tree.printable.printer.SimpleTreePrinter;
import ch.thn.util.tree.printable.printer.TreePrinter;

/**
 * A printer which prints the gedcom structure in text format. The output 
 * of this printer can be saved in a gedcom textfile to import the gedcom data 
 * into a software which supports the gedcom standard.
 * 
 * @author Thomas Naeff (github.com/thnaeff)
 *
 */
public class GedcomStructureTextPrinter extends SimpleTreePrinter<String, GedcomLine> {

	
	public GedcomStructureTextPrinter() {
		super(true, true);
		
		HEAD = "";
		FIRST_CHILD = "";
		START = "";
		END = "";
		INTERMEDIATE = "";
		THROUGH = "";
		AFTEREND = "";
		ADDITIONALLINETHROUGH = "";
		ADDITIONALLINEAFTEREND = "";
		START_OF_LINE = "";
		END_OF_LINE = "" + TreePrinter.LINE_SEPARATOR;
		
	}
	
	@Override
	public StringBuilder getNodeValue(
			PrintableTreeNode<String, GedcomLine> currentNode,
			int currentNodeLevel, int treeNodeIndex, int childNodeIndex,
			boolean lastChildNode) {
		
		StringBuilder sb = new StringBuilder();
		int level = getNodeLevel(currentNode);
		
		sb.append(GedcomFormatter.makeInset(level));
		sb.append(level);
		sb.append(" ");
		sb.append(currentNode.print());
		
		return sb;
		
	}
	
	
}

@@ -894,16 +894,160 @@
 Printer;
+%0Aimport ch.thn.util.tree.printable.printer.TreePrinterLineContent;%0Aimport ch.thn.util.tree.printable.printer.TreePrinterLineContent.ContentType;
 %0A%0A/**%0A *
@@ -1736,29 +1736,40 @@
 %09public 
-StringBuilder
+TreePrinterLineContent%5B%5D
  getNode
@@ -2141,18 +2141,107 @@
 %09return 
-sb
+new TreePrinterLineContent%5B%5D %7Bnew TreePrinterLineContent(ContentType.VALUE, sb.toString())%7D
 ;%0A%09%09%0A%09%7D%0A

Fix for new getNodeValue method from the TreePrinter of the Util project