cssgwtcelltablegwt-celltable

GWT CellTable Styling


I like to customize the design for my CellTable. For that reason, I tried a lot of suggested way's here in Stackoverflow and some tutorials. It does not work for me and I do not know why. Any hints are welcome.

GWT 2.8.1 is used.

Log/Error:

    Creating assignment for cellTableStyle()
                 Creating image sprite classes
                 Replacing property-based @if blocks
                 Replacing CSS class names
                    [ERROR] The following unobfuscated classes were present in a strict CssResource:
                       [ERROR] gwt-cellTableHoveredRow
                       [ERROR] gwt-cellTableSelectedRowCell
                       [ERROR] gwt-cellTableKeyboardSelectedCell
                       [ERROR] gwt-cellTableLastColumnHeader
                       [ERROR] gwt-cellTable
                       [ERROR] gwt-cellTableKeyboardSelectedRow
                       [ERROR] gwt-cellTableHoveredRowCell
                       [ERROR] gwt-cellTableFirstColumnHeader
                       [ERROR] gwt-cellTableKeyboardSelectedRowCell
                       [ERROR] gwt-cellTableCell
                       [ERROR] gwt-cellTableHeader
                       [ERROR] gwt-cellTableSelectedRow
                       [ERROR] gwt-cellTableOddRow
                       [ERROR] gwt-cellTableEvenRow
                       Fix by adding String accessor method(s) to the CssResource interface for obfuscated classes, or using an @external declaration for unobfuscated classes.
              [ERROR] Generator 'com.google.gwt.resources.rebind.context.InlineClientBundleGenerator' threw an exception while rebinding 'de.testProject.modules.gui.controls.table.MyCellTableResources'
     com.google.gwt.resources.css.ast.CssCompilerException: Missing a CSS replacement
        at com.google.gwt.resources.css.ClassRenamer.endVisit(ClassRenamer.java:209)
        at com.google.gwt.resources.css.ast.CssStylesheet.traverse(CssStylesheet.java:59)
        at com.google.gwt.resources.css.ast.CssVisitor.doTraverse(CssVisitor.java:325)
        at com.google.gwt.resources.css.ast.CssVisitor.doAccept(CssVisitor.java:313)
        at com.google.gwt.resources.css.ast.CssVisitor.accept(CssVisitor.java:59)
        at com.google.gwt.resources.rg.CssResourceGenerator.optimize(CssResourceGenerator.java:1093)
        at com.google.gwt.resources.rg.CssResourceGenerator.createAssignment(CssResourceGenerator.java:452)
        at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.createFieldsAndAssignments(AbstractClientBundleGenerator.java:752)
        at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.createFieldsAndAssignments(AbstractClientBundleGenerator.java:821)
        at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.generateIncrementally(AbstractClientBundleGenerator.java:469)
        at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:739)
        at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:103)
        at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
        at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:262)
        at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:251)
        at com.google.gwt.dev.PrecompilationContextCreator$1.getAllPossibleRebindAnswers(PrecompilationContextCreator.java:86)
        at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createStaticRebindExpression(UnifyAst.java:519)
        at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createRebindExpression(UnifyAst.java:487)
        at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.maybeHandleMagicMethodCall(UnifyAst.java:415)
        at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.visit(UnifyAst.java:402)
        at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:265)
        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:118)
         at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:76)
         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:118)
         at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:76)
         at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
         at com.google.gwt.dev.jjs.ast.JModVisitor.acceptImmutable(JModVisitor.java:305)
         at com.google.gwt.dev.jjs.ast.JMethodCall.visitChildren(JMethodCall.java:275)
         at com.google.gwt.dev.jjs.ast.JNewInstance.traverse(JNewInstance.java:74)
         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:118)
         at com.google.gwt.dev.jjs.ast.JBinaryOperation.traverse(JBinaryOperation.java:89)
         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:118)
         at com.google.gwt.dev.jjs.ast.JExpressionStatement.traverse(JExpressionStatement.java:42)
         at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:88)
         at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:331)
         at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:94)
         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:139)
         at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:135)
         at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.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.JModVisitor.accept(JModVisitor.java:265)
         at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:786)
         at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:778)
         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:1401)
         at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:896)
         at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.unifyJavaAst(JavaToJavaScriptCompiler.java:1410)
         at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.constructJavaAst(JavaToJavaScriptCompiler.java:1222)
         at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:1140)
         at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:255)
         at com.google.gwt.dev.Precompile.precompile(Precompile.java:255)
         at com.google.gwt.dev.Precompile.precompile(Precompile.java:202)
         at com.google.gwt.dev.Precompile.precompile(Precompile.java:143)
         at com.google.gwt.dev.Compiler.compile(Compiler.java:204)
         at com.google.gwt.dev.codeserver.Recompiler.doCompile(Recompiler.java:362)
         at com.google.gwt.dev.codeserver.Recompiler.compile(Recompiler.java:175)
         at com.google.gwt.dev.codeserver.Recompiler.recompile(Recompiler.java:134)
         at com.google.gwt.dev.codeserver.Outbox.recompile(Outbox.java:135)
         at com.google.gwt.dev.codeserver.JobRunner.recompile(JobRunner.java:113)
         at com.google.gwt.dev.codeserver.JobRunner.access$000(JobRunner.java:37)
         at com.google.gwt.dev.codeserver.JobRunner$2.run(JobRunner.java:90)
         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
         at java.lang.Thread.run(Thread.java:745)
     [ERROR] Errors in 'de/testproject/apps/gwt/javaviewer/client/app/testTable/TableTest.java'
        [ERROR] Line 47: Failed to resolve 'de.testProject.modules.gui.controls.table.MyCellTableResources' via deferred binding

