|
TelnetD at SF | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.wimpi.telnetd.io.terminal.ColorHelper
Utility class that provides methods and constants for creating and handling colored/styled Strings. The systems internal markup (Ctrl-a sequences) is utilized.
Field Summary | |
static java.lang.String |
BLACK
Defines the markup representation of the color black. |
static java.lang.String |
BLINK
Defines the markup representation of the activator for style blinking. |
static java.lang.String |
BLINK_OFF
Defines the markup representation of the deactivator for style blinking (i.e. steady) |
static java.lang.String |
BLUE
Defines the markup representation of the color blue. |
static java.lang.String |
BOLD
Defines the markup representation of the activator for style bold (normally represented by high intensity). |
static java.lang.String |
BOLD_OFF
Defines the markup representation of the deactivator for style bold. |
static java.lang.String |
CYAN
Defines the markup representation of the color cyan. |
static java.lang.String |
GREEN
Defines the markup representation of the color green. |
static java.lang.String |
INTERNAL_MARKER
Defines the internal marker string for style/color markups. |
static java.lang.String |
ITALIC
Defines the markup representation of the activator for style italic. |
static java.lang.String |
ITALIC_OFF
Defines the markup representation of the deactivator for style italic. |
static java.lang.String |
MAGENTA
Defines the markup representation of the color magenta. |
static int |
MARKER_CODE
Defines the internal marker character code. |
static java.lang.String |
RED
Defines the markup representation of the color red. |
static java.lang.String |
RESET_ALL
Defines the markup representation of the graphics rendition reset. |
static java.lang.String |
UNDERLINED
Defines the markup representation of the activator for style underlined. |
static java.lang.String |
UNDERLINED_OFF
Defines the markup representation of the deactivator for style underlined. |
static java.lang.String |
WHITE
Defines the markup representation of the color white. |
static java.lang.String |
YELLOW
Defines the markup representation of the color yellow. |
Constructor Summary | |
ColorHelper()
|
Method Summary | |
static java.lang.String |
blinkingText(java.lang.String str)
Creates a blinking string. |
static java.lang.String |
boldcolorizeText(java.lang.String str,
java.lang.String color)
Creates a string with high intensity (bold) in the given textcolor. |
static java.lang.String |
boldcolorizeText(java.lang.String str,
java.lang.String fgc,
java.lang.String bgc)
Creates a string with the given high intensity foregroundcolor and the given backgroundcolor. |
static java.lang.String |
boldText(java.lang.String str)
Creates a string with high intensity (bold). |
static java.lang.String |
colorizeBackground(java.lang.String str,
java.lang.String color)
Creates a string with the given backgroundcolor. |
static java.lang.String |
colorizeBackground(java.lang.String str,
java.lang.String color,
boolean autoff)
Creates a string with the given backgroundcolor. |
static java.lang.String |
colorizeText(java.lang.String str,
java.lang.String color)
Creates a string with the given textcolor. |
static java.lang.String |
colorizeText(java.lang.String str,
java.lang.String color,
boolean autoff)
Creates a string with the given textcolor. |
static java.lang.String |
colorizeText(java.lang.String str,
java.lang.String fgc,
java.lang.String bgc)
Creates a string with the given foreground and backgroundcolor. |
static java.lang.String |
colorizeText(java.lang.String str,
java.lang.String fgc,
java.lang.String bgc,
boolean autoff)
Creates a string with the given foreground and backgroundcolor. |
static long |
getVisibleLength(java.lang.String str)
Returns the length of the visible string calculated from the internal marked-up string passed as parameter. |
static java.lang.String |
italicText(java.lang.String str)
Creates a string with italic style. |
static java.lang.String |
underlinedText(java.lang.String str)
Creates an underlined string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String INTERNAL_MARKER
public static final int MARKER_CODE
public static final java.lang.String BLACK
public static final java.lang.String RED
public static final java.lang.String GREEN
public static final java.lang.String YELLOW
public static final java.lang.String BLUE
public static final java.lang.String MAGENTA
public static final java.lang.String CYAN
public static final java.lang.String WHITE
public static final java.lang.String BOLD
public static final java.lang.String BOLD_OFF
public static final java.lang.String ITALIC
public static final java.lang.String ITALIC_OFF
public static final java.lang.String UNDERLINED
public static final java.lang.String UNDERLINED_OFF
public static final java.lang.String BLINK
public static final java.lang.String BLINK_OFF
public static final java.lang.String RESET_ALL
Constructor Detail |
public ColorHelper()
Method Detail |
public static java.lang.String colorizeText(java.lang.String str, java.lang.String color)
str
- String to be colorized.color
- Constant defined color (see constants).
public static java.lang.String colorizeText(java.lang.String str, java.lang.String color, boolean autoff)
str
- String to be colorized.color
- Constant defined color (see constants).autoff
- boolean that toggles automatical appending of "attributes off"
sequence.true if "attributes off" should be appended, false
otherwise.
- Returns:
- String with internal markup-sequences.
public static java.lang.String colorizeBackground(java.lang.String str, java.lang.String color)
str
- String to be colorized.color
- Constant defined color (see constants).
public static java.lang.String colorizeBackground(java.lang.String str, java.lang.String color, boolean autoff)
str
- String to be colorized.color
- Constant defined color (see constants).autoff
- boolean that toggles automatical appending of "attributes off"
sequence.true if "attributes off" should be appended, false
otherwise.
- Returns:
- String with internal markup-sequences.
public static java.lang.String colorizeText(java.lang.String str, java.lang.String fgc, java.lang.String bgc)
str
- String to be colorized.fgc
- Constant defined color (see constants). Will be textcolor.bgc
- Constant defined color (see constants). Will be backgroundcolor.
public static java.lang.String colorizeText(java.lang.String str, java.lang.String fgc, java.lang.String bgc, boolean autoff)
str
- String to be colorized.fgc
- Constant defined color (see constants). Will be textcolor.bgc
- Constant defined color (see constants). Will be backgroundcolor.autoff
- boolean that toggles automatical appending of "attributes off"
sequence.true if "attributes off" should be appended, false
otherwise.
- Returns:
- String with internal markup-sequences.
public static java.lang.String boldcolorizeText(java.lang.String str, java.lang.String color)
str
- String to be boldcolorized.color
- Constant defined color (see constants).
public static java.lang.String boldcolorizeText(java.lang.String str, java.lang.String fgc, java.lang.String bgc)
str
- String to be colorized.fgc
- Constant defined color (see constants). Will be bold textcolor.bgc
- Constant defined color (see constants). Will be backgroundcolor.
public static java.lang.String boldText(java.lang.String str)
str
- String to be styled bold.
public static java.lang.String italicText(java.lang.String str)
str
- String to be styled italic.
public static java.lang.String underlinedText(java.lang.String str)
str
- String to be styled underlined.
public static java.lang.String blinkingText(java.lang.String str)
str
- String to be styled blinking.
public static long getVisibleLength(java.lang.String str)
str
- String with internal color/style markups.
|
TelnetD at SF | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |