3

GwtAI(Gwt アプレット統合)を使用してデモ アプリケーションを開発しています。GwtAI-client.jar,GwtAI-core.jarhttp://code.google.com/p/gwtai/wiki/GettingStarted以下はコードです。

FileUploadingApplet.class

@ImplementingClass(com.nextenders.appletImpl.FileUploadingAppletImpl.class)
@Height("60")
@Width("350")
@Archive("GwtAI-Client.jar,FileUploadingAppletImpl.jar")
@Codebase("applet")
public interface FileUploadingApplet extends Applet{

     public void increment();

     public void decrement();

     public Object getCurrentValue();

}

FileUploadingAppletImpl.class

public class FileUploadingAppletImpl extends JApplet implements FileUploadingApplet {
    JTextField m_fileNameTF = new JTextField(15);
    String controlTransactionId = "";
    JFileChooser m_fileChooser = new JFileChooser();
    JPanel content = new JPanel();
    FileWriter fstream = null;
    long fileLength = 0l;

    @Override
    public void init() { 

        JPanel panelMain = new JPanel();

        m_fileNameTF = new JTextField(20);
        m_fileNameTF.setHorizontalAlignment(JTextField.CENTER);
        m_fileNameTF.setText("0");
        m_fileNameTF.setEditable(false);

        panelMain.add(new JLabel("Current count : "));
        panelMain.add(m_fileNameTF);

        panelMain.setBorder(BorderFactory.createTitledBorder("CounterApplet"));
        panelMain.setBackground(Color.WHITE);

        getContentPane().add(panelMain);

    }

     public void increment() {
         int currentCount = Integer.parseInt(m_fileNameTF.getText());
         currentCount++;

         m_fileNameTF.setText(currentCount + "");
 }

 public void decrement() {
         int currentCount = Integer.parseInt(m_fileNameTF.getText());
         currentCount--;

         m_fileNameTF.setText(currentCount + "");
 }

 public Object getCurrentValue() {
         return m_fileNameTF.getText();
 }
}

NTFileUpload.java

private void createPanel(){
        PopupPanel panel = new PopupPanel();
        panel.setPopupPosition(500, 500);
        panel.setHeight("600px");
        panel.setHeight("900px");

        final FileUploadingApplet fileUploadApplet = (FileUploadingApplet) GWT.create(FileUploadingApplet.class);
        VerticalPanel panelMain = new VerticalPanel();
        Button buttonInc = new Button("Increment");
        buttonInc.addClickListener(new ClickListener() {
          public void onClick(Widget sender) {
              fileUploadApplet.increment();
          }
        });
        Widget widgetApplet = AppletJSUtil.createAppletWidget(fileUploadApplet);
        panelMain.add(widgetApplet);
        panelMain.add(buttonInc);
        panel.add(panelMain);
        panel.show();
    }

リンクに従ってパッケージ構造に従いました。しかし、次の例外が発生しています。

java.lang.IncompatibleClassChangeError: Found interface com.google.gwt.core.ext.typeinfo.JClassType, but class was expected
    at com.google.gwt.gwtai.applet.generator.AppletProxyGenerator.generate(AppletProxyGenerator.java:71)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
    at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
    at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
    at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:257)
    at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:91)
    at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:96)
    at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.process(AbstractCompiler.java:254)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
    at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:173)
    at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:288)
    at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.access$400(AbstractCompiler.java:139)
    at com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:588)
    at com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:97)
    at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:52)
    at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:569)
    at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:284)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
    at com.google.gwt.dev.Compiler.run(Compiler.java:232)
    at com.google.gwt.dev.Compiler.run(Compiler.java:198)
    at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
    at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
    at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
    at com.google.gwt.dev.Compiler.main(Compiler.java:177)

前もって感謝します。

4

2 に答える 2

2

プロジェクトのコンパイルに使用しているのと同じ GWT SDK バージョンで、使用している依存関係 (jar/war) をビルドする必要があります。つまり、2.4 の場合は、2.4 を使用して依存関係を jar し、プロジェクトをコンパイルします。このエラーは、使用されている SDK バージョンの不一致が原因です。

于 2013-06-06T10:46:37.877 に答える
0

バージョン1.7と2.0の間で、GWTコードジェネレーター機能に重大な変更が加えられました。したがって、GWTバージョン2.0以降を使用している場合は、GwtAIの現在のバージョンを使用していることを確認してください。2.0より前のバージョンのGWTを使用している場合は、GwtAIダウンロードページに移動し、[すべてのダウンロード]を選択して[検索]をクリックすると、GwtAI0.2ファイルが表示されます。それらは古いバージョンのGWTで動作するはずです。

于 2012-09-05T09:45:11.930 に答える