use of com.evolveum.midpoint.web.component.prism.ObjectWrapper in project midpoint by Evolveum.
the class FocusPersonasTabPanel method initLayout.
private void initLayout() {
WebMarkupContainer container = new WebMarkupContainer(ID_PERSONAS_CONTAINER);
container.setOutputMarkupId(true);
add(container);
RepeatingView view = new RepeatingView(ID_PERSONAS_TABLE);
view.setOutputMarkupId(true);
container.add(view);
LoadableModel<List<PrismObject<FocusType>>> personasListModel = loadModel();
if (personasListModel.getObject() == null || personasListModel.getObject().size() == 0) {
WebMarkupContainer viewChild = new WebMarkupContainer(view.newChildId());
viewChild.setOutputMarkupId(true);
view.add(viewChild);
WebMarkupContainer emptyContainer = new WebMarkupContainer(ID_PERSONAS_SUMMARY);
emptyContainer.setOutputMarkupId(true);
viewChild.add(emptyContainer);
return;
}
Task task = pageBase.createSimpleTask(OPERATION_LOAD_PERSONAS);
for (PrismObject<FocusType> personaObject : personasListModel.getObject()) {
ObjectWrapper<FocusType> personaWrapper = ObjectWrapperUtil.createObjectWrapper(WebComponentUtil.getEffectiveName(personaObject, RoleType.F_DISPLAY_NAME), "", personaObject, ContainerStatus.MODIFYING, task, getPageBase());
WebMarkupContainer personaPanel = new WebMarkupContainer(view.newChildId());
personaPanel.setOutputMarkupId(true);
view.add(personaPanel);
if (personaObject.getCompileTimeClass().equals(UserType.class)) {
personaPanel.add(new UserSummaryPanel(ID_PERSONAS_SUMMARY, new Model<ObjectWrapper<UserType>>((ObjectWrapper) personaWrapper)));
} else if (personaObject.getCompileTimeClass().equals(RoleType.class)) {
personaPanel.add(new RoleSummaryPanel(ID_PERSONAS_SUMMARY, new Model<ObjectWrapper<RoleType>>((ObjectWrapper) personaWrapper)));
} else if (personaObject.getCompileTimeClass().equals(OrgType.class)) {
personaPanel.add(new OrgSummaryPanel(ID_PERSONAS_SUMMARY, new Model<ObjectWrapper<OrgType>>((ObjectWrapper) personaWrapper)));
} else if (personaObject.getCompileTimeClass().equals(ServiceType.class)) {
personaPanel.add(new ServiceSummaryPanel(ID_PERSONAS_SUMMARY, new Model<ObjectWrapper<ServiceType>>((ObjectWrapper) personaWrapper)));
}
}
}
Aggregations