Class AbstractTableCellNode<N extends AbstractTableCellNode<N>>
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<N,TableCellContent>
-
- com.atlassian.adf.model.node.AbstractTableCellNode<N>
-
- Type Parameters:
N- the subclass's own type
- All Implemented Interfaces:
Element,Node,ContentNode<N,TableCellContent>,TableCellNode<N>,TableRowContent
- Direct Known Subclasses:
TableCell,TableHeader
@Internal public abstract class AbstractTableCellNode<N extends AbstractTableCellNode<N>> extends AbstractContentNode<N,TableCellContent> implements TableCellNode<N>
Either of the data-containing nodes that can be placed in aTableRow, meaning either atableHeaderor atableCell.Only the nodes that implement the
TableCellContentmarker interface are permitted as content.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringbackgroundprotected Integercolspanprotected int[]colwidthprotected Integerrowspan-
Fields inherited from class com.atlassian.adf.model.node.AbstractContentNode
content
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendContentNodeFields(AbstractNode.ToStringHelper buf)Allows content nodes that have their own fields to augment thetoString()implementation with their own field values.voidappendPlainText(StringBuilder sb)Renders this node as plain-text suitable for viewing by end users.Optional<String>background()Returns the background color for the table cell, if one is set.Nbackground(String background)Sets the background color for the table cell.Optional<Integer>colspan()Returns the colspan setting for the table cell, if one is set.Ncolspan(Integer colspan)NcolspanAndColwidth(Integer colspan, int[] colwidth)Sets the number of columns that the table cell spans, as well as the widths of those columns.Optional<int[]>colwidth()Returns the column widths for the table cell's spanned columns, if set.Ncolwidth(int... colwidth)Ncontent(String content)Ncontent(String... content)Class<TableCellContent>contentClass()ReturnsClass<N>, the class representing the type of items held by this node.protected booleancontentNodeEquals(N other)Allows content nodes that have their own fields to augment theequalsimplementation with tests for their own field values.protected intcontentNodeHashCode()Allows content nodes that have their own fields to augment thehashCodeimplementation with a hash of their own field values.protected voidcontentNodeValidate()protected NparseTableNode(Map<String,?> map)Optional<Integer>rowspan()Returns the rowspan setting for the table cell, if one is set.Nrowspan(Integer rowspan)Sets the number of rows that the table cell spans.Map<String,?>toMap()Note: Themapof attributes is always added, even if it is empty.protected voidvalidateContentNodeForAppend(TableCellContent node)Called on each content node before it is added to validate that the node can be accepted.-
Methods inherited from class com.atlassian.adf.model.node.AbstractContentNode
addContent, addContentIfPresent, allNodes, appendNodeFields, appendPlainTextContentJoinedWith, appendPlainTextInlineContent, clear, content, content, content, content, content, contentFieldMaps, isEmpty, nodeEquals, nodeHashCode, parseContentItem, parseContentItems, parseOptionalContent, parseRequiredContent, parseRequiredContentAllowEmpty, removeIf, replaceContent, requireNotEmpty, transformContent, transformDescendants, trim, validate, validateContentItems
-
Methods inherited from class com.atlassian.adf.model.node.AbstractNode
doubleEq, doubleHash, equals, hashCode, isSupported, mapWithType, numberEq, numberHash, self, toPlainText, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.atlassian.adf.model.node.type.ContentNode
allNodes, allNodesOfType, allNodesOfTypeAsList, clear, content, content, content, content, content, copy, isEmpty, removeIf, replaceContent, transformContent, transformDescendants
-
Methods inherited from interface com.atlassian.adf.model.Element
elementType, isSupported, validate
-
Methods inherited from interface com.atlassian.adf.model.node.Node
toPlainText
-
Methods inherited from interface com.atlassian.adf.model.node.type.TableCellNode
isHeader
-
-
-
-
Method Detail
-
background
public Optional<String> background()
Description copied from interface:TableCellNodeReturns the background color for the table cell, if one is set.- Specified by:
backgroundin interfaceTableCellNode<N extends AbstractTableCellNode<N>>- Returns:
- the background color for the table cell, or
empty()if not set
-
background
public N background(@Nullable String background)
Description copied from interface:TableCellNodeSets the background color for the table cell.- Specified by:
backgroundin interfaceTableCellNode<N extends AbstractTableCellNode<N>>- Parameters:
background- short or long hex color code or HTML color name- Returns:
this
-
content
public N content(String content)
- Specified by:
contentin interfaceTableCellNode<N extends AbstractTableCellNode<N>>
-
content
public N content(String... content)
- Specified by:
contentin interfaceTableCellNode<N extends AbstractTableCellNode<N>>
-
rowspan
public Optional<Integer> rowspan()
Description copied from interface:TableCellNodeReturns the rowspan setting for the table cell, if one is set.- Specified by:
rowspanin interfaceTableCellNode<N extends AbstractTableCellNode<N>>- Returns:
- the rowspan setting for the table cell, or
empty()if not set
-
rowspan
public N rowspan(@Nullable Integer rowspan)
Description copied from interface:TableCellNodeSets the number of rows that the table cell spans.- Specified by:
rowspanin interfaceTableCellNode<N extends AbstractTableCellNode<N>>- Parameters:
rowspan- a positive integer, default 1.- Returns:
this
-
colspan
public Optional<Integer> colspan()
Description copied from interface:TableCellNodeReturns the colspan setting for the table cell, if one is set.- Specified by:
colspanin interfaceTableCellNode<N extends AbstractTableCellNode<N>>- Returns:
- the colspan setting for the table cell, or
empty()if not set
-
colwidth
public Optional<int[]> colwidth()
Description copied from interface:TableCellNodeReturns the column widths for the table cell's spanned columns, if set.- Specified by:
colwidthin interfaceTableCellNode<N extends AbstractTableCellNode<N>>- Returns:
- the column widths for the table cell's spanned columns, or
empty()if not set
-
colwidth
public N colwidth(@Nullable int... colwidth)
-
colspanAndColwidth
public N colspanAndColwidth(@Nullable Integer colspan, @Nullable int[] colwidth)
Description copied from interface:TableCellNodeSets the number of columns that the table cell spans, as well as the widths of those columns.- Specified by:
colspanAndColwidthin interfaceTableCellNode<N extends AbstractTableCellNode<N>>- Parameters:
colspan- a positive integer, default 1.colwidth- an array of non-negative integers, at least one of which is positive, and with exactly one value for each of the columns counted bycolspan(meaning exactly 1 ifcolspanisnull). As an example,colspanAndColwidth(3, new int[] {120, 0, 120})is a valid request.- Returns:
this
-
contentNodeValidate
protected void contentNodeValidate()
- Overrides:
contentNodeValidatein classAbstractContentNode<N extends AbstractTableCellNode<N>,TableCellContent>
-
contentClass
public Class<TableCellContent> contentClass()
Description copied from interface:ContentNodeReturnsClass<N>, the class representing the type of items held by this node.- Specified by:
contentClassin interfaceContentNode<N extends AbstractTableCellNode<N>,TableCellContent>
-
toMap
public Map<String,?> toMap()
Note: Themapof attributes is always added, even if it is empty. This is a temporary patch to mirror the behaviour of the TypeScript parser (which always includes an empty attributes"attrs": {}field in table cells), in order to pass consistency checks during rollout. This change will be reverted whenTableParser.OMIT_TABLE_ATTRIBUTESis rolled out.
-
validateContentNodeForAppend
protected void validateContentNodeForAppend(TableCellContent node)
Description copied from class:AbstractContentNodeCalled on each content node before it is added to validate that the node can be accepted.- Overrides:
validateContentNodeForAppendin classAbstractContentNode<N extends AbstractTableCellNode<N>,TableCellContent>- Parameters:
node- the node that is about to be added
-
contentNodeEquals
protected final boolean contentNodeEquals(N other)
Description copied from class:AbstractContentNodeAllows content nodes that have their own fields to augment theequalsimplementation with tests for their own field values.Implementations need not check for identity,
null, or a different node class; those are already covered byAbstractNode.equals(Object). Implementations need not check theAbstractContentNode.content(), either; that is already covered byAbstractContentNode.nodeEquals(AbstractContentNode), which is expected to be this method's only consumer.Just as with the relationship between
hashCode,equals, andtoStringfor ordinary Java classes, subclasses ofAbstractContentNodeshould maintain consistent implementations ofcontentNodeHashCode,contentNodeEquals, andappendContentNodeFields.- Overrides:
contentNodeEqualsin classAbstractContentNode<N extends AbstractTableCellNode<N>,TableCellContent>- Returns:
trueif all additional field values that belong to a particular type of content node test as equal;falseif differences are found- See Also:
AbstractContentNode.contentNodeHashCode(),AbstractContentNode.appendContentNodeFields(ToStringHelper)
-
contentNodeHashCode
protected final int contentNodeHashCode()
Description copied from class:AbstractContentNodeAllows content nodes that have their own fields to augment thehashCodeimplementation with a hash of their own field values.Implementations need not include the node's class; that is already covered by
AbstractNode.hashCode(). Implementations need not include thecontent, either; that is already covered byAbstractNode.nodeHashCode(), which is expected to be this method's only consumer.Just as with the relationship between
hashCode,equals, andtoStringfor ordinary Java classes, subclasses ofAbstractContentNodeshould maintain consistent implementations ofcontentNodeHashCode,contentNodeEquals, andappendContentNodeFields.- Overrides:
contentNodeHashCodein classAbstractContentNode<N extends AbstractTableCellNode<N>,TableCellContent>- Returns:
- the hash code of any additional field values that belong to a particular type of content node.
- See Also:
AbstractContentNode.contentNodeEquals(AbstractContentNode),AbstractContentNode.appendContentNodeFields(ToStringHelper)
-
appendContentNodeFields
protected final void appendContentNodeFields(AbstractNode.ToStringHelper buf)
Description copied from class:AbstractContentNodeAllows content nodes that have their own fields to augment thetoString()implementation with their own field values.Each field's value should be provided by calling
AbstractNode.ToStringHelper.appendField(String, Object). Thevaluemay benull, in which case the field is omitted, for brevity. It will handle array values gracefully, including arrays of primitive types.Just as with the relationship between
hashCode,equals, andtoStringfor ordinary Java classes, subclasses ofAbstractContentNodeshould maintain consistent implementations ofcontentNodeHashCode,contentNodeEquals, andappendContentNodeFields.- Overrides:
appendContentNodeFieldsin classAbstractContentNode<N extends AbstractTableCellNode<N>,TableCellContent>- Parameters:
buf- where the field values should be written- See Also:
AbstractContentNode.contentNodeHashCode(),AbstractContentNode.contentNodeEquals(AbstractContentNode)
-
appendPlainText
public final void appendPlainText(StringBuilder sb)
Description copied from interface:NodeRenders this node as plain-text suitable for viewing by end users. This is equivalent to callingNode.toPlainText()and appending the result to the given buffer, except that it may be slightly more efficient, since it will write directly to the existing buffer instead of using a temporary buffer and having to make a copy of the result.- Specified by:
appendPlainTextin interfaceNode- Overrides:
appendPlainTextin classAbstractContentNode<N extends AbstractTableCellNode<N>,TableCellContent>- Parameters:
sb- where to write the result
-
-