public ItemAdditionalInformationPanel(String id, IModel<? extends ItemAdditionalInformation> model) {
super(id, model);
// Website link
add(new HideableExternalLink("websiteLink", BindingModel.of(model, Binding.itemAdditionalInformation().websiteUrl().url())));
// Issue tracker link
add(new HideableExternalLink("issueTrackerLink", BindingModel.of(model, Binding.itemAdditionalInformation().issueTrackerUrl().url())));
// Scm link
add(new HideableExternalLink("scmLink", BindingModel.of(model, Binding.itemAdditionalInformation().scmUrl().url())));
// Changelog link
add(new HideableExternalLink("changelogLink", BindingModel.of(model, Binding.itemAdditionalInformation().changelogUrl().url())));
// Licenses
final IModel<List<ProjectLicense>> licensesModel = BindingModel.of(model, Binding.itemAdditionalInformation().licenses());
add(new CountLabel("licensesHeader", "project.description.links.licenses", new LoadableDetachableModel<Number>() {
private static final long serialVersionUID = 1L;
@Override
protected Number load() {
List<ProjectLicense> licenses = licensesModel.getObject();
if (licenses != null) {
return licenses.size();
}
return 0;
}
}));
add(new ListView<ProjectLicense>("licenses", licensesModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<ProjectLicense> item) {
item.add(new CoreLabel("licenseShortLabel", BindingModel.of(item.getModel(), Binding.projectLicense().shortLabel()))
.hideIfEmpty());
item.add(new Label("licenseLabel", BindingModel.of(item.getModel(), Binding.projectLicense().label())));
item.add(new HideableExternalLink("licenseLink", BindingModel.of(item.getModel(), Binding.projectLicense().licenseUrl())));
}
@Override
protected void onConfigure() {
super.onConfigure();