Codota Logo
RowElement
Code IndexAdd Codota to your IDE (free)

How to use
RowElement
in
org.crsh.text.ui

Best Java code snippets using org.crsh.text.ui.RowElement (Showing top 20 results out of 315)

  • Common ways to obtain RowElement
private void myMethod () {
RowElement r =
  • Codota Iconnew RowElement()
  • Codota Iconnew RowElement(true)
  • Codota IconElement element;(RowElement) element.style(style)
  • Smart code suggestions by Codota
}
origin: crashub/crash

table.add(new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add("NAME", "LEVEL"));
origin: crashub/crash

@Override
public LineRenderer renderer(Iterator<BindingData> stream) {
 TableElement table = new TableElement();
 table.setRightCellPadding(1);
 RowElement header = new RowElement(true);
 header.add("NAME");
 table.add(header);
 while (stream.hasNext()) {
  BindingData binding = stream.next();
  RowElement row = new RowElement();
   row.add(binding.name);
  if (binding.verbose) {
   row.add(new LabelElement(binding.type));
   if (header.getSize() == 1) {
    header.add("CLASS");
   }
  }
  
  table.add(row);
 }
 return table.renderer();
}
origin: crashub/crash

RowLineRenderer(RowElement row, BorderStyle separator, int leftCellPadding, int rightCellPadding) {
 List<LineRenderer> cols = new ArrayList<LineRenderer>(row.cols.size());
 for (Element col : row.cols) {
  cols.add(col.renderer());
 }
 //
 this.cols = cols;
 this.style = row.getStyle();
 this.separator = separator;
 this.leftCellPadding = leftCellPadding;
 this.rightCellPadding = rightCellPadding;
}
origin: crashub/crash

public TableElement row(boolean header, Element... cols) {
 return add(new RowElement(header).add(cols));
}
origin: crashub/crash

@Override
protected void setParent(Object parent, Object child) {
 if (parent instanceof TreeElement) {
  TreeElement parentElement = (TreeElement)parent;
  Element childElement = (Element)child;
  parentElement.addChild(childElement);
 } else if (parent instanceof TableElement) {
  TableElement parentElement = (TableElement)parent;
  RowElement childElement = (RowElement)child;
  parentElement.add(childElement);
 } else if (parent instanceof RowElement) {
  RowElement parentElement = (RowElement)parent;
  Element childElement = (Element)child;
  if (child instanceof TreeElement) {
   throw new IllegalArgumentException("A table cannot contain a tree element");
  }
  parentElement.add(childElement);
 } else {
  throw new UnsupportedOperationException("Unrecognized parent " + parent);
 }
}
origin: crashub/crash

 add(row().style(Color.green.bg().fg(Color.blue).bold()).
   add(label("a")).
   add(label("b")))
.add(row().
  add(label("c").style(Color.green.bg().fg(Color.blue).bold())).
  add(label("d")));
origin: crashub/crash

public static RowElement header() {
 return new RowElement(true);
}
origin: crashub/crash

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());
}
origin: crashub/crash

public void testRow() {
 GroovyShell shell = new GroovyShell();
 UIBuilder res = (UIBuilder)shell.evaluate(
  "import org.crsh.text.ui.UIBuilder;\n" +
   "def builder = new UIBuilder();\n" +
   "builder.table {\n" +
    "row () {\n" +
     "label(\"col1\"); label(\"col2\")\n" +
    "}\n" +
   "};\n" +
   "return builder;\n"
 );
 assertEquals(1, res.getElements().size());
 assertTrue(res.getElements().get(0) instanceof TableElement);
 assertEquals(1, ((TableElement)res.getElements().get(0)).getRows().size());
 assertEquals(2, ((TableElement)res.getElements().get(0)).getRows().get(0).getSize());
 assertEquals("Label[col1]", ((TableElement)res.getElements().get(0)).getRows().get(0).getCol(0).toString());
 assertEquals("Label[col2]", ((TableElement)res.getElements().get(0)).getRows().get(0).getCol(1).toString());
}
origin: crashub/crash

public void testEmptyRow() {
 GroovyShell shell = new GroovyShell();
 UIBuilder res = (UIBuilder)shell.evaluate(
  "import org.crsh.text.ui.UIBuilder;\n" +
   "def builder = new UIBuilder();\n" +
   "builder.table {\n" +
    "row { }\n" +
   "};\n" +
   "return builder;\n"
 );
 assertEquals(1, res.getElements().size());
 assertTrue(res.getElements().get(0) instanceof TableElement);
 assertEquals(1, ((TableElement)res.getElements().get(0)).getRows().size());
 assertEquals(0, ((TableElement)res.getElements().get(0)).getRows().get(0).getSize());
}
origin: crashub/crash

public TableElement row(boolean header, String... cols) {
 return add(new RowElement(header).add(cols));
}
origin: crashub/crash

public void testSimple() throws Exception {
 TableElement tableElement = new TableElement();
 tableElement.
   add(row().
     add(label("a")).
     add(label("b"))).
   add(row().
     add(label("c")).
     add(label("d")));
 assertRender(tableElement, 12,
   "ab          ",
   "cd          ");
}
origin: crashub/crash

add(row().style(Color.green.bg().fg(Color.blue).bold()).
  add(label("a")).
  add(label("b"))).
add(row().
  add(label("c").style(Color.green.bg().fg(Color.blue).bold())).
  add(label("d")));
origin: crashub/crash

public static RowElement row() {
 return new RowElement();
}
origin: crashub/crash

 public void testEval() {
  GroovyShell shell = new GroovyShell();

  UIBuilder builder = (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 {\n" +
      "eval {" +
      " return 'HELLO';" +
      "}\n" +
     "}\n" +
    "};\n" +
    "return builder;\n"
  );

  //
  List<Element> elements = builder.getElements();
  assertEquals(1, elements.size());
  TableElement table = assertInstance(TableElement.class, elements.get(0));
  assertEquals(1, table.getRows().size());
  RowElement row = table.getRows().get(0);
  assertEquals(1, row.getSize());
  EvalElement eval = assertInstance(EvalElement.class, row.getCol(0));
  assertNotNull(eval.closure);
  assertEquals("HELLO", eval.closure.call());
 }
}
origin: crashub/crash

 RowElement header = new RowElement(true);
 header.style(Decoration.bold.fg(Color.black).bg(Color.white));
 for (String s : bilto) {
  header.add(s);
RowElement r = new RowElement();
for (String s : bilto) {
 r.add(String.valueOf(row.get(s)));
origin: crashub/crash

  RowElement header = new RowElement(true);
  header.add("NAME", "TYPE");
  table.add(header);
 RowElement row = new RowElement();
 row.add(entityTypeData.name, entityTypeData.type);
 table.add(row);
} else {
 table.setColumnLayout(Layout.weighted(1));
 RowElement name = new RowElement();
 name.add("Name : " + entityTypeData.name);
 table.add(name);
 RowElement type = new RowElement();
 type.add("Type : " + entityTypeData.type);
 table.add(type);
 RowElement mapping = new RowElement();
 mapping.add("Mapping : " + entityTypeData.mapping);
 table.add(mapping);
  RowElement attributesLabel = new RowElement();
  attributesLabel.add("Attributes : ");
  table.add(attributesLabel);
  RowElement attributeRowHeader = new RowElement(true);
  attributeRowHeader.add("NAME", "TYPE", "ASSOCIATION", "COLLECTION", "MAPPING");
  attributeTable.add(attributeRowHeader);
   RowElement row = new RowElement();
   row.add(attributes.name, attributes.type, "" + attributes.association, "" + attributes.collection, attributes.mapping);
origin: org.crashub/crash.shell

@Override
public LineRenderer renderer(Iterator<BindingData> stream) {
 TableElement table = new TableElement();
 table.setRightCellPadding(1);
 RowElement header = new RowElement(true);
 header.add("NAME");
 table.add(header);
 while (stream.hasNext()) {
  BindingData binding = stream.next();
  RowElement row = new RowElement();
   row.add(binding.name);
  if (binding.verbose) {
   row.add(new LabelElement(binding.type));
   if (header.getSize() == 1) {
    header.add("CLASS");
   }
  }
  
  table.add(row);
 }
 return table.renderer();
}
origin: crashub/crash

public void testTooLarge() throws Exception {
 TableElement tableElement = new TableElement();
 tableElement.
   add(row().
     add(label("a")).
     add(label("This text is very ver very too large to be displayed in a cell of 32"))).
   add(row().
     add(label("c")).
     add(label("d")));
 assertRender(tableElement, 27,
   "aThis text is very ver very",
   "  too large to be displayed",
   "  in a cell of 32          ",
   "cd                         "
 );
}
origin: crashub/crash

public void testStyleOff() {
 TableElement table = new TableElement().
   border(BorderStyle.DASHED).
   separator(BorderStyle.DASHED).
   style(Style.style(Decoration.bold)).
   add(
     row().style(Style.style(Decoration.underline)).add(label("foo"), label("bar")));
 assertRender(table, 32,
   " -------                        ",
   "|\033[1;4mfoo\033[0m|\033[1;4mbar\033[0m|                       ",
   " -------                        ");
}
org.crsh.text.uiRowElement

Most used methods

  • <init>
  • add
  • getSize
  • getStyle
  • style
  • getCol

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • onRequestPermissionsResult (Fragment)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now