mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 03:38:33 +08:00
IE11 Cosmetics #PL-5171
This commit is contained in:
parent
9d852de70b
commit
4128bb936a
@ -24,21 +24,31 @@
|
||||
|
||||
<!-- Text selection enable functions deffered binding -->
|
||||
|
||||
<define-property name="ie11orHigher" values="no,yes"/>
|
||||
<property-provider name="ie11orHigher"><![CDATA[
|
||||
{
|
||||
var ua = $wnd.navigator.userAgent;
|
||||
if (ua.indexOf('MSIE') == -1 && ua.indexOf('Trident') != -1) { return 'yes'; }
|
||||
return 'no';
|
||||
}
|
||||
]]></property-provider>
|
||||
|
||||
<replace-with class="com.haulmont.cuba.web.toolkit.ui.client.sys.ToolsImplIE">
|
||||
<when-type-is class="com.haulmont.cuba.web.toolkit.ui.client.sys.ToolsImpl"/>
|
||||
<any>
|
||||
<when-property-is name="user.agent" value="ie8"/>
|
||||
<when-property-is name="user.agent" value="ie9"/>
|
||||
<when-property-is name="user.agent" value="ie10"/>
|
||||
<when-property-is name="ie11orHigher" value="yes"/>
|
||||
</any>
|
||||
</replace-with>
|
||||
|
||||
<replace-with class="com.haulmont.cuba.web.toolkit.ui.client.sys.ToolsImplMozilla">
|
||||
<when-type-is class="com.haulmont.cuba.web.toolkit.ui.client.sys.ToolsImpl"/>
|
||||
<any>
|
||||
<when-property-is name="user.agent" value="gecko"/>
|
||||
<all>
|
||||
<when-property-is name="user.agent" value="gecko1_8"/>
|
||||
</any>
|
||||
<when-property-is name="ie11orHigher" value="no"/>
|
||||
</all>
|
||||
</replace-with>
|
||||
|
||||
<replace-with class="com.haulmont.cuba.web.toolkit.ui.client.sys.ToolsImplWebkit">
|
||||
|
@ -9,6 +9,7 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaButton;
|
||||
import com.haulmont.cuba.web.toolkit.ui.client.appui.ValidationErrorHolder;
|
||||
import com.vaadin.client.communication.StateChangeEvent;
|
||||
|
||||
import com.vaadin.client.ui.button.ButtonConnector;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
@ -35,6 +36,11 @@ public class CubaButtonConnector extends ButtonConnector {
|
||||
return (CubaButtonState) super.getState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CubaButtonWidget getWidget() {
|
||||
return (CubaButtonWidget) super.getWidget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged(StateChangeEvent stateChangeEvent) {
|
||||
stopResponsePending();
|
||||
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2015 Haulmont. All rights reserved.
|
||||
* Use is subject to license terms, see http://www.cuba-platform.com/license for details.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.button;
|
||||
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.vaadin.client.BrowserInfo;
|
||||
import com.vaadin.client.VConsole;
|
||||
import com.vaadin.client.ui.VButton;
|
||||
|
||||
/**
|
||||
* @author artamonov
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CubaButtonWidget extends VButton {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (BrowserInfo.get().isIE() && BrowserInfo.get().getIEVersion() >= 11) {
|
||||
// fix focusing of button-wrap in IE11
|
||||
setFocus(true);
|
||||
}
|
||||
|
||||
super.onClick(event);
|
||||
}
|
||||
}
|
@ -110,8 +110,8 @@ public class CubaPopupButtonConnector extends PopupButtonConnector {
|
||||
|
||||
case Event.ONKEYDOWN:
|
||||
if (!getState().customLayout && getWidget().popupHasChild(target)) {
|
||||
VButton widget = Util.findWidget(target, VButton.class);
|
||||
if (widget != null) {
|
||||
Widget widget = Util.findWidget(target, null);
|
||||
if (widget instanceof VButton) {
|
||||
Widget currentSlot = widget.getParent();
|
||||
VAbstractOrderedLayout layout = (VAbstractOrderedLayout) currentSlot.getParent();
|
||||
VButton focusButton = null;
|
||||
@ -133,12 +133,12 @@ public class CubaPopupButtonConnector extends PopupButtonConnector {
|
||||
|
||||
case Event.ONMOUSEOVER:
|
||||
if (!getState().customLayout && getWidget().popupHasChild(target)) {
|
||||
VButton widget = Util.findWidget(target, VButton.class);
|
||||
if (widget != null && !widget.getStyleName().contains(SELECTED_ITEM_STYLE)) {
|
||||
Widget widget = Util.findWidget(target, null);
|
||||
if (widget instanceof VButton && !widget.getStyleName().contains(SELECTED_ITEM_STYLE)) {
|
||||
getWidget().resetSelectedItem();
|
||||
|
||||
widget.addStyleName(SELECTED_ITEM_STYLE);
|
||||
widget.setFocus(true);
|
||||
((VButton) widget).setFocus(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.sys;
|
||||
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
|
||||
/**
|
||||
@ -14,24 +13,24 @@ import com.google.gwt.dom.client.Element;
|
||||
*/
|
||||
public class ToolsImpl {
|
||||
|
||||
protected JavaScriptObject falseFunction;
|
||||
|
||||
public ToolsImpl() {
|
||||
this.falseFunction = initFalseFunction();
|
||||
}
|
||||
|
||||
protected native JavaScriptObject initFalseFunction() /*-{
|
||||
return function () {
|
||||
return false;
|
||||
};
|
||||
}-*/;
|
||||
|
||||
protected native void setTextSelectionEnable(Element el) /*-{
|
||||
el.addEventListener("selectstart", this.@com.haulmont.cuba.web.toolkit.ui.client.sys.ToolsImpl::falseFunction, true);
|
||||
if (typeof $doc.textSelectionFalseFunction != "function") {
|
||||
$doc.textSelectionFalseFunction = function() {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
el.addEventListener("selectstart", $doc.textSelectionFalseFunction, true);
|
||||
}-*/;
|
||||
|
||||
protected native void setTextSelectionDisable(Element el) /*-{
|
||||
el.removeEventListener("selectstart", this.@com.haulmont.cuba.web.toolkit.ui.client.sys.ToolsImpl::falseFunction, true);
|
||||
if (typeof $doc.textSelectionFalseFunction != "function") {
|
||||
$doc.textSelectionFalseFunction = function() {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
el.removeEventListener("selectstart", $doc.textSelectionFalseFunction, true);
|
||||
}-*/;
|
||||
|
||||
public native void textSelectionEnable(Element el, boolean enable) /*-{
|
||||
|
@ -18,6 +18,8 @@ public class ToolsImplIE extends ToolsImpl {
|
||||
if (typeof el.style == "undefined")
|
||||
el.style = {};
|
||||
el.setAttribute('onselectstart', null);
|
||||
el.style.msUserSelect = "";
|
||||
|
||||
if (el.style.setProperty) {
|
||||
el.style.setProperty("user-select", "");
|
||||
} else {
|
||||
@ -27,9 +29,19 @@ public class ToolsImplIE extends ToolsImpl {
|
||||
|
||||
@Override
|
||||
protected native void setTextSelectionDisable(Element el) /*-{
|
||||
if (typeof el.style == "undefined")
|
||||
if (typeof $doc.ieTextSelectionFalseFunction != "function") {
|
||||
$doc.ieTextSelectionFalseFunction = function() {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof el.style == "undefined") {
|
||||
el.style = {};
|
||||
el.setAttribute('onselectstart', this.@com.haulmont.cuba.web.toolkit.ui.client.sys.ToolsImpl::falseFunction);
|
||||
}
|
||||
|
||||
el.setAttribute('onselectstart', $doc.ieTextSelectionFalseFunction);
|
||||
el.style.msUserSelect = "none";
|
||||
|
||||
if (el.style.setProperty) {
|
||||
el.style.setProperty("user-select", "none");
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user