Search in sources :

Example 1 with PrismPropertyRealValueFromContainerableModel

use of com.evolveum.midpoint.web.model.PrismPropertyRealValueFromContainerableModel in project midpoint by Evolveum.

the class AbstractSummaryPanel method initLayoutCommon.

protected void initLayoutCommon() {
    box = new WebMarkupContainer(ID_BOX);
    add(box);
    box.add(new AttributeModifier("class", BOX_CSS_CLASS + " " + getBoxAdditionalCssClass()));
    box.add(new Label(ID_DISPLAY_NAME, new PrismPropertyRealValueFromContainerableModel<>(getModel(), getDisplayNamePropertyName())));
    WebMarkupContainer identifierPanel = new WebMarkupContainer(ID_IDENTIFIER_PANEL);
    identifierPanel.add(new Label(ID_IDENTIFIER, new PrismPropertyRealValueFromContainerableModel<>(getModel(), getIdentifierPropertyName())));
    identifierPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isIdentifierVisible();
        }
    });
    box.add(identifierPanel);
    if (getTitlePropertyName() != null) {
        box.add(new Label(ID_TITLE, new PrismPropertyRealValueFromContainerableModel<>(getModel(), getTitlePropertyName())));
    } else if (getTitleModel() != null) {
        box.add(new Label(ID_TITLE, getTitleModel()));
    } else {
        box.add(new Label(ID_TITLE, " "));
    }
    if (getTitle2PropertyName() != null) {
        box.add(new Label(ID_TITLE2, new PrismPropertyRealValueFromContainerableModel<>(getModel(), getTitle2PropertyName())));
    } else if (getTitle2Model() != null) {
        box.add(new Label(ID_TITLE2, getTitle2Model()));
    } else {
        Label label = new Label(ID_TITLE2, " ");
        label.setVisible(false);
        box.add(label);
    }
    if (getTitle3PropertyName() != null) {
        box.add(new Label(ID_TITLE3, new PrismPropertyRealValueFromContainerableModel<>(getModel(), getTitle3PropertyName())));
    } else if (getTitle3Model() != null) {
        box.add(new Label(ID_TITLE3, getTitle3Model()));
    } else {
        Label label = new Label(ID_TITLE3, " ");
        label.setVisible(false);
        box.add(label);
    }
    Label parentOrgLabel = new Label(ID_ORGANIZATION, getParentOrgModel());
    parentOrgLabel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getParentOrgModel().getObject() != null;
        }
    });
    box.add(parentOrgLabel);
    iconBox = new WebMarkupContainer(ID_ICON_BOX);
    box.add(iconBox);
    if (getIconBoxAdditionalCssClass() != null) {
        iconBox.add(new AttributeModifier("class", ICON_BOX_CSS_CLASS + " " + getIconBoxAdditionalCssClass()));
    }
    Label icon = new Label(ID_ICON, "");
    icon.add(new AttributeModifier("class", getIconCssClass()));
    icon.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getPhotoModel().getObject() == null;
        }
    });
    iconBox.add(icon);
    NonCachingImage img = new NonCachingImage(ID_PHOTO, getPhotoModel());
    img.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getPhotoModel().getObject() != null;
        }
    });
    iconBox.add(img);
    tagBox = new WebMarkupContainer(ID_TAG_BOX);
    if (getTagBoxCssClass() != null) {
        tagBox.add(new AttributeModifier("class", getTagBoxCssClass()));
    }
    box.add(tagBox);
}
Also used : PrismPropertyRealValueFromContainerableModel(com.evolveum.midpoint.web.model.PrismPropertyRealValueFromContainerableModel) NonCachingImage(org.apache.wicket.markup.html.image.NonCachingImage) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AttributeModifier(org.apache.wicket.AttributeModifier) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 PrismPropertyRealValueFromContainerableModel (com.evolveum.midpoint.web.model.PrismPropertyRealValueFromContainerableModel)1 AttributeModifier (org.apache.wicket.AttributeModifier)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 Label (org.apache.wicket.markup.html.basic.Label)1 NonCachingImage (org.apache.wicket.markup.html.image.NonCachingImage)1