fr.gedeon.telnetservice
Class OutputFormatVT100Impl

java.lang.Object
  extended by fr.gedeon.telnetservice.OutputFormatDefaultImpl
      extended by fr.gedeon.telnetservice.OutputFormatVT100Impl
All Implemented Interfaces:
OutputFormat, OutputFormatSpi, OutputFormatVT100Constants
Direct Known Subclasses:
OutputFormatVelocityImpl

public abstract class OutputFormatVT100Impl
extends OutputFormatDefaultImpl
implements OutputFormatSpi, OutputFormatVT100Constants

Abstract implementation of the OutputFormat interface that provides VT100 coloring helper methods.

The different flavors of the setAttrs() and style() allow to set style attributes, those of resetAttrs() allow to reset those to the defaults.

For example: To set the style to green text color call:

 VT100PrintUtilities.setAttrs(buffer, new byte[][] {
    ATTRS_FORE_GREEN
 };
 

To set more than one attr, for example yellow underlined text:

 VT100PrintUtilities.setAttrs(buffer, new byte[][] {
    STYLE_UNDERSCORE, ATTRS_FORE_YELLOW
 };
 

Author:
wgedeon@gmail.com

Field Summary
 
Fields inherited from interface fr.gedeon.telnetservice.OutputFormatVT100Constants
_DONE, _MORE, _RESET, ATTRS_BACK_BLACK, ATTRS_BACK_BLUE, ATTRS_BACK_CYAN, ATTRS_BACK_GREEN, ATTRS_BACK_MAGENTA, ATTRS_BACK_RED, ATTRS_BACK_WHITE, ATTRS_BACK_YELLOW, ATTRS_DEFAULT, ATTRS_FORE_BLACK, ATTRS_FORE_BLUE, ATTRS_FORE_CYAN, ATTRS_FORE_GREEN, ATTRS_FORE_MAGENTA, ATTRS_FORE_RED, ATTRS_FORE_WHITE, ATTRS_FORE_YELLOW, STYLE_BLINK, STYLE_BOLD, STYLE_DIM, STYLE_HIDDEN, STYLE_REVERSE, STYLE_UNDERSCORE
 
Constructor Summary
OutputFormatVT100Impl()
           
 
Method Summary
 Prompt resetAttrs(Prompt prompt)
           
 StringBuffer resetAttrs(StringBuffer buffer)
          Reset attributes for upcoming text in the buffer
 Prompt setAttrs(Prompt prompt, byte[][] attrs)
           
 Prompt setAttrs(Prompt prompt, List<byte[]> attrs)
           
 StringBuffer setAttrs(StringBuffer buffer, byte[][] attrs)
          Set VT100 text attributes; set a sequence of attributes declared in OutputFormatVT100Constants.
 StringBuffer setAttrs(StringBuffer buffer, List<byte[]> attrs)
           
 String style(byte[][] attrs)
           
 String style(List<byte[]> attrsList)
           
 
Methods inherited from class fr.gedeon.telnetservice.OutputFormatDefaultImpl
format, format, format, format, formats, getPriority
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.gedeon.telnetservice.OutputFormatSpi
formats, getPriority
 
Methods inherited from interface fr.gedeon.telnetservice.OutputFormat
format, format, format, format
 

Constructor Detail

OutputFormatVT100Impl

public OutputFormatVT100Impl()
Method Detail

setAttrs

public StringBuffer setAttrs(StringBuffer buffer,
                             byte[][] attrs)
Set VT100 text attributes; set a sequence of attributes declared in OutputFormatVT100Constants. See example above.

Parameters:
buffer - the buffer that is to be updated
attrs - the attributes to be set
Returns:
the updated buffer. Note, this return is a convenience for chaining updates, the buffer parameter is updated and returned.

setAttrs

public StringBuffer setAttrs(StringBuffer buffer,
                             List<byte[]> attrs)

setAttrs

public Prompt setAttrs(Prompt prompt,
                       List<byte[]> attrs)

setAttrs

public Prompt setAttrs(Prompt prompt,
                       byte[][] attrs)

resetAttrs

public StringBuffer resetAttrs(StringBuffer buffer)
Reset attributes for upcoming text in the buffer

Parameters:
buffer - the buffer that is to be updated
Returns:
the updated buffer. Note, this return is a convenience for chaining updates, the buffer parameter is updated and returned.

resetAttrs

public Prompt resetAttrs(Prompt prompt)

style

public String style(byte[][] attrs)

style

public String style(List<byte[]> attrsList)


Copyright © 2008. All Rights Reserved.