}-*/;
public void onWindowClosed() {
+
+ }
+
+ public String onWindowClosing() {
// Change focus on this window in order to ensure that all state is
// collected from textfields
VTextField.flushChangesFromFocusedTextField();
// Send the closing state to server
connection.updateVariable(id, "close", true, false);
connection.sendPendingVariableChangesSync();
- }
- public String onWindowClosing() {
return null;
}
}
// Finds the window within the application
- Window window = getApplicationWindow(request, application);
+ Window window = getApplicationWindow(request, applicationManager,
+ application);
if (window == null) {
throw new ServletException(ERROR_NO_WINDOW_FOUND);
}
* servlet's normal operation.
*/
private Window getApplicationWindow(HttpServletRequest request,
- Application application) throws ServletException {
-
- Window window = null;
+ CommunicationManager applicationManager, Application application)
+ throws ServletException {
// Finds the window where the request is handled
+ Window assumedWindow = null;
String path = getRequestPathInfo(request);
// Main window as the URI is empty
- if (path == null || path.length() == 0 || path.equals("/")
- || path.startsWith("/APP/")) {
- window = application.getMainWindow();
- } else {
+ if (!(path == null || path.length() == 0 || path.equals("/") || path
+ .startsWith("/APP/"))) {
String windowName = null;
if (path.charAt(0) == '/') {
path = path.substring(1);
path = "";
} else {
windowName = path.substring(0, index);
- path = path.substring(index + 1);
}
- window = application.getWindow(windowName);
-
- if (window == null) {
- // By default, we use main window
- window = application.getMainWindow();
- } else if (!window.isVisible()) {
- // Implicitly painting without actually invoking paint()
- window.requestRepaintRequests();
+ assumedWindow = application.getWindow(windowName);
- // If the window is invisible send a blank page
- return null;
- }
}
- return window;
+ return applicationManager.getApplicationWindow(request, this,
+ application, assumedWindow);
}
String getRequestPathInfo(HttpServletRequest request) {
invalidComponentRelativeSizes = ComponentSizeValidator
.validateComponentRelativeSizes(w.getContent(),
null, null);
-
+
// Also check any existing subwindows
if (w.getChildWindows() != null) {
for (Window subWindow : (Set<Window>) w
* if an exception has occurred that interferes with the
* servlet's normal operation.
*/
- private Window getApplicationWindow(HttpServletRequest request,
+ Window getApplicationWindow(HttpServletRequest request,
AbstractApplicationServlet applicationServlet,
Application application, Window assumedWindow)
throws ServletException {
// Get the path from URL
String path = applicationServlet.getRequestPathInfo(request);
- path = path.substring("/UIDL".length());
+ if (path.startsWith("/UIDL")) {
+ path = path.substring("/UIDL".length());
+ }
// If the path is specified, create name from it
if (path != null && path.length() > 0 && !path.equals("/")) {