001package Torello.Browser; 002 003import static Torello.Java.C.*; 004 005import Torello.Java.StrIndent; 006import Torello.Java.StringParse; 007 008import java.util.function.Consumer; 009 010/** Simple printer for the example classes in this package */ 011public class Printing 012{ 013 private Printing() { } 014 015 /** Used to print a Yellow Line across the Screen. */ 016 public static final String YELLOW_LINE = 017 BYELLOW_BKGND + 018 StringParse.nChars(' ', 60) + 019 RESET + '\n'; 020 021 /** Used to print a Title-Bar with a Notice, as each Step in this Example-Class is executed */ 022 public static void notice(String msg) 023 { 024 System.out.println( 025 '\n' + 026 YELLOW_LINE + 027 BYELLOW_BKGND + ' ' + RESET + ' ' + 028 StringParse.rightSpacePad(msg, 57) + 029 BYELLOW_BKGND + ' ' + RESET + '\n' + 030 YELLOW_LINE 031 ); 032 } 033 034 /** 035 * A Handler which prints events and Data-Grams that are emitted by the Browser Connection & 036 * Browser-Connection Generated Web-Socket. 037 */ 038 public static void printObj(Object o) 039 { 040 System.out.println( 041 '\n' + BCYAN + "Example0(?).java: " + RESET + 042 BPURPLE_BKGND + " Handler 1 " + RESET + 043 " Browser Connection Handler has Received: " + 044 BPURPLE_BKGND + ' ' + o.getClass().getSimpleName() + ' ' + RESET + '\n' + 045 StrIndent.indent(o.toString(), 4) 046 ); 047 } 048}