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

knowledgepixels / nanodash / 18155160356

01 Oct 2025 07:42AM UTC coverage: 13.788% (-0.03%) from 13.817%
18155160356

push

github

ashleycaselli
docs: add missing or update Javadoc annotations

445 of 4084 branches covered (10.9%)

Branch coverage included in aggregate %.

1155 of 7520 relevant lines covered (15.36%)

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/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
/**
12
 * A base class for components that display results from an API call with a loading indicator.
13
 * This class extends AjaxLazyLoadPanel to provide lazy loading functionality.
14
 */
15
public abstract class ResultComponent extends AjaxLazyLoadPanel<Component> {
16

17
    private boolean waitIconEnabled = true;
×
18
    private String waitMessage = null;
×
19
    private String waitComponentHtml = null;
×
20

21
    /**
22
     * Constructor.
23
     *
24
     * @param id the component id
25
     */
26
    public ResultComponent(String id) {
27
        super(id);
×
28
    }
×
29

30
    /**
31
     * Sets whether to show a loading icon while waiting for the API response.
32
     *
33
     * @param waitIconEnabled true to enable the wait icon, false to disable it
34
     */
35
    public final void setWaitIconEnabled(boolean waitIconEnabled) {
36
        this.waitIconEnabled = waitIconEnabled;
×
37
    }
×
38

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

48
    /**
49
     * Sets a custom HTML component to be displayed while waiting for the API response.
50
     *
51
     * @param waitComponentHtml the HTML string to display
52
     */
53
    public final void setWaitComponentHtml(String waitComponentHtml) {
54
        this.waitComponentHtml = waitComponentHtml;
×
55
    }
×
56

57
    /**
58
     * {@inheritDoc}
59
     */
60
    @Override
61
    public final Component getLoadingComponent(String id) {
62
        if (!waitIconEnabled) {
×
63
            return new Label(id);
×
64
        } else if (waitComponentHtml != null) {
×
65
            return new Label(id, waitComponentHtml).setEscapeModelStrings(false);
×
66
        } else if (waitMessage != null) {
×
67
            return new Label(id, getWaitComponentHtml(waitMessage)).setEscapeModelStrings(false);
×
68
        } else {
69
            return super.getLoadingComponent(id);
×
70
        }
71
    }
72

73
    /**
74
     * Returns the HTML for a loading icon.
75
     *
76
     * @return a string containing the HTML for the loading icon
77
     */
78
    public final static String getWaitIconHtml() {
79
        IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR);
×
80
        return "<img alt=\"Loading...\" src=\"" + RequestCycle.get().urlFor(handler) + "\"/>";
×
81
    }
82

83
    /**
84
     * Returns the HTML for a waiting message with an icon.
85
     *
86
     * @param waitMessage the message to display while waiting
87
     * @return a string containing the HTML for the waiting message
88
     */
89
    public final static String getWaitComponentHtml(String waitMessage) {
90
        return "<p class=\"waiting\">" + waitMessage + " " + getWaitIconHtml() + "</p>";
×
91
    }
92

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