1

アプリケーションを ZK 5.011 から 6.5 にアップグレードしたところ、TreeitemRenderer の render() が呼び出されなくなりました。

これは私のコードです:

// --- 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 {
            ...
        }
    }
}

ZK v. 5.011 では問題なく動作しますが、ZK を v. 6.5 にアップグレードした後、CatalogTreeItemsRenderer のメソッド render(...) はまったく呼び出されず、ツリーは空です!

4

0 に答える 0