Class TextDisplayContainer
java.lang.Object
io.github.kaktushose.jdac.components.internal.AbstractSequencedContainer<TextDisplay, TextDisplayContainer>
io.github.kaktushose.jdac.components.container.TextDisplayContainer
- All Implemented Interfaces:
LocalizedComponent, SequencedComponent<TextDisplay>, IDisableable, Component, Container, IComponentUnion, MessageTopLevelComponent, MessageTopLevelComponentUnion, IReplaceable, SerializableData
public final class TextDisplayContainer
extends AbstractSequencedContainer<TextDisplay, TextDisplayContainer>
An implementation of SequencedContainer that only allows TextDisplays.
Example
var container = SequencedTextDisplay.of("Line 1");
container.add("Line 2");
container.addFirst("Line 0");
-
Nested Class Summary
Nested classes/interfaces inherited from interface Component
Component.Type -
Field Summary
Fields inherited from class AbstractSequencedContainer
container, entries -
Constructor Summary
ConstructorsConstructorDescriptionTextDisplayContainer(Resolver<String> resolver, Locale locale, String content) Constructs a newTextDisplayContainer.TextDisplayContainer(Resolver<String> resolver, Locale locale, TextDisplay header) Constructs a newTextDisplayContainer.TextDisplayContainer(Resolver<String> resolver, DiscordLocale locale, String content) Constructs a newTextDisplayContainer.TextDisplayContainer(Resolver<String> resolver, DiscordLocale locale, TextDisplay header) Constructs a newTextDisplayContainer. -
Method Summary
Modifier and TypeMethodDescriptionAppends the provided element to the end of this component.Adds the provided element to this component as the first element of this component.Adds the provided element to this component as the last element of this component.static TextDisplayContainerConstructs a newTextDisplayContainerfrom the givenString.static TextDisplayContainerof(TextDisplay header) Constructs a newTextDisplayContainerfrom the givenTextDisplay.protected TextDisplayContainerself()Methods inherited from class AbstractSequencedContainer
add, addAll, addFirst, addLast, asActionRow, asContainer, asDisabled, asEnabled, asFileDisplay, asMediaGallery, asSection, asSeparator, asTextDisplay, checkAccess, entries, entries, getAccentColorRaw, getComponents, getType, getUniqueId, isSpoiler, locale, locale, locale, replace, toData, withAccentColor, withAccentColor, withComponents, withComponents, withDisabled, withSpoiler, withUniqueIdMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Container
getAccentColor, isDisabled, isEnabled, isMessageCompatible, isModalCompatibleMethods inherited from interface IComponentUnion
isUnknownComponent
-
Constructor Details
-
TextDisplayContainer
Constructs a newTextDisplayContainer.- Parameters:
resolver- theResolverto use for localizationlocale- the locale this container will be localized tocontent- theStringto use for the firstTextDisplayof this container
-
TextDisplayContainer
Constructs a newTextDisplayContainer.- Parameters:
resolver- theResolverto use for localizationlocale- the locale this container will be localized toheader- the firstTextDisplayof this container
-
TextDisplayContainer
Constructs a newTextDisplayContainer.- Parameters:
resolver- theResolverto use for localizationlocale- the locale this container will be localized tocontent- theStringto use for the firstTextDisplayof this container
-
TextDisplayContainer
Constructs a newTextDisplayContainer.- Parameters:
resolver- theResolverto use for localizationlocale- the locale this container will be localized toheader- the firstTextDisplayof this container
-
-
Method Details
-
of
Constructs a new
TextDisplayContainerfrom the givenString.This method can only be used inside events or in methods annotated with
IntrospectionAccess.- Parameters:
content- theStringto use for the firstTextDisplayof this container- Throws:
IllegalStateException- if theJDACScope.PREPARATIONisn't accessible.
-
of
Constructs a new
TextDisplayContainerfrom the givenTextDisplay.This method can only be used inside events or in methods annotated with
IntrospectionAccess.- Parameters:
header- the firstTextDisplayof this container- Throws:
ReplyException- if theJDACScope.PREPARATIONisn't accessible.
-
add
Appends the provided element to the end of this component.- Parameters:
content- the content to create theTextDisplayfromentries- the Entries used for localization- Returns:
- this instance for fluent interface
-
addFirst
Adds the provided element to this component as the first element of this component.- Parameters:
content- the content to create theTextDisplayfromentries- the Entries used for localization- Returns:
- this instance for fluent interface
-
addLast
Adds the provided element to this component as the last element of this component.- Parameters:
content- the content to create theTextDisplayfromentries- the Entries used for localization- Returns:
- this instance for fluent interface
-
self
- Specified by:
selfin classAbstractSequencedContainer<TextDisplay, TextDisplayContainer>
-