本文介绍了Vaadin 7 将按钮添加到 Accordion com.vaadin.ui.TabSheet.Tab 标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将 Vaadin 7 中的按钮添加到 Accordion com.vaadin.ui.TabSheet.Tab 标题?

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

现在我只能在 Tab 标题中添加一个字符串.

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

这是我当前的屏幕:

我需要在 General 和 Julia Group 选项卡标题附近添加相同的 Edit/Remove 图标(就像我在 Live Chat 和 WMA 中所做的那样).

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.

推荐答案

很遗憾,这是不可能的.

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
    }
}

另一种选择是创建一个扩展 通过使用 GWT 或 Javascript 并在客户端修改 DOM,以便在选项卡标题上有两个按钮.

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.

这篇关于Vaadin 7 将按钮添加到 Accordion com.vaadin.ui.TabSheet.Tab 标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 21:02