标签: vaadin

如何在 Vaadin Flow 中显示不确定的微调进度条?

ProgressBar下面是在 Vaadin Flow(版本 23)中显示不确定的代码:

ProgressBar spinner = new ProgressBar();
spinner.setIndeterminate(true);
spinner.setVisible(true);
Run Code Online (Sandbox Code Playgroud)

唯一的事情是,这现在似乎创建了一个ProgressBar来回的东西,我想知道是否可以将其显示为圆形。我可以通过加载图标、动画 GIF 等来做到这一点,但是可以通过类来实现吗ProgressBar

java vaadin vaadin-flow vaadin14 vaadin23

0
推荐指数
1
解决办法
382
查看次数

无法设置@Theme vaadin

我对 vaadin 还很陌生。我正在尝试使用徽章。当我将其添加@Theme到我的班级时:

@PageTitle("Technology")
@Route(value = "")
@Theme("common-theme")
public class TechnologyLayout extends VerticalLayout {
    ...
    var tmp = new Span(new Span(label.getName()));
    tmp.getElement().getThemeList().add("badge");
    ....
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165) ~[spring-boot-2.7.4.jar:2.7.4]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.23.jar:5.3.23]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.4.jar:2.7.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.4.jar:2.7.4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.4.jar:2.7.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.4.jar:2.7.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.4.jar:2.7.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.4.jar:2.7.4]
at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:577) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.7.4.jar:2.7.4]

Caused by: …
Run Code Online (Sandbox Code Playgroud)

java vaadin badge

0
推荐指数
1
解决办法
132
查看次数

Hilla 类型“Promise<void>”缺少类型中的以下属性

尝试在 hilla(vaadin) 中创建一个应用程序,它将列出产品及其详细信息。为了对产品进行分类,需要存储与类别相关的信息,但在尝试在 hilla/vaadin 网格中列出类别时面临的问题。从端点返回类别列表,并在商店中消耗该列表并尝试在网格中显示。尝试运行应用程序时出现错误“

Type 'Promise<void>' is missing the following properties from type
Run Code Online (Sandbox Code Playgroud)

@Nonnull 是在列表的响应中指定的,并且在方法中仍然出现错误

下面是端点类

@Endpoint
@AnonymousAllowed
public class ProductEndpoint {

    private InterProductService productService;

    @Autowired
    public ProductEndpoint(InterProductService productService) {
        this.productService = productService;
    }

    public List<ProductDataList> fetchAllProducts() {
        return this.productService.fetchProducts("");
    }

    public @Nonnull List<@Nonnull ProductCategoryDataList> fetchAllProdCategory() {
        return this.productService.fetchProductCategory("");
    }

    @Nonnull
    public EndpointResponse saveCatgeory(@Nonnull CategoryDetails categoryDetails) {
        return this.productService.saveCategory(categoryDetails);
    }

}
Run Code Online (Sandbox Code Playgroud)

下面是商店

export class ProductStore {
    constructor() {
        makeAutoObservable(
            this);
        this.fetchProductCatgeory();
    }

