WikiEngine engine = context.getEngine();
table t = new table();
t.setBorder(0);
t.setCellPadding(4);
tr row = new tr();
t.addElement( row );
row.addElement( new th().setWidth("30%").setAlign("left").addElement("Page") );
row.addElement( new th().setAlign("left").addElement("Score"));
int idx = 0;
for( Iterator i = results.iterator(); i.hasNext() && idx++ <= maxItems; )
{
SearchResult sr = (SearchResult) i.next();
row = new tr();
td name = new td().setWidth("30%");
name.addElement( "<a href=\""+
context.getURL( WikiContext.VIEW, sr.getPage().getName() )+
"\">"+engine.beautifyTitle(sr.getPage().getName())+"</a>");
row.addElement( name );
row.addElement( new td().addElement(""+sr.getScore()));
t.addElement( row );
}
if( results.isEmpty() )
{
row = new tr();
row.addElement( new td().setColSpan(2).addElement( new b().addElement("No results")));
t.addElement(row);
}
return t.toString();