Wouldn't it be easier to first convert your List<Integer[]> into a Map<Integer, Map<Integer, Integer>> (or a a Guava Table) and then in your column's getCellStyleNames (assuming a Table here, for readability):
-- Integer colorLevel = intersections.get(context.getIndex(), context.getColumn());
if (colorLevel != null) {
switch (colorLevel.intValue()) {
case 1:
return myResource.css().sufferingColorLevel1();
…
}
}
return null;
On Monday, March 24, 2014 5:21:47 PM UTC+1, Tom wrote:
On Monday, March 24, 2014 5:21:47 PM UTC+1, Tom wrote:
Hi, i think i can just loop over the List<Integer[]>rowColIntersectionList and then loop over the text of each cell & append a control String like "colorLevel=1*" to the cell value, then in the IndexedColumn i just need to do@Override
public String getCellStyleNames(Context context, List<String> object) {
String value=object.get(index);
if (value!=null && !value.trim().equals("")) {
if(value.indexOf("colorLevel=1*" )>=0){
return myResource.css().sufferingColorLevel1 ();
}
else if(value.indexOf("colorLevel=2*" )>=0){
return myResource.css().sufferingColorLevel1 ();
}
else if(value.indexOf("colorLevel=3*" )>=0){
return myResource.css().sufferingColorLevel2 ();
}
else if(value.indexOf("colorLevel=4*" )>=0){
return myResource.css().sufferingColorLevel2 ();
}
else if(value.indexOf("colorLevel=5*" )>=0){
return myResource.css().sufferingColorLevel2 ();
}
}
return null;
}@Override
public String getValue(List<String> object) {
String value=object.get(this.index);
if (value!=null && !value.trim().equals("")) {
if(value.indexOf("colorLevel=1*" )>=0){
return value.replace("colorLevel=1*", "");
}
else if(value.indexOf("colorLevel=2*" )>=0){
return value.replace("colorLevel=2*", "");
}
else if(value.indexOf("colorLevel=3*" )>=0){
return value.replace("colorLevel=3*", "");
}
else if(value.indexOf("colorLevel=4*" )>=0){
return value.replace("colorLevel=4*", "");
}
else if(value.indexOf("colorLevel=5*" )>=0){
return value.replace("colorLevel=5*", "");
}
}
return value;
}However i ran into another problem, that is Not all text in cell needs controlString. For example:String originalText1="iPhone"; String controlString= "colorLevel=2*"; String newText1 =controlString+originalText1; //ie newText=colorLevel=2*iPhone String originalText2="iPhone 3G"; // this originalText2 has no controlString String newText2="iPhone 3G"; String originalText3="colorLevel=2*aaa" ; // this has no controlString but its front is exactly the same as controlString String newText3="colorLevel=2*aaa"; String originalText4="colorLevel=2*bbb" ; // has controlString but at the same time its front is exactly the same as controlString String controlString= "colorLevel=2*"; String newText4 =controlString+originalText4; // ie newText4=colorLevel=2*colorLevel=2*bbb Then i need a function to read all these new text. This function need to trip off the
controlStringto get the original.So my question is, how to encode the original text in such a way that when we trip out the front string of the new text we won't affect the original text?
On Monday, March 24, 2014 11:50:36 PM UTC+11, Thomas Broyer wrote:Actually, Column#getCellStyleNames also has everything you need; if you need to add the style to the table cell, rather than a "content container" (<div> or whatever) within the table cell.
On Monday, March 24, 2014 1:31:21 PM UTC+1, Jens wrote:I have the feeling that it would be easier to write a custom cell (possibly extending an existing one) and in its render method decide if it should add a bold, bolder or extrabold css class to the output.Inside Cell.render() you have access to everything you need to make that decision (row index, column index, column value).-- J.
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