2012-07-28 75 views
1

我有一個CellList,我想要的風格。我想改變光標風格,一個選定單元格的醜陋顏色。我檢查了幾個關於堆棧溢出的問題和討論,但沒有一個能夠工作。 我檢查這些中的一個:如何樣式GWT CellList?

CellList GWT CSS Style

How do I style a gwt 2.1 CellTables headers?

她是我的代碼:

public interface CellListResource extends CellList.Resources { 


    public static CellListResource INSTANCE = GWT.create(CellListResource.class); 

    interface CellListStyle extends CellList.Style { 

    } 

    @Source({CellList.Style.DEFAULT_CSS, "CellTableStyle.css"}) 
    CellListStyle style(); 
} 

public SearchViewImpl() { 

    CompanyCell companyCell = new CompanyCell(); 
//it doesn't work :S 
    companiesList = new CellList<Company>(companyCell, CellListResource.INSTANCE); 

    rootElement = ourUiBinder.createAndBindUi(this); 

    loadingImage.setVisible(false); 
    } 

我缺少的東西?我清除瀏覽器緩存,重新啓動服務器,F5 F5 F5 .... F5(按下刷新一遍又一遍),什麼也沒有...! 感謝您的幫助。

回答

2

確保您注入了css資源。

CellTableResources.INSTANCE.cellTableStyle().ensureInjected(); 
myCellTable = new CellTable<T>(Integer.MAX_VALUE,CellTableResources.INSTANCE); 

你可以按照下面的鏈接

How do you change the mouse over highlighting?

3

除了注入您致電CellListStyle風格cellListStyle()不只是風格()是很重要的CSS:

public interface CellListResource extends CellList.Resources { 
    public static CellListResource INSTANCE = GWT.create(CellListResource.class); 
    interface CellListStyle extends CellList.Style {} 

    @Override 
    @Source("cellListStyle.css") 
    CellListStyle cellListStyle(); 
} 

然後你做

CellListResource.INSTANCE.cellListStyle().ensureInjected(); 
companiesList = new CellList<Company>(companyCell, CellListResource.INSTANCE); 
+0

我想知道爲什麼調用方法'cellListStyle()'而不是'style()'很重要。這個評論對你來說是相似的。線索在'@ Override'註釋中:您需要在'CellList.Resources'中覆蓋該名稱的方法。 – 2014-08-29 09:21:06