public void styleOff() { if (stack != null && stack.size() > 0) { append(Style.reset); } }
public void enterStyle(Style.Composite style) { if (stack == null) { stack = new LinkedList<Style.Composite>(); } append(style); stack.addLast(style); }
public void styleOn() { if (stack != null && stack.size() > 0) { append(getMerged()); } } }
public void provide(Object element) throws IOException { Renderer current = Renderer.getRenderable(element.getClass()); if (current == null) { send(); if (element instanceof CharSequence) { out.append((CharSequence)element); } else if (element instanceof CLS) { out.cls(); } else if (element instanceof Style) { out.append((Style)element); } else { out.append(element.toString()); } } else { if (renderable != null && !current.equals(renderable)) { send(); } buffer.addLast(element); renderable = current; } }
case 2: { to.styleOff(); to.append(border.corner); for (int i = 0;i < widths.length;i++) { if (widths[i] > 0) { if (separator != null && i > 0) { to.append(border.horizontal); to.append(border.horizontal); to.append(border.corner); to.styleOn(); for (int i = width - effectiveWidth.get();i > 0;i--) { to.append(' '); if (border != null) { to.styleOff(); to.append(sep ? border.corner : border.vertical); to.styleOn(); to.append(separator.vertical); to.append(' '); to.append(sep ? border.corner : border.vertical); to.styleOn(); to.append(' ');
public void renderLine(RenderAppendable to) { if (index >= height) { throw new IllegalStateException(); } else { Style.Composite style = element.getStyle(); if (style != null) { to.enterStyle(style); } if (index < lines.length) { Pair<Integer, Integer> a = lines[index]; to.append(element.value, a.getFirst(), a.getSecond()); int missing = width - (a.getSecond() - a.getFirst()); if (missing > 0) { to.append(BlankSequence.create(missing)); } } else { for (int i = 0;i < width;i++) { to.append(' '); } } index++; if (style != null) { to.leaveStyle(); } } } }
/** * Renders this object to the provided output. * * @param out the output */ public final void render(RenderAppendable out) { LineReader renderer = reader(out.getWidth()); if (renderer != null) { while (renderer.hasLine()) { renderer.renderLine(out); out.append('\n'); } } }
public void render(RenderAppendable to) { LineRenderer renderer = renderer(); // For now height - 1 because of the char that goes to the line in some impl LineReader reader = renderer.reader(to.getWidth(), to.getHeight() - 1); if (reader != null) { while (reader.hasLine()) { reader.renderLine(to); to.append('\n'); } } }
public Style.Composite leaveStyle() { if (stack == null || stack.isEmpty()) { throw new IllegalStateException("Cannot leave non existing style"); } Style.Composite last = stack.removeLast(); if (stack.size() > 0) { // Compute merged Style.Composite merged = getMerged(); // Compute diff with removed Boolean bold = foo(last.getBold(), merged.getBold()); Boolean underline = foo(last.getUnderline(), merged.getUnderline()); Boolean blink = foo(last.getBlink(), merged.getBlink()); // For now we assume that black is the default background color // and white is the default foreground color Color fg = foo(last.getForeground(), merged.getForeground(), Color.def); Color bg = foo(last.getBackground(), merged.getBackground(), Color.def); // Style.Composite bilto = Style.style(bold, underline, blink, fg, bg); // append(bilto); } else { append(Style.reset); } return last; }
public void styleOff() { if (stack != null && stack.size() > 0) { append(Style.reset); } }
public void enterStyle(Style.Composite style) { if (stack == null) { stack = new LinkedList<Style.Composite>(); } append(style); stack.addLast(style); }
public void enterStyle(Style.Composite style) { if (stack == null) { stack = new LinkedList<Style.Composite>(); } append(style); stack.addLast(style); }
public void styleOn() { if (stack != null && stack.size() > 0) { append(getMerged()); } } }
public void render(RenderAppendable to) { Renderer renderer = renderer(); // For now height - 1 because of the char that goes to the line in some impl LineReader reader = renderer.reader(to.getWidth(), to.getHeight() - 1); if (reader != null) { while (reader.hasLine()) { reader.renderLine(to); to.append('\n'); } } }
public void render(RenderAppendable to) { LineRenderer renderer = renderer(); // For now height - 1 because of the char that goes to the line in some impl LineReader reader = renderer.reader(to.getWidth(), to.getHeight() - 1); if (reader != null) { while (reader.hasLine()) { reader.renderLine(to); to.append('\n'); } } }
public void render(RenderAppendable to) { LineRenderer renderer = renderer(); // For now height - 1 because of the char that goes to the line in some impl LineReader reader = renderer.reader(to.getWidth(), to.getHeight() - 1); if (reader != null) { while (reader.hasLine()) { reader.renderLine(to); to.append('\n'); } } }