use of com.evolveum.midpoint.gui.impl.prism.panel.component.ContainersPopupDto in project midpoint by Evolveum.
the class PrismValueMetadataPanel method createMetadataListModel.
private ReadOnlyModel<List<ContainersPopupDto>> createMetadataListModel() {
return new ReadOnlyModel<>(() -> {
ValueMetadataWrapperImpl metadataWrapper = getValueMetadata();
List<PrismContainerDefinition<? extends Containerable>> childContainers;
try {
childContainers = metadataWrapper != null ? metadataWrapper.getChildContainers() : Collections.emptyList();
} catch (SchemaException e) {
LOGGER.error("Cannot get child containers: {}", e.getMessage(), e);
childContainers = Collections.emptyList();
}
List<ContainersPopupDto> navigation = childContainers.stream().map(c -> new ContainersPopupDto(false, c)).collect(Collectors.toList());
List<? extends ItemDefinition> childNonContainers = metadataWrapper != null ? metadataWrapper.getChildNonContainers() : Collections.emptyList();
if (!childNonContainers.isEmpty()) {
navigation.add(new ContainersPopupDto(false, metadataWrapper));
}
return navigation;
});
}
use of com.evolveum.midpoint.gui.impl.prism.panel.component.ContainersPopupDto in project midpoint by Evolveum.
the class PrismValueMetadataPanel method createMetadataNavigationPanel.
private void createMetadataNavigationPanel() {
WebMarkupContainer metadataNavigation = new WebMarkupContainer(ID_METADATA_NAVIGATION);
add(metadataNavigation);
metadataNavigation.setOutputMarkupId(true);
ListView<ContainersPopupDto> metadataList = new ListView<ContainersPopupDto>(ID_METADATA_LIST, createMetadataListModel()) {
@Override
protected void populateItem(ListItem<ContainersPopupDto> listItem) {
AjaxButton showMetadataDetails = new AjaxButton(ID_METADATA_QNAME, createStringResource(listItem.getModelObject().getItemName())) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
ContainersPopupDto ccontainerToShow = listItem.getModelObject();
ccontainerToShow.setSelected(true);
setContainersToShow(ccontainerToShow, ajaxRequestTarget);
}
};
showMetadataDetails.add(AttributeAppender.replace("class", createButtonClassModel(listItem)));
showMetadataDetails.setOutputMarkupId(true);
showMetadataDetails.setOutputMarkupPlaceholderTag(true);
listItem.setOutputMarkupId(true);
listItem.add(showMetadataDetails);
}
};
metadataNavigation.add(metadataList);
ReadOnlyModel<String> activeTab = new ReadOnlyModel<>(() -> {
if (getValueMetadata() != null && isAnyMetadataSelected()) {
return "contains-active-tab";
}
return "";
});
metadataNavigation.add(AttributeAppender.replace("class", activeTab));
metadataList.setOutputMarkupId(true);
metadataList.setOutputMarkupPlaceholderTag(true);
}
Aggregations