You will notice that CellTable uses a ResourceBundle, which means that all css styles become confusing ... this makes it difficult to redefine styles.
The CellTable constructor will actually allow you to override the standard ResourceBundle. So, first you need to create your own resource package as follows:
public interface CellTableResources extends Resources { public CellTableResources INSTANCE = GWT.create(CellTableResources.class); @Source("CellTable.css") CellTable.Style cellTableStyle(); }
Then you need to create your own CSS file. I recommend copying the CellTable style directly into your project and using it as a starting point. You can find it here: http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/cellview/client/CellTable.css
Make sure you style first, and then you simply load it into the CellTable constructor as follows:
CellTableResources.INSTANCE.cellTableStyle().ensureInjected(); myCellTable = new CellTable<T>(Integer.MAX_VALUE,CellTableResources.INSTANCE);
In particular, you will want to customize these styles:
- cellTableKeyboardSelectedRow
- cellTableKeyboardSelectedRowCell
- cellTableSelectedRow
- cellTableSelectedRowCell
- cellTableKeyboardSelectedCell
It is important to note that the cell table distinguishes between "selected row" and "selected keyboard." The selected row is the selected actual row (i.e. via SelectionModel). The selected keyboard string refers to what is highlighted when the user presses the up / down key, but does not mean that the string is actually selected (if that makes sense).
Brad rydzewski
source share