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

knowledgepixels / nanodash / 18741366223

23 Oct 2025 07:48AM UTC coverage: 12.895% (-0.8%) from 13.69%
18741366223

push

github

tkuhn
feat: Apply new view display method also for Space pages

452 of 4396 branches covered (10.28%)

Branch coverage included in aggregate %.

1174 of 8214 relevant lines covered (14.29%)

0.64 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 java.util.ArrayList;
4
import java.util.List;
5

6
import org.apache.wicket.Component;
7
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
8
import org.apache.wicket.markup.html.basic.Label;
9
import org.apache.wicket.markup.html.link.AbstractLink;
10
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
11
import org.apache.wicket.model.Model;
12
import org.apache.wicket.request.mapper.parameter.PageParameters;
13
import org.nanopub.extra.services.FailedApiCallException;
14

15
import com.knowledgepixels.nanodash.MaintainedResource;
16
import com.knowledgepixels.nanodash.Space;
17
import com.knowledgepixels.nanodash.component.ButtonList;
18
import com.knowledgepixels.nanodash.component.TitleBar;
19
import com.knowledgepixels.nanodash.component.ViewList;
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 MaintainedResource resource;
43

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

47
        resource = MaintainedResource.get(parameters.get("id").toString());
×
48

49
        add(new TitleBar("titlebar", this, "connectors"));
×
50

51
        add(new Label("pagetitle", resource.getLabel() + " (resource) | nanodash"));
×
52
        add(new Label("resourcename", resource.getLabel()));
×
53
        add(new BookmarkablePageLink<Void>("id", ExplorePage.class, parameters.set("label", resource.getLabel())).setBody(Model.of(resource.getId())));
×
54
        add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().add("id", resource.getNanopubId())));
×
55

56
        Space space = resource.getSpace();
×
57
        add(new BookmarkablePageLink<Void>("space", SpacePage.class, new PageParameters().add("id", space.getId())).setBody(Model.of(space.getLabel())));
×
58

59

60
        final List<AbstractLink> viewButtons = new ArrayList<>();
×
61
        AbstractLink addViewButton = new BookmarkablePageLink<NanodashPage>("button", PublishPage.class, new PageParameters()
×
62
                .add("template", "https://w3id.org/np/RA7vjbk3kz4FCu2eTX5oekZshPeOGNGTw8b2WLk8ZS7VI")
×
63
                .add("param_resource", resource.getId())
×
64
                .add("context", space.getId())
×
65
            );
66
        addViewButton.setBody(Model.of("+"));
×
67
        viewButtons.add(addViewButton);
×
68

69
        if (resource.isDataInitialized()) {
×
70
            add(new ViewList("views", resource));
×
71
            add(new ButtonList("view-buttons", space, null, null, viewButtons));
×
72
        } else {
73
            add(new AjaxLazyLoadPanel<Component>("views") {
×
74
    
75
                @Override
76
                public Component getLazyLoadComponent(String markupId) {
77
                    return new ViewList(markupId, resource);
×
78
                }
79
    
80
                @Override
81
                protected boolean isContentReady() {
82
                    return resource.isDataInitialized();
×
83
                }
84
    
85
            });
86
            add(new AjaxLazyLoadPanel<Component>("view-buttons") {
×
87
    
88
                @Override
89
                public Component getLazyLoadComponent(String markupId) {
90
                    return new ButtonList(markupId, space, null, null, viewButtons);
×
91
                }
92
    
93
                @Override
94
                protected boolean isContentReady() {
95
                    return resource.isDataInitialized();
×
96
                }
97

98
                public Component getLoadingComponent(String id) {
99
                    return new Label(id).setVisible(false);
×
100
                };
101
    
102
            });
103
        }
104
    }
×
105

106
    /**
107
     * Checks if auto-refresh is enabled for this page.
108
     *
109
     * @return true if auto-refresh is enabled, false otherwise
110
     */
111
    protected boolean hasAutoRefreshEnabled() {
112
        return true;
×
113
    }
114

115
}
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