public interface HtmlParent extends HtmlPiece
The children are in an ordered list, indexed from 0 to getChildCount()-1.
A child piece cannot be null.
Abstract Methods | |
---|---|
int |
getChildCount()
Get the number of children.
|
HtmlPiece |
getChild(int index)
Get the child at the index.
|
HtmlPiece |
setChild(int index,
HtmlPiece newChild)
Replace the child at the index.
|
void |
addChild(int index,
HtmlPiece child)
Insert the child at the index.
|
HtmlPiece |
removeChild(int index)
Remove the child at the index.
|
Default Methods | |
void |
addChild(HtmlPiece child)
Append the child piece.
|
void |
addChildren(Object... children)
Append the child pieces.
|
void |
detachChildren(Object... args)
Detach child pieces from this parent.
|
List<HtmlPiece> |
getChildList()
Get a live List view of the children.
|
void |
render(int indent,
Consumer<CharSequence> out)
Render this piece to `out`.
|
int getChildCount()
HtmlPiece getChild(int index)
HtmlPiece setChild(int index, HtmlPiece newChild)
void addChild(int index, HtmlPiece child)
Required: 0 <= index <= getChildCount()
HtmlPiece removeChild(int index)
default void addChild(HtmlPiece child)
default void addChildren(Object... children)
If a `child` in `children` is not an HtmlPiece,
it will be converted to text by new HtmlText(child)
.
default void detachChildren(Object... args)
See the specification in
ContentParent.detach(args)
The implementation of this method must treat the array `args` as read-only.
default List<HtmlPiece> getChildList()
The returned List supports read and write.
default void render(int indent, Consumer<CharSequence> out)
This default implementation just calls render(indent, out) on each child piece, possibly with indentations inserted between adjacent children.