use of com.evolveum.midpoint.web.component.data.column.ObjectLinkColumn in project midpoint by Evolveum.
the class ResourceContentPanel method initColumns.
private List<IColumn<SelectableBean<ShadowType>, String>> initColumns() {
List<ColumnTypeDto<String>> columnDefs = Arrays.asList(new ColumnTypeDto<>("ShadowType.synchronizationSituation", SelectableBeanImpl.F_VALUE + ".synchronizationSituation", ShadowType.F_SYNCHRONIZATION_SITUATION.getLocalPart()), new ColumnTypeDto<>("ShadowType.intent", SelectableBeanImpl.F_VALUE + ".intent", ShadowType.F_INTENT.getLocalPart()));
List<IColumn<SelectableBean<ShadowType>, String>> columns = new ArrayList<>();
IColumn<SelectableBean<ShadowType>, String> identifiersColumn = new AbstractColumn<>(createStringResource("pageContentAccounts.identifiers")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<ShadowType>>> cellItem, String componentId, IModel<SelectableBean<ShadowType>> rowModel) {
SelectableBean<ShadowType> dto = rowModel.getObject();
RepeatingView repeater = new RepeatingView(componentId);
ShadowType value = dto.getValue();
if (value != null) {
for (ResourceAttribute<?> attr : ShadowUtil.getAllIdentifiers(value)) {
repeater.add(new Label(repeater.newChildId(), attr.getElementName().getLocalPart() + ": " + attr.getRealValue()));
}
}
cellItem.add(repeater);
}
};
columns.add(identifiersColumn);
columns.addAll(ColumnUtils.createColumns(columnDefs));
ObjectLinkColumn<SelectableBean<ShadowType>> ownerColumn = new ObjectLinkColumn<>(createStringResource("pageContentAccounts.owner")) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<FocusType> createLinkModel(final IModel<SelectableBean<ShadowType>> rowModel) {
return new IModel<>() {
private static final long serialVersionUID = 1L;
@Override
public FocusType getObject() {
return loadShadowOwner(rowModel);
}
};
}
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ShadowType>> rowModel, ObjectType targetObjectType) {
ownerDetailsPerformed((FocusType) targetObjectType);
}
};
columns.add(ownerColumn);
columns.add(new AbstractColumn<>(createStringResource("PageAccounts.accounts.pendingOperations")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<ShadowType>>> cellItem, String componentId, IModel<SelectableBean<ShadowType>> rowModel) {
cellItem.add(new PendingOperationPanel(componentId, new PropertyModel<>(rowModel, SelectableBeanImpl.F_VALUE + "." + ShadowType.F_PENDING_OPERATION.getLocalPart())));
}
});
return columns;
}
Aggregations