Search in sources :

Example 1 with LocalizableMessageModel

use of com.evolveum.midpoint.web.component.util.LocalizableMessageModel in project midpoint by Evolveum.

the class EvaluatedTriggerPanel method initLayout.

protected void initLayout() {
    EvaluatedTriggerDto trigger = getModelObject();
    WebMarkupContainer frame = new WebMarkupContainer(ID_FRAME);
    if (trigger.isHighlighted()) {
        // TODO skin
        frame.add(new AttributeAppender("style", "background-color: #fcffd3"));
    }
    add(frame);
    frame.add(new Label(ID_MESSAGE, new LocalizableMessageModel(Model.of(trigger.getMessage()), this)));
    EvaluatedTriggerGroupDto children = trigger.getChildren();
    EvaluatedTriggerGroupPanel childrenPanel = new EvaluatedTriggerGroupPanel(ID_CHILDREN, Model.of(children));
    childrenPanel.setVisible(!children.getTriggers().isEmpty());
    frame.add(childrenPanel);
}
Also used : EvaluatedTriggerDto(com.evolveum.midpoint.web.page.admin.workflow.dto.EvaluatedTriggerDto) Label(org.apache.wicket.markup.html.basic.Label) EvaluatedTriggerGroupDto(com.evolveum.midpoint.web.page.admin.workflow.dto.EvaluatedTriggerGroupDto) LocalizableMessageModel(com.evolveum.midpoint.web.component.util.LocalizableMessageModel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 2 with LocalizableMessageModel

use of com.evolveum.midpoint.web.component.util.LocalizableMessageModel 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);
}
Also used : IModel(org.apache.wicket.model.IModel) ListView(org.apache.wicket.markup.html.list.ListView) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Label(org.apache.wicket.markup.html.basic.Label) LocalizableMessageModel(com.evolveum.midpoint.web.component.util.LocalizableMessageModel) ListItem(org.apache.wicket.markup.html.list.ListItem) InformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType) InformationPartType(com.evolveum.midpoint.xml.ns._public.common.common_3.InformationPartType) SingleLocalizableMessageType(com.evolveum.midpoint.xml.ns._public.common.common_3.SingleLocalizableMessageType)

Aggregations

LocalizableMessageModel (com.evolveum.midpoint.web.component.util.LocalizableMessageModel)2 Label (org.apache.wicket.markup.html.basic.Label)2 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)1 EvaluatedTriggerDto (com.evolveum.midpoint.web.page.admin.workflow.dto.EvaluatedTriggerDto)1 EvaluatedTriggerGroupDto (com.evolveum.midpoint.web.page.admin.workflow.dto.EvaluatedTriggerGroupDto)1 InformationPartType (com.evolveum.midpoint.xml.ns._public.common.common_3.InformationPartType)1 InformationType (com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType)1 SingleLocalizableMessageType (com.evolveum.midpoint.xml.ns._public.common.common_3.SingleLocalizableMessageType)1 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 ListItem (org.apache.wicket.markup.html.list.ListItem)1 ListView (org.apache.wicket.markup.html.list.ListView)1 IModel (org.apache.wicket.model.IModel)1