protected Resource<?> generateNavigation(final String targetDir, final boolean overwrite)
throws IOException
{
WebResourceFacet web = this.project.getFacet(WebResourceFacet.class);
HtmlTag unorderedList = new HtmlTag("ul");
ResourceFilter filter = new ResourceFilter()
{
@Override
public boolean accept(Resource<?> resource)
{
FileResource<?> file = (FileResource<?>) resource;
if (!file.isDirectory()
|| file.getName().equals("resources")
|| file.getName().equals("WEB-INF")
|| file.getName().equals("META-INF"))
{
return false;
}
return true;
}
};
for (Resource<?> resource : web.getWebResource(targetDir + "/").listResources(filter))
{
HtmlOutcomeTargetLink outcomeTargetLink = new HtmlOutcomeTargetLink();
outcomeTargetLink.putAttribute("outcome", targetDir + "/" + resource.getName() + "/search");
outcomeTargetLink.setValue(StringUtils.uncamelCase(resource.getName()));
HtmlTag listItem = new HtmlTag("li");
listItem.getChildren().add(outcomeTargetLink);
unorderedList.getChildren().add(listItem);
}
Writer writer = new IndentedWriter(new StringWriter(), this.navigationTemplateIndent);
unorderedList.write(writer);