Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.console.text.ColorPrinter Class Reference

List of all members.

Static Public Member Functions

final void printMessage (final String message, final PrintStream stream, final int color)
final void printMessage (final String message, final PrintStream stream, final int color, boolean endline)

Static Public Attributes

final int STD = 0
final int ERROR = 1
final int INFO = 2
final int STATUS = 3
final int PROMPT = 4

Detailed Description

This class defines a ColorPrinter

Author:
Nicolas Modrzyk
Version:
1.0

Definition at line 35 of file ColorPrinter.java.


Member Function Documentation

final void org.objectweb.cjdbc.console.text.ColorPrinter.printMessage final String  message,
final PrintStream  stream,
final int  color,
boolean  endline
[static]
 

Print a message in color

Parameters:
message Message to print
stream Stream where to send the message
color Color for the message
endline true if a carriage return should be appended to the message

Definition at line 130 of file ColorPrinter.java.

00132   {
00133 
00134     final StringBuffer msg = new StringBuffer(message);
00135     switch (color)
00136     {
00137       default : // Use STD as default
00138       case STD :
00139         msg.insert(0, STD_COLOR);
00140         msg.append(END_COLOR);
00141         break;
00142       case ERROR :
00143         msg.insert(0, ERR_COLOR);
00144         msg.append(END_COLOR);
00145         break;
00146       case INFO :
00147         msg.insert(0, INFO_COLOR);
00148         msg.append(END_COLOR);
00149         break;
00150       case STATUS :
00151         msg.insert(0, STATUS_COLOR);
00152         msg.append(END_COLOR);
00153         break;
00154       case PROMPT :
00155         msg.insert(0, PROMPT_COLOR);
00156         msg.append(END_COLOR);
00157         break;
00158     }
00159     final String strmessage = msg.toString();
00160     if (endline)
00161       stream.println(strmessage);
00162     else
00163       stream.print(strmessage);
00164   }

final void org.objectweb.cjdbc.console.text.ColorPrinter.printMessage final String  message,
final PrintStream  stream,
final int  color
[static]
 

Print a message in color

Parameters:
message Message to print
stream Stream where to send the message
color Color for the message

Definition at line 116 of file ColorPrinter.java.

00118   {
00119     printMessage(message, stream, color, true);
00120   }


Member Data Documentation

final int org.objectweb.cjdbc.console.text.ColorPrinter.ERROR = 1 [static]
 

Error color

Definition at line 95 of file ColorPrinter.java.

final int org.objectweb.cjdbc.console.text.ColorPrinter.INFO = 2 [static]
 

Info color for commands

Definition at line 99 of file ColorPrinter.java.

final int org.objectweb.cjdbc.console.text.ColorPrinter.PROMPT = 4 [static]
 

status color for commands

Definition at line 107 of file ColorPrinter.java.

final int org.objectweb.cjdbc.console.text.ColorPrinter.STATUS = 3 [static]
 

status color for commands

Definition at line 103 of file ColorPrinter.java.

final int org.objectweb.cjdbc.console.text.ColorPrinter.STD = 0 [static]
 

Standard color

Definition at line 91 of file ColorPrinter.java.


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:02:40 2005 for C-JDBC by  doxygen 1.3.9.1