0

Failing to push addChild event from server

asked 2010-12-10 11:06:47 +0800

edstromj gravatar image edstromj
6

I've been banging my head against this for a couple hours now and I'm hoping that someone can help me out.

Basically, I've got some <div> tags laid out in a .zul, each with an associated id. Initially, each has a child <include> tag to include some source code from another .zul file (of which the top-level tag will be <window>). The initial layout works fine. What I want to now be able to do is grab the div, and use the removeChild and appendChild to remove the previous window, and add an <include> tag as the child. The Java code to do that looks like this:

public void setGadget(final int index, final String srcFile) {
divs.removeChild(divs.getFirstChild());
divs.appendChild(new Include(srcFile));
}

The code works fine when it is initiated by an eventHandler. But, now I want to "push" the change to other users who are in the same shared session (think of it as a shared chat, with multiple peripheral components). I can't call the code for another window directly, because ZK disallows doing cross-desktop updates. So, what I'm trying to do now is something like this:

public void setGadget(final int index, final String srcFile) {
	Runnable runner = new Runnable() {
		@Override
		public void run() {
			try {
				Executions.activate(desktop);
				divs.removeChild(divs.getFirstChild());
				divs.appendChild(new Include(srcFile));
				Executions.deactivate(desktop);
			} catch (DesktopUnavailableException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	};
	new Thread(runner).start();
}

delete flag offensive retag edit
Be the first one to reply this discussion!
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

RSS

Stats

Asked: 2010-12-10 11:06:47 +0800

Seen: 60 times

Last updated: Dec 10 '10

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