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

3
import org.apache.wicket.Component;
4
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
5
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
6
import org.apache.wicket.markup.html.basic.Label;
7
import org.apache.wicket.request.IRequestHandler;
8
import org.apache.wicket.request.cycle.RequestCycle;
9
import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler;
10

11
public abstract class ResultComponent extends AjaxLazyLoadPanel<Component> {
12

13
    private boolean waitIconEnabled = true;
×
14
    private String waitMessage = null;
×
15
    private String waitComponentHtml = null;
×
16

17
    public ResultComponent(String id) {
18
        super(id);
×
19
    }
×
20

21
    /**
22
     * Sets whether to show a loading icon while waiting for the API response.
23
     *
24
     * @param waitIconEnabled true to enable the wait icon, false to disable it
25
     */
26
    public final void setWaitIconEnabled(boolean waitIconEnabled) {
27
        this.waitIconEnabled = waitIconEnabled;
×
28
    }
×
29

30
    /**
31
     * Sets a custom message to be displayed while waiting for the API response.
32
     *
33
     * @param waitMessage the message to display
34
     */
35
    public final void setWaitMessage(String waitMessage) {
36
        this.waitMessage = waitMessage;
×
37
    }
×
38

39
    /**
40
     * Sets a custom HTML component to be displayed while waiting for the API response.
41
     *
42
     * @param waitComponentHtml the HTML string to display
43
     */
44
    public final void setWaitComponentHtml(String waitComponentHtml) {
45
        this.waitComponentHtml = waitComponentHtml;
×
46
    }
×
47

48
    /**
49
     * {@inheritDoc}
50
     */
51
    @Override
52
    public final Component getLoadingComponent(String id) {
53
        if (!waitIconEnabled) {
×
54
            return new Label(id);
×
55
        } else if (waitComponentHtml != null) {
×
56
            return new Label(id, waitComponentHtml).setEscapeModelStrings(false);
×
57
        } else if (waitMessage != null) {
×
58
            return new Label(id, getWaitComponentHtml(waitMessage)).setEscapeModelStrings(false);
×
59
        } else {
60
            return super.getLoadingComponent(id);
×
61
        }
62
    }
63

64
    /**
65
     * Returns the HTML for a loading icon.
66
     *
67
     * @return a string containing the HTML for the loading icon
68
     */
69
    public final static String getWaitIconHtml() {
70
        IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR);
×
71
        return "<img alt=\"Loading...\" src=\"" + RequestCycle.get().urlFor(handler) + "\"/>";
×
72
    }
73

74
    /**
75
     * Returns the HTML for a waiting message with an icon.
76
     *
77
     * @param waitMessage the message to display while waiting
78
     * @return a string containing the HTML for the waiting message
79
     */
80
    public final static String getWaitComponentHtml(String waitMessage) {
81
        return "<p class=\"waiting\">" + waitMessage + " " + getWaitIconHtml() + "</p>";
×
82
    }
83

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