【问题标题】:How to style GWT CellList?如何设置 GWT CellList 的样式?
【发布时间】:2012-07-28 11:06:48
【问题描述】:

我有一个要设置样式的 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(一次又一次按下刷新),什么都没有...! 提前感谢您的帮助。

【问题讨论】:

    标签: gwt gwt2 gwt-2.4


    【解决方案1】:

    除了注入 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);
    

    【讨论】:

    • 我想知道为什么调用方法cellListStyle() 而不是style() 很重要。如果您有类似的疑问,则此评论适合您。线索在@Override注解中:你需要覆盖CellList.Resources中那个名字的方法。
    【解决方案2】:

    确保注入 css 资源。

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

    您可以点击以下链接

    How do you change the mouse over highlighting?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-10
      • 1970-01-01
      • 2011-06-01
      相关资源
      最近更新 更多