vaadin中的样式列表选择 [英] Styling ListSelect in vaadin

查看:82
本文介绍了vaadin中的样式列表选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助Vaadin设置ListSelect的样式,是否可以设置它以选择列表中的第一项?是否可以将其设置为物品的高度?我需要设置每个项目的大小,因为该列表将用于触摸屏显示.

Please help to Styling ListSelect in Vaadin, Is it possible to set it up for choosing the first item at the list? Is it possible to set it up the height of the item? I need to set up the size of each items since the list will be use for touch display.

谢谢

推荐答案

是否可以将其设置为物品的高度?

Is it possible to set it up the height of the item?

是的. ListSelect可以很好地适应其字体大小,因此您可以例如在您的Java代码中是这样的:

Kind of yes. ListSelect adapts to its font size somewhat nicely, so you could do e.g. like this in your Java code:

ListSelect select = new ListSelect();
...
select.setStyleName("my-select");

然后在您的主题中定义不同的字体样式,例如

And then in your theme define different font styling, e.g.

.my-select {
    font: 300 12px "Open Sans", sans-serif;
}

是否可以设置它以选择列表中的第一项?

Is it possible to set it up for choosing the first item at the list?

listSelect.setValue(item)或listSelect.select(item)以编程方式选择项目.

listSelect.setValue(item) or listSelect.select(item) programmatically selects the item.

如果您不知道哪个是第一项,则可以例如使用

If you do not know which is the first item, you could e.g. use

item = listSelect.getDataCommunicator().fetchItemsWithRange(0,1);

获得第一项

这篇关于vaadin中的样式列表选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