DropDownChoiceに問題があります。次のような学校のタイトルのリストを含む列挙型があります。
public enum StudyTitle {
NONE(null,null),ELEMENTARY("1","Elementary"),COLLEGE("2","College");
private String code;
private String description;
private StudyTitle(String code, String description){
setCode(code);
setDescription(description);
}
[setter and getter]
}
次に、コードを配置したい文字列プロパティ呼び出し「studyTitleCode」を持つPojoがあります(たとえば、小学校の場合は1、大学の場合は2など)。
DropDownChoice Wicketを作成すると、DropDownChoiceがStudyTitle型の場合、String型のプロパティモデルを使用できません。
元。[列挙型のArrayListとしてlistOfStudyTitleを構築する]
DropDownChoice<String> studyLevel = new DropDownChoice<String>("id",new PropertyModel<String>(myPojo,"studyTitleCode"),listOfStudyTitle,new ChoiceRenderer<StudyTitle>("description","code"));
Wicketが列挙型の1つのプロパティをモデルのプロパティにリンクできるようにする方法はありますか?
ありがとう