0

calling showBusy, clearBusy from model or controller

asked 2013-08-06 18:09:55 +0800

robertkaren gravatar image robertkaren
77 7

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();
delete flag offensive retag edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-08-06 18:09:55 +0800

Seen: 18 times

Last updated: Aug 06 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More