1

I upgrade my application from ZK 5.011 to 6.5 and now TreeitemRenderer's render() not called.

This is my code:

// --- node (domain) class ---

public class CatalogTreeNode implements Serializable {

    private static final long serialVersionUID = 1L;

    public CatalogTreeNode( int nodeID, String nodeName, CatalogTreeNode parent ) {
        this.nodeID = nodeID;
        this.nodeName = nodeName;
    }

    private int nodeID;
    private String nodeName;

    // setters and getters
 }

// --- tree model class ---
// I need "load on demand"

public class CatalogTreeModel extends AbstractTreeModel<CatalogTreeNode> 
{
    private static final long serialVersionUID = 2L;

    public CatalogTreeModel( CatalogTreeNode root ) 
    {
        super( root );
        //...
    }

    @Override
    public CatalogTreeNode getChild( CatalogTreeNode parent, int childIndex ) {
        //...
    }

    @Override
    public int getChildCount( CatalogTreeNode node ) {  
        //...
    }

    @Override
    public boolean isLeaf( CatalogTreeNode node ) {
       //...
    }

    @Override
    public int getIndexOfChild( CatalogTreeNode parent, CatalogTreeNode child ) {
        //...
    }
}

// -- using in controller ---

public class MainFormController extends GenericForwardComposer<Component> {

    private Tree myTree;

    // ...

    @Override
    public void doAfterCompose( Component comp ) throws java.lang.Exception {
        super.doAfterCompose(comp);

        CatalogTreeNode catTreeRoot = new CatalogTreeNode( -1, "ROOT", null );

        catTreeRoot.addChild( new CatalogTreeNode( 1, "One", catTreeRoot ) );
        catTreeRoot.addChild( new CatalogTreeNode( 2, "Two", catTreeRoot ) );

            CatalogTreeModel model = new CatalogTreeModel( catTreeRoot );
                // model != null - Ok!

        CatalogTreeItemsRenderer renderer = new CatalogTreeItemsRenderer();
                // render != null - Ok!

        myTree.setItemRenderer( renderer ); 

        myTree.setModel( model );

        // ...
    }

    // renderer
    private class CatalogTreeItemsRenderer implements TreeitemRenderer<CatalogTreeNode> {

    @Override
    public void render( Treeitem item, CatalogTreeNode data, int index ) throws Exception {
            ...
        }
    }
}

With ZK v. 5.011 this work fine, but after upgrade ZK to v. 6.5 method render(...) of CatalogTreeItemsRenderer is not called at all and tree is empty!

4

0 回答 0