我正在开发一个从Vaadin设计师生成UI的项目。我有生成的html和相应的.java文件。
我扩展了java文件并将我的数据绑定到设计视图。显示我的数据的基本代码正在工作,因为表单上的每个字段都有一个相应的pojo变量。现在我想在表单上一起显示两个字段,就像将名字和姓氏结合起来显示全名一样。
我的pojo有一个toString方法,它返回两个值的组合,但我无法弄清楚如何将label propertyNoName设置为aPropertyProfile.toString()的值
public class PropertyProfileDesign extends VerticalLayout
{
private VerticalLayout propertyProfileHeader;
private Label propertyNoName;
private TextField propertyMgr;
private TextField propertyMgrPhone;
private TextField propertyMgrCellular;
private TextField propertyMgrHome;
private TextField regionalMgr;
private TextField regionalMgrPhone;
private TextField regionalMgrCellular;
private TextField regionalMgrHome;
private VerticalLayout propertyProfileBodyFooter;
public PropertyProfileDesign()
{
Design.read( this );
}
public VerticalLayout getPropertyProfileHeader()
{
return propertyProfileHeader;
}
public Label getPropertyNoName()
{
return propertyNoName;
}
public TextField getPropertyMgr()
{
return propertyMgr;
}
public TextField getPropertyMgrPhone()
{
return propertyMgrPhone;
}
public TextField getPropertyMgrCellular()
{
return propertyMgrCellular;
}
public TextField getPropertyMgrHome()
{
return propertyMgrHome;
}
public TextField getRegionalMgr()
{
return regionalMgr;
}
public TextField getRegionalMgrPhone()
{
return regionalMgrPhone;
}
public TextField getRegionalMgrCellular()
{
return regionalMgrCellular;
}
public TextField getRegionalMgrHome()
{
return regionalMgrHome;
}
public VerticalLayout getPropertyProfileBodyFooter()
{
return propertyProfileBodyFooter;
}
}
public class PropertyProfileView extends PropertyProfileDesign
{
private static final long serialVersionUID = 7454308982717559970L;
private Binder<PropertyProfile> binder = new Binder<>( PropertyProfile.class );
public PropertyProfileView()
{
}
public PropertyProfileView( final PropertyProfile aPropertyProfile )
{
this();
binder.bindInstanceFields( this );
binder.readBean( aPropertyProfile );
// How to update the label field propertyNoName with aPropertyProfile.toString()?
}
}