uiManager.addCollectionInstance(BASE_SERIES_SHEET_COLLECTION);
for (int iBS = iBaseSeriesCount; iBS < iNewBaseSeriesCount; iBS++) { uiManager.addCollectionInstance(BASE_SERIES_SHEET_COLLECTION_FOR_CHARTS_WITH_AXES); } } else { for (int iBS = iBaseSeriesCount; iBS > iNewBaseSeriesCount; iBS--) { uiManager.removeCollectionInstance(BASE_SERIES_SHEET_COLLECTION_FOR_CHARTS_WITH_AXES); } }  if (iNewOrthogonalSeriesCount >= iOrthogonalSeriesCount) { for (int iOS = iOrthogonalSeriesCount; iOS < iNewOrthogonalSeriesCount; iOS++) { uiManager.addCollectionInstance(ORTHOGONAL_SERIES_SHEET_COLLECTION_FOR_CHARTS_WITH_AXES); } } else { for (int iOS = iOrthogonalSeriesCount; iOS > iNewOrthogonalSeriesCount; iOS--) { uiManager.removeCollectionInstance(ORTHOGONAL_SERIES_SHEET_COLLECTION_FOR_CHARTS_WITH_AXES); }
    public void chartModified(IUIManager uiManager)    {        Chart cModel = uiManager.getCurrentModelState();        int iNewBaseAxisCount = 0;        int iNewOrthogonalAxisCount = 0;        int iNewBaseSeriesCount = 0;        int iNewOrthogonalSeriesCount = 0;        int iNewLabelBlockCount = 0;        if (cModel instanceof ChartWithAxes)        {            iNewBaseAxisCount = ((ChartWithAxes) cModel).getAxes().size();            iNewOrthogonalAxisCount = 0;            iNewBaseSeriesCount = 0;            iNewOrthogonalSeriesCount = 0;            for (int i = 0; i < iNewBaseAxisCount; i++)            {                iNewBaseSeriesCount += ((Axis) ((ChartWithAxes) cModel).getAxes().get(i)).getSeriesDefinitions().size();                iNewOrthogonalAxisCount += ((Axis) ((ChartWithAxes) cModel).getAxes().get(i)).getAssociatedAxes()                    .size();                for (int iS = 0; iS < iNewOrthogonalAxisCount; iS++)                {                    iNewOrthogonalSeriesCount += ((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            if (iNewBaseAxisCount >= iBaseAxisCount)            {                for (int iBA = iBaseAxisCount; iBA < iNewBaseAxisCount; iBA++)                {                    uiManager.addCollectionInstance(BASE_AXIS_SHEET_COLLECTION);                }            }            else            {                for (int iBA = iBaseAxisCount; iBA > iNewBaseAxisCount; iBA--)                {                    uiManager.removeCollectionInstance(BASE_AXIS_SHEET_COLLECTION);                }            }            if (iNewOrthogonalAxisCount >= iOrthogonalAxisCount)            {                for (int iOA = iOrthogonalAxisCount; iOA < iNewOrthogonalAxisCount; iOA++)                {                    uiManager.addCollectionInstance(ORTHOGONAL_AXIS_SHEET_COLLECTION);                }            }            else            {                for (int iOA = iOrthogonalAxisCount; iOA > iNewOrthogonalAxisCount; iOA--)                {                    uiManager.removeCollectionInstance(ORTHOGONAL_AXIS_SHEET_COLLECTION);                }            }        }        else        {            iNewBaseAxisCount = 0;            iNewOrthogonalAxisCount = 0;            iNewBaseSeriesCount = ((ChartWithoutAxes) cModel).getSeriesDefinitions().size();            iNewOrthogonalSeriesCount = 0;            for (int iS = 0; iS < iNewBaseSeriesCount; iS++)            {                iNewOrthogonalSeriesCount += ((SeriesDefinition) ((ChartWithoutAxes) cModel).getSeriesDefinitions()                    .get(iS)).getSeriesDefinitions().size();            }        }        Iterator iter = cModel.getBlock().getChildren().iterator();        while (iter.hasNext())        {            Block block = (Block) iter.next();            if (block instanceof LabelBlock && !(block instanceof TitleBlock))            {                iNewLabelBlockCount++;            }        }        // Start from 1 because there will always be at least 1 entry for each registered sheet when this method is        // called        if (iNewBaseSeriesCount >= iBaseSeriesCount)        {            for (int iBS = iBaseSeriesCount; iBS < iNewBaseSeriesCount; iBS++)            {                uiManager.addCollectionInstance(BASE_SERIES_SHEET_COLLECTION);            }        }        else        {            for (int iBS = iBaseSeriesCount; iBS > iNewBaseSeriesCount; iBS--)            {                uiManager.removeCollectionInstance(BASE_SERIES_SHEET_COLLECTION);            }        }        if (iNewOrthogonalSeriesCount >= iOrthogonalSeriesCount)        {            for (int iOS = iOrthogonalSeriesCount; iOS < iNewOrthogonalSeriesCount; iOS++)            {                uiManager.addCollectionInstance(ORTHOGONAL_SERIES_SHEET_COLLECTION);            }        }        else        {            for (int iOS = iOrthogonalSeriesCount; iOS > iNewOrthogonalSeriesCount; iOS--)            {                uiManager.removeCollectionInstance(ORTHOGONAL_SERIES_SHEET_COLLECTION);            }        }        /*         * for (int iLB = 1; iLB < iLabelBlockCount; iLB++) {         * uiManager.addCollectionInstance(LABEL_BLOCK_SHEET_COLLECTION); }         */        // Update the stored counts        iBaseAxisCount = iNewBaseAxisCount;        iOrthogonalAxisCount = iNewOrthogonalAxisCount;        iBaseSeriesCount = iNewBaseSeriesCount;        iOrthogonalSeriesCount = iNewOrthogonalSeriesCount;    }