• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

knowledgepixels / nanodash / 19851922971

02 Dec 2025 08:23AM UTC coverage: 15.356% (+0.06%) from 15.298%
19851922971

push

github

web-flow
Merge pull request #316 from knowledgepixels/292-breadcrumb-for-space-resource-hierarchy

Add breadcrumb path element to show space/resource hierarchy

596 of 4982 branches covered (11.96%)

Branch coverage included in aggregate %.

1569 of 9117 relevant lines covered (17.21%)

0.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
src/main/java/com/knowledgepixels/nanodash/page/MaintainedResourcePage.java
1
package com.knowledgepixels.nanodash.page;
2

3
import com.knowledgepixels.nanodash.MaintainedResource;
4
import com.knowledgepixels.nanodash.NanodashPageRef;
5
import com.knowledgepixels.nanodash.ProfiledResource;
6
import com.knowledgepixels.nanodash.Space;
7
import com.knowledgepixels.nanodash.component.ButtonList;
8
import com.knowledgepixels.nanodash.component.TitleBar;
9
import com.knowledgepixels.nanodash.component.ViewList;
10
import org.apache.wicket.Component;
11
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
12
import org.apache.wicket.markup.html.basic.Label;
13
import org.apache.wicket.markup.html.link.AbstractLink;
14
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
15
import org.apache.wicket.model.Model;
16
import org.apache.wicket.request.mapper.parameter.PageParameters;
17

18
import java.util.ArrayList;
19
import java.util.List;
20

21
/**
22
 * This class represents a page for a maintained resource.
23
 */
24
public class MaintainedResourcePage extends NanodashPage {
25

26
    /**
27
     * The mount path for this page.
28
     */
29
    public static final String MOUNT_PATH = "/resource";
30

31
    /**
32
     * {@inheritDoc}
33
     */
34
    @Override
35
    public String getMountPath() {
36
        return MOUNT_PATH;
×
37
    }
38

39
    /**
40
     * Maintained resource object with the data shown on this page.
41
     */
42
    private final MaintainedResource resource;
43

44
    public MaintainedResourcePage(final PageParameters parameters) {
45
        super(parameters);
×
46

47
        resource = MaintainedResource.get(parameters.get("id").toString());
×
48
        Space space = resource.getSpace();
×
49

50
        List<ProfiledResource> superSpaces = resource.getAllSuperSpacesUntilRoot();
×
51
        superSpaces.add(resource.getSpace());
×
52
        superSpaces.add(resource);
×
53
        add(new TitleBar("titlebar", this, null,
×
54
                superSpaces.stream().map(ss -> new NanodashPageRef(SpacePage.class, new PageParameters().add("id", ss.getId()), ss.getLabel())).toArray(NanodashPageRef[]::new)
×
55
        ));
56

57
        add(new Label("pagetitle", resource.getLabel() + " (resource) | nanodash"));
×
58
        add(new Label("resourcename", resource.getLabel()));
×
59
        add(new BookmarkablePageLink<Void>("id", ExplorePage.class, parameters.set("label", resource.getLabel())).setBody(Model.of(resource.getId())));
×
60
        add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().set("id", resource.getNanopubId())));
×
61

62
        String namespaceUri = resource.getNamespace() == null ? "" : resource.getNamespace();
×
63
        add(new BookmarkablePageLink<Void>("namespace", ExplorePage.class, new PageParameters().set("id", namespaceUri)).setBody(Model.of(namespaceUri)));
×
64

65
        final List<AbstractLink> viewButtons = new ArrayList<>();
×
66
        AbstractLink addViewButton = new BookmarkablePageLink<NanodashPage>("button", PublishPage.class, new PageParameters()
×
67
                .set("template", "https://w3id.org/np/RAxERE0cQ9jLQZ5VjeA-1v3XnE9ugxLpFG8vpkAd5FqHE")
×
68
                .set("template-version", "latest")
×
69
                .set("param_resource", resource.getId())
×
70
                .set("context", resource.getId())
×
71
        );
72
        addViewButton.setBody(Model.of("+ view"));
×
73
        viewButtons.add(addViewButton);
×
74

75
        if (resource.isDataInitialized()) {
×
76
            add(new ViewList("views", resource));
×
77
            add(new ButtonList("view-buttons", space, null, null, viewButtons));
×
78
        } else {
79
            add(new AjaxLazyLoadPanel<Component>("views") {
×
80

81
                @Override
82
                public Component getLazyLoadComponent(String markupId) {
83
                    return new ViewList(markupId, resource);
×
84
                }
85

86
                @Override
87
                protected boolean isContentReady() {
88
                    return resource.isDataInitialized();
×
89
                }
90

91
            });
92
            add(new AjaxLazyLoadPanel<Component>("view-buttons") {
×
93

94
                @Override
95
                public Component getLazyLoadComponent(String markupId) {
96
                    return new ButtonList(markupId, space, null, null, viewButtons);
×
97
                }
98

99
                @Override
100
                protected boolean isContentReady() {
101
                    return resource.isDataInitialized();
×
102
                }
103

104
                public Component getLoadingComponent(String id) {
105
                    return new Label(id).setVisible(false);
×
106
                }
107

108
            });
109
        }
110
    }
×
111

112
    /**
113
     * Checks if auto-refresh is enabled for this page.
114
     *
115
     * @return true if auto-refresh is enabled, false otherwise
116
     */
117
    protected boolean hasAutoRefreshEnabled() {
118
        return true;
×
119
    }
120

121
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc