我創建了以下類作爲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