use of com.evolveum.midpoint.web.component.assignment.MetadataPanel in project midpoint by Evolveum.
the class PrismObjectPanel method createMetadataPanel.
protected void createMetadataPanel(IModel<ObjectWrapper<O>> model, ListItem<ContainerWrapper> item, PrismContainerPanel containerPanel) {
//check if metadata container exists for
//the current item and create metadata panel if yes
Component metadataPanel;
//becomes visible only in case metadata exists
Model<Boolean> metadataVisibility = Model.of(false);
ItemPath metadataContainerPath = item.getModelObject().isMain() ? new ItemPath(ObjectType.F_METADATA) : new ItemPath(item.getModelObject().getPath(), ObjectType.F_METADATA);
if (model.getObject().findContainerWrapper(metadataContainerPath) != null) {
ContainerWrapper<MetadataType> metadataContainer = model.getObject().findContainerWrapper(metadataContainerPath);
metadataVisibility.setObject(true);
String containerName = item.getModelObject().isMain() ? "Object" : StringUtils.capitalize(item.getModelObject().getPath().last().toString());
metadataPanel = new MetadataPanel(ID_CONTAINER_METADATA, new AbstractReadOnlyModel<MetadataType>() {
@Override
public MetadataType getObject() {
return metadataContainer.getItem().getRealValue();
}
}, containerName, "");
} else {
metadataPanel = new WebMarkupContainer(ID_CONTAINER_METADATA);
}
metadataPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return containerPanel.isVisible() && metadataVisibility.getObject() && model.getObject().isShowMetadata() && !ContainerStatus.ADDING.equals(model.getObject().getStatus());
}
});
metadataPanel.setOutputMarkupId(true);
item.add(metadataPanel);
}
Aggregations