Modify the main UI and model from a pop-up before closing it

Hi,

I’m building a small web-application using Vaadin.
I have a main UI in my app. There’s a button in there that calls this code :

  BrowserWindowOpener opener = new BrowserWindowOpener(PopUp.class);
    opener.setFeatures("height=500,width=500,resizable");
    opener.extend(button);
[/code]As you can see, I created a class extending this com.vaadin.ui.UI class, intending to make it a popup. In this second class I have another button that should dismiss the popup when clicking on a button calling this function : [code]
   public void click(Button.ClickEvent event){
        TopologyService tService = new TopologyService();
        tService.updateTopology(FormAction.ADD, TargetedElement.CONNECTION, comboBoxi1.getValue(), comboBoxi2.getValue(), comboBoxNorm.getValue(), textfieldSpeed.getValue());     
    

The topologyService here is a controller that operates on my model. This method should do 2 main things :

  • Update the model with the data collected in the popup (passed as parameters here)
  • Update some of the main-UI components accordingly (graphical representation of the model’s state)

In the updateTopology method, I’d like to call my main UI using the getCurrent() method in order to modify some of its component the way I intend to.
I tried to close the pop-up UI to have the current UI changed back to the main one so I could use getCurrent() to get my main UI. To do so I tried using popUpUI.close() and .detach(), both in the click method and the upateTopology one but it doesn’t work
As I’m new to Vaadin, it’s likely I’m misusing those methods and/or misorganized my UIs but I’m stuck and couldn’t find anyone having had this problem resolved.
If you need any additional information, just let met know.

Thanks in advance.

I was indeed going wrong there. To solve my problem, I used the following code in order to close the popup and get access to my main UI. Having this access, I could modify and access everything I needed.

[code]
UI popUp, mainUI;
popUp = UI.getCurrent();
JavaScript.eval(“close()”);
popUp.close();

VaadinSession session = getSession();
mainUI = session.getUIById(mainUIId);
UI.setCurrent(mainUI)
[/code]Concerning the method call from my controller I let it be called in the pop up, since it ends its tasks before closing.

My popup was called on a button click with a BrowserWindowOpener like this

opener = new BrowserWindowOpener(PopUp.class); opener.extend(button Just in case it can help someone.