public void synchronize ( List < QueryControllerEntity > queryEntities ) { if ( queryEntities . size ( ) > 0 ) { for ( QueryControllerEntity queryEntity : queryEntities ) { if ( queryEntity instanceof QueryControllerGroup ) { QueryControllerGroup group = ( QueryControllerGroup ) queryEntity ; QueryGroupTreeElement queryGroupEle = new QueryGroupTreeElement ( group . getID ( ) ) ; Vector < QueryControllerQuery > queries = group . getQueries ( ) ; for ( QueryControllerQuery query : queries ) { QueryTreeElement queryTreeEle = new QueryTreeElement ( query . getID ( ) , query . getQuery ( ) ) ; insertNodeInto ( queryTreeEle , queryGroupEle , queryGroupEle . getChildCount ( ) ) ; } insertNodeInto ( queryGroupEle , ( DefaultMutableTreeNode ) root , root . getChildCount ( ) ) ; } else { QueryControllerQuery query = ( QueryControllerQuery ) queryEntity ; QueryTreeElement queryTreeEle = new QueryTreeElement ( query . getID ( ) , query . getQuery ( ) ) ; insertNodeInto ( queryTreeEle , ( DefaultMutableTreeNode ) root , root . getChildCount ( ) ) ; } } } }
Takes all the existing nodes and constructs the tree .