use of com.evolveum.midpoint.xml.ns._public.common.common_3.InformationPartType in project midpoint by Evolveum.
the class InformationPanel method initLayout.
private void initLayout() {
Label titleLabel = new Label(ID_TITLE, new PropertyModel<>(getModel(), InformationType.F_TITLE.getLocalPart()));
titleLabel.add(new VisibleBehaviour(() -> getModelObject().getTitle() != null));
add(titleLabel);
ListView<InformationPartType> list = new ListView<InformationPartType>(ID_PARTS, new PropertyModel<>(getModel(), InformationType.F_PART.getLocalPart())) {
@Override
protected void populateItem(ListItem<InformationPartType> item) {
InformationPartType part = item.getModelObject();
Label label = new Label(ID_PART, part.getText());
if (Boolean.TRUE.equals(part.isHasMarkup())) {
label.setEscapeModelStrings(false);
}
item.add(label);
}
};
add(list);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.InformationPartType in project midpoint by Evolveum.
the class PrepareForTaskCreation method wrapAdditionalInformationIfNeeded.
@SuppressWarnings("unchecked")
private List<InformationType> wrapAdditionalInformationIfNeeded(List<?> data) {
// data is not empty
if (data.stream().allMatch(o -> o instanceof String)) {
InformationType info = new InformationType();
for (Object o : data) {
InformationPartType part = new InformationPartType();
part.setText((String) o);
info.getPart().add(part);
}
return Collections.singletonList(info);
} else if (data.stream().allMatch(o -> o instanceof InformationType)) {
return (List<InformationType>) data;
} else {
throw new SystemException("Couldn't create 'additional information' structure from list of " + data.stream().map(o -> o != null ? o.getClass().getSimpleName() : null).collect(Collectors.joining(", ", "[", "]")));
}
}
Aggregations