Any other idé better than this
tree = new LinkTree("tree", treeModel){
private static final long serialVersionUID = 1L;
@Override
protected void onNodeLinkClicked ( Object node, BaseTree tree,
AjaxRequestTarget target) {
TreeNode current = (TreeNode) node;
onVirtualNodeSelected(
((VirtualNode)current.getUserObject()).getId(),
target );
}
@Override
public MarkupContainer newLink(String id, final
ILinkCallback callback){
return new IndicatingAjaxLink<Void>(id){
private static final long
serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget
target)
{
callback.onClick(target);
}
};
}
@Override
protected Component newJunctionLink(MarkupContainer
parent, final String
id, final Object node){
final MarkupContainer junctionLink;
if (isLeaf(node) == false)
{
junctionLink = newLink(id, new
ILinkCallback()
{
private static final long
serialVersionUID = 1L;
public void
onClick(AjaxRequestTarget target)
{
/**
* Lazy loading
children here
*/
TreeNode current =
(TreeNode) node;
for( int i = 0; i < 50;
i++){
current.add(
new DefaultMutableTreeNode( "new: " + i ) );
}
if
(isNodeExpanded(node)){
getTreeState().collapseNode(node);
}
else
{
getTreeState().expandNode(node);
}
onJunctionLinkClicked(target, node);
updateTree(target);
}
});
junctionLink.add(new AbstractBehavior(){
private static final long
serialVersionUID = 1L;
@Override
public void
onComponentTag(Component component, ComponentTag tag){
if
(isNodeExpanded(node)){
tag.put("class", "junction-open");
}
else{
tag.put("class", "junction-closed");
}
}
});
}
else{
junctionLink = new
WebMarkupContainer(id){
private static final long
serialVersionUID = 1L;
@Override
protected void
onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
tag.setName("span");
tag.put("class",
"junction-corner");
}
};
}
return junctionLink;
}
};
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Lazyloading-node-in-LinkTree-tp3554470p3554655.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
