}    for (int iBS = 1; iBS < iBaseSeriesCount; iBS++) { uiManager.addCollectionInstance(BASE_SERIES_SHEET_COLLECTION); } for (int iOS = 1; iOS < iOrthogonalSeriesCount; iOS++) { uiManager.addCollectionInstance(ORTHOGONAL_SERIES_SHEET_COLLECTION);
    public void initialize(Chart cModel, IUIManager uiManager)    {        // Register sheet collections        uiManager.registerSheetCollection(BASE_SERIES_SHEET_COLLECTION, BASE_SERIES_SHEETS);        uiManager.registerSheetCollection(ORTHOGONAL_SERIES_SHEET_COLLECTION, ORTHOGONAL_SERIES_SHEETS);        uiManager.registerSheetCollection(BASE_AXIS_SHEET_COLLECTION, BASE_AXIS_SHEETS);        uiManager.registerSheetCollection(ORTHOGONAL_AXIS_SHEET_COLLECTION, ORTHOGONAL_AXIS_SHEETS);        uiManager.registerSheetCollection(LABEL_BLOCK_SHEET_COLLECTION, LABEL_BLOCK_SHEETS);        iLabelBlockCount = 0;        if (cModel instanceof ChartWithAxes)        {            iBaseAxisCount = ((ChartWithAxes) cModel).getAxes().size();            iOrthogonalAxisCount = 0;            iBaseSeriesCount = 0;            iOrthogonalSeriesCount = 0;            for (int i = 0; i < iBaseAxisCount; i++)            {                iBaseSeriesCount += ((Axis) ((ChartWithAxes) cModel).getAxes().get(i)).getSeriesDefinitions().size();                iOrthogonalAxisCount += ((Axis) ((ChartWithAxes) cModel).getAxes().get(i)).getAssociatedAxes().size();                for (int iS = 0; iS < iOrthogonalAxisCount; iS++)                {                    iOrthogonalSeriesCount += ((Axis) ((Axis) ((ChartWithAxes) cModel).getAxes().get(i))                        .getAssociatedAxes().get(iS)).getSeriesDefinitions().size();                }            }            // Start from 1 because there will always be at least 1 entry for each registered sheet when this method is            // called            for (int iBA = 1; iBA < iBaseAxisCount; iBA++)            {                uiManager.addCollectionInstance(BASE_AXIS_SHEET_COLLECTION);            }            for (int iOA = 1; iOA < iOrthogonalAxisCount; iOA++)            {                uiManager.addCollectionInstance(ORTHOGONAL_AXIS_SHEET_COLLECTION);            }        }        else        {            iBaseAxisCount = 0;            iOrthogonalAxisCount = 0;            iBaseSeriesCount = ((ChartWithoutAxes) cModel).getSeriesDefinitions().size();            iOrthogonalSeriesCount = 0;            for (int iS = 0; iS < iBaseSeriesCount; iS++)            {                iOrthogonalSeriesCount += ((SeriesDefinition) ((ChartWithoutAxes) cModel).getSeriesDefinitions()                    .get(iS)).getSeriesDefinitions().size();            }            // Remove axis sheets since they are not needed for Charts Without Axes            uiManager.removeCollectionInstance(ORTHOGONAL_AXIS_SHEET_COLLECTION);            uiManager.removeCollectionInstance(BASE_AXIS_SHEET_COLLECTION);        }        Iterator iter = cModel.getBlock().getChildren().iterator();        while (iter.hasNext())        {            Block block = (Block) iter.next();            if (block instanceof LabelBlock && !(block instanceof TitleBlock))            {                iLabelBlockCount++;            }        }        // Start from 1 because there will always be at least 1 entry for each registered sheet when this method is        // called        for (int iBS = 1; iBS < iBaseSeriesCount; iBS++)        {            uiManager.addCollectionInstance(BASE_SERIES_SHEET_COLLECTION);        }        for (int iOS = 1; iOS < iOrthogonalSeriesCount; iOS++)        {            uiManager.addCollectionInstance(ORTHOGONAL_SERIES_SHEET_COLLECTION);        }        if (iLabelBlockCount == 0)        {            uiManager.removeCollectionInstance(LABEL_BLOCK_SHEET_COLLECTION);        }        else        {            for (int iLB = 1; iLB < iLabelBlockCount; iLB++)            {                uiManager.addCollectionInstance(LABEL_BLOCK_SHEET_COLLECTION);            }        }    }