congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RowElement.add
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: crashub/crash

public TableElement row(boolean header, Element... cols) {
 return add(new RowElement(header).add(cols));
}
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

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 testNoBorderHeaderTopBottom() throws Exception {
 TableElement tableElement = new TableElement();
 tableElement.border(null);
 tableElement.
   add(header().
     add(label("a")).
     add(label("b"))).
   add(row().
     add(label("c")).
     add(label("d"))).
   add(row().
     add(label("e")).
     add(label("f")));
 assertRender(tableElement, 3,
   "ab ",
   "-- ",
   "cd ",
   "ef ");
}
origin: crashub/crash

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

 public void testTooManyColumns() throws Exception {
  TableElement tableElement = new TableElement();
  tableElement.separator(BorderStyle.DASHED);
  tableElement.border(BorderStyle.DASHED);

  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(label("b")));

  assertRender(tableElement, 32,
    " ------------------------------ ",
    "|a|This text is very ver very t|",
    "| |oo large to be displayed in |",
    "| |a cell of 32                |",
    " ------------------------------ ");
 }
}
origin: crashub/crash

 public void testCosmetic() throws Exception {
  RowElement row = new RowElement().add(new LabelElement("foo", 5), new LabelElement("This text is larger to be displayed in a cell of 32", 5));
  assertRender(row, 32,
    "fooThis text is larger to be dis",
    "   played in a cell of 32       ");
 }
}
origin: crashub/crash

 public void testNullLabelInTable() {
  TableElement tableElement = new TableElement();
  tableElement.add(new RowElement().add(new LabelElement("a\nb")));
  assertNoRender(tableElement, 1, 1);
 }
}
origin: crashub/crash

public void testRowLayout() {
 TableElement table = new TableElement();
 table.add(new RowElement().add(new LabelElement("foo")));
 table.add(new RowElement().add(new LabelElement("bar")));
 //
 assertRender(table, 3, 2, "foo", "bar");
 assertRender(table, 3, 1, "foo");
 assertRender(table, 2, 4, "fo", "o ", "ba", "r ");
 assertRender(table, 2, 3, "fo", "o ", "  ");
}
origin: crashub/crash

public void testRowLayoutWithHeader() {
 TableElement table = new TableElement();
 table.add(new RowElement(true).add(new LabelElement("foo")));
 table.add(new RowElement().add(new LabelElement("bar")));
 //
 assertRender(table, 3, 3, "foo", "---", "bar");
 assertRender(table, 3, 2, "foo", "   ");
 assertNoRender(table, 3, 1);
 //
 assertRender(table, 2, 5, "fo", "o ", "--", "ba", "r ");
 assertRender(table, 2, 4, "fo", "o ", "  ", "  ");
 assertRender(table, 2, 3, "fo", "o ", "  ");
}
origin: crashub/crash

public void testRowLayoutWithBorder() {
 TableElement table = new TableElement().border(BorderStyle.DASHED);
 table.add(new RowElement().add(new LabelElement("foo")));
 table.add(new RowElement().add(new LabelElement("bar")));
 //
 assertRender(table, 5, 4, " --- ", "|foo|", "|bar|", " --- ");
 assertRender(table, 5, 3, " --- ", "|foo|", " --- ");
 assertNoRender(table, 5, 2);
 //
 assertRender(table, 4, 6, " -- ", "|fo|", "|o |", "|ba|", "|r |", " -- ");
 assertRender(table, 4, 5, " -- ", "|fo|", "|o |", "|  |", " -- ");
 assertRender(table, 4, 4, " -- ", "|fo|", "|o |", " -- ");
}
origin: crashub/crash

public void testCosmetic() throws Exception {
 TableElement table = new TableElement();
 table.withColumnLayout(Layout.flow());
 RowElement row = new RowElement().add(new LabelElement("foo", 5), new LabelElement("This text is larger to be displayed in a cell of 32", 5));
 table.add(row);
 assertRender(table, 32,
   "fooThis text is larger to be dis",
   "   played in a cell of 32       ");
}
origin: crashub/crash

