1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 package com.unitesk.atp.messages;
33
34 import java.io.PrintStream;
35
36 /***
37 * The message box that prints messages to output stream (and also logs them).
38 *
39 * @author <A href="mailto:demakov@ispras.ru">Alexey Demakov</A>
40 * @version $Id: PrintStreamMessageBox.java,v 1.1 2004/10/09 06:34:30 all-x Exp $
41 */
42 public class PrintStreamMessageBox extends NullMessageBox
43 {
44 public PrintStreamMessageBox( MessageStringManager sm
45 , PrintStream error_out
46 , PrintStream warning_out
47 , PrintStream info_out
48 )
49 {
50 super( sm );
51 this.error_out = error_out;
52 this.warning_out = warning_out;
53 this.info_out = info_out;
54 }
55
56 public PrintStreamMessageBox( MessageStringManager sm, PrintStream out )
57 {
58 this( sm, out, out, out );
59 }
60
61 public PrintStreamMessageBox( MessageStringManager sm )
62 {
63 this( sm, System.err );
64 }
65
66 public PrintStreamMessageBox( PrintStream error_out
67 , PrintStream warning_out
68 , PrintStream info_out
69 )
70 {
71 super();
72 this.error_out = error_out;
73 this.warning_out = warning_out;
74 this.info_out = info_out;
75 }
76
77 public PrintStreamMessageBox( PrintStream out )
78 {
79 this( out, out, out );
80 }
81
82 public PrintStreamMessageBox()
83 {
84 this( System.err );
85 }
86
87 protected void errorStr( String message )
88 {
89 error_out.println( message );
90 }
91
92 protected void warningStr( String message )
93 {
94 warning_out.println( message );
95 }
96
97 protected void infoStr( String message )
98 {
99 info_out.println( message );
100 }
101
102 private PrintStream error_out;
103 private PrintStream warning_out;
104 private PrintStream info_out;
105 }