How to access a table whose layout is set as composite root?

I have got a question regarding a table’s accessibility from within a View. I have got an application that I write merely for learning Vaadin - I added a Gridlayout which has various components to a composition root, among them there is a table.

After the table is added to the layout (which is set as composite root) - is there any possibility of accessing the composite root’s table in order to modify it? For example if - by my tableModifierMethod - I want to modify the table, is there a way of accessing it?

...

public class ChatView extends CustomComponent implements View{
    
...


        setCompositionRoot(createChatLayout());
        

    }
    

   private void tableModifierMethod(){
        ...
}
 
    @SuppressWarnings({ "deprecation", "unchecked" })
    private GridLayout createChatLayout(){
        
        final GridLayout gridlayout = new GridLayout(3, 3);
        gridlayout.addStyleName(ThemeStyle.Chatgridlayout);
        gridlayout.setMargin(true);
    
        
        VerticalLayout layout = new VerticalLayout();
                         
        final Table mainchat = new Table();
              mainchat.setSelectable(true);
              mainchat.setImmediate(true);
              mainchat.setNullSelectionAllowed(false);
          
...                     
            layout.addComponent(mainchat);
            

    
    @Override
enter(){
...
}
 
}

All layouts have methods for accessing their children. GridLayout specifically has
getComponent(x, y)
that you can use to retrieve the component at the specified coordinate. You’ll have to cast it yourself, though. Usually the better way is to simply retain a reference to the table as a member field in your view:

public class ChatView extends CustomComponent implements View {
    private Table mainchat;
    ...
    private GridLayout createChatLayout() {
        ...
        mainchat = new Table();
        ...
    }
}

Thank You - I just picked my component out of the gridlayout with the getComponent()-method, and then I was able to play around with it.