public void testRowLayoutWithHeaderBorder() {
 TableElement table = new TableElement().border(BorderStyle.DASHED);
 table.add(new RowElement(true).add(new LabelElement("foo")));
 table.add(new RowElement().add(new LabelElement("bar")));
 //
 assertRender(table, 5, 5, " --- ", "|foo|", " --- ", "|bar|", " --- ");
 assertRender(table, 5, 4, " --- ", "|foo|", "|   |", " --- ");
 assertNoRender(table, 5, 3);
 //
 assertRender(table, 4, 7, " -- ", "|fo|", "|o |", " -- ", "|ba|", "|r |", " -- ");
 assertRender(table, 4, 6, " -- ", "|fo|", "|o |", "|  |", "|  |", " -- ");
 assertRender(table, 4, 5, " -- ", "|fo|", "|o |", "|  |", " -- ");
 assertNoRender(table, 4, 4);
}
origin: crashub/crash

public void testRowLayoutWithOverflowHidden() {
 TableElement table = new TableElement().border(BorderStyle.DASHED).overflow(Overflow.HIDDEN);
 table.add(new RowElement(true).add(new LabelElement("foo")));
 table.add(new RowElement().add(new LabelElement("bar")));
 //
 assertRender(table, 5, 5, " --- ", "|foo|", " --- ", "|bar|", " --- ");
 assertRender(table, 5, 4, " --- ", "|foo|", "|   |", " --- ");
 assertNoRender(table, 5, 3);
 //
 assertRender(table, 4, 6, " -- ", "|fo|", " -- ", "|ba|", "|  |", " -- ");
 assertRender(table, 4, 5, " -- ", "|fo|", " -- ", "|ba|", " -- ");
 assertRender(table, 4, 4, " -- ", "|fo|", "|  |", " -- ");
 assertNoRender(table, 4, 3); // It should work with better impl
}
origin: crashub/crash

 public void testRowLayoutWithColumns() {
  TableElement table = new TableElement().border(BorderStyle.DASHED).separator(BorderStyle.DASHED);
  table.add(new RowElement().add(new LabelElement("foo"), new LabelElement("bar")));

  //
  assertRender(table, 9, 3, " ------- ", "|foo|bar|", " ------- ");
  assertRender(table, 9, 4, " ------- ", "|foo|bar|", "|   |   |", " ------- ");
 }
}
origin: crashub/crash

public void testCosmeticWithBorder() throws Exception {
 TableElement table = new TableElement();
 table.withColumnLayout(Layout.flow());
 RowElement row = new RowElement().add(new LabelElement("foo", 5), new LabelElement("This text is larger to be displayed in a cell of 32", 5));
 table.separator(BorderStyle.DASHED);
 table.border(BorderStyle.DASHED);
 table.add(row);
 assertRender(table, 32,
   " ------------------------------ ",
   "|foo|This text is larger to be |",
   "|   |displayed in a cell of 32 |",
   " ------------------------------ ");
}
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|                       ",
   " -------                        ");
}
origin: crashub/crash

public void testRender() throws Exception {
 RowElement row = new RowElement().add(new LabelElement("foo"), new LabelElement("bar"));
 //
 assertRender(row, 8, "foobar");
 assertRender(row, 7, "foobar");
 assertRender(row, 6, "foobar");
 assertRender(row, 5, "fooba", "   r ");
 assertRender(row, 4, "foob", "   a", "   r");
 assertRender(row, 3, "foo");
 assertRender(row, 2, "fo", "o ");
 assertRender(row, 1, "f", "o", "o");
 assertNoRender(row, 0);
}
origin: crashub/crash

public void testCellPadding() {
 TableElement table = new TableElement().leftCellPadding(1).rightCellPadding(2);
 table.add(new RowElement().add(new LabelElement("foo"), new LabelElement("bar")));
 //
 assertEquals(12, table.renderer().getActualWidth());
 assertEquals(8, table.renderer().getMinWidth());
 //
 assertRender(table, 12, " foo   bar  ");
 assertRender(table, 11, " foo   ba  ", "       r   ");
 assertRender(table, 10, " foo   b  ", "       a  ", "       r  ");
 assertRender(table, 9, " foo     ");
 assertRender(table, 8, " foo    ");
 assertRender(table, 7, " foo   ");
 assertRender(table, 6, " foo  ");
 assertRender(table, 5, " fo  ", " o   ");
 assertRender(table, 4, " f  ", " o  ", " o  ");
 // IT SHOULD BE NO RENDER
 assertRender(table, 3);
}
org.crsh.text.uiRowElementadd

Popular methods of RowElement

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

Popular in Java

  • Finding current android device location
  • getSystemService (Context)
  • getExternalFilesDir (Context)
  • getSharedPreferences (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Reference (javax.naming)
  • JLabel (javax.swing)
  • JList (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now