From the javadoc of setCellStyleNames:
If you want to apply style names based on the row or cell value, override #getCellStyleNames(Context, Object) directly.So:
@Override
public String getCellStyleNames(Cell.Context context, String, value) {
if ("898".equals(value)) {
return getView().getRes().css().myBoldColor();
}
return null;
}
};
If the style depends on the indices rather than the actual value, then you can use RowStyles to apply a specific class to the line, setCellStyleNames to apply a specific class to the cells in the column, and then style the "intersection" of those:
If the style depends on the indices rather than the actual value, then you can use RowStyles to apply a specific class to the line, setCellStyleNames to apply a specific class to the cells in the column, and then style the "intersection" of those:
.boldRow .boldColumn { font-weight: bold; }
(all cells in the 3 column would have class="boldColumn", but only the cells that also are in rows with class="boldRow" would actually be bold)
On Monday, March 24, 2014 12:37:28 AM UTC+1, Tom wrote:
On Monday, March 24, 2014 12:37:28 AM UTC+1, Tom wrote:
Ok, i have a
CellTablethat has 3 columns and 2 rows. I want the text in SOME specific cells (not all cell) in the table to be BOLD.Please look at this code:
ListDataProvider<List<String>> dataProvider = new ListDataProvider<List<String>>(); dataProvider.addDataDisplay( table); List<List<String>> list = dataProvider.getList(); List<String> sublist1= Arrays.asList("223","546"," 698"); List<String> sublist2= Arrays.asList("123","876"," 898"); List<String> sublist2= Arrays.asList("123","896"," 438"); IndexedColumn column1=new IndexedColumn(0); table.addColumn(column1, "Col1"); IndexedColumn column2=new IndexedColumn(1); table.addColumn(column2, "Col2"); IndexedColumn column3=new IndexedColumn(2); table.addColumn(column3, "Col3"); Now, I want the Cell that is the intersect of row2 & col3 (ie "898") to be BOLD, so if i do like this
column3.setCellStyleNames(getView().getRes().css(). myBoldColor()); Then it will make the whole column BOLD.
So, i think properly we need to loop over each cell in column3 & set the style accordingly, so that we can have the result like this:
Col1 - Col2 - Col3 223 - 546 - 698 123 - 876 - 898 123 - 896 - 438
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment