Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Can I use function in TableQuery ?
for example ” I hava a table person
cloumn1 id (key), cloumn2 name, cloumn3 age ”
Like this sql “ select id , function(age) as age from person "
Can I use TableQuery to build as table DataSource?
Or must I use FreeformQuery??
Thanks!!
public Object generateCell(Table source, Object itemId, Object columnId) {
Property prop =
source.getItem(itemId).getItemProperty(columnId);
if (prop.getType().equals(String.class)) {
String sporp=(String)prop.getValue();
String sporp2= sporp.replaceAll( neirong,"<span style=color:red>" + neirong + " </span>");
Label label = new Label(sporp2 ,Label.CONTENT_XHTML);
label.setWidth("750px");
// Label label = new Label(String.format(format,
// new Object[]{(String) prop.getValue()}),"CONTENT_XHTML");
// Set styles for the column: one indicating that it's
// a value and a more specific one with the column
// name in it. This assumes that the column name
// is proper for CSS.
label.addStyleName("column-type-value");
label.addStyleName("column-" + (String) columnId);
return label;
}
return null;
}
}
I flexible solved as above!!