Sass 如何在Vaadin网格布局中设置单个插槽的样式?

Sass 如何在Vaadin网格布局中设置单个插槽的样式?,sass,vaadin,vaadin-grid,Sass,Vaadin,Vaadin Grid,我想在GridLayout中的一些插槽上有一个边框。 如果我在插槽中的元素上设置了边框(借助样式名),则不会一直绘制边框 如何访问封闭的gridlayout插槽,以便每个其他插槽都有一个边框?我建议您在gridlayout中放置一个CssLayout,样式如下: final GridLayout gridLayout = new GridLayout(2, 2); // the size of the grid layout has to be defined, otherwise you ca

我想在GridLayout中的一些插槽上有一个边框。 如果我在插槽中的元素上设置了边框(借助样式名),则不会一直绘制边框


如何访问封闭的gridlayout插槽,以便每个其他插槽都有一个边框?

我建议您在gridlayout中放置一个CssLayout,样式如下:

final GridLayout gridLayout = new GridLayout(2, 2);
// the size of the grid layout has to be defined, otherwise you can't place a relatively sized component inside it
gridLayout.setHeight("400px"); // example height
gridLayout.setWidth("100%"); // example width

final CssLayout border = new CssLayout();
border.setStyleName("myCellStyle");
// make the layout fill the whole slot
border.setSizeFull();
// wrap your content with that border layout
border.addComponent(new Label("forth"));
gridLayout.addComponents(
            new Label("first"), 
            new Label("second"),
            new Label("third"),
            border);
在mytheme.scs中,写下您的边框样式:

.myCellStyle {
  border: 10px solid red;
}

我建议您在GridLayout中放置一个CssLayout,样式如下:

final GridLayout gridLayout = new GridLayout(2, 2);
// the size of the grid layout has to be defined, otherwise you can't place a relatively sized component inside it
gridLayout.setHeight("400px"); // example height
gridLayout.setWidth("100%"); // example width

final CssLayout border = new CssLayout();
border.setStyleName("myCellStyle");
// make the layout fill the whole slot
border.setSizeFull();
// wrap your content with that border layout
border.addComponent(new Label("forth"));
gridLayout.addComponents(
            new Label("first"), 
            new Label("second"),
            new Label("third"),
            border);
在mytheme.scs中,写下您的边框样式:

.myCellStyle {
  border: 10px solid red;
}