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

knowledgepixels / nanodash / 17592217047

09 Sep 2025 06:31PM UTC coverage: 13.801% (-0.02%) from 13.819%
17592217047

push

github

tkuhn
Use ItemListPanel for all user lists on UserListPage

415 of 3902 branches covered (10.64%)

Branch coverage included in aggregate %.

1102 of 7090 relevant lines covered (15.54%)

0.69 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/ItemListPanel.java
1
package com.knowledgepixels.nanodash.component;
2

3
import java.io.Serializable;
4
import java.util.List;
5
import java.util.function.Function;
6

7
import org.apache.wicket.Component;
8
import org.apache.wicket.behavior.AttributeAppender;
9
import org.apache.wicket.markup.html.basic.Label;
10
import org.apache.wicket.markup.html.panel.Panel;
11
import org.nanopub.extra.services.ApiResponse;
12

13
import com.knowledgepixels.nanodash.ApiCache;
14
import com.knowledgepixels.nanodash.QueryRef;
15

16
public class ItemListPanel<T extends Serializable> extends Panel {
17

18
    public ItemListPanel(String markupId, String title, List<T> items, ComponentProvider<T> compProvider) {
19
        super(markupId);
×
20
        setOutputMarkupId(true);
×
21

22
        if (markupId.endsWith("-users")) {
×
23
            add(new AttributeAppender("class", " users"));
×
24
        }
25

26
        if (title.contains("  ")) {
×
27
            add(new Label("description", title.replaceFirst("^.*  ", "")));
×
28
            title = title.replaceFirst("  .*$", "");
×
29
        } else {
30
            add(new Label("description").setVisible(false));
×
31
        }
32
        add(new Label("title", title));
×
33
        add(new Label("button").setVisible(false));
×
34

35
        add(new ItemList<T>("itemlist", items, compProvider));
×
36
    }
×
37

38
    public ItemListPanel(String markupId, String title, QueryRef queryRef, ApiResultListProvider<T> resultListProvider, ComponentProvider<T> compProvider) {
39
        super(markupId);
×
40
        setOutputMarkupId(true);
×
41

42
        if (markupId.endsWith("-users")) {
×
43
            add(new AttributeAppender("class", " users"));
×
44
        }
45

46
        if (title.contains("  ")) {
×
47
            add(new Label("description", title.replaceFirst("^.*  ", "")));
×
48
            title = title.replaceFirst("  .*$", "");
×
49
        } else {
50
            add(new Label("description").setVisible(false));
×
51
        }
52
        add(new Label("title", title));
×
53
        add(new Label("button").setVisible(false));
×
54

55
        ApiResponse qResponse = ApiCache.retrieveResponse(queryRef);
×
56
        if (qResponse != null) {
×
57
            add(new ItemList<T>("itemlist", resultListProvider.apply(qResponse), compProvider));
×
58
        } else {
59
            add(new ApiResultComponent("itemlist", queryRef) {
×
60

61
                @Override
62
                public Component getApiResultComponent(String markupId, ApiResponse response) {
63
                    return new ItemList<T>(markupId, resultListProvider.apply(response), compProvider);
×
64
                }
65
            });
66

67
        }
68
    }
×
69

70
    public static interface ComponentProvider<T> extends Function<T, Component>, Serializable {
71
    }
72

73
    public static interface ApiResultListProvider<T> extends Function<ApiResponse, List<T>>, Serializable {
74
    }
75

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