我创建了以下类作为gwtbootstrap3工具提示的扩展。至少有两个原因为什么我想要得到gwtbootstrap3 Tooltip类:GWT/GWTBootstrap3扩展工具提示:C'tor中的addHandler异常
1.)当显示工具提示时添加onWindowClosing处理程序,以便在用户离开页面时隐藏()工具提示(这是 - 据我所知 - 这是Bootstrap中不支持的功能,是吗?)
2.)我想要防止在iPad或iPhone上显示页面时显示工具提示,因为工具提示时它们表现很奇怪(第一个提示显示工具提示,第二个提示执行按钮,这不完全是用户期望的)
请注意,下面给出的类尚未完成...但已经在t他的阶段我添加一个处理程序时得到一个异常。 请注意,无论我添加什么类型的Handler(ShowHandler,ShownHandler等),它都会抛出异常。
任何帮助非常感谢。
package com.mypackage.client.widgets.featureWidgets;
import org.gwtbootstrap3.client.shared.event.ShowEvent;
import org.gwtbootstrap3.client.shared.event.ShowHandler;
import org.gwtbootstrap3.client.ui.constants.Trigger;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.ClosingEvent;
public class Tooltip extends org.gwtbootstrap3.client.ui.Tooltip {
private boolean isMobile;
private HandlerRegistration windowClosingHandlerRegistration;
private final Tooltip tooltip;
public Tooltip() {
super();
tooltip = this;
this.addShowHandler(new ShowHandler() {
@Override
public void onShow(final ShowEvent showEvent) {
// TODO Auto-generated method stub
if (windowClosingHandlerRegistration == null) {
windowClosingHandlerRegistration = Window.addWindowClosingHandler(new Window.ClosingHandler() {
@Override
public void onWindowClosing(final ClosingEvent arg0) {
tooltip.hide();
}
});
}
}
});
}
}
When I create a instance of this tooltip using the following:
[...]
<b:ButtonToolBar ui:field="itemButtonToolBar" addStyleNames="hiddenPrint">
<b:ButtonGroup>
<a:Tooltip title="{msgs.buttomTitleAddItem}" container="body">
<b:Button ui:field="addItemButton" icon="PLUS"/>
</a:Tooltip>
[...]
试图添加处理程序时出现以下异常,为什么?
SEVERE: (TypeError) : Cannot read property 'addHandler_11_g$' of undefinedcom.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'addHandler_11_g$' of undefined
at Unknown.addShowHandler_2_g$([email protected]:57195)
at Unknown.Tooltip_6_g$([email protected]:57685)
at Unknown.build_f_Tooltip2_0_g$([email protected]:31606)
at Unknown.get_f_Tooltip2_0_g$([email protected]:31831)
at Unknown.build_f_ButtonGroup1_0_g$([email protected]:31524)
at Unknown.get_f_ButtonGroup1_0_g$([email protected]:31791)
at Unknown.build_itemButtonToolBar_0_g$([email protected]:31696)
at Unknown.get_itemButtonToolBar_0_g$([email protected]:31876)
at Unknown.createAndBindUi_58_g$([email protected]:31437)
at Unknown.createAndBindUi_59_g$([email protected]:31441)
at Unknown.ItemButtonGroup_2_g$([email protected]:30733)
at Unknown.$init_589_g$([email protected]:37722)
at Unknown.SummaryWidget_1_g$([email protected]:37686)
at Unknown.loadSummaryWidget_0_g$([email protected]:4991)
at Unknown.setSummary_1_g$([email protected]:5028)
at Unknown.onSuccess_8_g$([email protected]:3312)
at Unknown.onSuccess_9_g$([email protected]:3317)
at Unknown.onResponseReceived_0_g$([email protected]:156917)
at Unknown.fireOnResponseReceived_0_g$([email protected]:129224)
at Unknown.onReadyStateChange_0_g$([email protected]:129532)
at Unknown.<anonymous>([email protected]:172082)
at Unknown.apply_0_g$([email protected]:104636)
at Unknown.entry0_0_g$([email protected]:104692)
at Unknown.<anonymous>([email protected]:104672)
嗨亚当,感谢您的好解释和您的帮助。你是我的英雄! – user668338