    async saveProductCategory(prodCategory: CategoryDetails) {
        const responseData …
Run Code Online (Sandbox Code Playgroud)

java vaadin spring-boot vaadin-flow hilla

0
推荐指数
1
解决办法
98
查看次数

根据相应的整数值对 String 类型的 Grid 列中的行进行排序

我有以下网格结构,并想知道如何根据字符串的整数值对列进行排序。数据提供者无法灵活更改,因此我必须通过某种中间步骤进行排序:

Grid<String[]> grid = new Grid<>();
...

grid.addColumn(str -> str[columnIndex]).setHeader("sample").setKey("integercolumn").setSortable(true);

...

GridSortOrder<String> order = new GridSortOrder<>(grid.getColumnByKey("integercolumn"), SortDirection.DESCENDING);

grid.sort(Arrays.asList(order));

Run Code Online (Sandbox Code Playgroud)

这可以正确排序两位数字,但不能对一位或 3+ 数字进行排序。

vaadin vaadin-grid

0
推荐指数
1
解决办法
209
查看次数

Spring beans 没有被注入到 Vaadin 视图中

我已经下载了 Vaadin Flow 启动器并尝试使用它,但由于某种原因,bean 没有被注入:

@PageTitle("About")
@Route(value = "about", layout = MainLayout.class)
public class AboutView extends VerticalLayout {
    
    @Autowired
    private UserService userService;
    
    public AboutView() {
        ...
    }
}
Run Code Online (Sandbox Code Playgroud)

userService 仍然为空。

我仍然可以通过构造函数传递 bean:

@PageTitle("About")
@Route(value = "about", layout = MainLayout.class)
public class AboutView extends VerticalLayout {
    public AboutView(UserService userService) {
        ...
    } 
}
Run Code Online (Sandbox Code Playgroud)

但这并不总是很方便。

我在同一个项目中创建了一个 REST 服务,即使没有注释,注入也能正常工作:

@RestController
@AllArgsConstructor
@RequestMapping("user")
public class UserController {

    private UserService userService;    
    ...
}
Run Code Online (Sandbox Code Playgroud)

Vaadin Flow 有什么问题?我正在使用 Vaadin Flow 24.0.0.alpha8、SpringBoot 3.0.1 和 Java 19。

PS顺便说一下,我也尝试过 Vaadin …

vaadin spring-boot vaadin-flow

0
推荐指数
1
解决办法
202
查看次数

允许 Vaadin Flow 工具提示中的换行符

换行符和 Vaadin Flow 工具提示已公开讨论,但仍然缺少推荐的解决方案(例如https://vaadin.com/forum/thread/17952864/tooltip-with-line-break-in-vaadin;结论是“这确实不行”)

关于工具提示组件的官方文档不包含任何提示。

有什么建议或已知的解决方法吗?

丹尼尔,为该要求提供任何帮助干杯

我还在工具提示上尝试了一些 vaadin 23。 在此输入图像描述

所有有希望的方法都没有奏效。 在此输入图像描述

vaadin vaadin-flow

0
推荐指数
1
解决办法
351
查看次数

选择元素的设置值未显示在 UI 中

我正在使用 vaadin select 来显示带有状态的选择菜单。

private Select<States> states = new Select<>();
Run Code Online (Sandbox Code Playgroud)
states.setLabel("State");
states.setItems(facade.stateService().findAllStates());
states.setItemLabelGenerator(States::getName);
Run Code Online (Sandbox Code Playgroud)
Optional<States> state = facade.stateService().findByCode(location.getLocationState());
if (state.isPresent()) {
    states.setValue(state.get());    // this is not working
}
Run Code Online (Sandbox Code Playgroud)

我正在获取状态值并使用它进行设置,states.setValue()但选择不显示更新的状态。该方法正在被调用。如何使选择的菜单被选中?谢谢。

html java vaadin

0
推荐指数
1
解决办法
101
查看次数

Quarkus 和 Vaadin v24.xx 升级

将 quarkus 和 vaadin 版本从 v23.xx 升级到 vaadin 版本 24.xx 时,出现错误:

cannot access jakarta.servlet.http.HttpServletRequestWrapper
Run Code Online (Sandbox Code Playgroud)

有人知道如何解决这个问题吗?

Quarkus 版本 2.16.5.Final

vaadin quarkus vaadin24

0
推荐指数
1
解决办法
112
查看次数

Vaadin 和 Apache Netbeans 12

我是 Vaadin 的新手,我正在尝试运行快速入门教程中的演示项目。我正在使用 Netbeans 12.0,当尝试运行该项目时,我会看到一个带有“选择要执行的主类”的窗口,并且没有可供选择的类。

我已经看到 Netbeans 8.2 有一个 Vaadin 插件,但我找不到 12.0 版本的它

我缺少什么?

亲切的问候,

拉法

vaadin netbeans-12

0
推荐指数
1
解决办法
62
查看次数

当前的 Vaadin LTS 版本是什么?

我的项目有一个错误。目前使用 v18.0.3。当我在另一个线程中提出问题时,有人提到我最好升级到 v21,因为那是 LTS 版本。我还记得收到过新闻信件,指出 v21 应该是 LTS 版本。

如果我今天查看 Vaadin 路线图 ( https://vaadin.com/roadmap ),没有任何文字表明 v21 是 LTS 版本。

相反,v14 被称为最后一个 LTS,而 v23 显然将成为下一个 LTS 版本。计划有变吗?

vaadin

-1
推荐指数
1
解决办法
180
查看次数