0

Messagebox.show with change in Tabpanel focus

asked 2014-03-13 21:10:35 +0800

robertkaren gravatar image robertkaren
77 7

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) {
        }
    }
}
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-03-13 21:51:22 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2014-03-13 22:17:27 +0800

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()

link publish delete flag offensive edit

Comments

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
Your answer
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: 2014-03-13 21:10:35 +0800

Seen: 11 times

Last updated: Mar 13 '14

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