/* * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.ui; import java.net.MalformedURLException; import java.net.URL; import com.vaadin.server.LegacyApplication; import com.vaadin.server.Page.BrowserWindowResizeEvent; import com.vaadin.server.Page.BrowserWindowResizeListener; import com.vaadin.server.Resource; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.BorderStyle; /** * Helper class to emulate the main window from Vaadin 6 using UIs. This class * should be used in the same way as Window used as a browser level window in * Vaadin 6 with {@link com.vaadin.server.LegacyApplication} */ @Deprecated public class LegacyWindow extends UI { private String name; private LegacyApplication application; /** * Create a new legacy window */ public LegacyWindow() { super(new VerticalLayout()); ((VerticalLayout) getContent()).setMargin(true); } /** * Creates a new legacy window with the given caption * * @param caption * the caption of the window */ public LegacyWindow(String caption) { super(new VerticalLayout()); ((VerticalLayout) getContent()).setMargin(true); setCaption(caption); } /** * Creates a legacy window with the given caption and content layout * * @param caption * @param content */ public LegacyWindow(String caption, ComponentContainer content) { super(content); setCaption(caption); } @Override protected void init(VaadinRequest request) { // Just empty } public void setApplication(LegacyApplication application) { this.application = application; } public LegacyApplication getApplication() { return application; } /** * Gets the unique name of the window. The name of the window is used to * uniquely identify it. *
* The name also determines the URL that can be used for direct access to a * window. All windows can be accessed through * {@code http://host:port/app/win} where {@code http://host:port/app} is * the application URL (as returned by {@link LegacyApplication#getURL()} * and {@code win} is the window name. *
** Note! Portlets do not support direct window access through URLs. *
* * @return the Name of the Window. */ public String getName() { return name; } /** * Sets the unique name of the window. The name of the window is used to * uniquely identify it inside the application. ** The name also determines the URL that can be used for direct access to a * window. All windows can be accessed through * {@code http://host:port/app/win} where {@code http://host:port/app} is * the application URL (as returned by {@link LegacyApplication#getURL()} * and {@code win} is the window name. *
** This method can only be called before the window is added to an * application. *
* Note! Portlets do not support direct window access through URLs. *
* * @param name * the new name for the window or null if the application should * automatically assign a name to it * @throws IllegalStateException * if the window is attached to an application */ public void setName(String name) { this.name = name; // The name can not be changed in application if (isAttached()) { throw new IllegalStateException( "Window name can not be changed while " + "the window is in application"); } } /** * Gets the full URL of the window. The returned URL is window specific and * can be used to directly refer to the window. ** Note! This method can not be used for portlets. *
* * @return the URL of the window or null if the window is not attached to an * application */ public URL getURL() { LegacyApplication application = getApplication(); if (application == null) { return null; } try { return new URL(application.getURL(), getName() + "/"); } catch (MalformedURLException e) { throw new RuntimeException( "Internal problem getting window URL, please report"); } } /** * Opens the given resource in this UI. The contents of this UI is replaced * by the {@code Resource}. * * @param resource * the resource to show in this UI * * @deprecated As of 7.0, use getPage().setLocation instead */ @Deprecated public void open(Resource resource) { open(resource, null, false); } /* ********************************************************************* */ /** * Opens the given resource in a window with the given name. *
* The supplied {@code windowName} is used as the target name in a
* window.open call in the client. This means that special values such as
* "_blank", "_self", "_top", "_parent" have special meaning. An empty or
* null
window name is also a
import { isIE } from "../var/isIE.js";
import { whitespace } from "../var/whitespace.js";
import { support } from "./support.js";
// Build QSA regex.
// Regex strategy adopted from Diego Perini.
export var rbuggyQSA = [];
if ( isIE ) {
rbuggyQSA.push(
// Support: IE 9 - 11+
// IE's :disabled selector does not pick up the children of disabled fieldsets
":enabled",
":disabled",
// Support: IE 11+
// IE 11 doesn't find elements on a `[name='']` query in some cases.
// Adding a temporary attribute to the document before the selection works
// around the issue.
"\\[" + whitespace + "*name" + whitespace + "*=" +
whitespace + "*(?:''|\"\")"
);
}
if ( !support.cssHas ) {
// Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
// Our regular `try-catch` mechanism fails to detect natively-unsupported
// pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
// in browsers that parse the `:has()` argument as a forgiving selector list.
// https://drafts.csswg.org/selectors/#relational now requires the argument
// to be parsed unforgivingly, but browsers have not yet fully adjusted.
rbuggyQSA.push( ":has" );
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );