Class TaskList
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<TaskList,TaskListContent>
-
- com.atlassian.adf.model.node.TaskList
-
- All Implemented Interfaces:
Element,Node,ContentNode<TaskList,TaskListContent>,DocContent,LayoutColumnContent,NonNestableBlockContent,TableCellContent,TaskListContent
@Documentation(state=UNDOCUMENTED, date="2023-07-26") public class TaskList extends AbstractContentNode<TaskList,TaskListContent> implements DocContent, LayoutColumnContent, NonNestableBlockContent, TableCellContent, TaskListContent
Task lists provide lists that look much like abulletList, but there are differences in their visual representation. They can be nested (although at least onetaskItemhas to be provided before any nested task lists). The task items also require identifier strings that can be used to associate them with information in other systems.Note: Jira does not currently support task lists.
Example
Java
taskList( "test-list-id",taskItem() .todo() .localId("test-id1") .content("Do this!"),taskItem() .localId("test-id2") .state(DONE) .content("This is completed") );ADF
{ "type": "taskList", "attrs": { "localId": "test-list-id" }, "content": [ { "type": "taskItem", "attrs": { "localId": "test-id1", "state": "TODO" }, "content": [ { "type": "text", "text": "Do this!" } ] }, { "type": "taskItem", "attrs": { "localId": "test-id2", "state": "DONE" }, "content": [ { "type": "text", "text": "This is completed" } ] } ] }Result
Do this!This is completedNote: This example output is not using AtlasKit to render the task list, so while it gives a vague impression of what a "task list" is, it does not faithfully reproduce the actual presentation in Atlassian products. In particular, the checkboxes are displayed here without the proper styling.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
-
Field Summary
-
Fields inherited from class com.atlassian.adf.model.node.AbstractContentNode
content
-
-
Method Summary
All Methods Static 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.Class<TaskListContent>contentClass()ReturnsClass<N>, the class representing the type of items held by this node.protected booleancontentNodeEquals(TaskList 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()TaskListcopy()Returns a deep copy of this element, including copies of any nodes or marks that it contains.StringelementType()Thetypevalue that identifies this element, such as"paragraph"or"strong".StringlocalId()TaskListlocalId(String localId)static TaskListtaskList(String localId)static TaskListtaskList(String localId, TaskListContent content)static TaskListtaskList(String localId, TaskListContent... content)static TaskListtaskList(String localId, Iterable<? extends TaskListContent> content)static TaskListtaskList(String localId, Stream<? extends TaskListContent> content)Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.protected voidvalidateContentNodeForAppend(TaskListContent 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, appendPlainText, 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
allNodesOfType, allNodesOfTypeAsList
-
Methods inherited from interface com.atlassian.adf.model.Element
isSupported, validate
-
Methods inherited from interface com.atlassian.adf.model.node.Node
appendPlainText, toPlainText
-
-
-
-
Method Detail
-
taskList
public static TaskList taskList(String localId, TaskListContent content)
-
taskList
public static TaskList taskList(String localId, TaskListContent... content)
-
taskList
public static TaskList taskList(String localId, Iterable<? extends TaskListContent> content)
-
taskList
public static TaskList taskList(String localId, Stream<? extends TaskListContent> content)
-
localId
public String localId()
-
contentClass
public Class<TaskListContent> contentClass()
Description copied from interface:ContentNodeReturnsClass<N>, the class representing the type of items held by this node.- Specified by:
contentClassin interfaceContentNode<TaskList,TaskListContent>
-
copy
public TaskList copy()
Description copied from interface:ElementReturns a deep copy of this element, including copies of any nodes or marks that it contains. The copy will not necessarily be in exactly the same state as the original in some cases. For example, atextnode that is used inside acodeBlockwill have the ability to use marks on it disabled, but a copy made of the text node using this method will not similarly disallow marks unless it is also added to a content node with those same restrictions.Implementations notes:
- Implementations should narrow the return type.
- Implementations should
return thisif the element is immutable. The@Immutableannotation should be used on the class to offer additional confirmation of this intent. - Implementations should
return parse(toMap())if they have state. - While there may be cases where it is worthwhile to do something more efficient than
the conversion to a map and back, this is discouraged because it would add yet another
fragile piece of code that breaks when new data is added to the node. The
parseandtoMapmethods already have to be updated in these circumstances, so it makes sense to take advantage of that.
- Specified by:
copyin interfaceContentNode<TaskList,TaskListContent>- Specified by:
copyin interfaceElement- Specified by:
copyin interfaceNode- Returns:
- a copy of this element, or
thisif the element is immutable anyway
-
elementType
public String elementType()
Description copied from interface:ElementThetypevalue that identifies this element, such as"paragraph"or"strong".- Specified by:
elementTypein interfaceElement
-
toMap
public Map<String,?> toMap()
Description copied from interface:ElementTransforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.
-
contentNodeEquals
protected boolean contentNodeEquals(TaskList 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<TaskList,TaskListContent>- 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 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<TaskList,TaskListContent>- 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 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<TaskList,TaskListContent>- Parameters:
buf- where the field values should be written- See Also:
AbstractContentNode.contentNodeHashCode(),AbstractContentNode.contentNodeEquals(AbstractContentNode)
-
validateContentNodeForAppend
protected void validateContentNodeForAppend(TaskListContent 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<TaskList,TaskListContent>- Parameters:
node- the node that is about to be added
-
contentNodeValidate
protected void contentNodeValidate()
- Overrides:
contentNodeValidatein classAbstractContentNode<TaskList,TaskListContent>
-
-