}
@Override
protected Component newNodeComponent(String id, IModel model)
{
final IModel nodeModel = model;
return new LinkIconPanel(id, model, PortalTree.this)
{
private static final long serialVersionUID = 1L;
String path = "images";
@Override
protected Component newContentComponent(String componentId,
BaseTree tree, IModel model)
{
return new Label(componentId, getNodeTextModel(model));
}
@Override
protected void onNodeLinkClicked(Object node, BaseTree tree,
AjaxRequestTarget target)
{
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) node;
SiteTreeNode siteNode = (SiteTreeNode) treeNode.getUserObject();
populateDocument(siteNode);
if (siteNode.getDocType() == SiteTreeNode.FileType.Folder && !siteNode.isLoaded())
{
retrieveFolders(siteNode.getNodePath(), treeNode);
siteNode.setLoaded(true);
}
if (!tree.getTreeState().isNodeExpanded(treeNode))
{
tree.getTreeState().expandNode(treeNode);
}
else
{
tree.getTreeState().collapseNode(treeNode);
}
controlTabs();
target.addComponent(tabPanel);
tree.getTreeState().selectNode(node, true);
tree.updateTree(target);
}
@Override
protected Component newImageComponent(String componentId,
BaseTree tree, IModel<Object> model)
{
return new Image(componentId)
{
private static final long serialVersionUID = 1L;
@Override
protected ResourceReference getImageResourceReference()
{
SiteTreeNode siteModel = (SiteTreeNode) ((DefaultMutableTreeNode) nodeModel
.getObject()).getUserObject();
if (siteModel.getDocType() == SiteTreeNode.FileType.Folder)
{
return new ResourceReference(PortalTree.class,
path + "/folder.gif");