org.crsh.text
Class RenderAppendable

java.lang.Object
  extended by org.crsh.text.RenderAppendable
All Implemented Interfaces:
Flushable, Appendable, Consumer<Chunk>, ScreenContext<Chunk>

public class RenderAppendable
extends Object
implements Appendable, ScreenContext<Chunk>


Field Summary
private  ScreenContext<Chunk> context
          .
private  LinkedList<Style.Composite> stack
          .
 
Constructor Summary
RenderAppendable(ScreenContext<Chunk> context)
           
 
Method Summary
 RenderAppendable append(char c)
           
 RenderAppendable append(CharSequence csq)
           
 RenderAppendable append(CharSequence csq, int start, int end)
           
 void enterStyle(Style.Composite style)
           
 void flush()
           
private  Boolean foo(Boolean last, Boolean merged)
           
private  Color foo(Color last, Color merged, Color def)
           
 Class<Chunk> getConsumedType()
          Returns the class of the element generic type.
 int getHeight()
          Returns the screen height in chars.
private  Style.Composite getMerged()
          Compute the current merged style.
 int getWidth()
          Returns the screen width in chars.
 Style.Composite leaveStyle()
           
 void provide(Chunk element)
          Provide an element.
private  void safeAppend(Chunk chunk)
           
 void styleOff()
           
 void styleOn()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

private final ScreenContext<Chunk> context
.


stack

private LinkedList<Style.Composite> stack
.

Constructor Detail

RenderAppendable

public RenderAppendable(ScreenContext<Chunk> context)
Method Detail

safeAppend

private void safeAppend(Chunk chunk)

getConsumedType

public Class<Chunk> getConsumedType()
Description copied from interface: Consumer
Returns the class of the element generic type.

Specified by:
getConsumedType in interface Consumer<Chunk>
Returns:
the consumed type

getWidth

public int getWidth()
Description copied from interface: ScreenContext
Returns the screen width in chars. When the value is not positive it means the value could not be determined.

Specified by:
getWidth in interface ScreenContext<Chunk>
Returns:
the term width

getHeight

public int getHeight()
Description copied from interface: ScreenContext
Returns the screen height in chars. When the value is not positive it means the value could not be determined.

Specified by:
getHeight in interface ScreenContext<Chunk>
Returns:
the term height

provide

public void provide(Chunk element)
             throws IOException
Description copied from interface: Consumer
Provide an element.

Specified by:
provide in interface Consumer<Chunk>
Parameters:
element - the provided element
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Throws:
IOException

append

public RenderAppendable append(CharSequence csq)
Specified by:
append in interface Appendable

enterStyle

public void enterStyle(Style.Composite style)

leaveStyle

public Style.Composite leaveStyle()

getMerged

private Style.Composite getMerged()
Compute the current merged style.

Returns:
the merged style

foo

private Boolean foo(Boolean last,
                    Boolean merged)

foo

private Color foo(Color last,
                  Color merged,
                  Color def)

styleOff

public void styleOff()

styleOn

public void styleOn()

append

public RenderAppendable append(CharSequence csq,
                               int start,
                               int end)
Specified by:
append in interface Appendable

append

public RenderAppendable append(char c)
Specified by:
append in interface Appendable


Copyright © 2014 eXo Platform SAS. All Rights Reserved.