DivElement outer = Elements.createDivElement();
if (i > 0) {
outer.setClassName(css.second());
}
final PathUtil path = new PathUtil(item.getTitle());
AnchorElement title = Elements.createAnchorElement(css.title());
title.setTextContent(item.getTitle());
if (item.getUrl() != null) {
// this is unusual, but allows search results to point outside of this
// workspace, e.g. to language API docs.
title.setHref(item.getUrl());
} else {
// this is the common case; the title will be a path in this workspace
// and clicking on the link should take us to its editor.
title.setOnClick(new EventListener() {
@Override
public void handleEvent(Event evt) {
currentPlace.fireChildPlaceNavigation(
FileSelectedPlace.PLACE.createNavigationEvent(path));
}