小编Hir*_*era的帖子

如何在Vaadin 8中有条件地为网格行着色?

我想根据单元格的值更改Vaadin网格行的颜色.我尝试了如下,但没有奏效.

SCSS

@import "mytheme.scss";
@import "addons.scss";

// This file prefixes all rules with the theme name to avoid causing conflicts with other themes.
// The actual styles should be defined in mytheme.scss

.mytheme {
     @include addons;
     @include mytheme;

     .v-grid-row.error_row {
            // Tried following elements and didn't work.
            // background-color: red !important;
            // color: blue !important; // This changed the color of the font.
            background: green !important;
     }
}
Run Code Online (Sandbox Code Playgroud)

Java代码

grid.setStyleGenerator(t -> {
            if (t.getLogLevel().trim().equals(ERROR) || t.getLogLevel().trim().equals(WARN)) {
                return "error_row";
            } …
Run Code Online (Sandbox Code Playgroud)

java sass vaadin vaadin-grid vaadin8

12
推荐指数
1
解决办法
5433
查看次数

如何在Java中的finally块中处理抛出异常

在Java中,不建议finallytry-chatch块的section中抛出异常,因为它会隐藏任何throwabletryor catch块中抛出的未处理的传播。blocker根据默认的声纳配置文件,此做法违反了液位。

声纳错误:从此finally块中删除此throw语句。

请考虑以下代码段。

例如:在finally块内关闭输入流,并在关闭流时处理可能的异常。

    public void upload(File file) {
        ChannelSftp c = (ChannelSftp) channel;
        BufferedInputStream bis = new BufferedInputStream(file.toInputStream());
        try {
            String uploadLocation = Files.simplifyPath(this.fileLocation + "/" + file.getName());
            c.put(bis, uploadLocation);
        } catch (SftpException e) {
            throw new IllegalTargetException("Error occurred while uploading " + e.getMessage());
        } finally {
            try {
                bis.close();
            } catch (IOException e) {
                throw new UnsupportedOperationException("Exception occurred while closing Input stream " + e.getMessage());
            } …
Run Code Online (Sandbox Code Playgroud)

java try-catch try-catch-finally try-finally sonarqube

5
推荐指数
1
解决办法
4044
查看次数

如何将对象列表设置为Vaadin 8组合框

我想将复杂对象列表集成到Vaadin组合框中.我尝试了如下,只显示垃圾值(toString()值).但我想知道如何设置应在下拉列表中显示的特定属性.

在此输入图像描述

下面的类对象应该在组合框中呈现.

public class TestExecution {
private String name;
private String startingTime;
private String endingTime;
private String status;

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getStartingTime() {
    return startingTime;
}

public void setStartingTime(String startingTime) {
    this.startingTime = startingTime;
}

public String getEndingTime() {
    return endingTime;
}

public void setEndingTime(String endingTime) {
    this.endingTime = endingTime;
}

public String getStatus() {
    return status;
}

public void setStatus(String status) {
    this.status = …
Run Code Online (Sandbox Code Playgroud)

java vaadin vaadin8

5
推荐指数
1
解决办法
1520
查看次数