简体   繁体   English

如何在SmartGWT中使用其他包中的类

[英]How to use classes from other packages in SmartGWT

If I try use method from another package, I'm getting an error: 如果我尝试使用其他软件包中的方法,则会收到错误消息:

[ERROR] [odminterface] - Errors in 'file:/C:/Eclipse%20EE%20WS/ODMInterface/src/com/odminterface/client/ODMInterface.java' [错误] [odminterface]-“文件:/ C:/Eclipse%20EE%20WS/ODMInterface/src/com/odminterface/client/ODMInterface.java”中的错误

[ERROR] [odminterface] - Line 71: No source code is available for type com.testpack.test.PackTest; [错误] [odminterface]-第71行:com.testpack.test.PackTest类型没有源代码; did you forget to inherit a required module? 您忘了继承必需的模块吗?

[ERROR] [odminterface] - Unable to find type 'com.odminterface.client.ODMInterface' [错误] [odminterface]-无法找到类型'com.odminterface.client.ODMInterface'

[ERROR] [odminterface] - Failed to load module 'odminterface' from user agent 'Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20100101 Firefox/10.0.2' at 127.0.0.1:6575 [错误] [odminterface]-无法从用户代理'Mozilla / 5.0(Windows NT 6.1; rv:10.0.2)Gecko / 20100101 Firefox / 10.0.2'从127.0.0.1:6575加载模块'odminterface'

My project: http://s019.radikal.ru/i616/1207/2e/1e224907c5c1t.jpg 我的项目: http : //s019.radikal.ru/i616/1207/2e/1e224907c5c1t.jpg

ODMInterface.gwt.xml code: ODMInterface.gwt.xml代码:

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='odminterface'>

<inherits name='com.google.gwt.user.User'/>
<inherits name='com.smartgwt.SmartGwt'/>

<inherits name='com.google.gwt.user.theme.clean.Clean'/>

<entry-point class='com.odminterface.client.ODMInterface'/>

<source path='client'/>
<source path='shared'/>
</module>

PackTest code: PackTest代码:

package com.testpack.test;


public class PackTest 
{

public void test()
{

}
}

If I put "PackTest" class to "com.odminterface.client" pakage - all work fine. 如果我将“ PackTest”类放入“ com.odminterface.client”包装中,则一切正常。

How to call a class method that is in another package? 如何调用另一个包中的类方法?

By default GWT looks for java sources in client package relative to the package of module (eg module is in ODMInterface.gwt.xml is in package com.odminterface so java sources will be expected to be in 'com.odminterface.client'). 默认情况下GWT查找在Java源client相对于所述封装模块封装(例如模块处于ODMInterface.gwt.xml是在包com.odminterface所以Java源将被预期在“com.odminterface.client”)。

Additional packages can be added using source tag (see your ODMInterface.gwt.xml for example usage, there are already two packages added using source tag). 可以使用source标记添加其他软件包(有关ODMInterface.gwt.xml的示例,请参见ODMInterface.gwt.xml ,已经使用source标记添加了两个软件包)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM