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

knowledgepixels / nanodash / 23047492673

13 Mar 2026 10:50AM UTC coverage: 15.67% (-0.006%) from 15.676%
23047492673

Pull #389

github

web-flow
Merge caafcefe6 into 84ce3619e
Pull Request #389: Reconsider title bar (#293)

710 of 5489 branches covered (12.93%)

Branch coverage included in aggregate %.

1751 of 10216 relevant lines covered (17.14%)

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

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

6
import org.apache.wicket.behavior.AttributeAppender;
7
import org.apache.wicket.markup.html.WebMarkupContainer;
8
import org.apache.wicket.markup.html.panel.Panel;
9
import org.apache.wicket.markup.repeater.Item;
10
import org.apache.wicket.markup.repeater.data.DataView;
11
import org.apache.wicket.markup.repeater.data.ListDataProvider;
12

13
import com.knowledgepixels.nanodash.NanodashPageRef;
14
import com.knowledgepixels.nanodash.NanodashPreferences;
15
import com.knowledgepixels.nanodash.Utils;
16
import com.knowledgepixels.nanodash.page.NanodashPage;
17

18
/**
19
 * TitleBar is the top bar of the Nanodash application, which contains
20
 * navigation elements such as profile, my channel, users, connectors,
21
 * publish, query, and breadcrumb navigation.
22
 */
23
public class TitleBar extends Panel {
24

25
    private String highlight;
26

27
    /**
28
     * Constructs a TitleBar with the specified id, page, highlight element,
29
     * and an array of path references for breadcrumb navigation.
30
     *
31
     * @param id        the component id
32
     * @param page      the current Nanodash page
33
     * @param highlight the id of the element to highlight
34
     * @param pathRefs  an array of NanodashPageRef for breadcrumb navigation
35
     */
36
    public TitleBar(String id, NanodashPage page, String highlight, NanodashPageRef... pathRefs) {
37
        super(id);
×
38
        this.highlight = highlight;
×
39
        add(new ProfileItem("profile", page));
×
40

41
        createContainer("users");
×
42
        createContainer("connectors");
×
43
        createContainer("publish").setVisible(!NanodashPreferences.get().isReadOnlyMode());
×
44
        createContainer("query");
×
45

46
        WebMarkupContainer breadcrumbPath = new WebMarkupContainer("breadcrumbpath");
×
47
        breadcrumbPath.setVisible(pathRefs.length > 0);
×
48
        if (pathRefs.length > 0) {
×
49
            breadcrumbPath.add(pathRefs[0].createComponent("firstpathelement"));
×
50
            // Getting serialization exception if not using 'new ArrayList<...>(...)' here:
51
            List<NanodashPageRef> morePathElements = new ArrayList<NanodashPageRef>(Utils.subList(pathRefs, 1, pathRefs.length));
×
52
            breadcrumbPath.add(new DataView<NanodashPageRef>("morepathelements", new ListDataProvider<NanodashPageRef>(morePathElements)) {
×
53

54
                @Override
55
                protected void populateItem(Item<NanodashPageRef> item) {
56
                    item.add(item.getModelObject().createComponent("furtherpathelement"));
×
57
                }
×
58

59
            });
60
        } else {
×
61
            breadcrumbPath.setVisible(false);
×
62
        }
63
        add(breadcrumbPath);
×
64
    }
×
65

66
    private WebMarkupContainer createContainer(String id) {
67
        WebMarkupContainer c = new WebMarkupContainer(id);
×
68
        if (id.equals(highlight)) {
×
69
            c.add(new AttributeAppender("class", "selected"));
×
70
        }
71
        add(c);
×
72
        return c;
×
73
    }
74

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