Note that there are some explanatory texts on larger screens.

plurals
  1. PONew GWT 2.4 DataGrid -- not styling -- annotation bug?
    primarykey
    data
    text
    <p>I have followed the example code laid out in <a href="https://stackoverflow.com/questions/4194717/how-do-i-style-a-gwt-2-1-celltables-headers">an earlier posting</a> regarding styling GWT CellTables, replicating the code for the new GWT 2.4 DataGrids. Unfortunately, nothing seemed to work. All I want to do is set the font-size of the cells smaller, so in my local css file (see the second parameter of the @Source annotation in the linked post) I included:</p> <pre><code>.dataGridCell { font-size: 6px; } </code></pre> <p>Nothing happened. The font size stubbornly refused to change. Then I noticed this in the DataGrid code:</p> <pre><code> @ImportedWithPrefix("gwt-CellTable") public interface Style extends CssResource { </code></pre> <p>I copied DataGrid into my workspace, along with the related three gif files, and commented out the one dependency on a protected method in AbstractCellTable (no empty table widgets -- oh well). I changed the prefix defined in the annotation to gwt-<strong>DataGrid</strong> -- and pfffft! -- still it didn't work.</p> <p>So what am I missing here? Is that gwt-CellTable prefix correct in the annotation? Seems fishy to me, though I failed to get it to work with my change.</p> <hr> <p>Turns out the names matter. Duh!</p> <p>OK, got it working. Turns out it matters to use the same names. Duh!</p> <pre><code>import com.google.gwt.core.client.GWT; import com.google.gwt.user.cellview.client.DataGrid; import com.google.gwt.user.cellview.client.DataGrid.Style; import com.google.gwt.user.cellview.client.DataGrid.Resources; public interface MyDataGridResources extends Resources { public static final MyDataGridResources INSTANCE = GWT.create(MyDataGridResources.class); @Override @Source({DataGrid.Style.DEFAULT_CSS, "../resources/styling/mydatagridstyles.css"}) Style dataGridStyle(); // *********************** } </code></pre> <p>When I made the name of the style the same as the name of the style interface in DataGrid.java ("dataGridStyle") then it started working.</p> <p>I sorta kinda get it...but not quite. I will need think more about scoping rules, and also study exactly what happens to the resources parameter passed into the DataGrid constructor.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload