如何设置GWT CellList的样式?

时间:2012-07-28 11:06:49

标签: gwt gwt2 gwt-2.4

我有一个我想要样式的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 个答案:

答案 0 :(得分:3)

除了注入CSS之外,调用CellListStyle样式的cellListStyle()而不仅仅是style()非常重要:

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

答案 1 :(得分:2)

确保注入css资源。

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

您可以点击以下链接

How do you change the mouse over highlighting?

相关问题