Package com.oorian.html
Interface Container
- All Known Implementing Classes:
A,Address,Anchor,Article,Aside,AsyncPanel,Blockquote,Body,Button,Center,ContainerElement,Deck,Details,Dialog,Dialog,Dialog.Content,Div,DropPanel,Fieldset,Figure,FilterableTree,Footer,Form,HashNavComponent,Header,HStack,Hyperlink,Label,Li,ListItem,LiveRegion,Main,Map,ModalPopup,ModalPopup.Content,Nav,NoScript,OorianForm,Output,P,Paragraph,Popup,Search,Section,SkipLink,Slot,Spinner,Stack,StyledContainerElement,TableCell,Td,Template,Th,TreeGroup,TreeItem,VStack
public interface Container
Common interface for elements that can contain child elements.
Both ContainerElement and StyledContainerElement implement this interface,
providing a unified type for code that needs to work with any container regardless of whether
it supports styling operations.
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddElement(Element child) Adds a child element to this container.voidaddLineOfText(String text) Adds a line of plain text.voidaddLineOfText(String text, CssStyle style) Adds a line of styled text.voidaddLineOfText(String text, String style) Adds a line of styled text.voidAdds an empty paragraph.voidaddParagraph(String text) Adds a paragraph with text.voidaddSpacer(int height) Adds a vertical spacer with the specified height.voidAdds a text node to this container.voidAdds plain text to this container.voidAdds styled text to this container.voidAdds styled text to this container.getElement(int index) Returns the child element at the specified index.intReturns the number of child elements.insertElement(int index, Element child) Inserts a child element at the specified index.voidRemoves all child elements from this container.voidremoveElement(Element child) Removes a child element.voidremoveElement(String id) Removes a child element by its ID.setElement(Element child) Sets the sole child element, replacing any existing children.voidSets the plain text content, replacing any existing children.voidSets the text content, replacing any existing children.voidSets the text content with a font.voidSets the text content with an inline style.
-
Method Details
-
addElement
Adds a child element to this container.- Parameters:
child- The element to add.- Returns:
- This element for method chaining.
-
setElement
Sets the sole child element, replacing any existing children.- Parameters:
child- The element to set as the only child.- Returns:
- This element for method chaining.
-
insertElement
Inserts a child element at the specified index.- Parameters:
index- The position at which to insert the child.child- The element to insert.- Returns:
- This element for method chaining.
-
removeAllElements
void removeAllElements()Removes all child elements from this container. -
removeElement
Removes a child element by its ID.- Parameters:
id- The ID of the child element to remove.
-
removeElement
Removes a child element.- Parameters:
child- The element to remove.
-
getElementCount
int getElementCount()Returns the number of child elements.- Returns:
- The child element count.
-
getElement
Returns the child element at the specified index.- Parameters:
index- The index of the child element.- Returns:
- The child element.
-
addText
Adds a text node to this container.- Parameters:
text- The text node to add.
-
addText
Adds styled text to this container.- Parameters:
text- The text content.style- The CSS style to apply.
-
addText
Adds styled text to this container.- Parameters:
text- The text content.style- The inline style string.
-
addText
Adds plain text to this container.- Parameters:
text- The text content.
-
setText
Sets the text content, replacing any existing children.- Parameters:
text- The text content.style- The CSS style to apply.
-
setText
Sets the text content with a font.- Parameters:
text- The text content.font- The font to apply.
-
setText
Sets the text content with an inline style.- Parameters:
text- The text content.style- The inline style string.
-
setText
Sets the plain text content, replacing any existing children.- Parameters:
text- The text content.
-
addParagraph
Adds a paragraph with text.- Parameters:
text- The paragraph text.
-
addParagraph
void addParagraph()Adds an empty paragraph. -
addSpacer
void addSpacer(int height) Adds a vertical spacer with the specified height.- Parameters:
height- The spacer height in pixels.
-
addLineOfText
Adds a line of styled text.- Parameters:
text- The text content.style- The CSS style to apply.
-
addLineOfText
Adds a line of styled text.- Parameters:
text- The text content.style- The inline style string.
-
addLineOfText
Adds a line of plain text.- Parameters:
text- The text content.
-