标签: gwt2

如何使用servlet获取图像并使用GWT Image类显示它?

我使用以下代码作为GWT-RPC的GWT服务器端类(servlet)的一部分.

private void getImage() {
        HttpServletResponse res = this.getThreadLocalResponse();
        try {
            // Set content type
            res.setContentType("image/png");

            // Set content size
            File file = new File("C:\\Documents and Settings\\User\\image.png");
            res.setContentLength((int) file.length());

            // Open the file and output streams
            FileInputStream in = new FileInputStream(file);
            OutputStream out = res.getOutputStream();

            // Copy the contents of the file to the output stream
            byte[] buf = new byte[1024];
            int count = 0;
            while ((count = in.read(buf)) >= 0) {
                out.write(buf, 0, count);
            }
            in.close();
            out.close();
        } catch …
Run Code Online (Sandbox Code Playgroud)

gwt gwt-rpc gwt2

5
推荐指数
1
解决办法
8217
查看次数

IncompatibleRemoteServiceException:此应用程序已过期,请单击浏览器上的刷新按钮

我的GWT项目工作正常,但今天,经过一些更改并添加新的一个异步调用没有执行.例外情况是"此应用程序已过期,请单击浏览器上的刷新按钮".执行所有其他异步调用.

 An IncompatibleRemoteServiceException was thrown while processing this call.
 com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This application is out of date, please click the refresh button on your browser. ( Blocked attempt to access interface 'com.client.FInterface', which is not implemented by 'com.server.FServiceImpl'; this is either misconfiguration or a hack attempt )
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:252)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
Run Code Online (Sandbox Code Playgroud)

客户:

     public void onClick(ClickEvent event) {

                            fService.getRepositories(repocallback);

        }
    });
Run Code Online (Sandbox Code Playgroud)

接口

   @RemoteServiceRelativePath("init")
  public interface FInterface extends RemoteService{    

    FCollection getRepositories();
 }
Run Code Online (Sandbox Code Playgroud)

AsyncInterface

  public interface FInterfaceAsync {
void getRepositories(AsyncCallback<FCollection> repositoryCallback);
} …
Run Code Online (Sandbox Code Playgroud)

java gwt gwt-rpc gwt2

5
推荐指数
1
解决办法
9620
查看次数

在GWT 2.1.1中使用RootLayoutPanel时,浏览器级滚动条完全禁用,如何重新启用它们?

我正在使用GWT 2.1.1,每次使用RootLayoutPanel而不是RootPanel在我的EntryPoint课程中,浏览器的滚动条都会被完全禁用,所以当我的内容不适合屏幕时,就无法进入.

如何使用需要的新Layout基础Panel类,RootLayoutPanel仍然可以在浏览器级别获得自动显示和消失的滚动条.

不是在谈论把东西放在一个ScrollPanel我想要的浏览器滚动条行为RootPanel,但是有一个RootLayoutPanel.

如何TabLayoutPanel自动填充页面并让浏览器自动生成整个页面的滚动条?

我尝试按照下面的建议穿上overflow: auto;RootLayoutPanel,没有任何影响.

layout gwt panel gwt2

4
推荐指数
1
解决办法
1772
查看次数

GWT - 为登录目的实现DialogBox

出于测试目的,我想使用DialogBox登录我的应用程序.

这是uibinder文件:

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
  xmlns:g="urn:import:com.google.gwt.user.client.ui">
  <ui:style>
  </ui:style>
    <g:HTMLPanel>
      <g:Label>Username</g:Label>
      <g:TextBox ui:field="username"></g:TextBox>
      <g:Label>Password</g:Label>
      <g:PasswordTextBox ui:field="password"></g:PasswordTextBox>
      <g:Button ui:field="login">Login</g:Button>
    </g:HTMLPanel>
</ui:UiBinder>
Run Code Online (Sandbox Code Playgroud)

这是我的实现:

public class Login extends DialogBox {
    private static LoginUiBinder uiBinder = GWT.create(LoginUiBinder.class);

    interface LoginUiBinder extends UiBinder<Widget, Login> {}

    @UiField
    TextBox username;
    @UiField
    PasswordTextBox password;
    @UiField
    Button login;

    public Login() {
        setHTML("Login");
        setWidget(uiBinder.createAndBindUi(this));
    }
}
Run Code Online (Sandbox Code Playgroud)

现在我的问题是:这是正确的方法吗?文档似乎没有说明如何做这种事情......

gwt uibinder gwt2

4
推荐指数
1
解决办法
3897
查看次数

GWT(event.getCharCode)在IE和Firefox中表现不同

我正在浏览GWT网站上有关StockWatcher应用程序的教程,并按照步骤4:在客户端管理事件中所述测试应用程序.

