Change-Id: I2ca0b41c3cc2ed851646ced2e0693a93b1853c95tags/8.0.0.alpha1
return browserDetails.isSafari(); | return browserDetails.isSafari(); | ||||
} | } | ||||
@Deprecated | |||||
public boolean isIE8() { | public boolean isIE8() { | ||||
return isIE() && getBrowserMajorVersion() == 8; | return isIE() && getBrowserMajorVersion() == 8; | ||||
} | } | ||||
@Deprecated | |||||
public boolean isIE9() { | public boolean isIE9() { | ||||
return isIE() && getBrowserMajorVersion() == 9; | return isIE() && getBrowserMajorVersion() == 9; | ||||
} | } | ||||
@Deprecated | |||||
public boolean isIE10() { | public boolean isIE10() { | ||||
return isIE() && getBrowserMajorVersion() == 10; | return isIE() && getBrowserMajorVersion() == 10; | ||||
} | } | ||||
return (getBrowserMajorVersion() > majorVersion); | return (getBrowserMajorVersion() > majorVersion); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Assigns a measured size to an element. Method defined as protected to | |||||
* allow separate implementation for IE8. | |||||
* Assigns a measured size to an element. Method defined as protected for | |||||
* legacy reasons. | |||||
* | * | ||||
* @param element | * @param element | ||||
* the dom element to attach the measured size to | * the dom element to attach the measured size to | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
* Gets the measured size for an element. Method defined as protected to | |||||
* allow separate implementation for IE8. | |||||
* Gets the measured size for an element. Method defined as protected for | |||||
* legacy reasons. | |||||
* | * | ||||
* @param element | * @param element | ||||
* The element to get measured size for | * The element to get measured size for | ||||
/** | /** | ||||
* Called once per iteration in the layout loop before size calculations so | * Called once per iteration in the layout loop before size calculations so | ||||
* different browsers quirks can be handled. Mainly this is currently for | |||||
* the IE8 permutation. | |||||
* different browsers quirks can be handled. Mainly this exists for legacy | |||||
* reasons. | |||||
*/ | */ | ||||
protected void performBrowserLayoutHacks() { | protected void performBrowserLayoutHacks() { | ||||
// Permutations implement this | // Permutations implement this | ||||
} | } | ||||
Profiler.leave("layout PostLayoutListener"); | Profiler.leave("layout PostLayoutListener"); | ||||
cleanMeasuredSizes(); | |||||
getLogger().info("Total layout phase time: " | getLogger().info("Total layout phase time: " | ||||
+ totalDuration.elapsedMillis() + "ms"); | + totalDuration.elapsedMillis() + "ms"); | ||||
} | } | ||||
private void setNeedsOverflowFix(ComponentConnector connector) { | private void setNeedsOverflowFix(ComponentConnector connector) { | ||||
// IE9 doesn't need the original fix, but for some reason it needs this | // IE9 doesn't need the original fix, but for some reason it needs this | ||||
if (BrowserInfo.get().requiresOverflowAutoFix() | |||||
|| BrowserInfo.get().isIE9()) { | |||||
if (BrowserInfo.get().requiresOverflowAutoFix()) { | |||||
ComponentConnector scrollingBoundary = currentDependencyTree | ComponentConnector scrollingBoundary = currentDependencyTree | ||||
.getScrollingBoundary(connector); | .getScrollingBoundary(connector); | ||||
if (scrollingBoundary != null) { | if (scrollingBoundary != null) { | ||||
everythingNeedsMeasure = true; | everythingNeedsMeasure = true; | ||||
} | } | ||||
/** | |||||
* Clean measured sizes which are no longer needed. Only for IE8. | |||||
*/ | |||||
public void cleanMeasuredSizes() { | |||||
} | |||||
private static Logger getLogger() { | private static Logger getLogger() { | ||||
return Logger.getLogger(LayoutManager.class.getName()); | return Logger.getLogger(LayoutManager.class.getName()); | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
/* | |||||
* Copyright 2000-2016 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.client; | |||||
import java.util.HashMap; | |||||
import java.util.Iterator; | |||||
import java.util.Map; | |||||
import com.google.gwt.dom.client.Document; | |||||
import com.google.gwt.dom.client.Element; | |||||
import com.google.gwt.dom.client.Node; | |||||
import com.google.gwt.user.client.ui.RootPanel; | |||||
/** | |||||
* Alternative MeasuredSize storage for IE8. Storing any information in a DOM | |||||
* element in IE8 seems to make the browser think the element has changed in a | |||||
* way that requires a reflow. To work around that, the MeasureData is instead | |||||
* stored in Map for IE8. | |||||
* | |||||
* This implementation is injected for IE8 by a replace-with definition in the | |||||
* GWT module. | |||||
* | |||||
* @author Vaadin Ltd | |||||
* @since 7.0.0 | |||||
*/ | |||||
public class LayoutManagerIE8 extends LayoutManager { | |||||
private Map<Element, MeasuredSize> measuredSizes = new HashMap<Element, MeasuredSize>(); | |||||
// this method is needed to test for memory leaks (see | |||||
// LayoutMemoryUsageIE8ExtensionConnector) but can be private | |||||
private int getMeasuredSizesMapSize() { | |||||
return measuredSizes.size(); | |||||
} | |||||
@Override | |||||
protected void setMeasuredSize(Element element, MeasuredSize measuredSize) { | |||||
if (measuredSize != null) { | |||||
measuredSizes.put(element, measuredSize); | |||||
} else { | |||||
measuredSizes.remove(element); | |||||
} | |||||
// clear any values that are saved to the element | |||||
if (super.getMeasuredSize(element, null) != null) { | |||||
super.setMeasuredSize(element, null); | |||||
} | |||||
} | |||||
@Override | |||||
protected MeasuredSize getMeasuredSize(Element element, | |||||
MeasuredSize defaultSize) { | |||||
MeasuredSize measured = measuredSizes.get(element); | |||||
if (measured != null) { | |||||
return measured; | |||||
} else { | |||||
// check if saved to the element instead | |||||
MeasuredSize measuredSize = super.getMeasuredSize(element, null); | |||||
if (measuredSize != null) { | |||||
// move the value back to the map | |||||
setMeasuredSize(element, measuredSize); | |||||
return measuredSize; | |||||
} | |||||
return defaultSize; | |||||
} | |||||
} | |||||
@Override | |||||
public void cleanMeasuredSizes() { | |||||
Profiler.enter("LayoutManager.cleanMeasuredSizes"); | |||||
// #12688: IE8 was leaking memory when adding&removing components. | |||||
// Uses IE specific logic to figure if an element has been removed from | |||||
// DOM or not. For removed elements the measured size is stored within | |||||
// the element in case the element gets re-attached. | |||||
Node rootNode = Document.get().getBody(); | |||||
Iterator<Element> i = measuredSizes.keySet().iterator(); | |||||
while (i.hasNext()) { | |||||
Element e = i.next(); | |||||
if (!rootNode.isOrHasChild(e)) { | |||||
// Store in element in case is still needed. | |||||
// Not attached, so reflow isn't a problem. | |||||
super.setMeasuredSize(e, measuredSizes.get(e)); | |||||
i.remove(); | |||||
} | |||||
} | |||||
Profiler.leave("LayoutManager.cleanMeasuredSizes"); | |||||
} | |||||
@Override | |||||
protected void performBrowserLayoutHacks() { | |||||
Profiler.enter("LayoutManagerIE8.performBrowserLayoutHacks"); | |||||
/* | |||||
* Fixes IE8 issues where IE8 sometimes forgets to update the size of | |||||
* the containing element. To force a reflow by modifying the magical | |||||
* zoom property. | |||||
*/ | |||||
WidgetUtil.forceIE8Redraw(RootPanel.get().getElement()); | |||||
Profiler.leave("LayoutManagerIE8.performBrowserLayoutHacks"); | |||||
} | |||||
} |
} else if (evt.getButton() == NativeEvent.BUTTON_MIDDLE) { | } else if (evt.getButton() == NativeEvent.BUTTON_MIDDLE) { | ||||
mouseEventDetails.setButton(MouseButton.MIDDLE); | mouseEventDetails.setButton(MouseButton.MIDDLE); | ||||
} else { | } else { | ||||
// IE8 does not always report a button. Assume left. | |||||
// No button reported? Assume left. | |||||
mouseEventDetails.setButton(MouseButton.LEFT); | mouseEventDetails.setButton(MouseButton.LEFT); | ||||
} | } | ||||
mouseEventDetails.setAltKey(evt.getAltKey()); | mouseEventDetails.setAltKey(evt.getAltKey()); | ||||
} | } | ||||
} | } | ||||
WidgetUtil.forceWebkitRedraw(element); | WidgetUtil.forceWebkitRedraw(element); | ||||
} | } | ||||
/** | |||||
* Performs a hack to trigger a re-layout in the IE8. This is usually | |||||
* necessary in cases where IE8 "forgets" to update child elements when they | |||||
* resize. | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#forceIE8Redraw(Element)} | |||||
* instead. | |||||
* | |||||
* @param e | |||||
* The element to perform the hack on | |||||
*/ | |||||
@Deprecated | |||||
public static final void forceIE8Redraw(Element e) { | |||||
WidgetUtil.forceIE8Redraw(e); | |||||
} | |||||
/** | /** | ||||
* Performs a hack to trigger a re-layout in the IE browser. This is usually | * Performs a hack to trigger a re-layout in the IE browser. This is usually | ||||
* necessary in cases where IE "forgets" to update child elements when they | * necessary in cases where IE "forgets" to update child elements when they | ||||
return Logger.getLogger(Util.class.getName()); | return Logger.getLogger(Util.class.getName()); | ||||
} | } | ||||
} | } | ||||
* @see ApplicationConnection#getVTooltip() | * @see ApplicationConnection#getVTooltip() | ||||
*/ | */ | ||||
public VTooltip() { | public VTooltip() { | ||||
super(false, false, true); | |||||
super(false, false); // no autohide, not modal | |||||
setStyleName(CLASSNAME); | setStyleName(CLASSNAME); | ||||
FlowPanel layout = new FlowPanel(); | FlowPanel layout = new FlowPanel(); | ||||
setWidget(layout); | setWidget(layout); | ||||
layout.add(em); | layout.add(em); | ||||
DOM.setElementProperty(description, "className", CLASSNAME + "-text"); | DOM.setElementProperty(description, "className", CLASSNAME + "-text"); | ||||
DOM.appendChild(layout.getElement(), description); | DOM.appendChild(layout.getElement(), description); | ||||
setSinkShadowEvents(true); | |||||
// When a tooltip is shown, the content of the tooltip changes. With a | // When a tooltip is shown, the content of the tooltip changes. With a | ||||
// tooltip being a live-area, this change is notified to a assistive | // tooltip being a live-area, this change is notified to a assistive |
import com.google.gwt.dom.client.Node; | import com.google.gwt.dom.client.Node; | ||||
import com.google.gwt.dom.client.NodeList; | import com.google.gwt.dom.client.NodeList; | ||||
import com.google.gwt.dom.client.Style; | import com.google.gwt.dom.client.Style; | ||||
import com.google.gwt.dom.client.Style.Display; | |||||
import com.google.gwt.dom.client.Style.Unit; | import com.google.gwt.dom.client.Style.Unit; | ||||
import com.google.gwt.dom.client.Touch; | import com.google.gwt.dom.client.Touch; | ||||
import com.google.gwt.event.dom.client.KeyEvent; | import com.google.gwt.event.dom.client.KeyEvent; | ||||
public static native Element getElementFromPoint(int clientX, int clientY) | public static native Element getElementFromPoint(int clientX, int clientY) | ||||
/*-{ | /*-{ | ||||
var el = $wnd.document.elementFromPoint(clientX, clientY); | var el = $wnd.document.elementFromPoint(clientX, clientY); | ||||
// Call elementFromPoint two times to make sure IE8 also returns something sensible if the application is running in an iframe | |||||
el = $wnd.document.elementFromPoint(clientX, clientY); | |||||
if(el != null && el.nodeType == 3) { | if(el != null && el.nodeType == 3) { | ||||
el = el.parentNode; | el = el.parentNode; | ||||
} | } | ||||
public static String escapeHTML(String html) { | public static String escapeHTML(String html) { | ||||
DOM.setInnerText(escapeHtmlHelper, html); | DOM.setInnerText(escapeHtmlHelper, html); | ||||
String escapedText = DOM.getInnerHTML(escapeHtmlHelper); | String escapedText = DOM.getInnerHTML(escapeHtmlHelper); | ||||
if (BrowserInfo.get().isIE8()) { | |||||
// #7478 IE8 "incorrectly" returns "<br>" for newlines set using | |||||
// setInnerText. The same for " " which is converted to " " | |||||
escapedText = escapedText.replaceAll("<(BR|br)>", "\n"); | |||||
escapedText = escapedText.replaceAll(" ", " "); | |||||
} | |||||
return escapedText; | return escapedText; | ||||
} | } | ||||
public static int getRequiredWidth( | public static int getRequiredWidth( | ||||
com.google.gwt.dom.client.Element element) { | com.google.gwt.dom.client.Element element) { | ||||
int reqWidth = getRequiredWidthBoundingClientRect(element); | int reqWidth = getRequiredWidthBoundingClientRect(element); | ||||
if (BrowserInfo.get().isIE() && !BrowserInfo.get().isIE8()) { | |||||
if (BrowserInfo.get().isIE()) { | |||||
int csSize = getRequiredWidthComputedStyle(element); | int csSize = getRequiredWidthComputedStyle(element); | ||||
if (csSize == reqWidth + 1) { | if (csSize == reqWidth + 1) { | ||||
// If computed style reports one pixel larger than requiredWidth | // If computed style reports one pixel larger than requiredWidth | ||||
public static double getRequiredWidthDouble( | public static double getRequiredWidthDouble( | ||||
com.google.gwt.dom.client.Element element) { | com.google.gwt.dom.client.Element element) { | ||||
double reqWidth = getRequiredWidthBoundingClientRectDouble(element); | double reqWidth = getRequiredWidthBoundingClientRectDouble(element); | ||||
if (BrowserInfo.get().isIE() && !BrowserInfo.get().isIE8()) { | |||||
if (BrowserInfo.get().isIE()) { | |||||
double csWidth = getRequiredWidthComputedStyleDouble(element); | double csWidth = getRequiredWidthComputedStyleDouble(element); | ||||
if (csWidth > reqWidth && csWidth <= (reqWidth + 1)) { | if (csWidth > reqWidth && csWidth <= (reqWidth + 1)) { | ||||
// IE9 rounds reqHeight to integers BUT sometimes reports wrong | // IE9 rounds reqHeight to integers BUT sometimes reports wrong | ||||
public static int getRequiredHeight( | public static int getRequiredHeight( | ||||
com.google.gwt.dom.client.Element element) { | com.google.gwt.dom.client.Element element) { | ||||
int reqHeight = getRequiredHeightBoundingClientRect(element); | int reqHeight = getRequiredHeightBoundingClientRect(element); | ||||
if (BrowserInfo.get().isIE() && !BrowserInfo.get().isIE8()) { | |||||
if (BrowserInfo.get().isIE()) { | |||||
int csSize = getRequiredHeightComputedStyle(element); | int csSize = getRequiredHeightComputedStyle(element); | ||||
if (csSize == reqHeight + 1) { | if (csSize == reqHeight + 1) { | ||||
// If computed style reports one pixel larger than | // If computed style reports one pixel larger than | ||||
public static double getRequiredHeightDouble( | public static double getRequiredHeightDouble( | ||||
com.google.gwt.dom.client.Element element) { | com.google.gwt.dom.client.Element element) { | ||||
double reqHeight = getRequiredHeightBoundingClientRectDouble(element); | double reqHeight = getRequiredHeightBoundingClientRectDouble(element); | ||||
if (BrowserInfo.get().isIE() && !BrowserInfo.get().isIE8()) { | |||||
if (BrowserInfo.get().isIE()) { | |||||
double csHeight = getRequiredHeightComputedStyleDouble(element); | double csHeight = getRequiredHeightComputedStyleDouble(element); | ||||
if (csHeight > reqHeight && csHeight <= (reqHeight + 1)) { | if (csHeight > reqHeight && csHeight <= (reqHeight + 1)) { | ||||
// IE9 rounds reqHeight to integers BUT sometimes reports wrong | // IE9 rounds reqHeight to integers BUT sometimes reports wrong | ||||
return @com.vaadin.client.WidgetUtil::getRequiredHeightBoundingClientRectDouble(Lcom/google/gwt/dom/client/Element;)(element); | return @com.vaadin.client.WidgetUtil::getRequiredHeightBoundingClientRectDouble(Lcom/google/gwt/dom/client/Element;)(element); | ||||
} | } | ||||
var height = parseFloat(heightPx); // Will automatically skip "px" suffix | var height = parseFloat(heightPx); // Will automatically skip "px" suffix | ||||
var border = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth); // Will automatically skip "px" suffix | |||||
var border = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth); // Will automatically skip "px" suffix | |||||
var padding = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom); // Will automatically skip "px" suffix | var padding = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom); // Will automatically skip "px" suffix | ||||
return height+border+padding; | return height+border+padding; | ||||
}-*/; | }-*/; | ||||
} | } | ||||
} | } | ||||
/** | |||||
* Performs a hack to trigger a re-layout in the IE8. This is usually | |||||
* necessary in cases where IE8 "forgets" to update child elements when they | |||||
* resize. | |||||
* | |||||
* @param e | |||||
* The element to perform the hack on | |||||
*/ | |||||
public static final void forceIE8Redraw(Element e) { | |||||
if (BrowserInfo.get().isIE8()) { | |||||
forceIERedraw(e); | |||||
} | |||||
} | |||||
/** | /** | ||||
* Performs a hack to trigger a re-layout in the IE browser. This is usually | * Performs a hack to trigger a re-layout in the IE browser. This is usually | ||||
* necessary in cases where IE "forgets" to update child elements when they | * necessary in cases where IE "forgets" to update child elements when they | ||||
* @return the corresponding absolute URL as a string | * @return the corresponding absolute URL as a string | ||||
*/ | */ | ||||
public static String getAbsoluteUrl(String url) { | public static String getAbsoluteUrl(String url) { | ||||
if (BrowserInfo.get().isIE8()) { | |||||
// The hard way - must use innerHTML and attach to DOM in IE8 | |||||
DivElement divElement = Document.get().createDivElement(); | |||||
divElement.getStyle().setDisplay(Display.NONE); | |||||
RootPanel.getBodyElement().appendChild(divElement); | |||||
divElement.setInnerHTML( | |||||
"<a href='" + escapeAttribute(url) + "' ></a>"); | |||||
AnchorElement a = divElement.getChild(0).cast(); | |||||
String href = a.getHref(); | |||||
RootPanel.getBodyElement().removeChild(divElement); | |||||
return href; | |||||
} else { | |||||
AnchorElement a = Document.get().createAnchorElement(); | |||||
a.setHref(url); | |||||
return a.getHref(); | |||||
} | |||||
AnchorElement a = Document.get().createAnchorElement(); | |||||
a.setHref(url); | |||||
return a.getHref(); | |||||
} | } | ||||
/** | /** | ||||
var cloneElement = element.cloneNode(false); | var cloneElement = element.cloneNode(false); | ||||
cloneElement.style.boxSizing ="content-box"; | cloneElement.style.boxSizing ="content-box"; | ||||
parentElement.appendChild(cloneElement); | parentElement.appendChild(cloneElement); | ||||
cloneElement.style.height = "10px"; // IE8 wants the height to be set to something... | |||||
var heightWithBorder = cloneElement.offsetHeight; | var heightWithBorder = cloneElement.offsetHeight; | ||||
for (i=0; i< borderNames.length; i++) { | for (i=0; i< borderNames.length; i++) { | ||||
cloneElement.style[borderNames[i]] = "0"; | cloneElement.style[borderNames[i]] = "0"; | ||||
} | } | ||||
private static double roundSize(double size, boolean roundUp) { | private static double roundSize(double size, boolean roundUp) { | ||||
if (BrowserInfo.get().isIE8()) { | |||||
if (roundUp) { | |||||
return Math.ceil(size); | |||||
} else { | |||||
return (int) size; | |||||
} | |||||
} | |||||
double factor = getSubPixelRoundingFactor(); | double factor = getSubPixelRoundingFactor(); | ||||
if (factor < 0 || size < 0) { | if (factor < 0 || size < 0) { | ||||
return size; | return size; | ||||
return integerPart + ((int) nrFractions) / divisor; | return integerPart + ((int) nrFractions) / divisor; | ||||
} | } | ||||
} | } | ||||
// Unregister all the old connectors that have now been removed | // Unregister all the old connectors that have now been removed | ||||
unregisterRemovedConnectors( | unregisterRemovedConnectors( | ||||
connectorHierarchyUpdateResult.detachedConnectorIds); | connectorHierarchyUpdateResult.detachedConnectorIds); | ||||
getLayoutManager().cleanMeasuredSizes(); | |||||
} | } | ||||
private void updateCaptions( | private void updateCaptions( | ||||
if (connector instanceof AbstractConnector) { | if (connector instanceof AbstractConnector) { | ||||
// optimization as the loop setting properties is very | // optimization as the loop setting properties is very | ||||
// slow, especially on IE8 | |||||
// slow | |||||
replaceState((AbstractConnector) connector, | replaceState((AbstractConnector) connector, | ||||
defaultState); | defaultState); | ||||
} else { | } else { |
import com.google.gwt.core.client.JavaScriptObject; | import com.google.gwt.core.client.JavaScriptObject; | ||||
import com.google.gwt.core.client.JsArrayString; | import com.google.gwt.core.client.JsArrayString; | ||||
import com.google.gwt.dom.client.NativeEvent; | import com.google.gwt.dom.client.NativeEvent; | ||||
import com.vaadin.client.BrowserInfo; | |||||
import com.vaadin.client.JavaScriptConnectorHelper; | import com.vaadin.client.JavaScriptConnectorHelper; | ||||
import com.vaadin.client.Util; | import com.vaadin.client.Util; | ||||
import com.vaadin.client.communication.HasJavaScriptConnectorHelper; | import com.vaadin.client.communication.HasJavaScriptConnectorHelper; | ||||
private final JavaScriptConnectorHelper helper = new JavaScriptConnectorHelper( | private final JavaScriptConnectorHelper helper = new JavaScriptConnectorHelper( | ||||
this); | this); | ||||
private final JavaScriptObject cellReferenceWrapper = createCellReferenceWrapper( | |||||
BrowserInfo.get().isIE8()); | |||||
private final JavaScriptObject cellReferenceWrapper = createCellReferenceWrapper(); | |||||
@Override | @Override | ||||
protected void init() { | protected void init() { | ||||
addGetRowKey(helper.getConnectorWrapper()); | addGetRowKey(helper.getConnectorWrapper()); | ||||
} | } | ||||
private static native JavaScriptObject createCellReferenceWrapper( | |||||
boolean isIE8) | |||||
private static native JavaScriptObject createCellReferenceWrapper() | |||||
/*-{ | /*-{ | ||||
var reference = {}; | var reference = {}; | ||||
if (isIE8) { | |||||
// IE8 only supports defineProperty for DOM objects | |||||
reference = $doc.createElement('div'); | |||||
} | |||||
var setProperty = function(name, getter, setter) { | var setProperty = function(name, getter, setter) { | ||||
var descriptor = { | var descriptor = { | ||||
return helper; | return helper; | ||||
} | } | ||||
} | } | ||||
.getAtmosphereVersion(); | .getAtmosphereVersion(); | ||||
String jsVersion = applicationConfiguration.getAtmosphereJSVersion(); | String jsVersion = applicationConfiguration.getAtmosphereJSVersion(); | ||||
String themeVersion; | |||||
boolean themeOk; | |||||
if (com.vaadin.client.BrowserInfo.get().isIE8()) { | |||||
themeVersion = "<IE8 can't detect this>"; | |||||
themeOk = true; | |||||
} else { | |||||
themeVersion = getThemeVersion(); | |||||
themeOk = equalsEither(themeVersion, clientVersion, servletVersion); | |||||
} | |||||
String themeVersion = getThemeVersion(); | |||||
boolean themeOk = equalsEither(themeVersion, clientVersion, | |||||
servletVersion); | |||||
boolean clientOk = equalsEither(clientVersion, servletVersion, | boolean clientOk = equalsEither(clientVersion, servletVersion, | ||||
themeVersion); | themeVersion); | ||||
} | } | ||||
} | } | ||||
@NotStrict | @NotStrict | ||||
public CssResource css(); | public CssResource css(); | ||||
// Can't embed because IE8 doesn't support datauri for fonts (images only) | |||||
// Could embed | |||||
@Source("font.eot") | @Source("font.eot") | ||||
@DoNotEmbed | @DoNotEmbed | ||||
DataResource iconFontEot(); | DataResource iconFontEot(); | ||||
@DoNotEmbed | @DoNotEmbed | ||||
DataResource iconFontSvg(); | DataResource iconFontSvg(); | ||||
} | |||||
} |
import java.util.logging.Logger; | import java.util.logging.Logger; | ||||
import com.google.gwt.core.client.JavaScriptObject; | import com.google.gwt.core.client.JavaScriptObject; | ||||
import com.google.gwt.dom.client.Element; | |||||
import com.vaadin.client.BrowserInfo; | |||||
import com.vaadin.client.LayoutManager; | import com.vaadin.client.LayoutManager; | ||||
import com.vaadin.client.ServerConnector; | import com.vaadin.client.ServerConnector; | ||||
import com.vaadin.client.communication.StateChangeEvent; | import com.vaadin.client.communication.StateChangeEvent; | ||||
// Get all the rulesets from the stylesheet | // Get all the rulesets from the stylesheet | ||||
var theRules = new Array(); | var theRules = new Array(); | ||||
var IEOrEdge = @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isIE()() || @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isEdge()(); | var IEOrEdge = @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isIE()() || @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isEdge()(); | ||||
var IE8 = @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isIE8()(); | |||||
try { | try { | ||||
if (sheet.cssRules) { | if (sheet.cssRules) { | ||||
return; | return; | ||||
} | } | ||||
// Special import handling for IE8 | |||||
if (IE8) { | |||||
try { | |||||
for(var i = 0, len = sheet.imports.length; i < len; i++) { | |||||
@com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(sheet.imports[i]); | |||||
} | |||||
} catch(e) { | |||||
// This is added due to IE8 failing to handle imports of some sheets for unknown reason (throws a permission denied exception) | |||||
@com.vaadin.client.extensions.ResponsiveConnector::error(Ljava/lang/String;)("Failed to handle imports of CSS style sheet: " + sheet.href); | |||||
} | |||||
} | |||||
// Loop through the rulesets | // Loop through the rulesets | ||||
for(var i = 0, len = theRules.length; i < len; i++) { | for(var i = 0, len = theRules.length; i < len; i++) { | ||||
var rule = theRules[i]; | var rule = theRules[i]; | ||||
int width = layoutManager.getOuterWidth(element); | int width = layoutManager.getOuterWidth(element); | ||||
int height = layoutManager.getOuterHeight(element); | int height = layoutManager.getOuterHeight(element); | ||||
boolean forceRedraw = false; | |||||
String oldWidthRanges = currentWidthRanges; | String oldWidthRanges = currentWidthRanges; | ||||
String oldHeightRanges = currentHeightRanges; | String oldHeightRanges = currentHeightRanges; | ||||
if (!"".equals(currentWidthRanges)) { | if (!"".equals(currentWidthRanges)) { | ||||
element.setAttribute("width-range", currentWidthRanges); | element.setAttribute("width-range", currentWidthRanges); | ||||
forceRedraw = true; | |||||
} else { | } else { | ||||
element.removeAttribute("width-range"); | element.removeAttribute("width-range"); | ||||
} | } | ||||
if (!"".equals(currentHeightRanges)) { | if (!"".equals(currentHeightRanges)) { | ||||
element.setAttribute("height-range", currentHeightRanges); | element.setAttribute("height-range", currentHeightRanges); | ||||
forceRedraw = true; | |||||
} else { | } else { | ||||
element.removeAttribute("height-range"); | element.removeAttribute("height-range"); | ||||
} | } | ||||
if (forceRedraw) { | |||||
forceRedrawIfIE8(element); | |||||
} | |||||
// If a new breakpoint is triggered, ensure all sizes are updated in | // If a new breakpoint is triggered, ensure all sizes are updated in | ||||
// case some new styles are applied | // case some new styles are applied | ||||
if (!currentWidthRanges.equals(oldWidthRanges) | if (!currentWidthRanges.equals(oldWidthRanges) | ||||
} | } | ||||
} | } | ||||
/** | |||||
* Forces IE8 to reinterpret CSS rules. | |||||
* {@link com.vaadin.client.WidgetUtil#forceIE8Redraw(com.google.gwt.dom.client.Element)} | |||||
* doesn't work in this case. | |||||
* | |||||
* @param element | |||||
* the element to redraw | |||||
*/ | |||||
private void forceRedrawIfIE8(Element element) { | |||||
if (BrowserInfo.get().isIE8()) { | |||||
element.addClassName("foo"); | |||||
element.removeClassName("foo"); | |||||
} | |||||
} | |||||
private native String resolveBreakpoint(String which, int size) | private native String resolveBreakpoint(String which, int size) | ||||
/*-{ | /*-{ | ||||
}-*/; | }-*/; | ||||
} | } | ||||
// FireFox likes "wheel", while others use "mousewheel" | // FireFox likes "wheel", while others use "mousewheel" | ||||
var eventName = 'onmousewheel' in element ? 'mousewheel' : 'wheel'; | var eventName = 'onmousewheel' in element ? 'mousewheel' : 'wheel'; | ||||
element.addEventListener(eventName, this.@com.vaadin.client.ui.JsniMousewheelHandler::mousewheelListenerFunction); | element.addEventListener(eventName, this.@com.vaadin.client.ui.JsniMousewheelHandler::mousewheelListenerFunction); | ||||
} else { | |||||
// IE8 | |||||
element.attachEvent("onmousewheel", this.@com.vaadin.client.ui.JsniMousewheelHandler::mousewheelListenerFunction); | |||||
} | } | ||||
}-*/; | }-*/; | ||||
// FireFox likes "wheel", while others use "mousewheel" | // FireFox likes "wheel", while others use "mousewheel" | ||||
var eventName = element.onwheel===undefined?"mousewheel":"wheel"; | var eventName = element.onwheel===undefined?"mousewheel":"wheel"; | ||||
element.removeEventListener(eventName, this.@com.vaadin.client.ui.JsniMousewheelHandler::mousewheelListenerFunction); | element.removeEventListener(eventName, this.@com.vaadin.client.ui.JsniMousewheelHandler::mousewheelListenerFunction); | ||||
} else { | |||||
// IE8 | |||||
element.detachEvent("onmousewheel", this.@com.vaadin.client.ui.JsniMousewheelHandler::mousewheelListenerFunction); | |||||
} | } | ||||
}-*/; | }-*/; | ||||
} | } | ||||
} | } | ||||
// ensure ne values | // ensure ne values | ||||
Style style = getElement().getStyle(); | Style style = getElement().getStyle(); | ||||
/* | |||||
* IE8 dies when nulling zIndex, even in IE7 mode. All other css | |||||
* properties (and even in older IE's) accept null values just | |||||
* fine. Assign empty string instead of null. | |||||
*/ | |||||
if (zIndex != null) { | |||||
style.setProperty("zIndex", zIndex); | |||||
} else { | |||||
style.setProperty("zIndex", ""); | |||||
} | |||||
style.setProperty("zIndex", zIndex); | |||||
style.setProperty("top", top); | style.setProperty("top", top); | ||||
style.setProperty("left", left); | style.setProperty("left", left); | ||||
style.setProperty("right", right); | style.setProperty("right", right); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
DOM.setCapture(getElement()); | DOM.setCapture(getElement()); | ||||
isCapturing = true; | isCapturing = true; | ||||
addStyleName(CLASSNAME_PRESSED); | addStyleName(CLASSNAME_PRESSED); | ||||
if (BrowserInfo.get().isIE8() || BrowserInfo.get().isIE9()) { | |||||
/* | |||||
* We need to prevent the default behavior on these browsers | |||||
* since user-select is not available. | |||||
*/ | |||||
event.preventDefault(); | |||||
} | |||||
} | } | ||||
break; | break; | ||||
case Event.ONMOUSEUP: | case Event.ONMOUSEUP: | ||||
} | } | ||||
removeStyleName(CLASSNAME_PRESSED); | removeStyleName(CLASSNAME_PRESSED); | ||||
// Explicitly prevent IE 8 from propagating mouseup events | |||||
// upward (fixes #6753) | |||||
if (BrowserInfo.get().isIE8()) { | |||||
event.stopPropagation(); | |||||
} | |||||
} | } | ||||
break; | break; | ||||
case Event.ONMOUSEMOVE: | case Event.ONMOUSEMOVE: | ||||
private static native int getHorizontalBorderAndPaddingWidth(Element elem) | private static native int getHorizontalBorderAndPaddingWidth(Element elem) | ||||
/*-{ | /*-{ | ||||
// THIS METHOD IS ONLY USED FOR INTERNET EXPLORER, IT DOESN'T WORK WITH OTHERS | // THIS METHOD IS ONLY USED FOR INTERNET EXPLORER, IT DOESN'T WORK WITH OTHERS | ||||
var convertToPixel = function(elem, value) { | var convertToPixel = function(elem, value) { | ||||
// From the awesome hack by Dean Edwards | // From the awesome hack by Dean Edwards | ||||
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | ||||
return ret; | return ret; | ||||
} | } | ||||
var ret = 0; | var ret = 0; | ||||
var sides = ["Right","Left"]; | var sides = ["Right","Left"]; | ||||
}-*/; | }-*/; | ||||
} | } | ||||
* to be set as an owner of menu | * to be set as an owner of menu | ||||
*/ | */ | ||||
public VContextMenu() { | public VContextMenu() { | ||||
super(true, false, true); | |||||
super(true, false); | |||||
setWidget(menu); | setWidget(menu); | ||||
setStyleName("v-contextmenu"); | setStyleName("v-contextmenu"); | ||||
getElement().setId(DOM.createUniqueId()); | getElement().setId(DOM.createUniqueId()); |
import com.google.gwt.dom.client.Document; | import com.google.gwt.dom.client.Document; | ||||
import com.google.gwt.dom.client.Element; | import com.google.gwt.dom.client.Element; | ||||
import com.google.gwt.dom.client.NativeEvent; | import com.google.gwt.dom.client.NativeEvent; | ||||
import com.google.gwt.dom.client.Node; | |||||
import com.google.gwt.dom.client.Style; | import com.google.gwt.dom.client.Style; | ||||
import com.google.gwt.dom.client.Style.Display; | import com.google.gwt.dom.client.Style.Display; | ||||
import com.google.gwt.dom.client.Style.Unit; | import com.google.gwt.dom.client.Style.Unit; | ||||
* Default constructor | * Default constructor | ||||
*/ | */ | ||||
SuggestionPopup() { | SuggestionPopup() { | ||||
super(true, false, true); | |||||
super(true, false); | |||||
debug("VFS.SP: constructor()"); | debug("VFS.SP: constructor()"); | ||||
setOwner(VFilterSelect.this); | setOwner(VFilterSelect.this); | ||||
menu = new SuggestionMenu(); | menu = new SuggestionMenu(); | ||||
.clearWidth(); | .clearWidth(); | ||||
setPopupPositionAndShow(popup); | setPopupPositionAndShow(popup); | ||||
// Fix for #14173 | |||||
// IE9 and IE10 have a bug, when resize an a element with | |||||
// box-shadow. | |||||
// IE9 and IE10 need explicit update to remove extra | |||||
// box-shadows | |||||
if (BrowserInfo.get().isIE9() | |||||
|| BrowserInfo.get().isIE10()) { | |||||
forceReflow(); | |||||
} | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
menu.setWidth(Window.getClientWidth() + "px"); | menu.setWidth(Window.getClientWidth() + "px"); | ||||
} | } | ||||
if (BrowserInfo.get().isIE() | |||||
&& BrowserInfo.get().getBrowserMajorVersion() < 10) { | |||||
setTdWidth(menu.getElement(), Window.getClientWidth() - 8); | |||||
} | |||||
} | } | ||||
setPopupPosition(left, top); | setPopupPosition(left, top); | ||||
width = WidgetUtil.escapeAttribute(suggestionPopupWidth); | width = WidgetUtil.escapeAttribute(suggestionPopupWidth); | ||||
} | } | ||||
menu.setWidth(width); | menu.setWidth(width); | ||||
// IE8 or 9? | |||||
if (BrowserInfo.get().isIE() | |||||
&& BrowserInfo.get().getBrowserMajorVersion() < 10) { | |||||
// using legacy mode? | |||||
if (suggestionPopupWidth == null) { | |||||
// set the TD widths manually as these browsers do not | |||||
// respect display: block; width:100% rules | |||||
setTdWidth(menu.getElement(), naturalMenuWidth); | |||||
} else { | |||||
int compensation = WidgetUtil | |||||
.measureHorizontalPaddingAndBorder( | |||||
menu.getElement(), 4); | |||||
setTdWidth(menu.getElement(), | |||||
menu.getOffsetWidth() - compensation); | |||||
} | |||||
} | |||||
} | |||||
/** | |||||
* Descends to child elements until finds TD elements and sets their | |||||
* width in pixels. Can be used to workaround IE8 & 9 TD element | |||||
* display: block issues | |||||
* | |||||
* @param parent | |||||
* @param width | |||||
*/ | |||||
private void setTdWidth(Node parent, int width) { | |||||
for (int i = 0; i < parent.getChildCount(); i++) { | |||||
Node child = parent.getChild(i); | |||||
if ("td".equals(child.getNodeName().toLowerCase())) { | |||||
((Element) child).getStyle().setWidth(width, Unit.PX); | |||||
} else { | |||||
setTdWidth(child, width); | |||||
} | |||||
} | |||||
} | } | ||||
/** | /** | ||||
isFirstIteration = false; | isFirstIteration = false; | ||||
} | } | ||||
if (suggestionPopupWidth != null && BrowserInfo.get().isIE() | |||||
&& BrowserInfo.get().getBrowserMajorVersion() < 10) { | |||||
// set TD width to a low value so that they won't mandate the | |||||
// suggestion pop-up width | |||||
suggestionPopup.setTdWidth(suggestionPopup.menu.getElement(), | |||||
1); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
} | } | ||||
private void afterSelectedItemIconChange() { | private void afterSelectedItemIconChange() { | ||||
if (BrowserInfo.get().isWebkit() || BrowserInfo.get().isIE8()) { | |||||
if (BrowserInfo.get().isWebkit()) { | |||||
// Some browsers need a nudge to reposition the text field | // Some browsers need a nudge to reposition the text field | ||||
forceReflow(); | forceReflow(); | ||||
} | } |
import com.google.gwt.user.client.Event; | import com.google.gwt.user.client.Event; | ||||
import com.google.gwt.user.client.ui.HTML; | import com.google.gwt.user.client.ui.HTML; | ||||
import com.vaadin.client.BrowserInfo; | |||||
import com.vaadin.client.Util; | import com.vaadin.client.Util; | ||||
import com.vaadin.client.VTooltip; | import com.vaadin.client.VTooltip; | ||||
import com.vaadin.client.WidgetUtil; | |||||
public class VLabel extends HTML { | public class VLabel extends HTML { | ||||
} | } | ||||
} | } | ||||
@Override | |||||
public void setText(String text) { | |||||
if (BrowserInfo.get().isIE8()) { | |||||
// #3983 - IE8 incorrectly replaces \n with <br> so we do the | |||||
// escaping manually and set as HTML | |||||
super.setHTML(WidgetUtil.escapeHTML(text)); | |||||
} else { | |||||
super.setText(text); | |||||
} | |||||
} | |||||
} | } | ||||
* @return overlay to use | * @return overlay to use | ||||
*/ | */ | ||||
protected VOverlay createOverlay() { | protected VOverlay createOverlay() { | ||||
return new VOverlay(true, false, true); | |||||
return new VOverlay(true, false); | |||||
} | } | ||||
private int adjustPopupHeight(int top, final int shadowSpace) { | private int adjustPopupHeight(int top, final int shadowSpace) { |
import com.google.gwt.aria.client.Roles; | import com.google.gwt.aria.client.Roles; | ||||
import com.google.gwt.core.client.GWT; | import com.google.gwt.core.client.GWT; | ||||
import com.google.gwt.dom.client.Element; | import com.google.gwt.dom.client.Element; | ||||
import com.google.gwt.event.logical.shared.CloseHandler; | |||||
import com.google.gwt.user.client.DOM; | import com.google.gwt.user.client.DOM; | ||||
import com.google.gwt.user.client.ui.PopupPanel; | |||||
import com.google.gwt.user.client.ui.RootPanel; | import com.google.gwt.user.client.ui.RootPanel; | ||||
import com.vaadin.client.ApplicationConnection; | import com.vaadin.client.ApplicationConnection; | ||||
import com.vaadin.client.ComponentConnector; | import com.vaadin.client.ComponentConnector; | ||||
* directly. | * directly. | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
public class VOverlay extends Overlay implements CloseHandler<PopupPanel> { | |||||
public class VOverlay extends Overlay { | |||||
/* | /* | ||||
* ApplicationConnection that this overlay belongs to, which is needed to | * ApplicationConnection that this overlay belongs to, which is needed to | ||||
super(autoHide, modal); | super(autoHide, modal); | ||||
} | } | ||||
/** | |||||
* @deprecated See main JavaDoc for VOverlay. Use the other constructors | |||||
* without the <code>showShadow</code> parameter. | |||||
*/ | |||||
@Deprecated | |||||
public VOverlay(boolean autoHide, boolean modal, boolean showShadow) { | |||||
super(autoHide, modal, showShadow); | |||||
} | |||||
/* | /* | ||||
* A "thread local" of sorts, set temporarily so that VOverlayImpl knows | * A "thread local" of sorts, set temporarily so that VOverlayImpl knows | ||||
* which VOverlay is using it, so that it can be attached to the correct | * which VOverlay is using it, so that it can be attached to the correct |
} | } | ||||
}); | }); | ||||
popup = new VOverlay(true, false, true); | |||||
popup = new VOverlay(true, false); | |||||
popup.setOwner(this); | popup.setOwner(this); | ||||
FlowPanel wrapper = new FlowPanel(); | FlowPanel wrapper = new FlowPanel(); |
private ShortcutActionHandler shortcutActionHandler; | private ShortcutActionHandler shortcutActionHandler; | ||||
public CustomPopup() { | public CustomPopup() { | ||||
super(true, false, true); // autoHide, not modal, dropshadow | |||||
super(true, false); // autoHide, not modal | |||||
setOwner(VPopupView.this); | setOwner(VPopupView.this); | ||||
// Delegate popup keyboard events to the relevant handler. The | // Delegate popup keyboard events to the relevant handler. The | ||||
// events do not propagate automatically because the popup is | // events do not propagate automatically because the popup is |
import com.vaadin.client.DeferredWorker; | import com.vaadin.client.DeferredWorker; | ||||
import com.vaadin.client.Focusable; | import com.vaadin.client.Focusable; | ||||
import com.vaadin.client.HasChildMeasurementHintConnector.ChildMeasurementHint; | import com.vaadin.client.HasChildMeasurementHintConnector.ChildMeasurementHint; | ||||
import com.vaadin.client.legacy.ui.VLegacyTextField; | |||||
import com.vaadin.client.MouseEventDetailsBuilder; | import com.vaadin.client.MouseEventDetailsBuilder; | ||||
import com.vaadin.client.StyleConstants; | import com.vaadin.client.StyleConstants; | ||||
import com.vaadin.client.TooltipInfo; | import com.vaadin.client.TooltipInfo; | ||||
import com.vaadin.client.VConsole; | import com.vaadin.client.VConsole; | ||||
import com.vaadin.client.VTooltip; | import com.vaadin.client.VTooltip; | ||||
import com.vaadin.client.WidgetUtil; | import com.vaadin.client.WidgetUtil; | ||||
import com.vaadin.client.legacy.ui.VLegacyTextField; | |||||
import com.vaadin.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow; | import com.vaadin.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow; | ||||
import com.vaadin.client.ui.dd.DDUtil; | import com.vaadin.client.ui.dd.DDUtil; | ||||
import com.vaadin.client.ui.dd.VAbstractDropHandler; | import com.vaadin.client.ui.dd.VAbstractDropHandler; | ||||
} | } | ||||
} else { | } else { | ||||
c.setText(caption); | c.setText(caption); | ||||
if (BrowserInfo.get().isIE10()) { | |||||
// IE10 can some times define min-height to include | |||||
// padding when setting the text... | |||||
// See https://dev.vaadin.com/ticket/15169 | |||||
WidgetUtil.forceIERedraw(c.getElement()); | |||||
} | |||||
} | } | ||||
c.setSorted(false); | c.setSorted(false); | ||||
} | } | ||||
} | } | ||||
protected SliderOrientation orientation = SliderOrientation.HORIZONTAL; | protected SliderOrientation orientation = SliderOrientation.HORIZONTAL; | ||||
private final HTML feedback = new HTML("", false); | private final HTML feedback = new HTML("", false); | ||||
private final VOverlay feedbackPopup = new VOverlay(true, false, true) { | |||||
private final VOverlay feedbackPopup = new VOverlay(true, false) { | |||||
{ | { | ||||
setOwner(VSlider.this); | setOwner(VSlider.this); | ||||
} | } |
if (info.isSafari()) { | if (info.isSafari()) { | ||||
return true; | return true; | ||||
} | } | ||||
if (info.isIE10() || info.isIE11() || info.isEdge()) { | |||||
if (info.isIE11() || info.isEdge()) { | |||||
return true; | return true; | ||||
} | } | ||||
if (info.isAndroid()) { | if (info.isAndroid()) { | ||||
} | } | ||||
} | } | ||||
} | } | ||||
* Tell LayoutManager that a layout is needed later for this VTree | * Tell LayoutManager that a layout is needed later for this VTree | ||||
*/ | */ | ||||
private void doLayout() { | private void doLayout() { | ||||
// IE8 needs a hack to measure the tree again after update | |||||
WidgetUtil.forceIE8Redraw(getElement()); | |||||
// This calls LayoutManager setNeedsMeasure and layoutNow | // This calls LayoutManager setNeedsMeasure and layoutNow | ||||
Util.notifyParentOfSizeChange(this, false); | Util.notifyParentOfSizeChange(this, false); | ||||
} | } | ||||
} | } | ||||
import com.google.gwt.user.client.Window; | import com.google.gwt.user.client.Window; | ||||
import com.google.gwt.user.client.ui.SimplePanel; | import com.google.gwt.user.client.ui.SimplePanel; | ||||
import com.vaadin.client.ApplicationConnection; | import com.vaadin.client.ApplicationConnection; | ||||
import com.vaadin.client.BrowserInfo; | |||||
import com.vaadin.client.ComponentConnector; | import com.vaadin.client.ComponentConnector; | ||||
import com.vaadin.client.ConnectorMap; | import com.vaadin.client.ConnectorMap; | ||||
import com.vaadin.client.Focusable; | import com.vaadin.client.Focusable; | ||||
*/ | */ | ||||
private void triggerSizeChangeCheck() { | private void triggerSizeChangeCheck() { | ||||
/* | /* | ||||
* IE (pre IE9 at least) will give us some false resize events due to | |||||
* problems with scrollbars. Firefox 3 might also produce some extra | |||||
* events. We postpone both the re-layouting and the server side event | |||||
* for a while to deal with these issues. | |||||
* | |||||
* We may also postpone these events to avoid slowness when resizing the | |||||
* We may postpone these events to avoid slowness when resizing the | |||||
* browser window. Constantly recalculating the layout causes the resize | * browser window. Constantly recalculating the layout causes the resize | ||||
* operation to be really slow with complex layouts. | * operation to be really slow with complex layouts. | ||||
*/ | */ | ||||
boolean lazy = resizeLazy || BrowserInfo.get().isIE8(); | |||||
boolean lazy = resizeLazy; | |||||
if (lazy) { | if (lazy) { | ||||
delayedResizeExecutor.trigger(); | delayedResizeExecutor.trigger(); |
private static native void setEncoding(Element form, String encoding) | private static native void setEncoding(Element form, String encoding) | ||||
/*-{ | /*-{ | ||||
form.enctype = encoding; | form.enctype = encoding; | ||||
// For IE8 | |||||
form.encoding = encoding; | |||||
}-*/; | }-*/; | ||||
/** For internal use only. May be removed or replaced in the future. */ | /** For internal use only. May be removed or replaced in the future. */ | ||||
} | } | ||||
} | } | ||||
import com.google.gwt.dom.client.Document; | import com.google.gwt.dom.client.Document; | ||||
import com.google.gwt.dom.client.Element; | import com.google.gwt.dom.client.Element; | ||||
import com.google.gwt.dom.client.NativeEvent; | import com.google.gwt.dom.client.NativeEvent; | ||||
import com.google.gwt.dom.client.Style; | |||||
import com.google.gwt.dom.client.Style.Display; | |||||
import com.google.gwt.dom.client.Style.Position; | import com.google.gwt.dom.client.Style.Position; | ||||
import com.google.gwt.dom.client.Style.Unit; | import com.google.gwt.dom.client.Style.Unit; | ||||
import com.google.gwt.dom.client.Style.Visibility; | import com.google.gwt.dom.client.Style.Visibility; | ||||
}); | }); | ||||
public VWindow() { | public VWindow() { | ||||
super(false, false, true); // no autohide, not modal, shadow | |||||
// Different style of shadow for windows | |||||
setShadowStyle("window"); | |||||
super(false, false); // no autohide, not modal | |||||
Roles.getDialogRole().set(getElement()); | Roles.getDialogRole().set(getElement()); | ||||
Roles.getDialogRole().setAriaRelevantProperty(getElement(), | Roles.getDialogRole().setAriaRelevantProperty(getElement(), | ||||
contentPanel.addKeyDownHandler(this); | contentPanel.addKeyDownHandler(this); | ||||
contentPanel.addFocusHandler(this); | contentPanel.addFocusHandler(this); | ||||
contentPanel.addBlurHandler(this); | contentPanel.addBlurHandler(this); | ||||
if (!BrowserInfo.get().isIE8() && !BrowserInfo.get().isIE9()) { | |||||
addTransitionEndLayoutListener(getElement()); | |||||
} | |||||
addTransitionEndLayoutListener(getElement()); | |||||
} | } | ||||
* state. | * state. | ||||
*/ | */ | ||||
setTabStopEnabled(doTabStop); | setTabStopEnabled(doTabStop); | ||||
// Fix for #14413. Any pseudo elements inside these elements are not | |||||
// visible on initial render unless we shake the DOM. | |||||
if (BrowserInfo.get().isIE8()) { | |||||
closeBox.getStyle().setDisplay(Display.NONE); | |||||
maximizeRestoreBox.getStyle().setDisplay(Display.NONE); | |||||
Scheduler.get().scheduleFinally(new Command() { | |||||
@Override | |||||
public void execute() { | |||||
closeBox.getStyle().clearDisplay(); | |||||
maximizeRestoreBox.getStyle().clearDisplay(); | |||||
} | |||||
}); | |||||
} | |||||
} | } | ||||
@Override | @Override | ||||
@Override | @Override | ||||
public void hide() { | public void hide() { | ||||
/* | |||||
* If the window has a RichTextArea and the RTA is focused at the time | |||||
* of hiding in IE8 only the window will have some problems returning | |||||
* the focus to the correct place. Curiously the focus will be returned | |||||
* correctly if clicking on the "close" button in the window header but | |||||
* closing the window from a button for example in the window will fail. | |||||
* Symptom described in #10776 | |||||
* | |||||
* The problematic part is that for the focus to be returned correctly | |||||
* an input element needs to be focused in the root panel. Focusing some | |||||
* other element apparently won't work. | |||||
*/ | |||||
if (BrowserInfo.get().isIE8()) { | |||||
fixIE8FocusCaptureIssue(); | |||||
} | |||||
if (vaadinModality) { | if (vaadinModality) { | ||||
hideModalityCurtain(); | hideModalityCurtain(); | ||||
} | } | ||||
focusTopmostModalWindow(); | focusTopmostModalWindow(); | ||||
} | } | ||||
private void fixIE8FocusCaptureIssue() { | |||||
Element e = DOM.createInputText(); | |||||
Style elemStyle = e.getStyle(); | |||||
elemStyle.setPosition(Position.ABSOLUTE); | |||||
elemStyle.setTop(-10, Unit.PX); | |||||
elemStyle.setWidth(0, Unit.PX); | |||||
elemStyle.setHeight(0, Unit.PX); | |||||
contentPanel.getElement().appendChild(e); | |||||
e.focus(); | |||||
contentPanel.getElement().removeChild(e); | |||||
} | |||||
/** For internal use only. May be removed or replaced in the future. */ | /** For internal use only. May be removed or replaced in the future. */ | ||||
public void setVaadinModality(boolean modality) { | public void setVaadinModality(boolean modality) { | ||||
vaadinModality = modality; | vaadinModality = modality; |
import com.google.gwt.user.client.Timer; | import com.google.gwt.user.client.Timer; | ||||
import com.google.gwt.user.client.ui.SimplePanel; | import com.google.gwt.user.client.ui.SimplePanel; | ||||
import com.google.gwt.user.client.ui.Widget; | import com.google.gwt.user.client.ui.Widget; | ||||
import com.vaadin.client.BrowserInfo; | |||||
import com.vaadin.client.LayoutManager; | import com.vaadin.client.LayoutManager; | ||||
import com.vaadin.client.StyleConstants; | import com.vaadin.client.StyleConstants; | ||||
import com.vaadin.client.WidgetUtil; | import com.vaadin.client.WidgetUtil; | ||||
import com.vaadin.client.ui.FontIcon; | import com.vaadin.client.ui.FontIcon; | ||||
import com.vaadin.client.ui.Icon; | import com.vaadin.client.ui.Icon; | ||||
import com.vaadin.client.ui.ImageIcon; | import com.vaadin.client.ui.ImageIcon; | ||||
import com.vaadin.client.ui.layout.ElementResizeEvent; | |||||
import com.vaadin.client.ui.layout.ElementResizeListener; | import com.vaadin.client.ui.layout.ElementResizeListener; | ||||
import com.vaadin.shared.ui.AlignmentInfo; | import com.vaadin.shared.ui.AlignmentInfo; | ||||
private ElementResizeListener spacingResizeListener; | private ElementResizeListener spacingResizeListener; | ||||
/* | |||||
* This listener is applied only in IE8 to workaround browser issue where | |||||
* IE8 forgets to update the error indicator position when the slot gets | |||||
* resized by widget resizing itself. #11693 | |||||
*/ | |||||
private ElementResizeListener ie8CaptionElementResizeUpdateListener = new ElementResizeListener() { | |||||
@Override | |||||
public void onElementResize(ElementResizeEvent e) { | |||||
Element caption = getCaptionElement(); | |||||
if (caption != null) { | |||||
WidgetUtil.forceIE8Redraw(caption); | |||||
} | |||||
} | |||||
}; | |||||
// Caption is placed after component unless there is some part which | // Caption is placed after component unless there is some part which | ||||
// moves it above. | // moves it above. | ||||
private CaptionPosition captionPosition = CaptionPosition.RIGHT; | private CaptionPosition captionPosition = CaptionPosition.RIGHT; | ||||
spacingResizeListener); | spacingResizeListener); | ||||
} | } | ||||
if (BrowserInfo.get().isIE8()) { | |||||
lm.addElementResizeListener(getWidget().getElement(), | |||||
ie8CaptionElementResizeUpdateListener); | |||||
} | |||||
} | } | ||||
} | } | ||||
spacingResizeListener); | spacingResizeListener); | ||||
} | } | ||||
if (BrowserInfo.get().isIE8()) { | |||||
lm.removeElementResizeListener(getWidget().getElement(), | |||||
ie8CaptionElementResizeUpdateListener); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
}; | }; | ||||
if (BrowserInfo.get().isIE8()) { | |||||
// IE8 can't fix the focus immediately. It will fail. | |||||
focusTimer.schedule(25); | |||||
} else { | |||||
// Newer IE versions can handle things immediately. | |||||
focusTimer.run(); | |||||
} | |||||
// Newer IE versions can handle things immediately. | |||||
focusTimer.run(); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
import com.google.gwt.user.client.ui.FlowPanel; | import com.google.gwt.user.client.ui.FlowPanel; | ||||
import com.google.gwt.user.client.ui.RequiresResize; | import com.google.gwt.user.client.ui.RequiresResize; | ||||
import com.google.gwt.user.client.ui.Widget; | import com.google.gwt.user.client.ui.Widget; | ||||
import com.vaadin.client.BrowserInfo; | |||||
import com.vaadin.client.LayoutManager; | import com.vaadin.client.LayoutManager; | ||||
import com.vaadin.client.Profiler; | import com.vaadin.client.Profiler; | ||||
import com.vaadin.client.Util; | import com.vaadin.client.Util; | ||||
import com.vaadin.client.WidgetUtil; | |||||
import com.vaadin.shared.ui.MarginInfo; | import com.vaadin.shared.ui.MarginInfo; | ||||
/** | /** | ||||
} else { | } else { | ||||
// Non-relative child without expansion should be unconstrained | // Non-relative child without expansion should be unconstrained | ||||
if (BrowserInfo.get().isIE8()) { | |||||
// unconstrained in IE8 is auto | |||||
if (vertical) { | |||||
slot.setHeight("auto"); | |||||
} else { | |||||
slot.setWidth("auto"); | |||||
} | |||||
if (vertical) { | |||||
slotStyle.clearHeight(); | |||||
} else { | } else { | ||||
if (vertical) { | |||||
slotStyle.clearHeight(); | |||||
} else { | |||||
slotStyle.clearWidth(); | |||||
} | |||||
slotStyle.clearWidth(); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
WidgetUtil.forceIE8Redraw(getElement()); | |||||
} | } | ||||
/** | /** | ||||
} | } | ||||
} | } | ||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand; | import com.google.gwt.core.client.Scheduler.ScheduledCommand; | ||||
import com.google.gwt.dom.client.Element; | import com.google.gwt.dom.client.Element; | ||||
import com.google.gwt.dom.client.EventTarget; | import com.google.gwt.dom.client.EventTarget; | ||||
import com.google.gwt.dom.client.Style.Position; | |||||
import com.google.gwt.event.shared.HandlerRegistration; | import com.google.gwt.event.shared.HandlerRegistration; | ||||
import com.google.gwt.user.client.ui.Widget; | import com.google.gwt.user.client.ui.Widget; | ||||
import com.vaadin.client.ApplicationConnection; | import com.vaadin.client.ApplicationConnection; | ||||
import com.vaadin.client.BrowserInfo; | |||||
import com.vaadin.client.ComponentConnector; | import com.vaadin.client.ComponentConnector; | ||||
import com.vaadin.client.ConnectorHierarchyChangeEvent; | import com.vaadin.client.ConnectorHierarchyChangeEvent; | ||||
import com.vaadin.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler; | import com.vaadin.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler; | ||||
public void updateEnabledState(boolean enabledState) { | public void updateEnabledState(boolean enabledState) { | ||||
super.updateEnabledState(enabledState); | super.updateEnabledState(enabledState); | ||||
getWidget().enabled = isEnabled(); | getWidget().enabled = isEnabled(); | ||||
if (BrowserInfo.get().isIE8() && !getWidget().enabled) { | |||||
/* | |||||
* The disabled shim will not cover the table body if it is relative | |||||
* in IE8. See #7324 | |||||
*/ | |||||
getWidget().scrollBodyPanel.getElement().getStyle() | |||||
.setPosition(Position.STATIC); | |||||
} else if (BrowserInfo.get().isIE8()) { | |||||
getWidget().scrollBodyPanel.getElement().getStyle() | |||||
.setPosition(Position.RELATIVE); | |||||
} | |||||
} | } | ||||
@Override | @Override | ||||
Scheduler.get().scheduleFinally(new ScheduledCommand() { | Scheduler.get().scheduleFinally(new ScheduledCommand() { | ||||
@Override | @Override | ||||
public void execute() { | public void execute() { | ||||
// IE8 needs some hacks to measure sizes correctly | |||||
WidgetUtil.forceIE8Redraw(getWidget().getElement()); | |||||
getLayoutManager().setNeedsMeasure(TableConnector.this); | getLayoutManager().setNeedsMeasure(TableConnector.this); | ||||
ServerConnector parent = getParent(); | ServerConnector parent = getParent(); | ||||
if (parent instanceof ComponentConnector) { | if (parent instanceof ComponentConnector) { |
if (uidl.hasAttribute("partialUpdate")) { | if (uidl.hasAttribute("partialUpdate")) { | ||||
handleUpdate(uidl); | handleUpdate(uidl); | ||||
// IE8 needs a hack to measure the tree again after update | |||||
WidgetUtil.forceIE8Redraw(getWidget().getElement()); | |||||
getWidget().rendering = false; | getWidget().rendering = false; | ||||
return; | return; | ||||
} | } | ||||
getWidget().focusedNode.setFocused(false); | getWidget().focusedNode.setFocused(false); | ||||
} | } | ||||
// IE8 needs a hack to measure the tree again after update | |||||
WidgetUtil.forceIE8Redraw(getWidget().getElement()); | |||||
getWidget().rendering = false; | getWidget().rendering = false; | ||||
} | } | ||||
WidgetUtil.clearTextSelection(); | WidgetUtil.clearTextSelection(); | ||||
} | } | ||||
} | } | ||||
import com.google.gwt.dom.client.NodeList; | import com.google.gwt.dom.client.NodeList; | ||||
import com.google.gwt.dom.client.Style; | import com.google.gwt.dom.client.Style; | ||||
import com.google.gwt.dom.client.Style.Position; | import com.google.gwt.dom.client.Style.Position; | ||||
import com.google.gwt.dom.client.StyleElement; | |||||
import com.google.gwt.dom.client.StyleInjector; | import com.google.gwt.dom.client.StyleInjector; | ||||
import com.google.gwt.event.dom.client.KeyDownEvent; | import com.google.gwt.event.dom.client.KeyDownEvent; | ||||
import com.google.gwt.event.dom.client.KeyDownHandler; | import com.google.gwt.event.dom.client.KeyDownHandler; | ||||
import com.google.web.bindery.event.shared.HandlerRegistration; | import com.google.web.bindery.event.shared.HandlerRegistration; | ||||
import com.vaadin.client.ApplicationConnection; | import com.vaadin.client.ApplicationConnection; | ||||
import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent; | import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent; | ||||
import com.vaadin.client.BrowserInfo; | |||||
import com.vaadin.client.ComponentConnector; | import com.vaadin.client.ComponentConnector; | ||||
import com.vaadin.client.ConnectorHierarchyChangeEvent; | import com.vaadin.client.ConnectorHierarchyChangeEvent; | ||||
import com.vaadin.client.Focusable; | import com.vaadin.client.Focusable; | ||||
public void init(String rootPanelId, | public void init(String rootPanelId, | ||||
ApplicationConnection applicationConnection) { | ApplicationConnection applicationConnection) { | ||||
// Create a style tag for style injections so they don't end up in | |||||
// the theme tag in IE8-IE10 (we don't want to wipe them out if we | |||||
// change theme). | |||||
// StyleInjectorImplIE always injects to the last style tag on the page. | |||||
if (BrowserInfo.get().isIE() | |||||
&& BrowserInfo.get().getBrowserMajorVersion() < 11) { | |||||
StyleElement style = Document.get().createStyleElement(); | |||||
style.setType("text/css"); | |||||
getHead().appendChild(style); | |||||
} | |||||
Widget shortcutContextWidget = getWidget(); | Widget shortcutContextWidget = getWidget(); | ||||
if (applicationConnection.getConfiguration().isStandalone()) { | if (applicationConnection.getConfiguration().isStandalone()) { | ||||
// Listen to body for standalone apps (#19392) | // Listen to body for standalone apps (#19392) | ||||
* height. Assuming v-ui does not have an undefined width for now, see | * height. Assuming v-ui does not have an undefined width for now, see | ||||
* #8460. | * #8460. | ||||
*/ | */ | ||||
if (child.isRelativeHeight() && !BrowserInfo.get().isIE9()) { | |||||
if (child.isRelativeHeight()) { | |||||
childStyle.setPosition(Position.ABSOLUTE); | childStyle.setPosition(Position.ABSOLUTE); | ||||
} else { | } else { | ||||
childStyle.clearPosition(); | childStyle.clearPosition(); |
import com.google.gwt.user.client.DOM; | import com.google.gwt.user.client.DOM; | ||||
import com.google.gwt.user.client.Window; | import com.google.gwt.user.client.Window; | ||||
import com.vaadin.client.ApplicationConnection; | import com.vaadin.client.ApplicationConnection; | ||||
import com.vaadin.client.BrowserInfo; | |||||
import com.vaadin.client.ComponentConnector; | import com.vaadin.client.ComponentConnector; | ||||
import com.vaadin.client.ConnectorHierarchyChangeEvent; | import com.vaadin.client.ConnectorHierarchyChangeEvent; | ||||
import com.vaadin.client.LayoutManager; | import com.vaadin.client.LayoutManager; | ||||
import com.vaadin.client.Paintable; | import com.vaadin.client.Paintable; | ||||
import com.vaadin.client.UIDL; | import com.vaadin.client.UIDL; | ||||
import com.vaadin.client.WidgetUtil; | |||||
import com.vaadin.client.communication.RpcProxy; | import com.vaadin.client.communication.RpcProxy; | ||||
import com.vaadin.client.communication.StateChangeEvent; | import com.vaadin.client.communication.StateChangeEvent; | ||||
import com.vaadin.client.ui.AbstractSingleComponentContainerConnector; | import com.vaadin.client.ui.AbstractSingleComponentContainerConnector; | ||||
Element layoutElement = content.getWidget().getElement(); | Element layoutElement = content.getWidget().getElement(); | ||||
Style childStyle = layoutElement.getStyle(); | Style childStyle = layoutElement.getStyle(); | ||||
// IE8 needs some hackery to measure its content correctly | |||||
WidgetUtil.forceIE8Redraw(layoutElement); | |||||
if (content.isRelativeHeight() && !BrowserInfo.get().isIE9()) { | |||||
if (content.isRelativeHeight()) { | |||||
childStyle.setPosition(Position.ABSOLUTE); | childStyle.setPosition(Position.ABSOLUTE); | ||||
Style wrapperStyle = contentElement.getStyle(); | Style wrapperStyle = contentElement.getStyle(); |
Each RowContainer can be thought to have three levels of | Each RowContainer can be thought to have three levels of | ||||
indices for any given displayed row (but the distinction | indices for any given displayed row (but the distinction | ||||
matters primarily for the BodyRowContainerImpl, because of | |||||
matters primarily for the BodyRowContainerImpl, because of | |||||
the way it scrolls through data): | the way it scrolls through data): | ||||
- Logical index | - Logical index | ||||
(because of 0-based indices). In Header and | (because of 0-based indices). In Header and | ||||
FooterRowContainers, you are safe to assume that the logical | FooterRowContainers, you are safe to assume that the logical | ||||
index is the same as the physical index. But because the | index is the same as the physical index. But because the | ||||
BodyRowContainerImpl never displays large data sources | |||||
entirely in the DOM, a physical index usually has no | |||||
BodyRowContainerImpl never displays large data sources | |||||
entirely in the DOM, a physical index usually has no | |||||
apparent direct relationship with its logical index. | apparent direct relationship with its logical index. | ||||
VISUAL INDEX is the index relating to the order that you | VISUAL INDEX is the index relating to the order that you | ||||
var hScrollElem = hScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); | var hScrollElem = hScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); | ||||
return $entry(function(e) { | return $entry(function(e) { | ||||
var target = e.target || e.srcElement; // IE8 uses e.scrElement | |||||
var target = e.target; | |||||
// in case the scroll event was native (i.e. scrollbars were dragged, or | // in case the scroll event was native (i.e. scrollbars were dragged, or | ||||
// the scrollTop/Left was manually modified), the bundles have old cache | // the scrollTop/Left was manually modified), the bundles have old cache | ||||
* class. | * class. | ||||
*/ | */ | ||||
/*-{ | /*-{ | ||||
if (element.addEventListener) { | |||||
// firefox likes "wheel", while others use "mousewheel" | |||||
var eventName = 'onmousewheel' in element ? 'mousewheel' : 'wheel'; | |||||
element.addEventListener(eventName, this.@com.vaadin.client.widgets.JsniWorkaround::mousewheelListenerFunction); | |||||
} else { | |||||
// IE8 | |||||
element.attachEvent("onmousewheel", this.@com.vaadin.client.widgets.JsniWorkaround::mousewheelListenerFunction); | |||||
} | |||||
// firefox likes "wheel", while others use "mousewheel" | |||||
var eventName = 'onmousewheel' in element ? 'mousewheel' : 'wheel'; | |||||
element.addEventListener(eventName, this.@com.vaadin.client.widgets.JsniWorkaround::mousewheelListenerFunction); | |||||
}-*/; | }-*/; | ||||
public native void detachMousewheelListener(Element element) | public native void detachMousewheelListener(Element element) | ||||
* class. | * class. | ||||
*/ | */ | ||||
/*-{ | /*-{ | ||||
if (element.addEventListener) { | |||||
// firefox likes "wheel", while others use "mousewheel" | |||||
var eventName = element.onwheel===undefined?"mousewheel":"wheel"; | |||||
element.removeEventListener(eventName, this.@com.vaadin.client.widgets.JsniWorkaround::mousewheelListenerFunction); | |||||
} else { | |||||
// IE8 | |||||
element.detachEvent("onmousewheel", this.@com.vaadin.client.widgets.JsniWorkaround::mousewheelListenerFunction); | |||||
} | |||||
// firefox likes "wheel", while others use "mousewheel" | |||||
var eventName = element.onwheel===undefined?"mousewheel":"wheel"; | |||||
element.removeEventListener(eventName, this.@com.vaadin.client.widgets.JsniWorkaround::mousewheelListenerFunction); | |||||
}-*/; | }-*/; | ||||
public native void attachTouchListeners(Element element) | public native void attachTouchListeners(Element element) | ||||
* class. | * class. | ||||
*/ | */ | ||||
/*-{ | /*-{ | ||||
if (element.addEventListener) { | |||||
element.addEventListener("touchstart", this.@com.vaadin.client.widgets.JsniWorkaround::touchStartFunction); | |||||
element.addEventListener("touchmove", this.@com.vaadin.client.widgets.JsniWorkaround::touchMoveFunction); | |||||
element.addEventListener("touchend", this.@com.vaadin.client.widgets.JsniWorkaround::touchEndFunction); | |||||
element.addEventListener("touchcancel", this.@com.vaadin.client.widgets.JsniWorkaround::touchEndFunction); | |||||
} else { | |||||
// this would be IE8, but we don't support it with touch | |||||
} | |||||
element.addEventListener("touchstart", this.@com.vaadin.client.widgets.JsniWorkaround::touchStartFunction); | |||||
element.addEventListener("touchmove", this.@com.vaadin.client.widgets.JsniWorkaround::touchMoveFunction); | |||||
element.addEventListener("touchend", this.@com.vaadin.client.widgets.JsniWorkaround::touchEndFunction); | |||||
element.addEventListener("touchcancel", this.@com.vaadin.client.widgets.JsniWorkaround::touchEndFunction); | |||||
}-*/; | }-*/; | ||||
public native void detachTouchListeners(Element element) | public native void detachTouchListeners(Element element) | ||||
* class. | * class. | ||||
*/ | */ | ||||
/*-{ | /*-{ | ||||
if (element.removeEventListener) { | |||||
element.removeEventListener("touchstart", this.@com.vaadin.client.widgets.JsniWorkaround::touchStartFunction); | |||||
element.removeEventListener("touchmove", this.@com.vaadin.client.widgets.JsniWorkaround::touchMoveFunction); | |||||
element.removeEventListener("touchend", this.@com.vaadin.client.widgets.JsniWorkaround::touchEndFunction); | |||||
element.removeEventListener("touchcancel", this.@com.vaadin.client.widgets.JsniWorkaround::touchEndFunction); | |||||
} else { | |||||
// this would be IE8, but we don't support it with touch | |||||
} | |||||
element.removeEventListener("touchstart", this.@com.vaadin.client.widgets.JsniWorkaround::touchStartFunction); | |||||
element.removeEventListener("touchmove", this.@com.vaadin.client.widgets.JsniWorkaround::touchMoveFunction); | |||||
element.removeEventListener("touchend", this.@com.vaadin.client.widgets.JsniWorkaround::touchEndFunction); | |||||
element.removeEventListener("touchcancel", this.@com.vaadin.client.widgets.JsniWorkaround::touchEndFunction); | |||||
}-*/; | }-*/; | ||||
public void scrollToColumn(final int columnIndex, | public void scrollToColumn(final int columnIndex, | ||||
/** | /** | ||||
* The table section element ({@code <thead>}, {@code <tbody>} or | * The table section element ({@code <thead>}, {@code <tbody>} or | ||||
* {@code <tfoot>}) the rows (i.e. {@code | |||||
* <tr> | |||||
* {@code <tfoot>}) the rows (i.e. {@code | |||||
* | |||||
<tr> | |||||
* } tags) are contained in. | * } tags) are contained in. | ||||
*/ | */ | ||||
protected final TableSectionElement root; | protected final TableSectionElement root; | ||||
* Applies the total length of the columns to each row element. | * Applies the total length of the columns to each row element. | ||||
* <p> | * <p> | ||||
* <em>Note:</em> In contrast to {@link #reapplyColumnWidths()}, this | * <em>Note:</em> In contrast to {@link #reapplyColumnWidths()}, this | ||||
* method only modifies the width of the {@code | |||||
* <tr> | |||||
* method only modifies the width of the {@code | |||||
* | |||||
<tr> | |||||
* } element, not the cells within. | * } element, not the cells within. | ||||
*/ | */ | ||||
protected void reapplyRowWidths() { | protected void reapplyRowWidths() { | ||||
* |3| ==> |*| ==> |5| <- newly rendered | * |3| ==> |*| ==> |5| <- newly rendered | ||||
* |4| |*| | * |4| |*| | ||||
* 5 5 | * 5 5 | ||||
* | |||||
* | |||||
* 1 1 |1| <- newly rendered | * 1 1 |1| <- newly rendered | ||||
* |2| |*| |4| | * |2| |*| |4| | ||||
* |3| ==> |*| ==> |5| <- newly rendered | * |3| ==> |*| ==> |5| <- newly rendered | ||||
* 1 |1| <-- newly rendered (by scrolling) | * 1 |1| <-- newly rendered (by scrolling) | ||||
* |4| |4| | * |4| |4| | ||||
* |*| ==> |*| | * |*| ==> |*| | ||||
* |*| | |||||
* |*| | |||||
* 5 5 | * 5 5 | ||||
*/ | */ | ||||
final double newScrollTop = contentBottom | final double newScrollTop = contentBottom | ||||
* |1| |1| | * |1| |1| | ||||
* |4| ==> |4| | * |4| ==> |4| | ||||
* |*| |5| <-- newly rendered | * |*| |5| <-- newly rendered | ||||
* | |||||
* | |||||
* 5 | * 5 | ||||
*/ | */ | ||||
* : : |4| <- newly rendered | * : : |4| <- newly rendered | ||||
* |5| |5| |5| | * |5| |5| |5| | ||||
* |6| ==> |*| ==> |7| | * |6| ==> |*| ==> |7| | ||||
* |7| |7| | |||||
* |7| |7| | |||||
*/ | */ | ||||
final int logicalTargetIndex = getLogicalRowIndex( | final int logicalTargetIndex = getLogicalRowIndex( | ||||
if (BrowserInfo.get().isIE()) { | if (BrowserInfo.get().isIE()) { | ||||
/* | /* | ||||
* IE refuses to scroll properly if the DIV isn't at least one pixel | * IE refuses to scroll properly if the DIV isn't at least one pixel | ||||
* larger than the scrollbar controls themselves. But, probably | |||||
* because of subpixel rendering, in Grid, one pixel isn't enough, | |||||
* so we'll add two instead. | |||||
* larger than the scrollbar controls themselves. | |||||
*/ | */ | ||||
if (BrowserInfo.get().isIE9()) { | |||||
scrollbarThickness += 2; | |||||
} else { | |||||
scrollbarThickness += 1; | |||||
} | |||||
scrollbarThickness += 1; | |||||
} | } | ||||
root.appendChild(verticalScrollbar.getElement()); | root.appendChild(verticalScrollbar.getElement()); | ||||
verticalScrollbar.addScrollHandler(scrollHandler); | verticalScrollbar.addScrollHandler(scrollHandler); | ||||
verticalScrollbar.setScrollbarThickness(scrollbarThickness); | verticalScrollbar.setScrollbarThickness(scrollbarThickness); | ||||
if (BrowserInfo.get().isIE8()) { | |||||
/* | |||||
* IE8 will have to compensate for a misalignment where it pops the | |||||
* scrollbar outside of its box. See Bug 3 in | |||||
* http://edskes.net/ie/ie8overflowandexpandingboxbugs.htm | |||||
*/ | |||||
Style vScrollStyle = verticalScrollbar.getElement().getStyle(); | |||||
vScrollStyle.setRight(verticalScrollbar.getScrollbarThickness() - 1, | |||||
Unit.PX); | |||||
} | |||||
root.appendChild(horizontalScrollbar.getElement()); | root.appendChild(horizontalScrollbar.getElement()); | ||||
horizontalScrollbar.addScrollHandler(scrollHandler); | horizontalScrollbar.addScrollHandler(scrollHandler); | ||||
horizontalScrollbar.setScrollbarThickness(scrollbarThickness); | horizontalScrollbar.setScrollbarThickness(scrollbarThickness); | ||||
double getMinCellWidth(int colIndex) { | double getMinCellWidth(int colIndex) { | ||||
return columnConfiguration.getMinCellWidth(colIndex); | return columnConfiguration.getMinCellWidth(colIndex); | ||||
} | } | ||||
} | |||||
} |
import com.google.gwt.core.shared.GWT; | import com.google.gwt.core.shared.GWT; | ||||
import com.google.gwt.dom.client.BrowserEvents; | import com.google.gwt.dom.client.BrowserEvents; | ||||
import com.google.gwt.dom.client.DivElement; | import com.google.gwt.dom.client.DivElement; | ||||
import com.google.gwt.dom.client.Document; | |||||
import com.google.gwt.dom.client.Element; | import com.google.gwt.dom.client.Element; | ||||
import com.google.gwt.dom.client.EventTarget; | import com.google.gwt.dom.client.EventTarget; | ||||
import com.google.gwt.dom.client.NativeEvent; | import com.google.gwt.dom.client.NativeEvent; | ||||
private static final String ERROR_CLASS_NAME = "error"; | private static final String ERROR_CLASS_NAME = "error"; | ||||
private static final String NOT_EDITABLE_CLASS_NAME = "not-editable"; | private static final String NOT_EDITABLE_CLASS_NAME = "not-editable"; | ||||
ScheduledCommand fieldFocusCommand = new ScheduledCommand() { | |||||
private int count = 0; | |||||
@Override | |||||
public void execute() { | |||||
Element focusedElement = WidgetUtil.getFocusedElement(); | |||||
if (focusedElement == grid.getElement() | |||||
|| focusedElement == Document.get().getBody() | |||||
|| count > 2) { | |||||
focusColumn(focusedColumnIndex); | |||||
} else { | |||||
++count; | |||||
Scheduler.get().scheduleDeferred(this); | |||||
} | |||||
} | |||||
}; | |||||
/** | /** | ||||
* A handler for events related to the Grid editor. Responsible for | * A handler for events related to the Grid editor. Responsible for | ||||
* opening, moving or closing the editor based on the received event. | * opening, moving or closing the editor based on the received event. | ||||
} | } | ||||
if (i == focusedColumnIndex) { | if (i == focusedColumnIndex) { | ||||
if (BrowserInfo.get().isIE8()) { | |||||
Scheduler.get().scheduleDeferred(fieldFocusCommand); | |||||
} else { | |||||
focusColumn(focusedColumnIndex); | |||||
} | |||||
focusColumn(focusedColumnIndex); | |||||
} | } | ||||
} else { | } else { | ||||
cell.addClassName(NOT_EDITABLE_CLASS_NAME); | cell.addClassName(NOT_EDITABLE_CLASS_NAME); | ||||
*/ | */ | ||||
final double widthPerRatio; | final double widthPerRatio; | ||||
int leftOver = 0; | int leftOver = 0; | ||||
if (BrowserInfo.get().isIE8() || BrowserInfo.get().isIE9() | |||||
|| BrowserInfo.getBrowserString().contains("PhantomJS")) { | |||||
if (BrowserInfo.getBrowserString().contains("PhantomJS")) { | |||||
// These browsers report subpixels as integers. this usually | // These browsers report subpixels as integers. this usually | ||||
// results into issues.. | // results into issues.. | ||||
widthPerRatio = (int) (pixelsToDistribute / totalRatios); | widthPerRatio = (int) (pixelsToDistribute / totalRatios); | ||||
* This is a workaround to make Chrome work like Firefox. In Chrome, | * This is a workaround to make Chrome work like Firefox. In Chrome, | ||||
* normally if you start a drag on one cell and release on: | * normally if you start a drag on one cell and release on: | ||||
* <ul> | * <ul> | ||||
* <li>that same cell, the click event is that {@code | |||||
* <td>}. | |||||
* <li>a cell on that same row, the click event is the parent {@code | |||||
* <tr> | |||||
* <li>that same cell, the click event is that {@code | |||||
* | |||||
<td>}. | |||||
* <li>a cell on that same row, the click event is the parent {@code | |||||
* | |||||
<tr> | |||||
* }. | * }. | ||||
* <li>a cell on another row, the click event is the table section ancestor | * <li>a cell on another row, the click event is the table section ancestor | ||||
* ({@code <thead>}, {@code <tbody>} or {@code <tfoot>}). | * ({@code <thead>}, {@code <tbody>} or {@code <tfoot>}). |
import com.google.gwt.event.logical.shared.CloseEvent; | import com.google.gwt.event.logical.shared.CloseEvent; | ||||
import com.google.gwt.event.logical.shared.CloseHandler; | import com.google.gwt.event.logical.shared.CloseHandler; | ||||
import com.google.gwt.user.client.Command; | import com.google.gwt.user.client.Command; | ||||
import com.google.gwt.user.client.DOM; | |||||
import com.google.gwt.user.client.Window; | import com.google.gwt.user.client.Window; | ||||
import com.google.gwt.user.client.ui.PopupPanel; | import com.google.gwt.user.client.ui.PopupPanel; | ||||
import com.google.gwt.user.client.ui.RootPanel; | import com.google.gwt.user.client.ui.RootPanel; | ||||
import com.vaadin.client.AnimationUtil.AnimationEndListener; | import com.vaadin.client.AnimationUtil.AnimationEndListener; | ||||
import com.vaadin.client.BrowserInfo; | import com.vaadin.client.BrowserInfo; | ||||
import com.vaadin.client.ComputedStyle; | import com.vaadin.client.ComputedStyle; | ||||
import com.vaadin.client.WidgetUtil; | |||||
/** | /** | ||||
* Overlay widget extending the PopupPanel. Overlay is used to float elements on | * Overlay widget extending the PopupPanel. Overlay is used to float elements on | ||||
* <b>Note:</b> This class should always be constructed with | * <b>Note:</b> This class should always be constructed with | ||||
* {@link GWT#create(Class)}. | * {@link GWT#create(Class)}. | ||||
* | * | ||||
* <h3>Shadow</h3> | |||||
* <p> | |||||
* The separate shadow element underneath the main overlay element is <strong> | |||||
* <em>deprecated</em></strong>, and should not be used for new overlay | |||||
* components. CSS box-shadow should be used instead of a separate shadow | |||||
* element. Remember to include any vendor-prefixed versions to support all | |||||
* browsers that you need to. To cover all possible browsers that Vaadin 7 | |||||
* supports, add <code>-webkit-box-shadow</code> and the standard | |||||
* <code>box-shadow</code> properties. | |||||
* </p> | |||||
* | |||||
* <p> | |||||
* For IE8, which doesn't support CSS box-shadow, you can use the proprietary | |||||
* DropShadow filter. It doesn't provide the exact same features as box-shadow, | |||||
* but it is suitable for graceful degradation. Other options are to use a | |||||
* border or a pseudo-element underneath the overlay which mimics a shadow, or | |||||
* any combination of these. | |||||
* </p> | |||||
* | |||||
* <p> | |||||
* Read more about the DropShadow filter from | |||||
* <a href="http://msdn.microsoft.com/en-us/library/ms532985(v=vs.85).aspx" | |||||
* >Microsoft Developer Network</a> | |||||
* </p> | |||||
* | |||||
* @since 7.6.1 | * @since 7.6.1 | ||||
*/ | */ | ||||
public class Overlay extends PopupPanel implements CloseHandler<PopupPanel> { | |||||
public class Overlay extends PopupPanel { | |||||
@Override | @Override | ||||
protected void onAttach() { | protected void onAttach() { | ||||
*/ | */ | ||||
public static final String ADDITIONAL_CLASSNAME_ANIMATE_OUT = "animate-out"; | public static final String ADDITIONAL_CLASSNAME_ANIMATE_OUT = "animate-out"; | ||||
/** | |||||
* The shadow element for this overlay. | |||||
* | |||||
* @deprecated See main JavaDoc for Overlay | |||||
* | |||||
*/ | |||||
@Deprecated | |||||
private Element shadow; | |||||
/* | /* | ||||
* The creator of this Overlay (the widget that made the instance, not the | * The creator of this Overlay (the widget that made the instance, not the | ||||
* layout parent) | * layout parent) | ||||
*/ | */ | ||||
private IFrameElement shimElement; | private IFrameElement shimElement; | ||||
/** | |||||
* The HTML snippet that is used to render the actual shadow. In consists of | |||||
* nine different DIV-elements with the following class names: | |||||
* | |||||
* <pre> | |||||
* .v-shadow[-stylename] | |||||
* ---------------------------------------------- | |||||
* | .top-left | .top | .top-right | | |||||
* |---------------|-----------|----------------| | |||||
* | | | | | |||||
* | .left | .center | .right | | |||||
* | | | | | |||||
* |---------------|-----------|----------------| | |||||
* | .bottom-left | .bottom | .bottom-right | | |||||
* ---------------------------------------------- | |||||
* </pre> | |||||
* | |||||
* See default theme 'shadow.css' for implementation example. | |||||
* | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
private static final String SHADOW_HTML = "<div aria-hidden=\"true\" class=\"top-left\"></div><div class=\"top\"></div><div class=\"top-right\"></div><div class=\"left\"></div><div class=\"center\"></div><div class=\"right\"></div><div class=\"bottom-left\"></div><div class=\"bottom\"></div><div class=\"bottom-right\"></div>"; | |||||
/** | /** | ||||
* Matches {@link PopupPanel}.ANIMATION_DURATION | * Matches {@link PopupPanel}.ANIMATION_DURATION | ||||
*/ | */ | ||||
private static final int POPUP_PANEL_ANIMATION_DURATION = 200; | private static final int POPUP_PANEL_ANIMATION_DURATION = 200; | ||||
/** | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
private boolean sinkShadowEvents = false; | |||||
private List<Command> runOnClose = new ArrayList<Command>(); | private List<Command> runOnClose = new ArrayList<Command>(); | ||||
public Overlay() { | public Overlay() { | ||||
adjustZIndex(); | adjustZIndex(); | ||||
} | } | ||||
/** | |||||
* @deprecated See main JavaDoc for Overlay. Use the other constructors | |||||
* without the <code>showShadow</code> parameter. | |||||
*/ | |||||
@Deprecated | |||||
public Overlay(boolean autoHide, boolean modal, boolean showShadow) { | |||||
super(autoHide, modal); | |||||
setShadowEnabled(showShadow && useShadowDiv()); | |||||
adjustZIndex(); | |||||
} | |||||
/** | |||||
* Return true if a separate shadow div should be used. Since Vaadin 7.3, | |||||
* shadows are implemented with CSS box-shadow. Thus, a shadow div is only | |||||
* used for IE8 by default. | |||||
* | |||||
* @deprecated See main JavaDoc for Overlay | |||||
* @since 7.3 | |||||
* @return true to use a shadow div | |||||
*/ | |||||
@Deprecated | |||||
protected boolean useShadowDiv() { | |||||
return BrowserInfo.get().isIE8(); | |||||
} | |||||
/** | |||||
* Method to control whether DOM elements for shadow are added. With this | |||||
* method subclasses can control displaying of shadow also after the | |||||
* constructor. | |||||
* | |||||
* @param enabled | |||||
* true if shadow should be displayed | |||||
* | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
protected void setShadowEnabled(boolean enabled) { | |||||
if (enabled != isShadowEnabled()) { | |||||
if (enabled) { | |||||
shadow = DOM.createDiv(); | |||||
shadow.setClassName(CLASSNAME_SHADOW); | |||||
shadow.setInnerHTML(SHADOW_HTML); | |||||
shadow.getStyle().setPosition(Position.ABSOLUTE); | |||||
addCloseHandler(this); | |||||
} else { | |||||
removeShadowIfPresent(); | |||||
shadow = null; | |||||
} | |||||
} | |||||
} | |||||
/** | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
protected boolean isShadowEnabled() { | |||||
return shadow != null; | |||||
} | |||||
protected boolean isShimElementEnabled() { | protected boolean isShimElementEnabled() { | ||||
return shimElement != null; | return shimElement != null; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
private void removeShadowIfPresent() { | |||||
if (isShadowAttached()) { | |||||
// Remove event listener from the shadow | |||||
unsinkShadowEvents(); | |||||
shadow.removeFromParent(); | |||||
} | |||||
} | |||||
/** | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
private boolean isShadowAttached() { | |||||
return isShadowEnabled() && shadow.getParentElement() != null; | |||||
} | |||||
private void adjustZIndex() { | private void adjustZIndex() { | ||||
setZIndex(Z_INDEX); | setZIndex(Z_INDEX); | ||||
} | } | ||||
*/ | */ | ||||
protected void setZIndex(int zIndex) { | protected void setZIndex(int zIndex) { | ||||
getElement().getStyle().setZIndex(zIndex); | getElement().getStyle().setZIndex(zIndex); | ||||
if (isShadowEnabled()) { | |||||
shadow.getStyle().setZIndex(zIndex); | |||||
} | |||||
} | } | ||||
@Override | @Override | ||||
boolean isAttached = isAttached() && isShowing(); | boolean isAttached = isAttached() && isShowing(); | ||||
super.show(); | super.show(); | ||||
// Don't animate if already visible or browser is IE8 or IE9 (no CSS | |||||
// animation support) | |||||
if (isAttached || BrowserInfo.get().isIE8() | |||||
|| BrowserInfo.get().isIE9()) { | |||||
// Don't animate if already visible | |||||
if (isAttached) { | |||||
return false; | return false; | ||||
} else { | } else { | ||||
// Check if animations are used | // Check if animations are used | ||||
setVisible(false); | setVisible(false); | ||||
addStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_IN); | addStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_IN); | ||||
if (isShadowEnabled()) { | |||||
shadow.addClassName(CLASSNAME_SHADOW + "-" | |||||
+ ADDITIONAL_CLASSNAME_ANIMATE_IN); | |||||
} | |||||
ComputedStyle cs = new ComputedStyle(getElement()); | ComputedStyle cs = new ComputedStyle(getElement()); | ||||
String animationName = AnimationUtil.getAnimationName(cs); | String animationName = AnimationUtil.getAnimationName(cs); | ||||
getElement(), animateInListener); | getElement(), animateInListener); | ||||
removeStyleDependentName( | removeStyleDependentName( | ||||
ADDITIONAL_CLASSNAME_ANIMATE_IN); | ADDITIONAL_CLASSNAME_ANIMATE_IN); | ||||
if (isShadowEnabled()) { | |||||
shadow.removeClassName(CLASSNAME_SHADOW | |||||
+ "-" | |||||
+ ADDITIONAL_CLASSNAME_ANIMATE_IN); | |||||
} | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
return true; | return true; | ||||
} else { | } else { | ||||
removeStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_IN); | removeStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_IN); | ||||
if (isShadowEnabled()) { | |||||
shadow.removeClassName(CLASSNAME_SHADOW + "-" | |||||
+ ADDITIONAL_CLASSNAME_ANIMATE_IN); | |||||
} | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
super.onDetach(); | super.onDetach(); | ||||
// Always ensure shadow is removed when the overlay is removed. | // Always ensure shadow is removed when the overlay is removed. | ||||
removeShadowIfPresent(); | |||||
removeShimElement(); | removeShimElement(); | ||||
} | } | ||||
@Override | @Override | ||||
public void setVisible(boolean visible) { | public void setVisible(boolean visible) { | ||||
super.setVisible(visible); | super.setVisible(visible); | ||||
if (isShadowEnabled()) { | |||||
shadow.getStyle().setProperty("visibility", | |||||
visible ? "visible" : "hidden"); | |||||
} | |||||
if (isShimElementEnabled()) { | if (isShimElementEnabled()) { | ||||
shimElement.getStyle().setProperty("visibility", | shimElement.getStyle().setProperty("visibility", | ||||
visible ? "visible" : "hidden"); | visible ? "visible" : "hidden"); | ||||
positionOrSizeUpdated(1.0); | positionOrSizeUpdated(1.0); | ||||
} | } | ||||
/** | |||||
* Sets the shadow style for this overlay. Will override any previous style | |||||
* for the shadow. The default style name is defined by CLASSNAME_SHADOW. | |||||
* The given style will be prefixed with CLASSNAME_SHADOW. | |||||
* | |||||
* @param style | |||||
* The new style name for the shadow element. Will be prefixed by | |||||
* CLASSNAME_SHADOW, e.g. style=='foobar' -> actual style | |||||
* name=='v-shadow-foobar'. | |||||
* | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
protected void setShadowStyle(String style) { | |||||
if (isShadowEnabled()) { | |||||
shadow.setClassName(CLASSNAME_SHADOW + "-" + style); | |||||
} | |||||
} | |||||
/** | /** | ||||
* Extending classes should always call this method after they change the | * Extending classes should always call this method after they change the | ||||
* size of overlay without using normal 'setWidth(String)' and | * size of overlay without using normal 'setWidth(String)' and | ||||
getOffsetWidth(); | getOffsetWidth(); | ||||
} | } | ||||
if (isShadowEnabled() || needsShimElement()) { | |||||
if (needsShimElement()) { | |||||
PositionAndSize positionAndSize = new PositionAndSize( | PositionAndSize positionAndSize = new PositionAndSize( | ||||
getActualLeft(), getActualTop(), getOffsetWidth(), | getActualLeft(), getActualTop(), getOffsetWidth(), | ||||
Element container = getElement().getParentElement(); | Element container = getElement().getParentElement(); | ||||
if (isShadowEnabled()) { | |||||
updateShadowPosition(progress, zIndex, positionAndSize); | |||||
if (shadow.getParentElement() == null) { | |||||
container.insertBefore(shadow, getElement()); | |||||
sinkShadowEvents(); | |||||
} | |||||
} | |||||
if (needsShimElement()) { | if (needsShimElement()) { | ||||
updateShimPosition(positionAndSize); | updateShimPosition(positionAndSize); | ||||
if (shimElement.getParentElement() == null) { | if (shimElement.getParentElement() == null) { | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// Fix for #14173 | |||||
// IE9 and IE10 have a bug, when resize an a element with box-shadow. | |||||
// IE9 and IE10 need explicit update to remove extra box-shadows | |||||
if (BrowserInfo.get().isIE9() || BrowserInfo.get().isIE10()) { | |||||
WidgetUtil.forceIERedraw(getElement()); | |||||
} | |||||
} | |||||
/** | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
private void updateShadowPosition(final double progress, int zIndex, | |||||
PositionAndSize positionAndSize) { | |||||
// Opera needs some shaking to get parts of the shadow showing | |||||
// properly (ticket #2704) | |||||
if (BrowserInfo.get().isOpera()) { | |||||
// Clear the height of all middle elements | |||||
DOM.getChild(shadow, 3).getStyle().setProperty("height", "auto"); | |||||
DOM.getChild(shadow, 4).getStyle().setProperty("height", "auto"); | |||||
DOM.getChild(shadow, 5).getStyle().setProperty("height", "auto"); | |||||
} | |||||
updatePositionAndSize(shadow, positionAndSize); | |||||
shadow.getStyle().setZIndex(zIndex); | |||||
shadow.getStyle().setProperty("display", progress < 0.9 ? "none" : ""); | |||||
// Opera fix, part 2 (ticket #2704) | |||||
if (BrowserInfo.get().isOpera()) { | |||||
// We'll fix the height of all the middle elements | |||||
DOM.getChild(shadow, 3).getStyle().setPropertyPx("height", | |||||
DOM.getChild(shadow, 3).getOffsetHeight()); | |||||
DOM.getChild(shadow, 4).getStyle().setPropertyPx("height", | |||||
DOM.getChild(shadow, 4).getOffsetHeight()); | |||||
DOM.getChild(shadow, 5).getStyle().setPropertyPx("height", | |||||
DOM.getChild(shadow, 5).getOffsetHeight()); | |||||
} | |||||
} | } | ||||
private void updateShimPosition(PositionAndSize positionAndSize) { | private void updateShimPosition(PositionAndSize positionAndSize) { | ||||
} | } | ||||
} | } | ||||
@Override | |||||
public void onClose(CloseEvent<PopupPanel> event) { | |||||
removeShadowIfPresent(); | |||||
} | |||||
@Override | |||||
public void sinkEvents(int eventBitsToAdd) { | |||||
super.sinkEvents(eventBitsToAdd); | |||||
// Also sink events on the shadow if present | |||||
sinkShadowEvents(); | |||||
} | |||||
/** | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
private void sinkShadowEvents() { | |||||
if (isSinkShadowEvents() && isShadowAttached()) { | |||||
// Sink the same events as the actual overlay has sunk | |||||
DOM.sinkEvents(shadow, DOM.getEventsSunk(getElement())); | |||||
// Send events to Overlay.onBrowserEvent | |||||
DOM.setEventListener(shadow, this); | |||||
} | |||||
} | |||||
/** | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
private void unsinkShadowEvents() { | |||||
if (isShadowAttached()) { | |||||
DOM.setEventListener(shadow, null); | |||||
DOM.sinkEvents(shadow, 0); | |||||
} | |||||
} | |||||
/** | |||||
* Enables or disables sinking the events of the shadow to the same | |||||
* onBrowserEvent as events to the actual overlay goes. | |||||
* | |||||
* Please note, that if you enable this, you can't assume that e.g. | |||||
* event.getEventTarget returns an element inside the DOM structure of the | |||||
* overlay | |||||
* | |||||
* @param sinkShadowEvents | |||||
* | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
protected void setSinkShadowEvents(boolean sinkShadowEvents) { | |||||
this.sinkShadowEvents = sinkShadowEvents; | |||||
if (sinkShadowEvents) { | |||||
sinkShadowEvents(); | |||||
} else { | |||||
unsinkShadowEvents(); | |||||
} | |||||
} | |||||
/** | |||||
* @deprecated See main JavaDoc for Overlay | |||||
*/ | |||||
@Deprecated | |||||
protected boolean isSinkShadowEvents() { | |||||
return sinkShadowEvents; | |||||
} | |||||
/** | /** | ||||
* Get owner (Widget that made this Overlay, not the layout parent) of | * Get owner (Widget that made this Overlay, not the layout parent) of | ||||
* Overlay | * Overlay | ||||
*/ | */ | ||||
public void hide(final boolean autoClosed, final boolean animateIn, | public void hide(final boolean autoClosed, final boolean animateIn, | ||||
final boolean animateOut) { | final boolean animateOut) { | ||||
if (BrowserInfo.get().isIE8() || BrowserInfo.get().isIE9()) { | |||||
reallyHide(autoClosed); | |||||
if (animateIn | |||||
&& getStyleName().contains(ADDITIONAL_CLASSNAME_ANIMATE_IN)) { | |||||
AnimationUtil.addAnimationEndListener(getElement(), | |||||
new AnimationEndListener() { | |||||
@Override | |||||
public void onAnimationEnd(NativeEvent event) { | |||||
if (AnimationUtil.getAnimationName(event).contains( | |||||
ADDITIONAL_CLASSNAME_ANIMATE_IN)) { | |||||
reallyHide(autoClosed); | |||||
} | |||||
} | |||||
}); | |||||
} else { | } else { | ||||
if (animateIn && getStyleName() | |||||
.contains(ADDITIONAL_CLASSNAME_ANIMATE_IN)) { | |||||
// Check if animations are used | |||||
addStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_OUT); | |||||
ComputedStyle cs = new ComputedStyle(getElement()); | |||||
String animationName = AnimationUtil.getAnimationName(cs); | |||||
if (animationName == null) { | |||||
animationName = ""; | |||||
} | |||||
if (animateOut && animationName | |||||
.contains(ADDITIONAL_CLASSNAME_ANIMATE_OUT)) { | |||||
// Disable GWT PopupPanel closing animation if used | |||||
setAnimationEnabled(false); | |||||
AnimationUtil.addAnimationEndListener(getElement(), | AnimationUtil.addAnimationEndListener(getElement(), | ||||
new AnimationEndListener() { | new AnimationEndListener() { | ||||
@Override | @Override | ||||
public void onAnimationEnd(NativeEvent event) { | public void onAnimationEnd(NativeEvent event) { | ||||
if (AnimationUtil.getAnimationName(event) | |||||
.contains( | |||||
ADDITIONAL_CLASSNAME_ANIMATE_IN)) { | |||||
String animationName = AnimationUtil | |||||
.getAnimationName(event); | |||||
if (animationName.contains( | |||||
ADDITIONAL_CLASSNAME_ANIMATE_OUT)) { | |||||
AnimationUtil | |||||
.removeAllAnimationEndListeners( | |||||
getElement()); | |||||
// Remove both animation styles just in | |||||
// case | |||||
removeStyleDependentName( | |||||
ADDITIONAL_CLASSNAME_ANIMATE_IN); | |||||
removeStyleDependentName( | |||||
ADDITIONAL_CLASSNAME_ANIMATE_OUT); | |||||
reallyHide(autoClosed); | reallyHide(autoClosed); | ||||
} | } | ||||
} | } | ||||
}); | }); | ||||
// No event previews should happen after the animation has | |||||
// started | |||||
Overlay.this.setPreviewingAllNativeEvents(false); | |||||
} else { | } else { | ||||
// Check if animations are used | |||||
addStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_OUT); | |||||
if (isShadowEnabled()) { | |||||
shadow.addClassName(CLASSNAME_SHADOW + "-" | |||||
+ ADDITIONAL_CLASSNAME_ANIMATE_OUT); | |||||
} | |||||
ComputedStyle cs = new ComputedStyle(getElement()); | |||||
String animationName = AnimationUtil.getAnimationName(cs); | |||||
if (animationName == null) { | |||||
animationName = ""; | |||||
} | |||||
if (animateOut && animationName | |||||
.contains(ADDITIONAL_CLASSNAME_ANIMATE_OUT)) { | |||||
// Disable GWT PopupPanel closing animation if used | |||||
setAnimationEnabled(false); | |||||
AnimationUtil.addAnimationEndListener(getElement(), | |||||
new AnimationEndListener() { | |||||
@Override | |||||
public void onAnimationEnd(NativeEvent event) { | |||||
String animationName = AnimationUtil | |||||
.getAnimationName(event); | |||||
if (animationName.contains( | |||||
ADDITIONAL_CLASSNAME_ANIMATE_OUT)) { | |||||
AnimationUtil | |||||
.removeAllAnimationEndListeners( | |||||
getElement()); | |||||
// Remove both animation styles just in | |||||
// case | |||||
removeStyleDependentName( | |||||
ADDITIONAL_CLASSNAME_ANIMATE_IN); | |||||
removeStyleDependentName( | |||||
ADDITIONAL_CLASSNAME_ANIMATE_OUT); | |||||
if (isShadowEnabled()) { | |||||
shadow.removeClassName( | |||||
CLASSNAME_SHADOW + "-" | |||||
+ ADDITIONAL_CLASSNAME_ANIMATE_IN); | |||||
shadow.removeClassName( | |||||
CLASSNAME_SHADOW + "-" | |||||
+ ADDITIONAL_CLASSNAME_ANIMATE_OUT); | |||||
} | |||||
reallyHide(autoClosed); | |||||
} | |||||
} | |||||
}); | |||||
// No event previews should happen after the animation has | |||||
// started | |||||
Overlay.this.setPreviewingAllNativeEvents(false); | |||||
} else { | |||||
removeStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_OUT); | |||||
if (isShadowEnabled()) { | |||||
shadow.removeClassName(CLASSNAME_SHADOW + "-" | |||||
+ ADDITIONAL_CLASSNAME_ANIMATE_OUT); | |||||
} | |||||
reallyHide(autoClosed); | |||||
} | |||||
removeStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_OUT); | |||||
reallyHide(autoClosed); | |||||
} | } | ||||
} | } | ||||
} | } |
<inherits name="com.google.gwt.logging.Logging" /> | <inherits name="com.google.gwt.logging.Logging" /> | ||||
<set-property name="gwt.logging.enabled" value="TRUE" /> | <set-property name="gwt.logging.enabled" value="TRUE" /> | ||||
<inherits name="com.vaadin.VaadinBrowserSpecificOverrides" /> | |||||
<source path="client" /> | <source path="client" /> | ||||
<source path="shared" /> | <source path="shared" /> | ||||
<!-- Use the new cross site linker to get a nocache.js without document.write --> | <!-- Use the new cross site linker to get a nocache.js without document.write --> | ||||
<add-linker name="xsiframe" /> | <add-linker name="xsiframe" /> | ||||
<!-- Remove IE6/IE7 permutation as they are not supported --> | |||||
<set-property name="user.agent" value="ie8,ie9,ie10,gecko1_8,safari" /> | |||||
<set-property name="user.agent" value="gecko1_8,safari" /> | |||||
<!-- Pointer event support --> | <!-- Pointer event support --> | ||||
<define-property name="modernie" values="none,yes" /> | <define-property name="modernie" values="none,yes" /> | ||||
</none> | </none> | ||||
</replace-with> | </replace-with> | ||||
<replace-with class="com.vaadin.client.event.PointerEventSupportImplIE10"> | |||||
<when-type-is class="com.vaadin.client.event.PointerEventSupportImpl" /> | |||||
<when-property-is value="ie10" name="user.agent" /> | |||||
</replace-with> | |||||
<replace-with | <replace-with | ||||
class="com.vaadin.client.communication.DefaultConnectionStateHandler"> | class="com.vaadin.client.communication.DefaultConnectionStateHandler"> | ||||
<when-type-is | <when-type-is |
<module> | |||||
<!-- This GWT module defines the browser specific overrides used by Vaadin --> | |||||
<!-- Hint for WidgetSetBuilder not to automatically update the file --> | |||||
<!-- WS Compiler: manually edited --> | |||||
<!-- Fall through to this rule for everything but IE --> | |||||
<replace-with | |||||
class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy"> | |||||
<when-type-is | |||||
class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy" /> | |||||
</replace-with> | |||||
<replace-with | |||||
class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategyIE"> | |||||
<when-type-is | |||||
class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy" /> | |||||
<any> | |||||
<when-property-is name="user.agent" value="ie8" /> | |||||
</any> | |||||
</replace-with> | |||||
<!-- Fall through to this rule for everything but IE --> | |||||
<replace-with class="com.vaadin.client.ui.VDragAndDropWrapper"> | |||||
<when-type-is class="com.vaadin.client.ui.VDragAndDropWrapper" /> | |||||
</replace-with> | |||||
<replace-with class="com.vaadin.client.ui.VDragAndDropWrapperIE"> | |||||
<when-type-is class="com.vaadin.client.ui.VDragAndDropWrapper" /> | |||||
<any> | |||||
<when-property-is name="user.agent" value="ie8" /> | |||||
</any> | |||||
</replace-with> | |||||
<!-- Fall through to this rule for everything but IE --> | |||||
<replace-with class="com.vaadin.client.LayoutManager"> | |||||
<when-type-is class="com.vaadin.client.LayoutManager" /> | |||||
</replace-with> | |||||
<replace-with class="com.vaadin.client.LayoutManagerIE8"> | |||||
<when-type-is class="com.vaadin.client.LayoutManager" /> | |||||
<any> | |||||
<when-property-is name="user.agent" value="ie8" /> | |||||
</any> | |||||
</replace-with> | |||||
</module> |
private static final String FIREFOX_40B11_WIN = "Mozilla/5.0 (Windows NT 5.1; rv:2.0b11) Gecko/20100101 Firefox/4.0b11"; | private static final String FIREFOX_40B11_WIN = "Mozilla/5.0 (Windows NT 5.1; rv:2.0b11) Gecko/20100101 Firefox/4.0b11"; | ||||
private static final String KONQUEROR_LINUX = "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Exabot-Thumbnails)"; | private static final String KONQUEROR_LINUX = "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Exabot-Thumbnails)"; | ||||
private static final String IE6_WINDOWS = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)"; | |||||
private static final String IE7_WINDOWS = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"; | |||||
private static final String IE8_WINDOWS = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)"; | |||||
private static final String IE8_IN_IE7_MODE_WINDOWS = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)"; | |||||
private static final String IE9_IN_IE7_MODE_WINDOWS_7 = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)"; | |||||
private static final String IE9_BETA_IN_IE8_MODE_WINDOWS_7 = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)"; | |||||
private static final String IE9_BETA_WINDOWS_7 = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; | |||||
private static final String IE10_WINDOWS_8 = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)"; | |||||
private static final String IE11_WINDOWS_7 = "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; rv:11.0) like Gecko"; | private static final String IE11_WINDOWS_7 = "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; rv:11.0) like Gecko"; | ||||
private static final String IE11_WINDOWS_PHONE_8_1_UPDATE = "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 920) Like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537"; | private static final String IE11_WINDOWS_PHONE_8_1_UPDATE = "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 920) Like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537"; | ||||
assertWindows(bd); | assertWindows(bd); | ||||
} | } | ||||
@Test | |||||
public void testIE6() { | |||||
VBrowserDetails bd = new VBrowserDetails(IE6_WINDOWS); | |||||
assertEngineVersion(bd, -1); | |||||
assertIE(bd); | |||||
assertBrowserMajorVersion(bd, 6); | |||||
assertBrowserMinorVersion(bd, 0); | |||||
assertWindows(bd); | |||||
} | |||||
@Test | |||||
public void testIE7() { | |||||
VBrowserDetails bd = new VBrowserDetails(IE7_WINDOWS); | |||||
assertEngineVersion(bd, -1); | |||||
assertIE(bd); | |||||
assertBrowserMajorVersion(bd, 7); | |||||
assertBrowserMinorVersion(bd, 0); | |||||
assertWindows(bd); | |||||
} | |||||
@Test | |||||
public void testIE8() { | |||||
VBrowserDetails bd = new VBrowserDetails(IE8_WINDOWS); | |||||
assertTrident(bd); | |||||
assertEngineVersion(bd, 4); | |||||
assertIE(bd); | |||||
assertBrowserMajorVersion(bd, 8); | |||||
assertBrowserMinorVersion(bd, 0); | |||||
assertWindows(bd); | |||||
} | |||||
@Test | |||||
public void testIE8CompatibilityMode() { | |||||
VBrowserDetails bd = new VBrowserDetails(IE8_IN_IE7_MODE_WINDOWS); | |||||
bd.setIEMode(7); | |||||
assertTrident(bd); | |||||
assertEngineVersion(bd, 4); | |||||
assertIE(bd); | |||||
assertBrowserMajorVersion(bd, 7); | |||||
assertBrowserMinorVersion(bd, 0); | |||||
assertWindows(bd); | |||||
} | |||||
@Test | |||||
public void testIE9() { | |||||
VBrowserDetails bd = new VBrowserDetails(IE9_BETA_WINDOWS_7); | |||||
assertTrident(bd); | |||||
assertEngineVersion(bd, 5); | |||||
assertIE(bd); | |||||
assertBrowserMajorVersion(bd, 9); | |||||
assertBrowserMinorVersion(bd, 0); | |||||
assertWindows(bd); | |||||
} | |||||
@Test | |||||
public void testIE9InIE7CompatibilityMode() { | |||||
VBrowserDetails bd = new VBrowserDetails(IE9_IN_IE7_MODE_WINDOWS_7); | |||||
// bd.setIE8InCompatibilityMode(); | |||||
assertTrident(bd); | |||||
assertEngineVersion(bd, 5); | |||||
assertIE(bd); | |||||
assertBrowserMajorVersion(bd, 7); | |||||
assertBrowserMinorVersion(bd, 0); | |||||
assertWindows(bd); | |||||
} | |||||
@Test | |||||
public void testIE9InIE8CompatibilityMode() { | |||||
VBrowserDetails bd = new VBrowserDetails( | |||||
IE9_BETA_IN_IE8_MODE_WINDOWS_7); | |||||
// bd.setIE8InCompatibilityMode(); | |||||
/* | |||||
* Trident/4.0 in example user agent string based on beta even though it | |||||
* should be Trident/5.0 in real (non-beta) user agent strings | |||||
*/ | |||||
assertTrident(bd); | |||||
assertEngineVersion(bd, 4); | |||||
assertIE(bd); | |||||
assertBrowserMajorVersion(bd, 8); | |||||
assertBrowserMinorVersion(bd, 0); | |||||
assertWindows(bd); | |||||
} | |||||
@Test | |||||
public void testIE10() { | |||||
VBrowserDetails bd = new VBrowserDetails(IE10_WINDOWS_8); | |||||
assertTrident(bd); | |||||
assertEngineVersion(bd, 6); | |||||
assertIE(bd); | |||||
assertBrowserMajorVersion(bd, 10); | |||||
assertBrowserMinorVersion(bd, 0); | |||||
assertWindows(bd); | |||||
} | |||||
@Test | @Test | ||||
public void testIE11() { | public void testIE11() { | ||||
VBrowserDetails bd = new VBrowserDetails(IE11_WINDOWS_7); | VBrowserDetails bd = new VBrowserDetails(IE11_WINDOWS_7); | ||||
} | } | ||||
} | } | ||||
@import "popupview/popupview.scss"; | @import "popupview/popupview.scss"; | ||||
@import "progressindicator/progressindicator.scss"; | @import "progressindicator/progressindicator.scss"; | ||||
@import "select/select.scss"; | @import "select/select.scss"; | ||||
@import "shadow/shadow.scss"; | |||||
@import "slider/slider.scss"; | @import "slider/slider.scss"; | ||||
@import "splitpanel/splitpanel.scss"; | @import "splitpanel/splitpanel.scss"; | ||||
@import "table/table.scss"; | @import "table/table.scss"; | ||||
@include base-progressindicator(v-progressindicator); | @include base-progressindicator(v-progressindicator); | ||||
@include base-select; | @include base-select; | ||||
@include base-shadow; | |||||
@include base-slider; | @include base-slider; | ||||
@include base-splitpanel; | @include base-splitpanel; | ||||
@include base-table; | @include base-table; |
@mixin base-shadow($primaryStyleName : v-shadow) { | |||||
.#{$primaryStyleName} { | |||||
position: absolute; | |||||
display: none; | |||||
pointer-events: none; | |||||
} | |||||
.#{$primaryStyleName} .top-left { | |||||
position: absolute; overflow: hidden; | |||||
top: -3px; left: -5px; | |||||
width: 10px; height: 10px; | |||||
background: transparent url(img/top-left.png); | |||||
} | |||||
.#{$primaryStyleName} .top { | |||||
position: absolute; overflow: hidden; | |||||
top: -3px; left: 5px; | |||||
height: 10px; right: 5px; | |||||
background: transparent url(img/top.png); | |||||
} | |||||
.#{$primaryStyleName} .top-right { | |||||
position: absolute; overflow: hidden; | |||||
top: -3px; right: -5px; | |||||
width: 10px; height: 10px; | |||||
background: transparent url(img/top-right.png); | |||||
} | |||||
.#{$primaryStyleName} .left { | |||||
position: absolute; overflow: hidden; | |||||
top: 7px; left: -5px; | |||||
width: 10px; | |||||
bottom: 3px; | |||||
background: transparent url(img/left.png); | |||||
} | |||||
.#{$primaryStyleName} .center { | |||||
position: absolute; overflow: hidden; | |||||
top: 7px; left: 5px; | |||||
bottom: 3px; right: 5px; | |||||
background: transparent url(img/center.png); | |||||
} | |||||
.#{$primaryStyleName} .right { | |||||
position: absolute; overflow: hidden; | |||||
top: 7px; right: -5px; | |||||
width: 10px; | |||||
bottom: 3px; | |||||
background: transparent url(img/right.png); | |||||
} | |||||
.#{$primaryStyleName} .bottom-left { | |||||
position: absolute; overflow: hidden; | |||||
bottom: -7px; left: -5px; | |||||
width: 10px; height: 10px; | |||||
background: transparent url(img/bottom-left.png); | |||||
} | |||||
.#{$primaryStyleName} .bottom { | |||||
position: absolute; overflow: hidden; | |||||
bottom: -7px; left: 5px; | |||||
right: 5px; height: 10px; | |||||
background: transparent url(img/bottom.png); | |||||
} | |||||
.#{$primaryStyleName} .bottom-right { | |||||
position: absolute; overflow: hidden; | |||||
bottom: -7px; right: -5px; | |||||
width: 10px; height: 10px; | |||||
background: transparent url(img/bottom-right.png); | |||||
} | |||||
} |
height: 100%; | height: 100%; | ||||
filter: alpha(opacity=50); | filter: alpha(opacity=50); | ||||
} | } | ||||
/* Shadow for window */ | |||||
.v-shadow-window { | |||||
position: absolute; | |||||
display: none; | |||||
pointer-events: none; | |||||
} | |||||
.v-shadow-window .top-left { | |||||
position: absolute; overflow: hidden; | |||||
top: -10px; left: -15px; | |||||
width: 28px; height: 28px; | |||||
background: transparent url(img/shadow/top-left.png); | |||||
} | |||||
.v-shadow-window .top { | |||||
position: absolute; overflow: hidden; | |||||
top: -10px; left: 13px; | |||||
height: 28px; | |||||
right: 13px; | |||||
background: transparent url(img/shadow/top.png); | |||||
} | |||||
.v-shadow-window .top-right { | |||||
position: absolute; overflow: hidden; | |||||
top: -10px; right: -15px; | |||||
width: 28px; height: 28px; | |||||
background: transparent url(img/shadow/top-right.png); | |||||
} | |||||
.v-shadow-window .left { | |||||
position: absolute; overflow: hidden; | |||||
top: 18px; left: -15px; | |||||
width: 28px; | |||||
bottom: 10px; | |||||
background: transparent url(img/shadow/left.png); | |||||
} | |||||
.v-shadow-window .center { | |||||
position: absolute; overflow: hidden; | |||||
top: 18px; left: 13px; | |||||
bottom: 10px; right: 13px; | |||||
background: transparent url(img/shadow/center.png); | |||||
} | |||||
.v-shadow-window .right { | |||||
position: absolute; overflow: hidden; | |||||
top: 18px; right: -15px; | |||||
width: 28px; | |||||
bottom: 10px; | |||||
background: transparent url(img/shadow/right.png); | |||||
} | |||||
.v-shadow-window .bottom-left { | |||||
position: absolute; overflow: hidden; | |||||
bottom: -18px; left: -15px; | |||||
width: 28px; height: 28px; | |||||
background: transparent url(img/shadow/bottom-left.png); | |||||
} | |||||
.v-shadow-window .bottom { | |||||
position: absolute; overflow: hidden; | |||||
bottom: -18px; left: 13px; | |||||
right: 13px; height: 28px; | |||||
background: transparent url(img/shadow/bottom.png); | |||||
} | |||||
.v-shadow-window .bottom-right { | |||||
position: absolute; overflow: hidden; | |||||
bottom: -18px; right: -15px; | |||||
width: 28px; height: 28px; | |||||
background: transparent url(img/shadow/bottom-right.png); | |||||
} | |||||
} | } |
@import "popupview/popupview.scss"; | @import "popupview/popupview.scss"; | ||||
@import "progressindicator/progressindicator.scss"; | @import "progressindicator/progressindicator.scss"; | ||||
@import "select/select.scss"; | @import "select/select.scss"; | ||||
@import "shadow/shadow.scss"; | |||||
@import "slider/slider.scss"; | @import "slider/slider.scss"; | ||||
@import "splitpanel/splitpanel.scss"; | @import "splitpanel/splitpanel.scss"; | ||||
@import "table/table.scss"; | @import "table/table.scss"; | ||||
@include runo-progressindicator(v-progressindicator); | @include runo-progressindicator(v-progressindicator); | ||||
@include runo-select; | @include runo-select; | ||||
@include runo-shadow; | |||||
@include runo-slider; | @include runo-slider; | ||||
@include runo-splitpanel; | @include runo-splitpanel; | ||||
@include runo-table; | @include runo-table; |
@mixin runo-shadow($primaryStyleName : v-shadow) { | |||||
.#{$primaryStyleName} { | |||||
position: absolute; | |||||
} | |||||
.#{$primaryStyleName} .top-left { | |||||
position: absolute; overflow: hidden; | |||||
top: -3px; left: -4px; | |||||
width: 8px; height: 8px; | |||||
background: transparent url(img/top-left.png); | |||||
} | |||||
.#{$primaryStyleName} .top { | |||||
position: absolute; overflow: hidden; | |||||
top: -3px; left: 4px; | |||||
height: 8px; right: 4px; | |||||
background: transparent url(img/top.png); | |||||
} | |||||
.#{$primaryStyleName} .top-right { | |||||
position: absolute; overflow: hidden; | |||||
top: -3px; right: -4px; | |||||
width: 8px; height: 8px; | |||||
background: transparent url(img/top-right.png); | |||||
} | |||||
.#{$primaryStyleName} .left { | |||||
position: absolute; overflow: hidden; | |||||
top: 5px; left: -4px; | |||||
width: 8px; | |||||
bottom: 3px; | |||||
background: transparent url(img/left.png); | |||||
} | |||||
.#{$primaryStyleName} .center { | |||||
position: absolute; overflow: hidden; | |||||
top: 5px; left: 4px; | |||||
bottom: 3px; right: 4px; | |||||
background: transparent url(img/center.png); | |||||
} | |||||
.#{$primaryStyleName} .right { | |||||
position: absolute; overflow: hidden; | |||||
top: 5px; right: -4px; | |||||
width: 8px; | |||||
bottom: 3px; | |||||
background: transparent url(img/right.png); | |||||
} | |||||
.#{$primaryStyleName} .bottom-left { | |||||
position: absolute; overflow: hidden; | |||||
bottom: -5px; left: -4px; | |||||
width: 8px; height: 8px; | |||||
background: transparent url(img/bottom-left.png); | |||||
} | |||||
.#{$primaryStyleName} .bottom { | |||||
position: absolute; overflow: hidden; | |||||
bottom: -5px; left: 4px; | |||||
right: 4px; height: 8px; | |||||
background: transparent url(img/bottom.png); | |||||
} | |||||
.#{$primaryStyleName} .bottom-right { | |||||
position: absolute; overflow: hidden; | |||||
bottom: -5px; right: -4px; | |||||
width: 8px; height: 8px; | |||||
background: transparent url(img/bottom-right.png); | |||||
} | |||||
} |
} | } | ||||
} | } | ||||
/* Shadow for window */ | |||||
.v-shadow-window .top-left { | |||||
top: -13px; left: -20px; | |||||
width: 39px; height: 39px; | |||||
background: transparent url(img/shadow/top-left.png); | |||||
} | |||||
.v-shadow-window .top { | |||||
top: -13px; left: 19px; | |||||
height: 39px; | |||||
right: 19px; | |||||
background: transparent url(img/shadow/top.png); | |||||
} | |||||
.v-shadow-window .top-right { | |||||
top: -13px; right: -20px; | |||||
width: 39px; height: 39px; | |||||
background: transparent url(img/shadow/top-right.png); | |||||
} | |||||
.v-shadow-window .left { | |||||
top: 26px; left: -20px; | |||||
width: 39px; | |||||
bottom: 12px; | |||||
background: transparent url(img/shadow/left.png); | |||||
} | |||||
.v-shadow-window .center { | |||||
top: 26px; left: 19px; | |||||
bottom: 12px; right: 19px; | |||||
background: transparent url(img/shadow/center.png); | |||||
} | |||||
.v-shadow-window .right { | |||||
top: 26px; right: -20px; | |||||
width: 39px; | |||||
bottom: 12px; | |||||
background: transparent url(img/shadow/right.png); | |||||
} | |||||
.v-shadow-window .bottom-left { | |||||
bottom: -27px; left: -20px; | |||||
width: 39px; height: 39px; | |||||
background: transparent url(img/shadow/bottom-left.png); | |||||
} | |||||
.v-shadow-window .bottom { | |||||
bottom: -27px; left: 19px; | |||||
right: 19px; height: 39px; | |||||
background: transparent url(img/shadow/bottom.png); | |||||
} | |||||
.v-shadow-window .bottom-right { | |||||
bottom: -27px; right: -20px; | |||||
width: 39px; height: 39px; | |||||
background: transparent url(img/shadow/bottom-right.png); | |||||
} | |||||
} | } |
*/ | */ | ||||
$v-selection-item-selection-color: $v-selection-color !default; | $v-selection-item-selection-color: $v-selection-color !default; | ||||
/* | |||||
* Simulates CSS box-shadow using the extraneous shadow elements in the DOM. | |||||
* | |||||
* @access private | |||||
* @deprecated The .v-shadow element is deprecated since 7.3.0 | |||||
* @group overlay | |||||
*/ | |||||
@mixin valo-ie8-shadow($shadow, $element: top) { | |||||
.#{$element} { | |||||
$shadow-offset-x: nth($shadow, 1); | |||||
$shadow-offset-y: nth($shadow, 2); | |||||
$shadow-blur: nth($shadow, 3); | |||||
$shadow-spread: 0; | |||||
@if length($shadow) > 4 { | |||||
$shadow-spread: nth($shadow, 4); | |||||
} | |||||
$shadow-color: last($shadow); | |||||
$shadow-color-opacity: round(opacity($shadow-color) * 100); | |||||
$shadow-color: opacify($shadow-color, 1); | |||||
position: absolute; | |||||
top: $shadow-offset-y - $shadow-blur - $shadow-spread; | |||||
right: -$shadow-offset-x + $shadow-blur - $shadow-spread; | |||||
bottom: -$shadow-offset-y + $shadow-blur - $shadow-spread; | |||||
left: $shadow-offset-x - $shadow-blur - $shadow-spread; | |||||
background: $shadow-color; | |||||
filter: alpha(opacity=#{$shadow-color-opacity}) progid:DXImageTransform.Microsoft.blur(pixelradius=#{strip-units($shadow-blur)}, makeShadow=false); | |||||
} | |||||
} | |||||
// Not needed in modern browsers | |||||
.v-shadow, | |||||
.v-shadow-window { | |||||
display: none; | |||||
} | |||||
/** | /** | ||||
* Outputs styles for overlay elements | * Outputs styles for overlay elements | ||||
* | * |