[英]How to set value for a progressbar in groovy?
I am using a vaadin progressbar in groovy. 我在Groovy中使用vaadin进度栏。 I have a variables Total = 10, Right =5, left =3, I need to show Left=Total-(right+left), and visualize it in the progressbar.All are integer value.
我有一个变量Total = 10,Right = 5,left = 3,我需要显示Left = Total-(right + left),并在进度栏中显示它。它们都是整数值。 In my code in am using a propertydatasource.
在我的代码中,我使用了propertydatasource。 How can i use these values and load into the progressabr.
我如何使用这些值并将其加载到Progressabr中。 Please help.
请帮忙。 I am using vaadin 7.6.3.
我正在使用vaadin 7.6.3。
Progressbar defining: 进度栏定义:
private final ProgressBar _progress;
public View() {
_progress = new ProgressBar();
_progress.setWidth("100%");
_Layout.addComponents(_progress); // here Layout is horizontal layout
fewcodes are missing which are not related.
}
public ProgressBar get_progress() {
return _progress;
}
In an another java class i am trying to set the progressbar data using the 'setPropertyDataSource' here '_view' is my Ui where i am trying to load. 在另一个Java类中,我尝试使用“ setPropertyDataSource”设置进度条数据,这里“ _view”是我要加载的Ui。
_view.get_progress().setPropertyDataSource(_equipmentItem.getItemProperty(Equipment.Total));
Did you follow the examples from the docs? 您是否遵循了文档中的示例? See here .
看这里 。 Basically you can call
setValue
within range 0.0f to 1.0f (see javadoc ) where 0.0f is no progress and 1.0f is full progress. 基本上,您可以在0.0f到1.0f的范围内调用
setValue
(请参阅javadoc ),其中0.0f是没有进度,而1.0f是完整进度。 That means you can use current / (float)max
formular to calculate your progress value. 这意味着您可以使用
current / (float)max
公式来计算进度值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.