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

knowledgepixels / nanodash / 21569970831

01 Feb 2026 08:46PM UTC coverage: 14.11% (-0.2%) from 14.273%
21569970831

push

github

tkuhn
style: Remove "beta" from logo and "by Knowledge Pixels" link

549 of 5182 branches covered (10.59%)

Branch coverage included in aggregate %.

1506 of 9382 relevant lines covered (16.05%)

2.11 hits per line

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

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

3
import com.knowledgepixels.nanodash.component.ButtonList;
4
import com.knowledgepixels.nanodash.page.NanodashPage;
5
import org.apache.wicket.behavior.AttributeAppender;
6
import org.apache.wicket.markup.html.basic.Label;
7
import org.apache.wicket.markup.html.link.AbstractLink;
8
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
9
import org.apache.wicket.markup.html.panel.Panel;
10
import org.apache.wicket.model.Model;
11
import org.apache.wicket.request.mapper.parameter.PageParameters;
12
import org.nanopub.extra.services.ApiResponse;
13
import org.nanopub.extra.services.QueryRef;
14

15
import java.util.ArrayList;
16
import java.util.List;
17

18
/**
19
 * Abstract base class for displaying query results in different formats.
20
 */
21
public abstract class QueryResult extends Panel {
22

23
    protected final List<AbstractLink> buttons = new ArrayList<>();
×
24
    protected String contextId;
25
    protected String partId;
26
    protected boolean finalized = false;
×
27
    protected final QueryRef queryRef;
28
    protected final ViewDisplay viewDisplay;
29
    protected final ApiResponse response;
30
    protected ProfiledResource profiledResource;
31
    protected final GrlcQuery grlcQuery;
32

33
    /**
34
     * Constructor for QueryResult.
35
     *
36
     * @param markupId    the markup ID
37
     * @param queryRef    the query reference
38
     * @param response    the API response
39
     * @param viewDisplay the view display
40
     */
41
    public QueryResult(String markupId, QueryRef queryRef, ApiResponse response, ViewDisplay viewDisplay) {
42
        super(markupId);
×
43
        this.queryRef = queryRef;
×
44
        this.viewDisplay = viewDisplay;
×
45
        this.response = response;
×
46
        this.grlcQuery = GrlcQuery.get(queryRef);
×
47

48
        add(new AttributeAppender("class", " col-" + viewDisplay.getDisplayWidth()));
×
49
    }
×
50

51
    @Override
52
    protected void onBeforeRender() {
53
        if (!finalized) {
×
54
            if (!buttons.isEmpty()) {
×
55
                add(new ButtonList("buttons", profiledResource, buttons, null, null));
×
56
            } else {
57
                add(new Label("buttons").setVisible(false));
×
58
            }
59
            finalized = true;
×
60
        }
61
        super.onBeforeRender();
×
62
    }
×
63

64
    /**
65
     * Set the profiled resource for this component.
66
     *
67
     * @param profiledResource The profiled resource to set.
68
     */
69
    public void setProfiledResource(ProfiledResource profiledResource) {
70
        this.profiledResource = profiledResource;
×
71
    }
×
72

73
    /**
74
     * Set the context ID for this component.
75
     *
76
     * @param contextId The context ID to set.
77
     */
78
    public void setContextId(String contextId) {
79
        this.contextId = contextId;
×
80
    }
×
81

82
    /**
83
     * Set the part ID when this view is shown on a part page (e.g. paper collection).
84
     * Used for redirect-after-publish to return to the part page.
85
     *
86
     * @param partId The part ID to set, or null when on the main context page.
87
     */
88
    public void setPartId(String partId) {
89
        this.partId = partId;
×
90
    }
×
91

92
    // TODO button adding method copied and adjusted from ItemListPanel
93
    // TODO Improve this (member/admin) button handling:
94
    public void addButton(String label, Class<? extends NanodashPage> pageClass, PageParameters parameters) {
95
        if (parameters == null) {
×
96
            parameters = new PageParameters();
×
97
        }
98
        if (contextId != null) {
×
99
            parameters.set("context", contextId);
×
100
        }
101
        AbstractLink button = new BookmarkablePageLink<NanodashPage>("button", pageClass, parameters);
×
102
        button.setBody(Model.of(label));
×
103
        buttons.add(button);
×
104
    }
×
105

106
    /**
107
     * Populate the component with the query results.
108
     */
109
    protected abstract void populateComponent();
110

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