-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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(); }
Asked: 2010-12-10 11:06:47 +0800
Seen: 60 times
Last updated: Dec 10 '10