如何将 vaadin table 中列的值设置为 link 或按钮?

How can l set the values of a column in vaadin table to link or button?

我需要将列 "anzahl" 中的值转换为链接或按钮,我正在努力处理 vaadin table 的结构。我正在从 mysql table 名称 "SYSTEM"(在实体 class 系统中)获取数据库值。

这是我定义的 table 属性:

private void initSystemTable() {
        JPAContainer<System> systems = new SystemServiceDB().getAllSystems();
        table_system.setSizeFull();
        table_system.setContainerDataSource(systems);
        table_system.setVisibleColumns(new Object[] { "softwarebezeichung", "version", "anzahl", "lizenzen" });
        table_system.setColumnHeader("softwarebezeichung", "Softwarebezeichung");
        table_system.setColumnHeader("version", "Version");
        table_system.setColumnHeader("anzahl", "Anzahl");
        table_system.setColumnHeader("lizenzen", "Vorhandene lizenzen");
        table_system.setImmediate(true);
    }

和class SystemServiceDB:

public class SystemServiceDB implements SystemService{

        @Override
    public JPAContainer<System> getAllSystems()
    {
        JPAContainer<System> systems = JPAContainerFactory.make(System.class, "help-pu");

        return systems; 
    }
}

这是我的输出 table:

我无法使用 addContainerProperty 设置列,因为我从 mysql 加载这些值,我找不到解决这个问题的方法。如果有人能帮我解决这个问题,我将不胜感激。

table_system.addContainerProperty("anzahl", Link.class, null);
table_system.addContainerProperty("anzahl", Button.class, null);

使用生成的列。

这是带有按钮的生成列的示例:

table.addGeneratedColumn("generated", new ColumnGenerator() {

        @Override
        public Component generateCell(Table source,
                    final Object itemId, Object columnId) {
            Button button = new Button("caption");
            //Listener for the button
            button.addClickListener(Event -> {
                //Your code
            });
            return button;
        }          
});