use of org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator in project midpoint by Evolveum.
the class LoggingConfigurationTabPanel method initAppendersBasicColumns.
private List<IColumn<PrismContainerValueWrapper<AppenderConfigurationType>, String>> initAppendersBasicColumns(IModel<PrismContainerWrapper<AppenderConfigurationType>> appenderModel) {
List<IColumn<PrismContainerValueWrapper<AppenderConfigurationType>, String>> columns = new ArrayList<>();
columns.add(new CheckBoxHeaderColumn<>());
columns.add(new IconColumn<PrismContainerValueWrapper<AppenderConfigurationType>>(Model.of("")) {
private static final long serialVersionUID = 1L;
@Override
protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<AppenderConfigurationType>> rowModel) {
return GuiDisplayTypeUtil.createDisplayType(WebComponentUtil.createDefaultBlackIcon(SystemConfigurationType.COMPLEX_TYPE));
}
});
columns.add(new PrismPropertyWrapperColumn<AppenderConfigurationType, String>(appenderModel, AppenderConfigurationType.F_NAME, ColumnType.LINK, getPageBase()) {
@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<AppenderConfigurationType>> rowModel) {
getAppendersMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
}
});
columns.add(new PrismPropertyWrapperColumn<AppenderConfigurationType, String>(appenderModel, AppenderConfigurationType.F_PATTERN, ColumnType.VALUE, getPageBase()) {
@Override
public String getCssClass() {
return " col-md-5 ";
}
});
columns.add(new AbstractColumn<PrismContainerValueWrapper<AppenderConfigurationType>, String>(createStringResource("LoggingConfigurationTabPanel.appender.typeColumn")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<PrismContainerValueWrapper<AppenderConfigurationType>>> item, String componentId, final IModel<PrismContainerValueWrapper<AppenderConfigurationType>> rowModel) {
ItemRealValueModel<AppenderConfigurationType> appender = new ItemRealValueModel<>(rowModel);
String type = "";
if (appender != null && appender.getObject() instanceof FileAppenderConfigurationType) {
type = "File appender";
} else if (appender != null && appender.getObject() instanceof SyslogAppenderConfigurationType) {
type = "Syslog appender";
}
item.add(new Label(componentId, Model.of(type)));
}
});
List<InlineMenuItem> menuActionsList = getAppendersMultivalueContainerListPanel().getDefaultMenuActions();
columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {
@Override
public String getCssClass() {
return " col-md-1 ";
}
});
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator in project midpoint by Evolveum.
the class ColumnUtils method getDefaultOrgColumns.
public static <T extends ObjectType> List<IColumn<SelectableBean<T>, String>> getDefaultOrgColumns(PageBase pageBase) {
List<IColumn<SelectableBean<T>, String>> columns = new ArrayList<>();
columns.addAll((Collection) getDefaultAbstractRoleColumns(false));
columns.add(new LinkColumn<>(createStringResource("ObjectType.parentOrgRef")) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<T>>> cellItem, String componentId, IModel<SelectableBean<T>> rowModel) {
RepeatingView links = new RepeatingView(componentId);
if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getValue() != null && rowModel.getObject().getValue().getParentOrgRef() != null && !rowModel.getObject().getValue().getParentOrgRef().isEmpty()) {
for (ObjectReferenceType parentRef : rowModel.getObject().getValue().getParentOrgRef()) {
if (parentRef.getOid() == null) {
continue;
}
Model name = Model.of(WebModelServiceUtils.resolveReferenceName(parentRef, pageBase, true));
if (name.getObject() == null) {
continue;
}
links.add(new LinkPanel(links.newChildId(), name) {
private static final long serialVersionUID = 1L;
@Override
public void onClick() {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, parentRef.getOid());
pageBase.navigateToNext(PageOrgUnit.class, parameters);
}
@Override
public boolean isEnabled() {
return parentRef.getTargetName() != null;
}
});
}
}
cellItem.add(links);
}
@Override
public void onClick(IModel<SelectableBean<T>> rowModel) {
super.onClick(rowModel);
}
});
columns.add((IColumn) getAbstractRoleColumnForProjection());
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator in project midpoint by Evolveum.
the class ColumnUtils method getDefaultCaseColumns.
public static List<IColumn<SelectableBean<CaseType>, String>> getDefaultCaseColumns(PageBase pageBase, boolean isDashboard) {
List<IColumn<SelectableBean<CaseType>, String>> columns = new ArrayList<>();
IColumn column = new PropertyColumn(createStringResource("pageCases.table.description"), "value.description");
columns.add(column);
column = new AbstractColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.objectRef")) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> item, String componentId, IModel<SelectableBean<CaseType>> rowModel) {
item.add(new Label(componentId, new IModel<String>() {
@Override
public String getObject() {
CaseType caseModelObject = rowModel.getObject().getValue();
if (caseModelObject == null) {
return "";
}
AssignmentHolderType objectRef = WebComponentUtil.getObjectFromAddDeltyForCase(caseModelObject);
if (objectRef != null) {
return WebComponentUtil.getEffectiveName(objectRef, AbstractRoleType.F_DISPLAY_NAME);
} else if (caseModelObject.getObjectRef() != null && StringUtils.isNotEmpty(caseModelObject.getObjectRef().getOid())) {
if (caseModelObject.getObjectRef().getObject() != null) {
return WebComponentUtil.getEffectiveName(caseModelObject.getObjectRef().getObject(), AbstractRoleType.F_DISPLAY_NAME);
} else {
try {
return WebComponentUtil.getEffectiveName(caseModelObject.getObjectRef(), AbstractRoleType.F_DISPLAY_NAME, pageBase, pageBase.getClass().getSimpleName() + "." + "loadCaseObjectRefName");
} catch (Exception ex) {
LOGGER.error("Unable find the object for reference: {}", caseModelObject.getObjectRef());
}
}
}
return "";
}
}));
}
};
columns.add(column);
if (!isDashboard) {
columns.add(createCaseActorsColumn(pageBase));
}
column = new AbstractColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.openTimestamp"), MetadataType.F_CREATE_TIMESTAMP.getLocalPart()) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem, String componentId, final IModel<SelectableBean<CaseType>> rowModel) {
CaseType object = rowModel.getObject().getValue();
MetadataType metadata = object != null ? object.getMetadata() : null;
XMLGregorianCalendar createdCal = metadata != null ? metadata.getCreateTimestamp() : null;
final Date created;
if (createdCal != null) {
created = createdCal.toGregorianCalendar().getTime();
// cellItem.add(AttributeModifier.replace("title", WebComponentUtil.getLocalizedDate(created, DateLabelComponent.LONG_MEDIUM_STYLE)));
// cellItem.add(new TooltipBehavior());
} else {
created = null;
}
cellItem.add(new Label(componentId, new IModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getShortDateTimeFormattedValue(created, pageBase);
}
}));
}
@Override
public String getCssClass() {
return isDashboard ? "col-sm-2 col-lg-1" : super.getCssClass();
}
};
columns.add(column);
if (!isDashboard) {
column = new PropertyColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.closeTimestamp"), CaseType.F_CLOSE_TIMESTAMP.getLocalPart(), "value.closeTimestamp") {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem, String componentId, final IModel<SelectableBean<CaseType>> rowModel) {
CaseType object = rowModel.getObject().getValue();
XMLGregorianCalendar closedCal = object != null ? object.getCloseTimestamp() : null;
final Date closed;
if (closedCal != null) {
closed = closedCal.toGregorianCalendar().getTime();
cellItem.add(AttributeModifier.replace("title", WebComponentUtil.getLocalizedDate(closed, DateLabelComponent.LONG_MEDIUM_STYLE)));
cellItem.add(new TooltipBehavior());
} else {
closed = null;
}
cellItem.add(new Label(componentId, new IModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getShortDateTimeFormattedValue(closed, pageBase);
}
}));
}
@Override
public String getCssClass() {
return isDashboard ? "col-sm-2 col-lg-1" : super.getCssClass();
}
};
columns.add(column);
}
column = new CountIconColumn<SelectableBean<CaseType>>(createStringResource("CaseType.outcome")) {
@Override
protected Map<DisplayType, Integer> getIconDisplayType(IModel<SelectableBean<CaseType>> rowModel) {
Map<DisplayType, Integer> map = new HashMap<>();
CaseType caseType = rowModel.getObject().getValue();
if (ObjectTypeUtil.hasArchetype(caseType, SystemObjectsType.ARCHETYPE_OPERATION_REQUEST.value())) {
ObjectQuery queryFilter = pageBase.getPrismContext().queryFor(CaseType.class).item(CaseType.F_PARENT_REF).ref(caseType.getOid()).build();
List<PrismObject<CaseType>> childs = WebModelServiceUtils.searchObjects(CaseType.class, queryFilter, new OperationResult("search_case_child"), pageBase);
for (PrismObject<CaseType> child : childs) {
processCaseOutcome(child.asObjectable(), map, false);
}
} else {
processCaseOutcome(caseType, map, true);
}
return map;
}
@Override
public String getCssClass() {
return "col-lg-1";
}
};
columns.add(column);
column = new PropertyColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.state"), CaseType.F_STATE.getLocalPart(), "value.state") {
@Override
public String getCssClass() {
return "col-lg-1";
}
@Override
public IModel<?> getDataModel(IModel<SelectableBean<CaseType>> rowModel) {
IModel<String> dataModel = (IModel<String>) super.getDataModel(rowModel);
if (StringUtils.isNotBlank(dataModel.getObject())) {
String key = CaseType.COMPLEX_TYPE.getLocalPart() + "." + CaseType.F_STATE.getLocalPart() + "." + dataModel.getObject();
return new StringResourceModel(key, pageBase).setModel(new Model<String>()).setDefaultValue(dataModel.getObject());
}
return dataModel;
}
};
columns.add(column);
if (!isDashboard) {
column = new AbstractExportableColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.workitems")) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem, String componentId, IModel<SelectableBean<CaseType>> model) {
cellItem.add(new Label(componentId, model.getObject().getValue() != null && model.getObject().getValue().getWorkItem() != null ? model.getObject().getValue().getWorkItem().size() : null));
}
@Override
public IModel<String> getDataModel(IModel<SelectableBean<CaseType>> rowModel) {
return Model.of(rowModel.getObject().getValue() != null && rowModel.getObject().getValue().getWorkItem() != null ? Integer.toString(rowModel.getObject().getValue().getWorkItem().size()) : "");
}
@Override
public String getCssClass() {
return "col-lg-1";
}
};
columns.add(column);
}
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator in project midpoint by Evolveum.
the class TaskErrorsPanel method initColumnsNew.
private List<IColumn<TaskErrorSelectableBeanImpl, String>> initColumnsNew() {
List<IColumn<TaskErrorSelectableBeanImpl, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.objectName"), TaskErrorSelectableBeanImpl.F_OBJECT_REF_NAME) {
@Override
public String getSortProperty() {
return "name";
}
});
columns.add(new AbstractColumn<>(createStringResource("pageTaskEdit.taskErros.timestamp"), TaskErrorSelectableBeanImpl.F_ERROR_TIMESTAMP) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<TaskErrorSelectableBeanImpl>> cellItem, String componentId, IModel<TaskErrorSelectableBeanImpl> rowModel) {
Label label = new Label(componentId, (IModel<String>) () -> WebComponentUtil.getShortDateTimeFormattedValue(rowModel.getObject().getErrorTimestamp(), getPageBase()));
cellItem.add(label);
}
});
columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.status"), TaskErrorSelectableBeanImpl.F_STATUS));
columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.message"), TaskErrorSelectableBeanImpl.F_MESSAGE));
columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.recordType"), TaskErrorSelectableBeanImpl.F_RECORD_TYPE));
columns.add(new AjaxLinkColumn<>(createStringResource("pageTaskEdit.taskErros.realOwner"), TaskErrorSelectableBeanImpl.F_REAL_OWNER_DESCRIPTION) {
@Override
public void onClick(AjaxRequestTarget target, IModel<TaskErrorSelectableBeanImpl> rowModel) {
TaskErrorSelectableBeanImpl object = rowModel.getObject();
PrismObject<ObjectType> realOwner = object.getRealOwner();
WebComponentUtil.dispatchToObjectDetailsPage(realOwner.getCompileTimeClass(), realOwner.getOid(), TaskErrorsPanel.this, false);
}
});
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator in project midpoint by Evolveum.
the class TaskResultPanel method initResultColumns.
private List<IColumn<SelectableBean<OperationResult>, String>> initResultColumns() {
List<IColumn<SelectableBean<OperationResult>, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.token"), OperationResultType.F_TOKEN.getLocalPart(), createPropertyExpression("token")));
columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.operation"), OperationResultType.F_OPERATION.getLocalPart(), createPropertyExpression("operation")));
columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.status"), OperationResultType.F_STATUS.getLocalPart(), createPropertyExpression("status")));
columns.add(new AbstractColumn<>(createStringResource("pageTaskEdit.opResult.timestamp"), OperationResultType.F_END.getLocalPart()) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<OperationResult>>> cellItem, String componentId, IModel<SelectableBean<OperationResult>> rowModel) {
Label label = new Label(componentId, (IModel<String>) () -> {
Long resultEndTime = rowModel.getObject().getValue().getEnd();
return resultEndTime != null && resultEndTime > 0 ? WebComponentUtil.getShortDateTimeFormattedValue(new Date(resultEndTime), getPageBase()) : "";
});
cellItem.add(label);
}
});
columns.add(new AbstractColumn<>(createStringResource("pageTaskEdit.opResult.message"), OperationResultType.F_MESSAGE.getLocalPart()) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<OperationResult>>> cellItem, String componentId, IModel<SelectableBean<OperationResult>> rowModel) {
Label label = new Label(componentId, (IModel<String>) () -> WebComponentUtil.nl2br(rowModel.getObject().getValue().getMessage()));
label.setEscapeModelStrings(false);
cellItem.add(label);
}
});
return columns;
}
Aggregations