henplus.view.util
Class CancelWriter

java.lang.Object
  extended by henplus.view.util.CancelWriter

public final class CancelWriter
extends Object

Little utility that allows to write a string to the screen and cancel it afterwards (with Backspaces). Will only write, if the Output is indeed a terminal.


Constructor Summary
CancelWriter(OutputDevice out)
           
 
Method Summary
 int cancel()
          cancel out the written string and wipe it with spaces.
 int cancel(boolean wipeOut)
          cancel the output.
 boolean hasCancellableOutput()
          returns, if this cancel writer has any cancellable output.
 boolean isPrinting()
          returns, wether this cancel writer will print anything.
 void print(String str)
          Print message to screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CancelWriter

public CancelWriter(OutputDevice out)
Method Detail

isPrinting

public boolean isPrinting()
returns, wether this cancel writer will print anything. Depends on the fact, that the output is a terminal.


hasCancellableOutput

public boolean hasCancellableOutput()
returns, if this cancel writer has any cancellable output.


print

public void print(String str)
Print message to screen. Cancel out any previous message. If the output is no terminal, do not write anything.

Parameters:
str - string to print. Must not be null.

cancel

public int cancel()
cancel out the written string and wipe it with spaces.


cancel

public int cancel(boolean wipeOut)
cancel the output.

Parameters:
wipeOut - 'true', if the written characters should be wiped out with spaces. Otherwise, the cursor is placed at the beginning of the string without wiping.
Returns:
number of characters cancelled.


? 1997..2006 Henner Zeller