use of com.evolveum.midpoint.xml.ns._public.common.common_3.SingleLocalizableMessageType 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.SingleLocalizableMessageType in project midpoint by Evolveum.
the class LocalizationUtil method createLocalizableMessageType.
@NotNull
private static SingleLocalizableMessageType createLocalizableMessageType(@NotNull SingleLocalizableMessage message, Function<LocalizableMessage, String> resolveKeys) {
SingleLocalizableMessageType rv = new SingleLocalizableMessageType();
rv.setKey(message.getKey());
if (message.getArgs() != null) {
for (Object argument : message.getArgs()) {
LocalizableMessageArgumentType messageArgument;
if (argument instanceof LocalizableMessage) {
messageArgument = new LocalizableMessageArgumentType().localizable(createLocalizableMessageType(((LocalizableMessage) argument), resolveKeys));
} else {
messageArgument = new LocalizableMessageArgumentType().value(argument != null ? argument.toString() : null);
}
rv.getArgument().add(messageArgument);
}
}
if (message.getFallbackLocalizableMessage() != null) {
rv.setFallbackLocalizableMessage(createLocalizableMessageType(message.getFallbackLocalizableMessage(), resolveKeys));
}
if (StringUtils.isBlank(message.getFallbackMessage()) && resolveKeys != null) {
rv.setFallbackMessage(resolveKeys.apply(message));
} else {
rv.setFallbackMessage(message.getFallbackMessage());
}
return rv;
}
Aggregations