use of com.evolveum.midpoint.web.page.admin.server.dto.ActionsExecutedInformationDto in project midpoint by Evolveum.
the class ActionsExecutedInformationPanel method initLayout.
protected void initLayout() {
WebMarkupContainer tableLinesContainer = new WebMarkupContainer(ID_OBJECTS_TABLE_LINES_CONTAINER);
ListView tableLines = new ListView<ActionsExecutedObjectsTableLineDto>(ID_OBJECTS_TABLE_LINES, new AbstractReadOnlyModel<List<ActionsExecutedObjectsTableLineDto>>() {
@Override
public List<ActionsExecutedObjectsTableLineDto> getObject() {
final ActionsExecutedInformationDto modelObject = getModelObject();
if (modelObject == null) {
return new ArrayList<>();
}
if (showResultingActionsOnly) {
return modelObject.getUniqueObjectsTableLines();
} else {
return modelObject.getObjectsTableLines();
}
}
}) {
protected void populateItem(final ListItem<ActionsExecutedObjectsTableLineDto> item) {
item.add(new Label(ID_OBJECT_TYPE, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
String key = item.getModelObject().getObjectTypeLocalizationKey();
if (key != null) {
return createStringResource(key).getString();
} else {
return item.getModelObject().getObjectType().getLocalPart();
}
}
}));
item.add(new Label(ID_OPERATION, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return createStringResource(item.getModelObject().getOperation()).getString();
}
}));
item.add(new Label(ID_CHANNEL, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
String channel = item.getModelObject().getChannel();
if (channel != null && !channel.isEmpty()) {
String key = "Channel." + channel;
return createStringResource(key).getString();
} else {
return "";
}
}
}));
item.add(new Label(ID_SUCCESS_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_SUCCESS_COUNT)));
item.add(new Label(ID_LAST_SUCCESS_OBJECT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_OBJECT)));
item.add(new Label(ID_LAST_SUCCESS_TIMESTAMP, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_TIMESTAMP)));
item.add(new Label(ID_FAILURE_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_FAILURE_COUNT)));
}
};
tableLinesContainer.add(tableLines);
tableLinesContainer.setOutputMarkupId(true);
add(tableLinesContainer);
final Label showResultingActionsOnlyLabel = new Label(ID_SHOW_RESULTING_ACTIONS_ONLY_LABEL, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return showResultingActionsOnly ? createStringResource("ActionsExecutedInformationPanel.showingResultingActionsOnly").getString() : createStringResource("ActionsExecutedInformationPanel.showingAllActions").getString();
}
});
showResultingActionsOnlyLabel.setOutputMarkupId(true);
add(showResultingActionsOnlyLabel);
add(new AjaxFallbackLink<String>(ID_SHOW_RESULTING_ACTIONS_ONLY_LINK) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
showResultingActionsOnly = !showResultingActionsOnly;
ajaxRequestTarget.add(ActionsExecutedInformationPanel.this);
}
});
add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject() != null;
}
});
}
Aggregations