i’m creating a new table for my project with this structure:
ID | ID_STATE | ID_USER | .....
So, my problem is this one: i’d like to convert the ID_STATE to a most presentable value, but to do that i need to access the corresponding ID_USER field (since i have a mapping in the db).
Can i do that with a converter? Basically i think i’ll have to extrapolate the rowId to get to the other properties…
Or should i write an extended version of table? And how?
Table t = new Table(){
@Override
protected String formatPropertyValue(final Object rowId, final Object colId, final Property<?> property) {
String result = super.formatPropertyValue(rowId, colId, property);
if (colId.equals("ID_STATE")) {
result = //Maybe some enumerated state list
} else {
return "";
}
return result;
}
};
Thanks a lot! That actually (almost) did it.
I was able to cast rowId into my pojo type and extract the data from there.
In other words:
Table t = new Table(){
@Override
protected String formatPropertyValue(final Object rowId, final Object colId, final Property<?> property) {
String result = super.formatPropertyValue(rowId, colId, property);
switch(colId.toString()){
case "ID_STATE":
result = connect_to_db(((myobj)rowId).getId());
break;
......
return result;
}
};
Thanks a lot!