@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); } }
public void testTooLarge() throws IOException { TreeElement elt = new TreeElement(); elt.addChild(new LabelElement("foo value is very very very too large for the console")); elt.addChild(new LabelElement("bar\n")); assertRender(elt, 32, "+-foo value is very very very to", "| o large for the console ", "+-bar ", " "); } }
public void testTooLarge() throws IOException { TreeElement elt = new TreeElement(); elt.addChild(new LabelElement("foo value is very very very too large for the console")); elt.addChild(new LabelElement("bar\n")); assertRender(elt, 32, "+-foo value is very very very to", "| o large for the console ", "+-bar ", " "); } }
public void testNested() throws Exception { TreeElement elt = new TreeElement(new LabelElement("foo")); elt.addChild(new TreeElement(new LabelElement("bar")).addChild(new LabelElement("1\n1")).addChild(new LabelElement("2\n2"))); elt.addChild(new TreeElement().addChild(new LabelElement("3")).addChild(new LabelElement("4"))); assertRender(elt, 5, "foo ", "+-bar", "| +-1", "| | 1", "| +-2", "| 2", "+-+-3", " +-4"); }
public void testNested() throws Exception { TreeElement elt = new TreeElement(new LabelElement("foo")); elt.addChild(new TreeElement(new LabelElement("bar")).addChild(new LabelElement("1\n1")).addChild(new LabelElement("2\n2"))); elt.addChild(new TreeElement().addChild(new LabelElement("3")).addChild(new LabelElement("4"))); assertRender(elt, 6, "foo ", "+-bar ", "| +-1 ", "| | 1 ", "| +-2 ", "| 2 ", "+-+-3 ", " +-4 "); }
public void testFoo() throws Exception { TreeElement elt = new TreeElement(); elt.addChild(new LabelElement("1\n1")); assertRender(elt, 3, "+-1", " 1"); }
impact = "UNKNOWN"; operation.addChild(new TableElement(). add( new RowElement().add("Type: ", operationInfo.getReturnType()), operations.addChild(operation); root.addChild( new TableElement().leftCellPadding(1).overflow(Overflow.HIDDEN). row("ClassName", info.getClassName()). root.addChild(new TreeElement("Descriptor").addChild(descriptor)); root.addChild(new TreeElement("Attributes").addChild(attributes)); root.addChild(operations);
public void testInNode() throws Exception { TableElement tableElement = new TableElement(); tableElement. add(row(). add(label("a")). add(label("b"))). add(row(). add(label("c")). add(label("d"))); TreeElement node = new TreeElement(); node.addChild(label("foo")); node.addChild(tableElement); node.addChild(label("bar")); assertRender(node, 14, "+-foo ", "+-ab ", "| cd ", "+-bar "); }
public void testInNode() throws Exception { TableElement tableElement = new TableElement(); tableElement. add(row(). add(label("a")). add(label("b"))). add(row(). add(label("c")). add(label("d"))); TreeElement node = new TreeElement(); node.addChild(label("foo")); node.addChild(tableElement); node.addChild(label("bar")); assertRender(node, 32, "+-foo ", "+-ab ", "| cd ", "+-bar " ); }
public void testInNodeBorder() throws Exception { TableElement tableElement = new TableElement(1, 1); tableElement.border(BorderStyle.DASHED); tableElement. add(row(). add(label("a")). add(label("b"))). add(row(). add(label("c")). add(label("d"))); TreeElement node = new TreeElement(); node.addChild(label("foo")); node.addChild(tableElement); node.addChild(label("bar")); assertRender(node, 32, "+-foo ", "+- ---------------------------- ", "| |a b |", "| |c d |", "| ---------------------------- ", "+-bar "); }
public void testInNodeTooLarge() throws Exception { TableElement tableElement = new TableElement(); tableElement. add(row(). add(label("a")). add(label("b")). add(label("c is a very very very too long value"))). add(row(). add(label("d")). add(label("e")). add(label("f"))); TreeElement node = new TreeElement(); node.addChild(label("foo")); node.addChild(tableElement); node.addChild(label("bar")); assertRender(node, 24, "+-foo " , "+-abc is a very very ver" , "| y too long value " , "| def " , "+-bar "); }
public void testInNodeTooLargeBorder() throws Exception { TableElement tableElement = new TableElement(); tableElement.border(BorderStyle.DASHED); tableElement.separator(BorderStyle.DASHED); tableElement. add(row(). add(label("a")). add(label("b")). add(label("c is a very very very too long value"))). add(row(). add(label("d")). add(label("e")). add(label("f"))); TreeElement node = new TreeElement(); node.addChild(label("foo")); node.addChild(tableElement); node.addChild(label("bar")); assertRender(node, 32, "+-foo ", "+- ---------------------------- ", "| |a|b|c is a very very very to|", "| | | |o long value |", "| |d|e|f |", "| ---------------------------- ", "+-bar "); }
@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); } }
@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); } }
@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); } }
impact = "UNKNOWN"; operation.addChild(new TableElement(). add( new RowElement().add("Type: ", operationInfo.getReturnType()), operations.addChild(operation); root.addChild( new TableElement().leftCellPadding(1).overflow(Overflow.HIDDEN). row("ClassName", info.getClassName()). root.addChild(new TreeElement("Descriptor").addChild(descriptor)); root.addChild(new TreeElement("Attributes").addChild(attributes)); root.addChild(operations);
impact = "UNKNOWN"; operation.addChild(new TableElement(). add( new RowElement().add("Type: ", operationInfo.getReturnType()), operations.addChild(operation); root.addChild( new TableElement().leftCellPadding(1).overflow(Overflow.HIDDEN). row("ClassName", info.getClassName()). root.addChild(new TreeElement("Descriptor").addChild(descriptor)); root.addChild(new TreeElement("Attributes").addChild(attributes)); root.addChild(operations);