我正在尝试在CssLayout中添加不同的标签,标签没有采用设定的保证金。 这是我写的:
private Component productSettingsLabel = new Label();
CssLayout layoutRight = new CssLayout() {
@Override
protected String getCss(Component c) {
return "margin-top: 8px; margin-left: 8px";
}
}
layoutRight.addComponent(productSettingsLabel);
productSettingsLabel.setCaption("Product settings");
标签上未应用指定的边距。
这是我用firebug检查添加的文本时得到的结果:
<div class="v-caption v-caption-searcher-title">
<div class="v-captiontext">Product settings</div>
<div class="v-caption-clearelem"></div>
</div>
标签下方显示一条空白水平线,其检查结果如下:
<div class="v-label v-label-searcher-title
searcher-title" style="margin-top: 8px; margin-left: 8px; width: 434px;">
</div>
因此标题与标签分开。由于标题不被视为“组件”(在覆盖的getCss()方法中),因此未应用该样式。
我希望我能提供所有细节。
答案 0 :(得分:1)
将ID SDATE
----------- -----------------------
1 2016-04-13 14:54:18.983
1 2016-04-08 12:55:47.907
2 2016-04-13 14:54:18.983
3 2016-04-13 14:54:18.983
4 2016-04-13 14:54:18.983
5 2016-04-11 12:55:47.907
6 2016-04-13 14:54:18.983
添加到您的样式中。
WITH tt AS (
SELECT 1 as ID, GETDATE() as SDATE
UNION ALL
SELECT 1 as ID, '2016-04-09 12:55:47.907' as SDATE
UNION ALL
SELECT 2 as ID, GETDATE() as SDATE
UNION ALL
SELECT 3 as ID, GETDATE() as SDATE
UNION ALL
SELECT 4 as ID, GETDATE() as SDATE
UNION ALL
SELECT 5 as ID, GETDATE() as SDATE
UNION ALL
SELECT 5 as ID, '2016-04-11 12:55:47.907' as SDATE
UNION ALL
SELECT 6 as ID, GETDATE() as SDATE
UNION ALL
SELECT 6 as ID, GETDATE() as SDATE
)
SELECT MIN(SDATE) as SDATE, ID FROM tt as tbl
GROUP BY ID, DATEADD(HH, DATEDIFF(HH,0,SDATE) + 96,0)
display: inline-block;
的示例:
private Component productSettingsLabel = new Label();
CssLayout layoutRight = new CssLayout() {
@Override
protected String getCss(Component c) {
return "display: inline-block; margin-top: 8px; margin-left: 8px";
}
}
layoutRight.addComponent(productSettingsLabel);
productSettingsLabel.setCaption("Product settings");
&#13;
display: inline-block
&#13;