2017-06-02 180 views
1

我喜歡爲我的CellTable定製設計。出於這個原因,我在Stackoverflow和一些教程中嘗試了很多建議的方法。它不適用於我,我不知道爲什麼。任何提示都是值得歡迎的。GWT CellTable樣式

使用GWT 2.8.1。

日誌/錯誤:

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 

代碼:

public interface MyCellTableResources extends CellTable.Resources { 

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

這是我如何創建表:

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

隨着從CellTable在CSS沒有CSS類所有錯誤消失,但後來我無法設計我的表格

CSS文件看起來:

.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; 
} 

我在做什麼錯?我是否需要包含更多內容?

回答

0

您只需要從每個類名稱中刪除gwt-前綴。

還有一個問題:沒有cellTable類(您的文件中的第一個)。也許你的意思是cellTableWidget它適用於<table>元素:

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

非常感謝。這樣一個愚蠢的錯誤。 – MichaD