我一直在使用GWT MVP框架+ GWT 編輯框架開展一些小型項目。我有一個領域的瀏覽界面聲明如下:GWT活動和編輯框架
@Path("field")
IsEditor<ValueBoxEditor<Long>> getField();
視圖實現是這樣的:
@UiField
IsEditor<ValueBoxEditor<Long>> field;
public IsEditor<ValueBoxEditor<Long>> getField(){
return field;
}
在我Activitys我referances對應視圖,當我有 做(在活動)的東西像這樣:
view.getField.setEnable(true);
我必須做投地
((ValueBoxBase<Long>)view.getField()).setEnable(true);
後,我不能測試這個單位,因爲在我的測試中,我定義視圖的行爲對view.getFiled()
返回模擬(IsEditor<ValueBoxEditor<Long>>)
的結果我得到:
java.lang.ClassCastException: com.google.gwt.editor.client.IsEditor$
$EnhancerByMockitoWithCGLIB$$e8c00c36 cannot be cast to
com.google.gwt.user.client.ui.ValueBoxBase
什麼是調用視圖組件的方法最好practiece從活動 沒有做鑄造?
asdjava.lang.ClassCastException:com.google.gwt.editor.client.IsEditor $$ EnhancerByMockitoWithCGLIB $$ ea68060b不能轉換爲COM .google.gwt.user.client.ui.HasEnabled – user709433 2011-04-15 08:50:48
這對我的測試沒有幫助,我仍然有 java.lang.ClassCastException:com.google.gwt.editor.client.IsEditor $$ EnhancerByMockitoWithCGLIB $$ ea68060b can not被轉換爲com.google.gwt.user.client.ui.HasEnabled 我想找到如何在沒有強制轉換的Activity下從IsEditor>中的對象獲取小部件的方法。 –
user709433
2011-04-15 09:01:27