Class Grid.Builder

  • All Implemented Interfaces:
    GridOrBuilder, com.google.protobuf.GeneratedMessage.ExtendableMessageOrBuilder<com.google.protobuf.GeneratedMessageV3>, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.lang.Cloneable
    Enclosing class:
    Grid

    public static final class Grid.Builder
    extends com.google.protobuf.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`][google.apps.card.v1.Columns]. For an example in Google Chat apps,
     see [Display a Grid with a collection of
     items](https://developers.google.com/workspace/chat/format-structure-card-dialog#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](https://developers.google.com/workspace/extend):
    
     For example, the following JSON creates a 2 column grid with a single
     item:
    
     ```
     "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"
         }
       }
     }
     ```
     
    Protobuf type google.apps.card.v1.Grid
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Overrides:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>
      • clear

        public Grid.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessage.Builder<Grid.Builder>
      • getDefaultInstanceForType

        public Grid getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.GeneratedMessage.ExtendableMessageOrBuilder<com.google.protobuf.GeneratedMessageV3>
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public Grid build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public Grid buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public Grid.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>
      • setField

        public Grid.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                     java.lang.Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>
      • clearField

        public Grid.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>
      • clearOneof

        public Grid.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>
      • setRepeatedField

        public Grid.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                             int index,
                                             java.lang.Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>
      • addRepeatedField

        public Grid.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                             java.lang.Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>
      • mergeFrom

        public Grid.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<Grid.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessage.ExtendableBuilder<com.google.protobuf.GeneratedMessageV3,​Grid.Builder>
      • mergeFrom

        public Grid.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                               throws java.io.IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<Grid.Builder>
        Throws:
        java.io.IOException
      • getTitle

        public java.lang.String getTitle()
         The text that displays in the grid header.
         
        string title = 1;
        Specified by:
        getTitle in interface GridOrBuilder
        Returns:
        The title.
      • getTitleBytes

        public com.google.protobuf.ByteString getTitleBytes()
         The text that displays in the grid header.
         
        string title = 1;
        Specified by:
        getTitleBytes in interface GridOrBuilder
        Returns:
        The bytes for title.
      • setTitle

        public Grid.Builder setTitle​(java.lang.String value)
         The text that displays in the grid header.
         
        string title = 1;
        Parameters:
        value - The title to set.
        Returns:
        This builder for chaining.
      • clearTitle

        public Grid.Builder clearTitle()
         The text that displays in the grid header.
         
        string title = 1;
        Returns:
        This builder for chaining.
      • setTitleBytes

        public Grid.Builder setTitleBytes​(com.google.protobuf.ByteString value)
         The text that displays in the grid header.
         
        string title = 1;
        Parameters:
        value - The bytes for title to set.
        Returns:
        This builder for chaining.
      • getItemsList

        public java.util.List<Grid.GridItem> getItemsList()
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
        Specified by:
        getItemsList in interface GridOrBuilder
      • getItemsCount

        public int getItemsCount()
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
        Specified by:
        getItemsCount in interface GridOrBuilder
      • getItems

        public Grid.GridItem getItems​(int index)
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
        Specified by:
        getItems in interface GridOrBuilder
      • setItems

        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;
      • setItems

        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;
      • addItems

        public Grid.Builder addItems​(Grid.GridItem value)
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
      • addItems

        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;
      • addItems

        public Grid.Builder addItems​(Grid.GridItem.Builder builderForValue)
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
      • addItems

        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;
      • addAllItems

        public Grid.Builder addAllItems​(java.lang.Iterable<? extends Grid.GridItem> values)
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
      • clearItems

        public Grid.Builder clearItems()
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
      • removeItems

        public Grid.Builder removeItems​(int index)
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
      • getItemsBuilder

        public Grid.GridItem.Builder getItemsBuilder​(int index)
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
      • addItemsBuilder

        public Grid.GridItem.Builder addItemsBuilder()
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
      • addItemsBuilder

        public Grid.GridItem.Builder addItemsBuilder​(int index)
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
      • getItemsBuilderList

        public java.util.List<Grid.GridItem.Builder> getItemsBuilderList()
         The items to display in the grid.
         
        repeated .google.apps.card.v1.Grid.GridItem items = 2;
      • hasBorderStyle

        public boolean hasBorderStyle()
         The border style to apply to each grid item.
         
        .google.apps.card.v1.BorderStyle border_style = 3;
        Specified by:
        hasBorderStyle in interface GridOrBuilder
        Returns:
        Whether the borderStyle field is set.
      • getBorderStyle

        public BorderStyle getBorderStyle()
         The border style to apply to each grid item.
         
        .google.apps.card.v1.BorderStyle border_style = 3;
        Specified by:
        getBorderStyle in interface GridOrBuilder
        Returns:
        The borderStyle.
      • setBorderStyle

        public Grid.Builder setBorderStyle​(BorderStyle value)
         The border style to apply to each grid item.
         
        .google.apps.card.v1.BorderStyle border_style = 3;
      • setBorderStyle

        public Grid.Builder setBorderStyle​(BorderStyle.Builder builderForValue)
         The border style to apply to each grid item.
         
        .google.apps.card.v1.BorderStyle border_style = 3;
      • mergeBorderStyle

        public Grid.Builder mergeBorderStyle​(BorderStyle value)
         The border style to apply to each grid item.
         
        .google.apps.card.v1.BorderStyle border_style = 3;
      • clearBorderStyle

        public Grid.Builder clearBorderStyle()
         The border style to apply to each grid item.
         
        .google.apps.card.v1.BorderStyle border_style = 3;
      • getBorderStyleBuilder

        public BorderStyle.Builder getBorderStyleBuilder()
         The border style to apply to each grid item.
         
        .google.apps.card.v1.BorderStyle border_style = 3;
      • 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;
        Specified by:
        getColumnCount in interface GridOrBuilder
        Returns:
        The columnCount.
      • setColumnCount

        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;
        Parameters:
        value - The columnCount to set.
        Returns:
        This builder for chaining.
      • 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:
        This builder for chaining.
      • 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;
        Specified by:
        hasOnClick in interface GridOrBuilder
        Returns:
        Whether the onClick field is set.
      • 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;
        Specified by:
        getOnClick in interface GridOrBuilder
        Returns:
        The onClick.
      • setOnClick

        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;
      • setOnClick

        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;
      • mergeOnClick

        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;
      • 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;
      • 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;
      • 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;
        Specified by:
        getOnClickOrBuilder in interface GridOrBuilder
      • setUnknownFields

        public final Grid.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>
      • mergeUnknownFields

        public final Grid.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Grid.Builder>