Class Grid.Builder (2.39.1)

public static final class Grid.Builder extends GeneratedMessageV3.Builder<Grid.Builder> implements GridOrBuilder

Displays a grid with a collection of items. Items can only include text or images. For responsive columns, or to include more than text or images, use Columns. For an example in Google Chat apps, see Display a Grid with a collection of items.

A grid supports any number of columns and items. The number of rows is determined by items divided by columns. A grid with 10 items and 2 columns has 5 rows. A grid with 11 items and 2 columns has 6 rows.

Google Workspace Add-ons and Chat apps:

For example, the following JSON creates a 2 column grid with a single item:

<code><code> "grid": { "title": "A fine collection of items", "columnCount": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4 }, "items": [ { "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" } ], "onClick": { "openLink": { "url": "https://www.example.com" } } } </code></code>

Protobuf type google.apps.card.v1.Grid

Implements

GridOrBuilder

Static Methods

getDescriptor()

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

Methods

addAllItems(Iterable<? extends Grid.GridItem> values)

public Grid.Builder addAllItems(Iterable<? extends Grid.GridItem> values)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameter
Name Description
values Iterable<? extends com.google.apps.card.v1.Grid.GridItem>
Returns
Type Description
Grid.Builder

addItems(Grid.GridItem value)

public Grid.Builder addItems(Grid.GridItem value)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameter
Name Description
value Grid.GridItem
Returns
Type Description
Grid.Builder

addItems(Grid.GridItem.Builder builderForValue)

public Grid.Builder addItems(Grid.GridItem.Builder builderForValue)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameter
Name Description
builderForValue Grid.GridItem.Builder
Returns
Type Description
Grid.Builder

addItems(int index, Grid.GridItem value)

public Grid.Builder addItems(int index, Grid.GridItem value)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameters
Name Description
index int
value Grid.GridItem
Returns
Type Description
Grid.Builder

addItems(int index, Grid.GridItem.Builder builderForValue)

public Grid.Builder addItems(int index, Grid.GridItem.Builder builderForValue)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameters
Name Description
index int
builderForValue Grid.GridItem.Builder
Returns
Type Description
Grid.Builder

addItemsBuilder()

public Grid.GridItem.Builder addItemsBuilder()

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Returns
Type Description
Grid.GridItem.Builder

addItemsBuilder(int index)

public Grid.GridItem.Builder addItemsBuilder(int index)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameter
Name Description
index int
Returns
Type Description
Grid.GridItem.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Grid.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Grid.Builder
Overrides

build()

public Grid build()
Returns
Type Description
Grid

buildPartial()

public Grid buildPartial()
Returns
Type Description
Grid

clear()

public Grid.Builder clear()
Returns
Type Description
Grid.Builder
Overrides

clearBorderStyle()

public Grid.Builder clearBorderStyle()

The border style to apply to each grid item.

.google.apps.card.v1.BorderStyle border_style = 3;

Returns
Type Description
Grid.Builder

clearColumnCount()

public Grid.Builder clearColumnCount()

The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion).

int32 column_count = 4;

Returns
Type Description
Grid.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public Grid.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
Grid.Builder
Overrides

clearItems()

public Grid.Builder clearItems()

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Returns
Type Description
Grid.Builder

clearOnClick()

public Grid.Builder clearOnClick()

This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters.

.google.apps.card.v1.OnClick on_click = 5;

Returns
Type Description
Grid.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public Grid.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
Grid.Builder
Overrides

clearTitle()

public Grid.Builder clearTitle()

The text that displays in the grid header.

string title = 1;

Returns
Type Description
Grid.Builder

This builder for chaining.

clone()

public Grid.Builder clone()
Returns
Type Description
Grid.Builder
Overrides

getBorderStyle()

public BorderStyle getBorderStyle()

The border style to apply to each grid item.

.google.apps.card.v1.BorderStyle border_style = 3;

Returns
Type Description
BorderStyle

The borderStyle.

getBorderStyleBuilder()

public BorderStyle.Builder getBorderStyleBuilder()

The border style to apply to each grid item.

.google.apps.card.v1.BorderStyle border_style = 3;

Returns
Type Description
BorderStyle.Builder

getBorderStyleOrBuilder()

public BorderStyleOrBuilder getBorderStyleOrBuilder()

The border style to apply to each grid item.

.google.apps.card.v1.BorderStyle border_style = 3;

Returns
Type Description
BorderStyleOrBuilder

getColumnCount()

public int getColumnCount()

The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion).

int32 column_count = 4;

Returns
Type Description
int

The columnCount.

getDefaultInstanceForType()

public Grid getDefaultInstanceForType()
Returns
Type Description
Grid

getDescriptorForType()

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

getItems(int index)

public Grid.GridItem getItems(int index)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameter
Name Description
index int
Returns
Type Description
Grid.GridItem

getItemsBuilder(int index)

public Grid.GridItem.Builder getItemsBuilder(int index)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameter
Name Description
index int
Returns
Type Description
Grid.GridItem.Builder

getItemsBuilderList()

public List<Grid.GridItem.Builder> getItemsBuilderList()

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Returns
Type Description
List<Builder>

getItemsCount()

public int getItemsCount()

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Returns
Type Description
int

getItemsList()

public List<Grid.GridItem> getItemsList()

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Returns
Type Description
List<GridItem>

getItemsOrBuilder(int index)

public Grid.GridItemOrBuilder getItemsOrBuilder(int index)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameter
Name Description
index int
Returns
Type Description
Grid.GridItemOrBuilder

getItemsOrBuilderList()

public List<? extends Grid.GridItemOrBuilder> getItemsOrBuilderList()

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

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

getOnClick()

public OnClick getOnClick()

This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters.

.google.apps.card.v1.OnClick on_click = 5;

Returns
Type Description
OnClick

The onClick.

getOnClickBuilder()

public OnClick.Builder getOnClickBuilder()

This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters.

.google.apps.card.v1.OnClick on_click = 5;

Returns
Type Description
OnClick.Builder

getOnClickOrBuilder()

public OnClickOrBuilder getOnClickOrBuilder()

This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters.

.google.apps.card.v1.OnClick on_click = 5;

Returns
Type Description
OnClickOrBuilder

getTitle()

public String getTitle()

The text that displays in the grid header.

string title = 1;

Returns
Type Description
String

The title.

getTitleBytes()

public ByteString getTitleBytes()

The text that displays in the grid header.

string title = 1;

Returns
Type Description
ByteString

The bytes for title.

hasBorderStyle()

public boolean hasBorderStyle()

The border style to apply to each grid item.

.google.apps.card.v1.BorderStyle border_style = 3;

Returns
Type Description
boolean

Whether the borderStyle field is set.

hasOnClick()

public boolean hasOnClick()

This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters.

.google.apps.card.v1.OnClick on_click = 5;

Returns
Type Description
boolean

Whether the onClick field is set.

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeBorderStyle(BorderStyle value)

public Grid.Builder mergeBorderStyle(BorderStyle value)

The border style to apply to each grid item.

.google.apps.card.v1.BorderStyle border_style = 3;

Parameter
Name Description
value BorderStyle
Returns
Type Description
Grid.Builder

mergeFrom(Grid other)

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

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeOnClick(OnClick value)

public Grid.Builder mergeOnClick(OnClick value)

This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters.

.google.apps.card.v1.OnClick on_click = 5;

Parameter
Name Description
value OnClick
Returns
Type Description
Grid.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Grid.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Grid.Builder
Overrides

removeItems(int index)

public Grid.Builder removeItems(int index)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameter
Name Description
index int
Returns
Type Description
Grid.Builder

setBorderStyle(BorderStyle value)

public Grid.Builder setBorderStyle(BorderStyle value)

The border style to apply to each grid item.

.google.apps.card.v1.BorderStyle border_style = 3;

Parameter
Name Description
value BorderStyle
Returns
Type Description
Grid.Builder

setBorderStyle(BorderStyle.Builder builderForValue)

public Grid.Builder setBorderStyle(BorderStyle.Builder builderForValue)

The border style to apply to each grid item.

.google.apps.card.v1.BorderStyle border_style = 3;

Parameter
Name Description
builderForValue BorderStyle.Builder
Returns
Type Description
Grid.Builder

setColumnCount(int value)

public Grid.Builder setColumnCount(int value)

The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion).

int32 column_count = 4;

Parameter
Name Description
value int

The columnCount to set.

Returns
Type Description
Grid.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public Grid.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Grid.Builder
Overrides

setItems(int index, Grid.GridItem value)

public Grid.Builder setItems(int index, Grid.GridItem value)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameters
Name Description
index int
value Grid.GridItem
Returns
Type Description
Grid.Builder

setItems(int index, Grid.GridItem.Builder builderForValue)

public Grid.Builder setItems(int index, Grid.GridItem.Builder builderForValue)

The items to display in the grid.

repeated .google.apps.card.v1.Grid.GridItem items = 2;

Parameters
Name Description
index int
builderForValue Grid.GridItem.Builder
Returns
Type Description
Grid.Builder

setOnClick(OnClick value)

public Grid.Builder setOnClick(OnClick value)

This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters.

.google.apps.card.v1.OnClick on_click = 5;

Parameter
Name Description
value OnClick
Returns
Type Description
Grid.Builder

setOnClick(OnClick.Builder builderForValue)

public Grid.Builder setOnClick(OnClick.Builder builderForValue)

This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters.

.google.apps.card.v1.OnClick on_click = 5;

Parameter
Name Description
builderForValue OnClick.Builder
Returns
Type Description
Grid.Builder

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public Grid.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
Grid.Builder
Overrides

setTitle(String value)

public Grid.Builder setTitle(String value)

The text that displays in the grid header.

string title = 1;

Parameter
Name Description
value String

The title to set.

Returns
Type Description
Grid.Builder

This builder for chaining.

setTitleBytes(ByteString value)

public Grid.Builder setTitleBytes(ByteString value)

The text that displays in the grid header.

string title = 1;

Parameter
Name Description
value ByteString

The bytes for title to set.

Returns
Type Description
Grid.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final Grid.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Grid.Builder
Overrides