Search code examples
vaadinvaadin7

Vaadin 7 add buttons into Accordion com.vaadin.ui.TabSheet.Tab caption


Is it possible to add a buttons in Vaadin 7 to Accordion com.vaadin.ui.TabSheet.Tab caption ?

Right now I can only add a String into Tab caption.

This is my current screen:

enter image description here

I need to add the same Edit/Remove icons(as I have for Live Chat and WMA) near the General and Julia Group tab captions.


Solution

  • Unfortunately it's not possible.

    You could create a server-side composition, which behaves like Accordion but then you could design the component so that you can add buttons to tab captions. You could start with something like this:

    public class MyAccordion extends CustomComponent {
    
        public MyAccordion() {
    
            VerticalLayout layout = new VerticalLayout();
            setCompositionRoot(layout);
            // TODO layout should contain all tabs and tab captions
        }
    }
    

    Another option would be to create an extension by using GWT or Javascript and on the client-side modify DOM so that there a two buttons on tab captions.