-
FEATURED COMPONENTS
First time here? Check out the FAQ!
All of the examples I see in reference docs use showBusy() called from a button that calls an event like this:
<window id="w" width="200px" title="Test echoEvent" border="normal">
<attribute name="onLater">
doLongOperation(); //take long to execute
Clients.clearBusy(); //remove the busy message
</attribute>
<button label="Echo Event">
<attribute name="onClick">
Clients.showBusy("Execute..."); //show a busy message to user
Events.echoEvent("onLater", w, null); //echo an event back
</attribute>
</button>
</window>
Why can't I call showBusy("...") from my model.java when I'm getting my data and clearBusy() when I'm done? I've tried inserting the lines in controller and model and nothing shows up. For example ( below). Does it need to be called from zul and does it need an event called to make it appear. Thanks for any help!
private void getData (String _url, String contentStr, String type) {
try {
Clients.showBusy("loading1...");
URL url = new URL(_url);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());
setLoadingFlag(true);
writer.write(contentStr);
writer.flush();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String result = getResult(conn, reader, writer);
Clients.clearBusy();
Asked: 2013-08-06 18:09:55 +0800
Seen: 18 times
Last updated: Aug 06 '13