org.crsh.text
Class Renderer
java.lang.Object
org.crsh.text.Renderer
- Direct Known Subclasses:
- LabelRenderer, MemoryUsageRenderer, Renderer.Composite, RowRenderer, TableRenderer, TextRenderer, TreeRenderer
-
public abstract class Renderer
- extends Object
-
Something that can be rendered within a context.
Method Summary |
abstract int |
getActualHeight(int width)
Return the actual height for the specified with. |
abstract int |
getActualWidth()
Returns the element actual width. |
abstract int |
getMinHeight(int width)
Return the minimum height for the specified with. |
abstract int |
getMinWidth()
Returns the element minimum width. |
abstract LineReader |
reader(int width)
Create a renderer for the specified width or return null if the element does not provide any output. |
LineReader |
reader(int width, int height)
Create a renderer for the specified width and height or return null if the element does not provide any output for the specified dimensions. |
void |
render(RenderAppendable out)
Renders this object to the provided output. |
static Renderer |
vertical(Iterable<? extends Renderer> renderers)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NULL
public static final Renderer NULL
-
Renderer
public Renderer()
vertical
public static Renderer vertical(Iterable<? extends Renderer> renderers)
-
getActualWidth
public abstract int getActualWidth()
-
Returns the element actual width.
-
- Returns:
- the actual width
getMinWidth
public abstract int getMinWidth()
-
Returns the element minimum width.
-
- Returns:
- the minimum width
getMinHeight
public abstract int getMinHeight(int width)
-
Return the minimum height for the specified with.
-
- Parameters:
width
- the width
- Returns:
- the actual height
getActualHeight
public abstract int getActualHeight(int width)
-
Return the actual height for the specified with.
-
- Parameters:
width
- the width
- Returns:
- the minimum height
reader
public LineReader reader(int width,
int height)
-
Create a renderer for the specified width and height or return null if the element does not provide any output for the specified dimensions. The default implementation delegates to the
reader(int)
method when the height
argument is not positive otherwise it returns null. Subclasses should override this method when they want to provide content that can adapts to the specified height.
-
- Parameters:
width
- the width
height
- the height
- Returns:
- the renderer
reader
public abstract LineReader reader(int width)
-
Create a renderer for the specified width or return null if the element does not provide any output.
-
- Parameters:
width
- the width
- Returns:
- the renderer
render
public final void render(RenderAppendable out)
-
Renders this object to the provided output.
-
- Parameters:
out
- the output
Copyright © 2014 eXo Platform SAS. All Rights Reserved.