No. couldn't get event thread to stop but while trying I inadvertantly clicked on orig tab and found the Messagebox! Thanks for idea.
robertkaren ( 2014-03-13 22:15:01 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Inside a controller I call
anotherTab.setSelected(true);
to focus on a different tab, which is not controlled by this controller and after that I call Messagebox.show(), but it still shows up in the first tab. I even tried calling a method in a controller beneath the second tab, but it still shows up in the first tab(panel). What controls where the Messagebox appears? does it have to do with the controller or the tab that is selected at the time of the Messagebox.show() call? Is there a way to guarantee that Messagebox will show up above all tabs?
thanks for any help. Here is the original code. see codebookTab.setSelected(true) and the Messagebox.show() is in addDefaultTable().
public void openNewFile (String studyCode, String ttl) {
// must send server command to open file and download
// codebook.
Runid run = null;
RunidDefaults runidDefaults = new RunidDefaults();
try {
run = new Runid(studyCode, ttl);
} catch (Exception e) {
}
if (run != null) {
try {
Tab codebookTab = (Tab) new Path("//mainPage/mainWindow/codebookTab").getComponent();
codebookTab.setVisible(true);
codebookTab.setSelected(true);
} catch (Exception e) {
}
try {
Window w1 = (Window) new Path("//codebookCategoriesTreePage/codebookCategoriesWinOuter").getComponent();
codebookCatTreeController = (CodebookCategoriesTreeController)(w1.getAttribute("composer"));
codebookCatTreeController.getTreeData();
clearTablesColsRows();
addDefaultTable(runidDefaults);
} catch (Exception e) {
}
}
}
Did you find it with disabling the event thread?
Now a messagebox you can't "stick" to an component. A solution can be : Write a window that looks like a popup, even get parameters. then :
HashMap map = new HashMap<String, String>();
map.put("message", "this should be shown as message");
map.put("title", "this is the title");
Window dialog = (Window) Executions.createComponents( "MyPopup.zul",codebookTab , map);
dialog.doModal();
and in your controller of zul (mvc and it MUST be in your doAfterCompose)
@Override
public void doAfterCompose(Component window) throws Exception {
super.doAfterCompose(window);
String message = "default message";
String title = "default title";
if (arg.containsKey("message")) {
message = (String)arg.get("message"));
}
if (arg.containsKey("title")) {
title = (String)arg.get("title"));
}
// what ever you still need
}
An other solution can be (this can fail cause I'm not 100% sure) do a global-command with BindUtils
and write in your codebookTab global-command method that calls your Messagebox.show()
No. couldn't get event thread to stop but while trying I inadvertantly clicked on orig tab and found the Messagebox! Thanks for idea.
robertkaren ( 2014-03-13 22:15:01 +0800 )editAsked: 2014-03-13 21:10:35 +0800
Seen: 11 times
Last updated: Mar 13 '14