1 28 29 package com.idaremedia.antx.print; 30 31 import java.io.IOException ; 32 import java.io.OutputStream ; 33 import java.io.PrintStream ; 34 import java.util.Date ; 35 import java.util.Iterator ; 36 37 38 56 57 public final class MappingPrinter implements DisplayStrategy 58 { 59 62 public MappingPrinter() 63 { 64 } 65 66 67 76 public void print(final DisplayRequest info, OutputStream os) 77 throws IOException 78 { 79 Object thing = info.getObjectToBeDisplayed(); 80 81 if (thing instanceof PrinterMapping) { 82 PrinterMapping pm = (PrinterMapping)thing; 83 PrintStream ps = new PrintStream (os); 84 85 ps.println(); 87 ps.print("#PrinterMapping: "); 88 ps.println(pm.getId()); 89 ps.print("#"); 90 ps.println(new Date ()); 91 ps.print("#Size: "); 92 ps.println(String.valueOf(pm.getTargetClasses().size())); 93 94 ps.print(PrinterMapping.RESOURCE_KEY); 96 ps.print("="); 97 ps.println(String.valueOf(pm.getPrinterClassName())); 98 Iterator itr= pm.getTargetClasses().iterator(); 99 int i=1; 100 while (itr.hasNext()) { 101 ps.print("@"); 102 ps.print(i++); 103 ps.print("="); 104 ps.println(((Class )itr.next()).getName()); 105 } 106 try {os.flush();} catch(IOException iox) {} 107 itr = null; 108 ps = null; 109 } 110 } 111 } 112 113 114 | Popular Tags |