Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-2639

performance issue with AbstractTreeModel and render on demand

    XMLWordPrintable

    Details

      Description

      the implementation of the getChild method unecessarily calls getChildCount() for the last item in the path.
      This results in performance problems when the call to getChildCount is expensive(e.g. loaded from DB).

      getChildCount is called many times when scrolling down a a tree and tree nodes get loaded from the server, or when opening dynamically added tree nodes.

      here a suggested much simpler implementation also usable as a WORKAROUND

      	@Override
      	public Hierarchy<String> getChild(int[] path) {
      		Hierarchy<String> parent = getRoot();
      		for (int index : path) {
      			parent = getChild(parent, index);
      		}
      		return parent;
      	}
      

        Attachments

          Activity

            People

            Assignee:
            jumperchen jumperchen
            Reporter:
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: