Class Grid.Builder (0.1.0)

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 Grid.

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
TypeDescription
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
NameDescription
valuesIterable<? extends com.google.apps.card.v1.Grid.GridItem>
Returns
TypeDescription
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
NameDescription
valueGrid.GridItem
Returns
TypeDescription
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
NameDescription
builderForValueGrid.GridItem.Builder
Returns
TypeDescription
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
NameDescription
indexint
valueGrid.GridItem
Returns
TypeDescription
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
NameDescription
indexint
builderForValueGrid.GridItem.Builder
Returns
TypeDescription
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
TypeDescription
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
NameDescription
indexint
Returns
TypeDescription
Grid.GridItem.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Grid.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
Grid.Builder
Overrides

build()

public Grid build()
Returns
TypeDescription
Grid

buildPartial()

public Grid buildPartial()
Returns
TypeDescription
Grid

clear()

public Grid.Builder clear()
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
Grid.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public Grid.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
Grid.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public Grid.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
Grid.Builder
Overrides

clearTitle()

public Grid.Builder clearTitle()

The text that displays in the grid header.

string title = 1;

Returns
TypeDescription
Grid.Builder

This builder for chaining.

clone()

public Grid.Builder clone()
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
BorderStyle.Builder

getBorderStyleOrBuilder()

public BorderStyleOrBuilder getBorderStyleOrBuilder()

The border style to apply to each grid item.

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

Returns
TypeDescription
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
TypeDescription
int

The columnCount.

getDefaultInstanceForType()

public Grid getDefaultInstanceForType()
Returns
TypeDescription
Grid

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
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
NameDescription
indexint
Returns
TypeDescription
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
NameDescription
indexint
Returns
TypeDescription
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
TypeDescription
List<Builder>

getItemsCount()

public int getItemsCount()

The items to display in the grid.

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

Returns
TypeDescription
int

getItemsList()

public List<Grid.GridItem> getItemsList()

The items to display in the grid.

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

Returns
TypeDescription
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
NameDescription
indexint
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
OnClickOrBuilder

getTitle()

public String getTitle()

The text that displays in the grid header.

string title = 1;

Returns
TypeDescription
String

The title.

getTitleBytes()

public ByteString getTitleBytes()

The text that displays in the grid header.

string title = 1;

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
boolean

Whether the onClick field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
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
NameDescription
valueBorderStyle
Returns
TypeDescription
Grid.Builder

mergeFrom(Grid other)

public Grid.Builder mergeFrom(Grid other)
Parameter
NameDescription
otherGrid
Returns
TypeDescription
Grid.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Grid.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Grid.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public Grid.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
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
NameDescription
valueOnClick
Returns
TypeDescription
Grid.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Grid.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
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
NameDescription
indexint
Returns
TypeDescription
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
NameDescription
valueBorderStyle
Returns
TypeDescription
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
NameDescription
builderForValueBorderStyle.Builder
Returns
TypeDescription
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
NameDescription
valueint

The columnCount to set.

Returns
TypeDescription
Grid.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public Grid.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
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
NameDescription
indexint
valueGrid.GridItem
Returns
TypeDescription
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
NameDescription
indexint
builderForValueGrid.GridItem.Builder
Returns
TypeDescription
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
NameDescription
valueOnClick
Returns
TypeDescription
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
NameDescription
builderForValueOnClick.Builder
Returns
TypeDescription
Grid.Builder

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

public Grid.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
Grid.Builder
Overrides

setTitle(String value)

public Grid.Builder setTitle(String value)

The text that displays in the grid header.

string title = 1;

Parameter
NameDescription
valueString

The title to set.

Returns
TypeDescription
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
NameDescription
valueByteString

The bytes for title to set.

Returns
TypeDescription
Grid.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final Grid.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
Grid.Builder
Overrides