package hu.webarticum.treeprinter.demo;

import hu.webarticum.treeprinter.SimpleTreeNode;
import hu.webarticum.treeprinter.decorator.BorderTreeNodeDecorator;
import hu.webarticum.treeprinter.printer.boxing.BoxingTreePrinter;
import hu.webarticum.treeprinter.printer.listing.ListingTreePrinter;
import hu.webarticum.treeprinter.printer.traditional.DefaultLiner;
import hu.webarticum.treeprinter.printer.traditional.Liner;
import hu.webarticum.treeprinter.printer.traditional.TraditionalTreePrinter;
import hu.webarticum.treeprinter.text.AnsiConsoleText;
import hu.webarticum.treeprinter.text.AnsiFormat;

public class AnsiExamplesMain {

    public static void main(String[] args) {
        SimpleTreeNode rootNode = new SimpleTreeNode("Root");
        
        SimpleTreeNode childNode1 = new SimpleTreeNode(
                new AnsiConsoleText("\u001B[1;32mChild 1\u001B[0m"));
        rootNode.addChild(new BorderTreeNodeDecorator(childNode1));
        
        SimpleTreeNode childNode2 = new SimpleTreeNode("Child 2");
        rootNode.addChild(childNode2);

        SimpleTreeNode grandChildNode22 = new SimpleTreeNode("Grandchild 2-2");
        childNode2.addChild(grandChildNode22);
        
        new ListingTreePrinter().print(rootNode);
        
        System.out.println();
        System.out.println();
        
        Liner liner = DefaultLiner.builder()
                .topHeight(1)
                .bottomHeight(1)
                .format(AnsiFormat.BLUE)
                .build();
        new TraditionalTreePrinter(liner).print(rootNode);
        
        System.out.println();
        System.out.println();
        
        BoxingTreePrinter.builder()
                .defaultFormat(AnsiFormat.CYAN)
                .levelFormat(1, AnsiFormat.YELLOW)
                .levelFormat(2, AnsiFormat.RED)
                .build()
                .print(rootNode);
    }
    
}

@@ -533,26 +533,21 @@
 ext.Ansi
-ConsoleTex
+Forma
 t;%0Aimpor
@@ -579,25 +579,26 @@
 er.text.
-AnsiForma
+ConsoleTex
 t;%0A%0Apubl
@@ -818,16 +818,8 @@
     
-new Ansi
 Cons
@@ -829,39 +829,71 @@
 Text
-(%22%5Cu001B%5B1;32mChild 1%5Cu001B%5B0m%22
+.of(%22Child 1%22).format(AnsiFormat.GREEN.compose(AnsiFormat.BOLD)
 ));%0A
@@ -1141,24 +1141,108 @@
 ode(
-%22Grandchild 2-2%22
+%0A                ConsoleText.of(%22Grandchild %22).concat(ConsoleText.of(%222-2%22).format(AnsiFormat.CYAN))
 );%0A 

Improve ansi formatting in AnsiExamplesMain