2017-02-23 118 views
0

我必須將JavaFX應用程序轉換爲GWT實現,但我不完全理解GWT應用程序的某些結構。如何將自定義類添加到EntryPoint外的GWT項目

在我的入口點類中,我創建了我需要的所有gwt元素,但是我想包含一些其他類來添加一些功能。然而每當我嘗試編譯GWT項目時,我都會遇到以下錯誤。

[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly 

的SRC結構是:

src.com.Application 
| 
+-- Client 
| | 
| +-- Application 
| +-- ApplicationService 
| +-- ApplicationServiceAsync 
|  
+-- Controller 
| | 
| +-- ParameterController 
| +-- PopupController 
|  
+-- Server 
| | 
| +-- ApplicationServiceImpl 

Application.gwt.xm升文件看起來像這樣:

<module rename-to="Application"> 

    <!-- Inherit the core Web Toolkit stuff.     --> 
    <inherits name='com.google.gwt.user.User'/>    --> 

    <!-- Specify the app entry point class.     --> 
    <entry-point class='com.Application.client.Application'/> 

    <!--Specify the GWT style sheet       --> 
    <inherits name='com.google.gwt.user.theme.clean.Clean'/> 

    <!-- Specify the app servlets.     --> 
    <servlet path='/ApplicationService' class='com.Application.server.ApplicationServiceImpl'/> 

    <source path="com.Application.Controllers.ParameterController" /> 
</module> 

如果我刪除的ParameterController.java所有引用的Application.java和註釋掉源標籤我的Application.gwt.xm文件編譯並以chrome打開,並且沒有任何功能的所有空元素。

我如何允許Application.java以外的代碼在我的gwt項目中可用?是否有一些具體的類ParameterController.java必須繼承爲可編譯的,如果是的話是什麼?

回答

0

如果您未指定任何<source/>元素,則僅添加客戶端軟件包以進行編譯,因爲默認值爲<source path="Client">
在您的示例中,將由GWT編譯器編譯(並且可在客戶端使用)的唯一代碼是ParameterController
通過還將<source path="Client">添加到您的*.gwt.xml文件中,問題應該得到解決。
(此外,軟件包名稱不應使用大寫字母。)

相關問題