Code:

 public interface MyCellTableResources extends CellTable.Resources {

     @Source({CellTable.Style.DEFAULT_CSS, "resources/gwtcelltable.css" })
     public CellTable.Style cellTableStyle();
 }

This is how I create the table:

 table = new CellTable<Contact>(10, (CellTable.Resources)GWT.create(MyCellTableResources.class));

With no CSS classes from the CellTable in the css all error are gone but then I can't style my Table

CSS file looks:

.gwt-cellTable {
    color: #00ff00;
    background-color: #ff00ff;
}

.gwt-cellTableHeader {
    color: #00ff00;
    background-color: #ff00ff;
}
.gwt-cellTableFirstColumnHeader {
    color: #15ffdd;
}
.gwt-cellTableLastColumnHeader {
    color: #15ffdd;
}
.gwt-cellTableCell {
    color: #15ffdd;
}
.gwt-cellTableEvenRow {
    background: #5500FF;
}
.gwt-cellTableOddRow {
    background: #FF0055;
}
.gwt-cellTableSelectedRow {
    background: #aaaa00;
}
.gwt-cellTableSelectedRowCell {
    background: #aaaa00;
    color: #15ffdd;
}
.gwt-cellTableHoveredRow {
    background: #ff12ff;
}
.gwt-cellTableHoveredRowCell {
    background-color: #15ffdd;
}
.gwt-cellTableKeyboardSelectedRow {
    background: #15ffdd;
}
.gwt-cellTableKeyboardSelectedRowCell {
    color: #15ffdd;
}
.gwt-cellTableKeyboardSelectedCell {
    color: #15ffdd;
}

What am I doing wrong? Do I need to include something more?


Solution

  • You just need to remove the gwt- prefix from each class name.

    There is also one more problem: there is no cellTable class (the first in your file). Maybe you meant cellTableWidget which is applied to the <table> element:

    .cellTableWidget {
        color: #00ff00;
        background-color: #ff00ff;
    }
    .cellTableHeader {
        color: #00ff00;
        background-color: #ff00ff;
    }
    ...