I have figured out atleast one problem I was doing wrong so far that was causing my style to be injected multiple times. The first is that I defined my CellTable and Datagrid styles to be inside my single style sheet but when injecting this style it gets injected multiple times. In the code below the default.css contains all my css definitions for the entire web application including the cell table and cell grid styles. I was injecting these at application start of course the the cellTableStyle() and cell dataGridStyle() inject the entire style sheet.
public interface Resources extends ClientBundle, CellTable.Resources, CellList.Resources, DataGrid.Resources {
...
/**
* {@link CellTable.Style} styles
*/
@Source("default.css")
Style cellTableStyle();
/**
* {@link DataGrid.Style} styles
*/
@Source("default.css")
Style dataGridStyle();
/**
* These are the obfuscated styles.
*
* @return
*/
@Source({ "default.css", "default-external.css" })
public Style style();
...
}
If declaring styles in this way the stylesheets should be broken up into separate style sheets and only contain the relevant styles or implement my main style to implement these interfaces and remove the extra dependent style implementations.
public interface Resources extends ClientBundle, CellTable.Resources, CellList.Resources, DataGrid.Resources {
...
/**
* {@link CellTable.Style} styles
*/
@Source("celltable.css")
Style cellTableStyle();
/**
* {@link DataGrid.Style} styles
*/
@Source("datagrid.css")
Style dataGridStyle();
/**
* These are the obfuscated styles.
*
* @return
*/
@Source({ "default.css", "default-external.css" })
public Style style();
...
}
This is the implementation where the style can be passed to a CellTable style and the styles will only be injected one time. Notice that the style implments all the needed table, grid and list styles.
public interface Resources extends ClientBundle, CellTable.Resources, CellList.Resources, DataGrid.Resources {
...
public interface Style extends CssResource, ProgressWidget.Style, CellTable.Style, CellList.Style, DataGrid.Style {
...
}
/**
* Single style that can be used for all my cell table resources
* and the default styles.
*
* @return
*/
@Source({ "default.css", "default-external.css" })
public Style style();
...
}