private void fillDimensionProvider ( final boolean _updateDim ) { final DimensionProvider provider = getDimensionProvider ( ) ; final Iterator < ? extends DimTreeNode > currentIter = provider . getRoots ( ) ; final List < Dimension > dims = getDimensions ( ) ; if ( _updateDim && dims . isEmpty ( ) ) { provider . getRootList ( ) . clear ( ) ; } else { Collections . sort ( dims , new Comparator < Dimension > ( ) { @ Override public int compare ( final Dimension _arg0 , final Dimension _arg1 ) { final String dim0 = DBProperties . getProperty ( DimensionPanel . class . getName ( ) + "." + _arg0 . getKey ( ) ) ; final String dim1 = DBProperties . getProperty ( DimensionPanel . class . getName ( ) + "." + _arg1 . getKey ( ) ) ; return dim0 . compareTo ( dim1 ) ; } } ) ; final Iterator < Dimension > newDimsIter = dims . iterator ( ) ; while ( currentIter . hasNext ( ) ) { final DimTreeNode current = currentIter . next ( ) ; if ( newDimsIter . hasNext ( ) ) { final Dimension newDim = newDimsIter . next ( ) ; if ( ! newDim . getKey ( ) . equals ( ( ( Dimension ) current . getValue ( ) ) . getKey ( ) ) ) { currentIter . remove ( ) ; } else if ( _updateDim ) { current . update ( newDim . getValues ( ) ) ; } } } // add new ones while ( newDimsIter . hasNext ( ) ) { final DimTreeNode node = new DimTreeNode ( ) . setValue ( newDimsIter . next ( ) ) ; provider . getRootList ( ) . add ( node ) ; } } }
Fill dimension provider .