use of org.apache.tapestry5.internal.OptionModelImpl in project tapestry-5 by apache.
the class OptionGroupForm method getModel.
public SelectModel getModel() {
return new AbstractSelectModel() {
private List<OptionGroupModel> groupModels = null;
public List<OptionModel> getOptions() {
return null;
}
public List<OptionGroupModel> getOptionGroups() {
if (groupModels == null) {
computeModel();
}
return groupModels;
}
private void computeModel() {
groupModels = new ArrayList<OptionGroupModel>();
for (Entity entity : entityList) {
List<OptionModel> options = new ArrayList<OptionModel>();
options.add(new OptionModelImpl(entity.getLabel(), entity));
OptionGroupModel groupModel = new OptionGroupModelImpl(entity.getLabel(), false, options);
groupModels.add(groupModel);
}
}
};
}
Aggregations