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

knowledgepixels / nanodash / 17581526343

09 Sep 2025 11:44AM UTC coverage: 13.601% (-0.007%) from 13.608%
17581526343

push

github

tkuhn
Merge branch 'master' of github.com:knowledgepixels/nanodash

406 of 3856 branches covered (10.53%)

Branch coverage included in aggregate %.

1072 of 7011 relevant lines covered (15.29%)

0.68 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.HashMap;
5
import java.util.List;
6
import java.util.function.Function;
7

8
import org.apache.wicket.Component;
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

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

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

21
        if (title.contains("  ")) {
×
22
            add(new Label("description", title.replaceFirst("^.*  ", "")));
×
23
            title = title.replaceFirst("  .*$", "");
×
24
        } else {
25
            add(new Label("description").setVisible(false));
×
26
        }
27
        add(new Label("title", title));
×
28
        add(new Label("button").setVisible(false));
×
29

30
        add(new ItemList<T>("itemlist", items, compProvider));
×
31
    }
×
32

33
    public ItemListPanel(String markupId, String title, String queryName, HashMap<String, String> params, ApiResultListProvider<T> resultListProvider, ComponentProvider<T> compProvider) {
34
        super(markupId);
×
35
        setOutputMarkupId(true);
×
36

37
        if (title.contains("  ")) {
×
38
            add(new Label("description", title.replaceFirst("^.*  ", "")));
×
39
            title = title.replaceFirst("  .*$", "");
×
40
        } else {
41
            add(new Label("description").setVisible(false));
×
42
        }
43
        add(new Label("title", title));
×
44
        add(new Label("button").setVisible(false));
×
45

46
        ApiResponse qResponse = ApiCache.retrieveResponse(queryName, params);
×
47
        if (qResponse != null) {
×
48
            add(new ItemList<T>("itemlist", resultListProvider.apply(qResponse), compProvider));
×
49
        } else {
50
            add(new ApiResultComponent("itemlist", queryName, params) {
×
51

52
                @Override
53
                public Component getApiResultComponent(String markupId, ApiResponse response) {
54
                    return new ItemList<T>(markupId, resultListProvider.apply(response), compProvider);
×
55
                }
56
            });
57

58
        }
59
    }
×
60

61
    public static interface ComponentProvider<T> extends Function<T, Component>, Serializable {
62
    }
63

64
    public static interface ApiResultListProvider<T> extends Function<ApiResponse, List<T>>, Serializable {
65
    }
66

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