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

knowledgepixels / nanodash / 17518110100

06 Sep 2025 06:34PM UTC coverage: 11.955% (-0.1%) from 12.094%
17518110100

push

github

tkuhn
Undo custom AjaxLazyLoadPanel to fix paging navigation

334 of 3876 branches covered (8.62%)

Branch coverage included in aggregate %.

958 of 6931 relevant lines covered (13.82%)

0.61 hits per line

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

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

3
import java.util.ArrayList;
4
import java.util.List;
5
import java.util.Map;
6

7
import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator;
8
import org.apache.wicket.markup.html.basic.Label;
9
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
10
import org.apache.wicket.markup.html.panel.Panel;
11
import org.apache.wicket.markup.repeater.Item;
12
import org.apache.wicket.markup.repeater.data.DataView;
13
import org.apache.wicket.markup.repeater.data.ListDataProvider;
14
import org.apache.wicket.request.mapper.parameter.PageParameters;
15
import org.eclipse.rdf4j.model.IRI;
16
import org.nanopub.extra.services.ApiResponse;
17
import org.nanopub.extra.services.ApiResponseEntry;
18

19
import com.knowledgepixels.nanodash.User;
20
import com.knowledgepixels.nanodash.Utils;
21
import com.knowledgepixels.nanodash.page.UserPage;
22

23
/**
24
 * A panel that displays a list of users with links to their user pages.
25
 * Optionally, it can also display notes associated with each user.
26
 */
27
public class UserList extends Panel {
28

29
    private static final long serialVersionUID = 1L;
30

31
    /**
32
     * Constructor for UserList.
33
     *
34
     * @param id    the component id
35
     * @param users a list of user IRI objects
36
     * @param notes a map of user IRI to notes (optional)
37
     */
38
    public UserList(String id, List<IRI> users, Map<IRI, String> notes) {
39
        super(id);
×
40
        setOutputMarkupId(true);
×
41
        init(users, notes);
×
42
    }
×
43

44
    /**
45
     * Constructor for UserList with a list of user IRI objects.
46
     *
47
     * @param id    the component id
48
     * @param users a list of user IRI objects
49
     */
50
    public UserList(String id, List<IRI> users) {
51
        super(id);
×
52
        setOutputMarkupId(true);
×
53
        init(users, null);
×
54
    }
×
55

56
    /**
57
     * Constructor for UserList that initializes from an ApiResponse.
58
     *
59
     * @param id        the component id
60
     * @param resp      the ApiResponse containing user data
61
     * @param userIdKey the key in the ApiResponse entries that contains the user IRI
62
     */
63
    public UserList(String id, ApiResponse resp, String userIdKey) {
64
        super(id);
×
65
        setOutputMarkupId(true);
×
66
        List<IRI> users = new ArrayList<>();
×
67
        for (ApiResponseEntry e : resp.getData()) {
×
68
            users.add(Utils.vf.createIRI(e.get(userIdKey)));
×
69
        }
×
70
        init(users, null);
×
71
    }
×
72

73
    private void init(List<IRI> users, Map<IRI, String> notes) {
74
        DataView<IRI> dataView = new DataView<>("userlist", new ListDataProvider<IRI>(users)) {
×
75

76
            private static final long serialVersionUID = 1L;
77

78
            @Override
79
            protected void populateItem(Item<IRI> item) {
80
                IRI userIri = item.getModelObject();
×
81
                PageParameters params = new PageParameters();
×
82
                params.add("id", userIri);
×
83
                BookmarkablePageLink<Void> l = new BookmarkablePageLink<Void>("userlink", UserPage.class, params);
×
84
                l.add(new Label("linktext", User.getShortDisplayName(userIri)));
×
85
                item.add(l);
×
86
                if (notes != null && notes.containsKey(userIri)) {
×
87
                    item.add(new Label("notes", notes.get(userIri)));
×
88
                } else {
89
                    item.add(new Label("notes"));
×
90
                }
91
            }
×
92

93
        };
94
        dataView.setItemsPerPage(10);
×
95
        dataView.setOutputMarkupId(true);
×
96
        add(dataView);
×
97
        AjaxPagingNavigator pagingNavigator = new AjaxPagingNavigator("navigator", dataView);
×
98
        pagingNavigator.setVisible(dataView.getPageCount() > 1);
×
99
        pagingNavigator.setOutputMarkupId(true);
×
100
        add(pagingNavigator);
×
101
    }
×
102

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