Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT-AI Integration

Tags:

java

applet

gwt

I am developing a demo application with using GwtAI (Gwt Applet Integration). I have included all the GwtAI-client.jar,GwtAI-core.jar.I am referring to the http://code.google.com/p/gwtai/wiki/GettingStarted Following is the code.

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();
    }

I have followed the package structure as per the link. But I am getting following Exception.

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)

Thanks in advance.

like image 222
Anishri Kumar Avatar asked Jan 21 '26 08:01

Anishri Kumar


1 Answers

you need to build the dependencies that you're using (jar/war) with the same GWT SDK version that you are using for compilation of your project i.e. if 2.4 then use 2.4 to jar the dependencies and then compile your project. This error is due to the mismatch in the SDK versions being used.

like image 51
yassar Avatar answered Jan 24 '26 02:01

yassar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!