// no current UI -> set the main window as the current UI
UI.setCurrent(mainWindow);
}
+ mainWindow.setApplication(this);
this.mainWindow = mainWindow;
}
}
@Override
- public UI createInstance(Class<? extends UI> type,
- WrappedRequest request) {
+ public UI createInstance(Class<? extends UI> type, WrappedRequest request) {
return getUIInstance(request);
}
uI.setName(name);
}
+ uI.setApplication(this);
+
legacyUINames.put(uI.getName(), uI);
uI.setSession(VaadinSession.getCurrent());
}
protected Class<?> getAssociatedClass() {
if (associatedClass == null) {
- Class<? extends UI> associatedClass = UI.getCurrent().getClass();
- if (associatedClass == LegacyWindow.class) {
- return VaadinSession.getCurrent().getClass();
+ UI current = UI.getCurrent();
+ if (current instanceof LegacyWindow) {
+ LegacyWindow legacyWindow = (LegacyWindow) current;
+ return legacyWindow.getApplication().getClass();
+ } else {
+ return current.getClass();
}
- return associatedClass;
}
return associatedClass;
}
import java.util.LinkedHashSet;
import java.util.Map;
+import com.vaadin.Application;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.event.ActionManager;
@Deprecated
public static class LegacyWindow extends UI {
private String name;
+ private Application application;
/**
* Create a new legacy window
// Just empty
}
+ public void setApplication(Application application) {
+ this.application = application;
+ }
+
+ public Application getApplication() {
+ return application;
+ }
+
/**
* Gets the unique name of the window. The name of the window is used to
* uniquely identify it.