table.add(new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add("NAME", "LEVEL"));
new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add( "ID", "NAME",
header.style(Decoration.bold.fg(Color.black).bg(Color.white)); for (String s : bilto) { header.add(s);
header.style(Decoration.bold.fg(Color.black).bg(Color.white)); header.add(new LabelElement("ID")); header.add(new LabelElement("NAME"));
new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add( "ID", "NAME",
new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add( "ID", "NAME",
overflow(Overflow.HIDDEN). rightCellPadding(1). add(new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add("NAME", "TYPE", "DESCRIPTION")); for (MBeanAttributeInfo attributeInfo : info.getAttributes()) { attributes.row(attributeInfo.getName(), attributeInfo.getType(), attributeInfo.getDescription());
overflow(Overflow.HIDDEN). rightCellPadding(1). add(new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add("NAME", "TYPE", "DESCRIPTION")); for (MBeanAttributeInfo attributeInfo : info.getAttributes()) { attributes.row(attributeInfo.getName(), attributeInfo.getType(), attributeInfo.getDescription());
header.style(Decoration.bold.fg(Color.black).bg(Color.white)); for (String s : bilto) { header.add(s);
style(Decoration.bold.fg(Color.black).bg(Color.white)). add("NAME", "CLASSNAME", "MXBEAN", "DESCRIPTION") );
header.style(Decoration.bold.fg(Color.black).bg(Color.white)); for (String s : bilto) { header.add(new LabelElement(s));
header.style(Decoration.bold.fg(Color.black).bg(Color.white)); header.add(new LabelElement("NAME")); header.add(new LabelElement("LEVEL"));
style(Decoration.bold.fg(Color.black).bg(Color.white)). add("NAME", "CLASSNAME", "MXBEAN", "DESCRIPTION") );
table.add(new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add("NAME", "LEVEL"));
table.add(new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add("NAME", "LEVEL"));
header.style(Decoration.bold.fg(Color.black).bg(Color.white)); for (String s : bilto) { header.add(s);
overflow(Overflow.HIDDEN). rightCellPadding(1). add(new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add("NAME", "TYPE", "DESCRIPTION")); for (MBeanAttributeInfo attributeInfo : info.getAttributes()) { attributes.row(attributeInfo.getName(), attributeInfo.getType(), attributeInfo.getDescription());
style(Decoration.bold.fg(Color.black).bg(Color.white)). add("NAME", "CLASSNAME", "MXBEAN", "DESCRIPTION") );
public void testRowStyleWithEnd() { GroovyShell shell = new GroovyShell(); UIBuilder res = (UIBuilder)shell.evaluate( "import org.crsh.text.ui.UIBuilder;\n" + "import org.crsh.text.Color;\n" + "import org.crsh.text.Style;\n" + "def builder = new UIBuilder();\n" + "builder.table {\n" + "row (bold: true, foreground: red, background: green) {\n" + "label(\"col1\"); label(\"col2\")\n" + "}\n" + "};\n" + "return builder;\n" ); assertEquals(1, res.getElements().size()); TableElement table = assertInstance(TableElement.class, res.getElements().get(0)); assertEquals(1, table.getRows().size()); assertEquals(2, table.getRows().get(0).getSize()); assertEquals(Decoration.bold.fg(Color.red).bg(Color.green), table.getRows().get(0).getStyle()); }