5 Replies Latest reply on Feb 13, 2014 9:41 AM by tmcclure0501

    Composite Inheritance work working in 2.4.3

    tmcclure0501

      I am trying to inherit a composite using Errai version 2.4.3.  In the documentation it states that you declare the component you are inheriting from with @Template and no html reference.  I did this and the compile erred because it was looking for the default html for that class - I tried making the class I inherited abstract but it still tried to instantiate - what am I missing?

       

      Tim

        • 1. Re: Composite Inheritance work working in 2.4.3
          csa

          Hi Tim,

           

          In the case you describe you're going to need an HTML template for you base component e.g.

           

          @Templated
          public class PageLayout extends Composite {
           ...
          }
          

           

          @Templated("PageLayout.html")
          public class LoginLayout extends PageLayout {
          
          }
          

           

          So, you will need the PageLayout.html file. Is this what you're trying to do?

           

          Cheers,

          Christian

          • 2. Re: Composite Inheritance work working in 2.4.3
            tmcclure0501

            yes I am doing that but I get a compile error which equates to PageLayout is missing is HTML template.

            • 3. Re: Composite Inheritance work working in 2.4.3
              csa

              Where is your [PageLayout].html file located relative to the [PageLayout].java file?

               

              Can you share the full error message and stacktrace with us?

               

              Cheers,

              Christian

              • 4. Re: Composite Inheritance work working in 2.4.3
                tmcclure0501

                Christian,

                 

                The problem is Errai is always trying to instantiate the composite I am inheriting from (DbIntegrationViewImpl) which has no HTML template.  I know this because when I make this class abstract I receive the compile error below:

                 

                [ERROR] Caused by: org.jboss.errai.codegen.exception.InvalidTypeException: Cannot instantiate type:com.apimg.dakota.workflow.dbintegration.client.DbIntegrationViewImpl

                [ERROR] at org.jboss.errai.codegen.builder.impl.ObjectBuilder$2.doDeferred(ObjectBuilder.java:148)

                [ERROR] at org.jboss.errai.codegen.builder.callstack.DeferredCallElement.handleCall(DeferredCallElement.java:42)

                [ERROR] at org.jboss.errai.codegen.builder.impl.AbstractStatementBuilder.generate(AbstractStatementBuilder.java:61)

                [ERROR] at org.jboss.errai.codegen.builder.impl.ObjectBuilder.generate(ObjectBuilder.java:181)

                [ERROR] at org.jboss.errai.codegen.util.GenUtil.convert(GenUtil.java:183)

                [ERROR] at org.jboss.errai.codegen.Variable.generate(Variable.java:390)

                [ERROR] at org.jboss.errai.codegen.builder.callstack.DeclareVariable.handleCall(DeclareVariable.java:37)

                [ERROR] at org.jboss.errai.codegen.builder.impl.AbstractStatementBuilder.generate(AbstractStatementBuilder.java:61)

                [ERROR] at org.jboss.errai.codegen.BlockStatement.generate(BlockStatement.java:90)

                 

                There must be missing that tells Errai not to instantiate this component - clearly the fact that another component inherits from it is not enough.  When I make the class I am inheriting from concrete I get the following error:

                 

                aused by: java.lang.IllegalArgumentException: Could not find HTML template file: com/apimg/dakota/workflow/dbintegration/client/DbIntegrationViewImpl.html

                [INFO] at org.jboss.errai.ui.rebind.chain.TemplateChain.visitTemplate(TemplateChain.java:41)

                [INFO] at org.jboss.errai.ui.rebind.TranslationServiceGenerator.generateI18nHelperFilesInto(TranslationServiceGenerator.java:284)

                [INFO] at org.jboss.errai.ui.rebind.TranslationServiceGenerator.generate(TranslationServiceGenerator.java:156)

                [INFO] at org.jboss.errai.config.rebind.AbstractAsyncGenerator$1.call(AbstractAsyncGenerator.java:43)

                [INFO] at org.jboss.errai.config.rebind.AbstractAsyncGenerator$1.call(AbstractAsyncGenerator.java:40)

                [INFO] at java.util.concurrent.FutureTask.run(FutureTask.java:262)

                [INFO] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                [INFO] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                [INFO] at java.lang.Thread.run(Thread.java:744)

                [INFO]    [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)

                [INFO]       [WARN] org.jboss.errai.ui.client.local.spi.TranslationServiceImpl

                [INFO]    [ERROR] An internal compiler exception occurred

                [INFO] com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.

                [INFO] at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:109)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:276)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)

                [INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:116)

                [INFO] at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:65)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)

                [INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:116)

                [INFO] at com.google.gwt.dev.jjs.ast.JBinaryOperation.traverse(JBinaryOperation.java:81)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)

                [INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:116)

                [INFO] at com.google.gwt.dev.jjs.ast.JExpressionStatement.traverse(JExpressionStatement.java:41)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor$ListContextImmutable.traverse(JModVisitor.java:170)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemoveImmutable(JModVisitor.java:336)

                [INFO] at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:83)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)

                [INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:137)

                [INFO] at com.google.gwt.dev.jjs.ast.JIfStatement.traverse(JIfStatement.java:52)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor$ListContextImmutable.traverse(JModVisitor.java:170)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemoveImmutable(JModVisitor.java:336)

                [INFO] at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:83)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)

                [INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:137)

                [INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:133)

                [INFO] at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:82)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)

                [INFO] at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:434)

                [INFO] at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:403)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)

                [INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)

                [INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.mainLoop(UnifyAst.java:900)

                [INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:625)

                [INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:640)

                [INFO] at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)

                [INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:278)

                [INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:229)

                [INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:141)

                [INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:232)

                [INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:198)

                [INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)

                [INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)

                [INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)

                [INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:177)

                [INFO] Caused by: java.lang.NoClassDefFoundError: org.jboss.errai.ui.client.local.spi.TranslationServiceImpl

                [INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.searchForTypeBySource(UnifyAst.java:981)

                • 5. Re: Composite Inheritance work working in 2.4.3
                  tmcclure0501

                  Christian,

                   

                  Was my exception trace helpful?  Also if inheritence does not work can I used composition - composites sharing the same HTML at difference reference points (#"xxx")?

                   

                  Tim