Class Panel
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<Panel,PanelContent>
-
- com.atlassian.adf.model.node.Panel
-
- All Implemented Interfaces:
Element,Node,ContentNode<Panel,PanelContent>,DocContent,LayoutColumnContent,NonNestableBlockContent,TableCellContent
public class Panel extends AbstractContentNode<Panel,PanelContent> implements DocContent, LayoutColumnContent, NonNestableBlockContent, TableCellContent
A container that highlights content as additional information, a warning, or the result of an action.Example
Java
Panel.
info(p("Hello world") )ADF
{ "type": "panel", "attrs": { "panelType": "info" }, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Hello world" } ] } ] }Result
ℹ️ Hello worldNote: This example output is not using AtlasKit to render the panel, so while it gives a vague impression of what a "panel" is, it does not faithfully reproduce the actual presentation in Atlassian products.
- See Also:
- Node - panel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPanel.PanelTypestatic interfacePanel.PartialTypes that represent a partially constructedpanel.-
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.voidappendPlainText(StringBuilder sb)Renders this node as plain-text suitable for viewing by end users.Panelcontent(String content)Panelcontent(String... content)Class<PanelContent>contentClass()ReturnsClass<N>, the class representing the type of items held by this node.protected booleancontentNodeEquals(Panel 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()Panelcopy()Returns a deep copy of this element, including copies of any nodes or marks that it contains.Panelcustom()static Panelcustom(PanelContent content)static Panelcustom(PanelContent... content)static Panelcustom(Iterable<? extends PanelContent> content)static Panelcustom(String content)static Panelcustom(String... content)static Panelcustom(Stream<? extends PanelContent> content)StringelementType()Thetypevalue that identifies this element, such as"paragraph"or"strong".Panelerror()static Panelerror(PanelContent content)static Panelerror(PanelContent... content)static Panelerror(Iterable<? extends PanelContent> content)static Panelerror(String content)static Panelerror(String... content)static Panelerror(Stream<? extends PanelContent> content)Panelinfo()static Panelinfo(PanelContent content)static Panelinfo(PanelContent... content)static Panelinfo(Iterable<? extends PanelContent> content)static Panelinfo(String content)static Panelinfo(String... content)static Panelinfo(Stream<? extends PanelContent> content)Panelnote()static Panelnote(PanelContent content)static Panelnote(PanelContent... content)static Panelnote(Iterable<? extends PanelContent> content)static Panelnote(String content)static Panelnote(String... content)static Panelnote(Stream<? extends PanelContent> content)static Panel.Partial.NeedsPanelTypepanel()static Panelpanel(Panel.PanelType panelType)static Panelpanel(Panel.PanelType panelType, PanelContent content)static Panelpanel(Panel.PanelType panelType, PanelContent... content)static Panelpanel(Panel.PanelType panelType, Iterable<? extends PanelContent> content)static Panelpanel(Panel.PanelType panelType, Stream<? extends PanelContent> content)static Panelpanel(String panelType)static Panelpanel(String panelType, PanelContent content)static Panelpanel(String panelType, PanelContent... content)static Panelpanel(String panelType, Iterable<? extends PanelContent> content)static Panelpanel(String panelType, Stream<? extends PanelContent> content)StringpanelColor()PanelpanelColor(String panelColor)StringpanelIcon()PanelpanelIcon(String panelIcon)StringpanelIconId()PanelpanelIconId(String panelIconId)StringpanelIconText()PanelpanelIconText(String panelIconText)Panel.PanelTypepanelType()Return the panel's type.PanelpanelType(Panel.PanelType panelType)PanelpanelType(String panelType)Panelsuccess()static Panelsuccess(PanelContent content)static Panelsuccess(PanelContent... content)static Panelsuccess(Iterable<? extends PanelContent> content)static Panelsuccess(String content)static Panelsuccess(String... content)static Panelsuccess(Stream<? extends PanelContent> content)Paneltip()static Paneltip(PanelContent content)static Paneltip(PanelContent... content)static Paneltip(Iterable<? extends PanelContent> content)static Paneltip(String content)static Paneltip(String... content)static Paneltip(Stream<? extends PanelContent> 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(PanelContent node)Called on each content node before it is added to validate that the node can be accepted.Panelwarning()static Panelwarning(PanelContent content)static Panelwarning(PanelContent... content)static Panelwarning(Iterable<? extends PanelContent> content)static Panelwarning(String content)static Panelwarning(String... content)static Panelwarning(Stream<? extends PanelContent> content)-
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
allNodesOfType, allNodesOfTypeAsList
-
Methods inherited from interface com.atlassian.adf.model.Element
isSupported, validate
-
Methods inherited from interface com.atlassian.adf.model.node.Node
toPlainText
-
-
-
-
Method Detail
-
validateContentNodeForAppend
protected void validateContentNodeForAppend(PanelContent 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<Panel,PanelContent>- Parameters:
node- the node that is about to be added
-
panel
public static Panel.Partial.NeedsPanelType panel()
-
info
public static Panel info(PanelContent content)
-
info
public static Panel info(PanelContent... content)
-
info
public static Panel info(Iterable<? extends PanelContent> content)
-
info
public static Panel info(Stream<? extends PanelContent> content)
-
tip
public static Panel tip(PanelContent content)
-
tip
public static Panel tip(PanelContent... content)
-
tip
public static Panel tip(Iterable<? extends PanelContent> content)
-
tip
public static Panel tip(Stream<? extends PanelContent> content)
-
note
public static Panel note(PanelContent content)
-
note
public static Panel note(PanelContent... content)
-
note
public static Panel note(Iterable<? extends PanelContent> content)
-
note
public static Panel note(Stream<? extends PanelContent> content)
-
warning
public static Panel warning(PanelContent content)
-
warning
public static Panel warning(PanelContent... content)
-
warning
public static Panel warning(Iterable<? extends PanelContent> content)
-
warning
public static Panel warning(Stream<? extends PanelContent> content)
-
success
public static Panel success(PanelContent content)
-
success
public static Panel success(PanelContent... content)
-
success
public static Panel success(Iterable<? extends PanelContent> content)
-
success
public static Panel success(Stream<? extends PanelContent> content)
-
error
public static Panel error(PanelContent content)
-
error
public static Panel error(PanelContent... content)
-
error
public static Panel error(Iterable<? extends PanelContent> content)
-
error
public static Panel error(Stream<? extends PanelContent> content)
-
custom
public static Panel custom(PanelContent content)
-
custom
public static Panel custom(PanelContent... content)
-
custom
public static Panel custom(Iterable<? extends PanelContent> content)
-
custom
public static Panel custom(Stream<? extends PanelContent> content)
-
panel
public static Panel panel(String panelType)
- Returns:
- a new, empty panel of the given type. At least one content item must be added to make it valid.
-
panel
public static Panel panel(Panel.PanelType panelType)
- Returns:
- a new, empty panel of the given type. At least one content item must be added to make it valid.
-
panel
public static Panel panel(String panelType, PanelContent content)
- Returns:
- a new panel with the given type and content
-
panel
public static Panel panel(String panelType, PanelContent... content)
- Returns:
- a new panel with the given type and content
-
panel
public static Panel panel(String panelType, Iterable<? extends PanelContent> content)
- Returns:
- a new panel with the given type and content
-
panel
public static Panel panel(String panelType, Stream<? extends PanelContent> content)
- Returns:
- a new panel with the given type and content
-
panel
public static Panel panel(Panel.PanelType panelType, PanelContent content)
- Returns:
- a new panel with the given type and content
-
panel
public static Panel panel(Panel.PanelType panelType, PanelContent... content)
- Returns:
- a new panel with the given type and content
-
panel
public static Panel panel(Panel.PanelType panelType, Iterable<? extends PanelContent> content)
- Returns:
- a new panel with the given type and content
-
panel
public static Panel panel(Panel.PanelType panelType, Stream<? extends PanelContent> content)
- Returns:
- a new panel with the given type and content
-
panelType
public Panel.PanelType panelType()
Return the panel's type.- Returns:
- the panel's type.
-
panelIconId
public String panelIconId()
-
panelIcon
public String panelIcon()
-
panelColor
public String panelColor()
-
panelIconText
public String panelIconText()
-
panelType
public Panel panelType(Panel.PanelType panelType)
-
info
public Panel info()
-
note
public Panel note()
-
tip
public Panel tip()
-
warning
public Panel warning()
-
error
public Panel error()
-
success
public Panel success()
-
custom
public Panel custom()
-
contentClass
public Class<PanelContent> contentClass()
Description copied from interface:ContentNodeReturnsClass<N>, the class representing the type of items held by this node.- Specified by:
contentClassin interfaceContentNode<Panel,PanelContent>
-
copy
public Panel 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<Panel,PanelContent>- 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
-
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<Panel,PanelContent>- 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)
-
contentNodeEquals
protected boolean contentNodeEquals(Panel 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<Panel,PanelContent>- 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)
-
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<Panel,PanelContent>- Parameters:
buf- where the field values should be written- See Also:
AbstractContentNode.contentNodeHashCode(),AbstractContentNode.contentNodeEquals(AbstractContentNode)
-
contentNodeValidate
protected void contentNodeValidate()
- Overrides:
contentNodeValidatein classAbstractContentNode<Panel,PanelContent>
-
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.
-
appendPlainText
public 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<Panel,PanelContent>- Parameters:
sb- where to write the result
-
-