下面的代码在Firefox和IE7中表现不同.在IE7中这很好用,即如果我在文本字段中输入一些垃圾字符并按Enter键" event.getCharCode() == KeyCodes.KEY_ENTER"行成功执行,我可以看到一条警告消息.但是,如果我使用Firefox,这条线路也不起作用.

当我使用Firefox并按Enter键时,event.getCharCode返回一些垃圾字符.我在这做错了什么?或者这是预期的行为?

newSymbolTextBox.addKeyPressHandler(new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            if (event.getCharCode() == KeyCodes.KEY_ENTER) {
              addStock();
            }
          }
        });
Run Code Online (Sandbox Code Playgroud)

gwt gwt2 gwt-2.2

4
推荐指数
1
解决办法
1981
查看次数

GWT - 编译错误:没有可用于类型的源代码

我正在通过Maven构建GWT应用程序.

编译时获取以下消息:

Validating newly compiled units
Run Code Online (Sandbox Code Playgroud)

起初有这个警告:

[WARNING] Don't declare gwt-dev as a project dependency. This may introduce complex dependency conflicts
Run Code Online (Sandbox Code Playgroud)

然后就是这个错误:

[ERROR] Line 19: No source code is available for type org.apache.commons.lang.StringUtils did you forget to inherit a required module?
Run Code Online (Sandbox Code Playgroud)

尽管这种构建不会下降,Dev模式也能正常工作.如何摆脱这些错误消息?

java gwt compiler-errors maven gwt2

4
推荐指数
2
解决办法
1万
查看次数

GWT 2.0.3中的String.split()方法错误

我正在将GWT项目从GWT 1.7.1升级到目前最新的2.0.3版本.似乎新GWT打破了String.split(String regex)方法 - 我在Javascript端遇到以下错误:

this$static is undefined
Run Code Online (Sandbox Code Playgroud)

这发生在我的.nocache.js文件的这一行:

if (maxMatch == 0 && this$static.length > 0) {
Run Code Online (Sandbox Code Playgroud)

...恰好是Javascript中等效的String split方法的一部分.

除了自己进行字符串分割之外,还有治疗方法吗?

string gwt gwt2

3
推荐指数
1
解决办法
2902
查看次数

在运行时更新GWT单元表

我试图在运行时更新单元格表,单元格表从列表中获取其日期

Cell_Table.setRowData(0,AllMessages);
Run Code Online (Sandbox Code Playgroud)

我正在尝试更新列表AllMessages然后执行此操作但Cell_Table.redraw();没有成功.

我正在尝试再次这样做 Cell_Table.setRowData(0,AllMessages);,但没有成功

当我使用相同的技术添加行时,一切都很好但是当我从列表中删除一些数据时,单元格表没有被更新!

gwt widget gwt2

3
推荐指数
1
解决办法
5151
查看次数

我怎样才能克服Selenium中的元素id异常?

在UiBinder中为GWT小部件设置'id'.

例如.

还添加了 在*.gwt.xml中

然后我在Selenium测试用例中尝试这个

WebElement element = driver.findElement(By.id("gwt-debug-loginButton"));
Run Code Online (Sandbox Code Playgroud)

有时它工作正常.但有时会抛出以下异常,

无法定位元素:{"method":"id","selector":"gwt-debug-loginButton"}命令持续时间或超时:62毫秒

我需要更新什么?谁能帮我?

gwt selenium gwt2 selenium-server selenium-webdriver

3
推荐指数
1
解决办法
1412
查看次数

com.google.gwt.dev.jjs.InternalCompilerException:访问期间出现意外错误

我在使用版本 2.6.0 编译 gwt 应用程序时遇到以下错误,最初我使用具有 gwt 版本 2.6.1 的 maven 编译它,然后尝试通过版本 2.6.0 的 eclipse 编译它。跟版本兼容有关系吗?

com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
    at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:110)
    at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:276)
    at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
    at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:117)
    at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:65)
    at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
    at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
    at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
    at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:117)
    at com.google.gwt.dev.jjs.ast.JDeclarationStatement.traverse(JDeclarationStatement.java:48)
    at com.google.gwt.dev.jjs.ast.JModVisitor$ListContextImmutable.traverse(JModVisitor.java:170)
    at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemoveImmutable(JModVisitor.java:336)
    at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:83)
    at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
    at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
    at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:138)
    at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:134)
    at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:82)
    at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
    at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
    at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
    at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:449)
    at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:418)
    at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
    at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
    at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
    at com.google.gwt.dev.jjs.impl.UnifyAst.mainLoop(UnifyAst.java:940)
    at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:665)
    at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:672)
    at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:34) …
Run Code Online (Sandbox Code Playgroud)

java gwt gwt-rpc gwt2

3
推荐指数
1
解决办法
4960
查看次数