use of com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType in project midpoint by Evolveum.
the class InformationPanel method initLayout.
private void initLayout() {
Label titleLabel = new Label(ID_TITLE, new LocalizableMessageModel(new IModel<LocalizableMessageType>() {
@Override
public LocalizableMessageType getObject() {
InformationType info = getModelObject();
if (info == null || info.getTitle() == null && info.getLocalizableTitle() == null) {
return new SingleLocalizableMessageType().fallbackMessage("ApprovalStageDefinitionType.additionalInformation");
}
return getLocalizableMessageOrDefault(info.getLocalizableTitle(), info.getTitle());
}
}, this));
titleLabel.add(new VisibleBehaviour(() -> getModelObject() != 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 != null ? WebComponentUtil.resolveLocalizableMessage(getLocalizableMessageOrDefault(part.getLocalizableText(), part.getText()), InformationPanel.this) : "");
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.InformationType in project midpoint by Evolveum.
the class MidpointParsingMigrator method stringToInformationType.
public static InformationType stringToInformationType(String s) {
InformationType info = new InformationType();
InformationPartType part = new InformationPartType();
part.setLocalizableText(LocalizationUtil.createForFallbackMessage(s));
info.getPart().add(part);
return info;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType 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