2014-01-07 1 views
4

vaadin 응용 프로그램을 개발 중입니다. 이제 다음 문제를 해결할 수 없습니다.컨테이너에 있거나 생성 된 열로 ID가 있어야합니다.

나는 내 개체 모델이 있습니다

이제
public class MyModel { 

    private long id; 
    private Date dValidoAl; 

    public long getId() { 
     return id; 
    } 

    public void setId(long id) { 
     this.id = id; 
    } 

    public Date getDValidoAl() { 
     return dValidoAl; 
    } 

    public void setDValidoAl(Date dValidoAl) { 
     this.dValidoAl = dValidoAl; 
    } 

} 

나는이 방법으로 BeanItemContainer이 객체를 결합하기 위해 노력하고있어 :

Table table = new Table(); 
BeanItemContainer<MyModel> container = new BeanItemContainer<MyModel>(MyModel.class); 
table.setContainerDataSource(container); 

Object[] visibleProperties = new Object[] { "id", "dValidoAl" }; 
String[] columnsHeader = new String[] { "Id", "Inizio Validità" }; 
table.setVisibleColumns(visibleProperties); 
table.setColumnHeaders(columnsHeader); 

하지만이 오류 얻을 :

Ids must exist in the Container or as a generated column, missing id: dValidoAl

어디에서 잘못 했습니까?

+2

'tableContainer.getContainerPropertyIds()'는 무엇을 반환합니까? 'dValidoAl'가 있습니까? –

+1

tableContainer.getContainerPropertyIds()에서 dValidoAl 대신 DValidoAl가 발견되었고 "DValidoAl"속성의 "dValidoAl"속성이 변경되었습니다. 이제는 모든 것이 작동합니다. 감사합니다 – Skizzo

+0

@Skizzo 해결책으로 답변을 게시하고 수락하십시오! 감사! – Krayo

답변

1

@Skizzo가 게시하고 Book of Vaadin에 정의 된대로 BeanItemContainer (BeanContainer 구현)는 getter 및 setter를 검사하는 PropertyIds로 간주됩니다. 당신이 필요로하는 작업을 할 수있는 용기의 부동산 ID로 DValidoAl 적용이 경우

The item properties are determined automatically by inspecting the getter and setter methods of the class. This requires that the bean class has public visibility, local classes for example are not allowed. Only beans of the same type can be added to the container.

.

관련 문제