Class Grid (2.43.0)

public final class Grid extends GeneratedMessageV3 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 Fields

BORDER_STYLE_FIELD_NUMBER

public static final int BORDER_STYLE_FIELD_NUMBER
Field Value
Type Description
int

COLUMN_COUNT_FIELD_NUMBER

public static final int COLUMN_COUNT_FIELD_NUMBER
Field Value
Type Description
int

ITEMS_FIELD_NUMBER

public static final int ITEMS_FIELD_NUMBER
Field Value
Type Description
int

ON_CLICK_FIELD_NUMBER

public static final int ON_CLICK_FIELD_NUMBER
Field Value
Type Description
int

TITLE_FIELD_NUMBER

public static final int TITLE_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static Grid getDefaultInstance()
Returns
Type Description
Grid

getDescriptor()

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

newBuilder()

public static Grid.Builder newBuilder()
Returns
Type Description
Grid.Builder

newBuilder(Grid prototype)

public static Grid.Builder newBuilder(Grid prototype)
Parameter
Name Description
prototype Grid
Returns
Type Description
Grid.Builder

parseDelimitedFrom(InputStream input)

public static Grid parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Grid
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Grid parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Grid
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static Grid parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
Grid
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Grid parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Grid
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Grid parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
Grid
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Grid parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Grid
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Grid parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Grid
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Grid parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Grid
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static Grid parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Grid
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Grid parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Grid
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static Grid parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Grid
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Grid parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Grid
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<Grid> parser()
Returns
Type Description
Parser<Grid>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
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.

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

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

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.

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

getParserForType()

public Parser<Grid> getParserForType()
Returns
Type Description
Parser<Grid>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

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.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public Grid.Builder newBuilderForType()
Returns
Type Description
Grid.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Grid.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Grid.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public Grid.Builder toBuilder()
Returns
Type Description
Grid.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException