Class Card.Section.Builder (2.65.0)

public static final class Card.Section.Builder extends GeneratedMessage.Builder<Card.Section.Builder> implements Card.SectionOrBuilder

A section contains a collection of widgets that are rendered vertically in the order that they're specified.

Google Workspace add-ons and Chat apps:

Protobuf type google.apps.card.v1.Card.Section

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addAllWidgets(Iterable<? extends Widget> values)

public Card.Section.Builder addAllWidgets(Iterable<? extends Widget> values)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
values Iterable<? extends com.google.apps.card.v1.Widget>
Returns
Type Description
Card.Section.Builder

addWidgets(Widget value)

public Card.Section.Builder addWidgets(Widget value)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
value Widget
Returns
Type Description
Card.Section.Builder

addWidgets(Widget.Builder builderForValue)

public Card.Section.Builder addWidgets(Widget.Builder builderForValue)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
builderForValue Widget.Builder
Returns
Type Description
Card.Section.Builder

addWidgets(int index, Widget value)

public Card.Section.Builder addWidgets(int index, Widget value)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameters
Name Description
index int
value Widget
Returns
Type Description
Card.Section.Builder

addWidgets(int index, Widget.Builder builderForValue)

public Card.Section.Builder addWidgets(int index, Widget.Builder builderForValue)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameters
Name Description
index int
builderForValue Widget.Builder
Returns
Type Description
Card.Section.Builder

addWidgetsBuilder()

public Widget.Builder addWidgetsBuilder()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
Widget.Builder

addWidgetsBuilder(int index)

public Widget.Builder addWidgetsBuilder(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
Widget.Builder

build()

public Card.Section build()
Returns
Type Description
Card.Section

buildPartial()

public Card.Section buildPartial()
Returns
Type Description
Card.Section

clear()

public Card.Section.Builder clear()
Returns
Type Description
Card.Section.Builder
Overrides

clearCollapseControl()

public Card.Section.Builder clearCollapseControl()

Optional. Define the expand and collapse button of the section. This button will be shown only if the section is collapsible. If this field isn't set, the default button is used.

.google.apps.card.v1.CollapseControl collapse_control = 8;

Returns
Type Description
Card.Section.Builder

clearCollapsible()

public Card.Section.Builder clearCollapsible()

Indicates whether this section is collapsible.

Collapsible sections hide some or all widgets, but users can expand the section to reveal the hidden widgets by clicking Show more. Users can hide the widgets again by clicking Show less.

To determine which widgets are hidden, specify uncollapsibleWidgetsCount.

bool collapsible = 5;

Returns
Type Description
Card.Section.Builder

This builder for chaining.

clearHeader()

public Card.Section.Builder clearHeader()

Text that appears at the top of a section. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace add-ons.

string header = 1;

Returns
Type Description
Card.Section.Builder

This builder for chaining.

clearUncollapsibleWidgetsCount()

public Card.Section.Builder clearUncollapsibleWidgetsCount()

The number of uncollapsible widgets which remain visible even when a section is collapsed.

For example, when a section contains five widgets and the uncollapsibleWidgetsCount is set to 2, the first two widgets are always shown and the last three are collapsed by default. The uncollapsibleWidgetsCount is taken into account only when collapsible is true.

int32 uncollapsible_widgets_count = 6;

Returns
Type Description
Card.Section.Builder

This builder for chaining.

clearWidgets()

public Card.Section.Builder clearWidgets()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
Card.Section.Builder

getCollapseControl()

public CollapseControl getCollapseControl()

Optional. Define the expand and collapse button of the section. This button will be shown only if the section is collapsible. If this field isn't set, the default button is used.

.google.apps.card.v1.CollapseControl collapse_control = 8;

Returns
Type Description
CollapseControl

The collapseControl.

getCollapseControlBuilder()

public CollapseControl.Builder getCollapseControlBuilder()

Optional. Define the expand and collapse button of the section. This button will be shown only if the section is collapsible. If this field isn't set, the default button is used.

.google.apps.card.v1.CollapseControl collapse_control = 8;

Returns
Type Description
CollapseControl.Builder

getCollapseControlOrBuilder()

public CollapseControlOrBuilder getCollapseControlOrBuilder()

Optional. Define the expand and collapse button of the section. This button will be shown only if the section is collapsible. If this field isn't set, the default button is used.

.google.apps.card.v1.CollapseControl collapse_control = 8;

Returns
Type Description
CollapseControlOrBuilder

getCollapsible()

public boolean getCollapsible()

Indicates whether this section is collapsible.

Collapsible sections hide some or all widgets, but users can expand the section to reveal the hidden widgets by clicking Show more. Users can hide the widgets again by clicking Show less.

To determine which widgets are hidden, specify uncollapsibleWidgetsCount.

bool collapsible = 5;

Returns
Type Description
boolean

The collapsible.

getDefaultInstanceForType()

public Card.Section getDefaultInstanceForType()
Returns
Type Description
Card.Section

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getHeader()

public String getHeader()

Text that appears at the top of a section. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace add-ons.

string header = 1;

Returns
Type Description
String

The header.

getHeaderBytes()

public ByteString getHeaderBytes()

Text that appears at the top of a section. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace add-ons.

string header = 1;

Returns
Type Description
ByteString

The bytes for header.

getUncollapsibleWidgetsCount()

public int getUncollapsibleWidgetsCount()

The number of uncollapsible widgets which remain visible even when a section is collapsed.

For example, when a section contains five widgets and the uncollapsibleWidgetsCount is set to 2, the first two widgets are always shown and the last three are collapsed by default. The uncollapsibleWidgetsCount is taken into account only when collapsible is true.

int32 uncollapsible_widgets_count = 6;

Returns
Type Description
int

The uncollapsibleWidgetsCount.

getWidgets(int index)

public Widget getWidgets(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
Widget

getWidgetsBuilder(int index)

public Widget.Builder getWidgetsBuilder(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
Widget.Builder

getWidgetsBuilderList()

public List<Widget.Builder> getWidgetsBuilderList()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
List<Builder>

getWidgetsCount()

public int getWidgetsCount()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
int

getWidgetsList()

public List<Widget> getWidgetsList()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
List<Widget>

getWidgetsOrBuilder(int index)

public WidgetOrBuilder getWidgetsOrBuilder(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
WidgetOrBuilder

getWidgetsOrBuilderList()

public List<? extends WidgetOrBuilder> getWidgetsOrBuilderList()

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Returns
Type Description
List<? extends com.google.apps.card.v1.WidgetOrBuilder>

hasCollapseControl()

public boolean hasCollapseControl()

Optional. Define the expand and collapse button of the section. This button will be shown only if the section is collapsible. If this field isn't set, the default button is used.

.google.apps.card.v1.CollapseControl collapse_control = 8;

Returns
Type Description
boolean

Whether the collapseControl field is set.

internalGetFieldAccessorTable()

protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeCollapseControl(CollapseControl value)

public Card.Section.Builder mergeCollapseControl(CollapseControl value)

Optional. Define the expand and collapse button of the section. This button will be shown only if the section is collapsible. If this field isn't set, the default button is used.

.google.apps.card.v1.CollapseControl collapse_control = 8;

Parameter
Name Description
value CollapseControl
Returns
Type Description
Card.Section.Builder

mergeFrom(Card.Section other)

public Card.Section.Builder mergeFrom(Card.Section other)
Parameter
Name Description
other Card.Section
Returns
Type Description
Card.Section.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Card.Section.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Card.Section.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public Card.Section.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
Card.Section.Builder
Overrides

removeWidgets(int index)

public Card.Section.Builder removeWidgets(int index)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameter
Name Description
index int
Returns
Type Description
Card.Section.Builder

setCollapseControl(CollapseControl value)

public Card.Section.Builder setCollapseControl(CollapseControl value)

Optional. Define the expand and collapse button of the section. This button will be shown only if the section is collapsible. If this field isn't set, the default button is used.

.google.apps.card.v1.CollapseControl collapse_control = 8;

Parameter
Name Description
value CollapseControl
Returns
Type Description
Card.Section.Builder

setCollapseControl(CollapseControl.Builder builderForValue)

public Card.Section.Builder setCollapseControl(CollapseControl.Builder builderForValue)

Optional. Define the expand and collapse button of the section. This button will be shown only if the section is collapsible. If this field isn't set, the default button is used.

.google.apps.card.v1.CollapseControl collapse_control = 8;

Parameter
Name Description
builderForValue CollapseControl.Builder
Returns
Type Description
Card.Section.Builder

setCollapsible(boolean value)

public Card.Section.Builder setCollapsible(boolean value)

Indicates whether this section is collapsible.

Collapsible sections hide some or all widgets, but users can expand the section to reveal the hidden widgets by clicking Show more. Users can hide the widgets again by clicking Show less.

To determine which widgets are hidden, specify uncollapsibleWidgetsCount.

bool collapsible = 5;

Parameter
Name Description
value boolean

The collapsible to set.

Returns
Type Description
Card.Section.Builder

This builder for chaining.

setHeader(String value)

public Card.Section.Builder setHeader(String value)

Text that appears at the top of a section. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace add-ons.

string header = 1;

Parameter
Name Description
value String

The header to set.

Returns
Type Description
Card.Section.Builder

This builder for chaining.

setHeaderBytes(ByteString value)

public Card.Section.Builder setHeaderBytes(ByteString value)

Text that appears at the top of a section. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace add-ons.

string header = 1;

Parameter
Name Description
value ByteString

The bytes for header to set.

Returns
Type Description
Card.Section.Builder

This builder for chaining.

setUncollapsibleWidgetsCount(int value)

public Card.Section.Builder setUncollapsibleWidgetsCount(int value)

The number of uncollapsible widgets which remain visible even when a section is collapsed.

For example, when a section contains five widgets and the uncollapsibleWidgetsCount is set to 2, the first two widgets are always shown and the last three are collapsed by default. The uncollapsibleWidgetsCount is taken into account only when collapsible is true.

int32 uncollapsible_widgets_count = 6;

Parameter
Name Description
value int

The uncollapsibleWidgetsCount to set.

Returns
Type Description
Card.Section.Builder

This builder for chaining.

setWidgets(int index, Widget value)

public Card.Section.Builder setWidgets(int index, Widget value)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameters
Name Description
index int
value Widget
Returns
Type Description
Card.Section.Builder

setWidgets(int index, Widget.Builder builderForValue)

public Card.Section.Builder setWidgets(int index, Widget.Builder builderForValue)

All the widgets in the section. Must contain at least one widget.

repeated .google.apps.card.v1.Widget widgets = 2;

Parameters
Name Description
index int
builderForValue Widget.Builder
Returns
Type Description
Card.Section.Builder