diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java index 1a8f85df5..dfbf2d640 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java @@ -165,10 +165,17 @@ public class ZoomPane extends BasicBeanPane { } private void checkCustomModePane() { + if (customModePane == null){ + return; + } customModePane.setVisible(modeTypeButtonGroup.getSelectedItem() == ZoomModeType.CUSTOM); } private void checkInitialDisplayCardPane() { + if (initialDisplayCardPane == null){ + return; + } + CardLayout cardLayout = (CardLayout) initialDisplayCardPane.getLayout(); if (ComparatorUtils.equals(initialDisplayTypeComboBox.getSelectedItem(), ZoomInitialDisplayType.TOP_CATEGORY)) { cardLayout.show(initialDisplayCardPane, ZoomInitialDisplayType.TOP_CATEGORY.toString()); @@ -180,16 +187,22 @@ public class ZoomPane extends BasicBeanPane { @Override public void populateBean(ZoomAttribute ob) { - modeTypeButtonGroup.setSelectedItem(ob.getModeType()); + if (modeTypeButtonGroup != null) { + modeTypeButtonGroup.setSelectedItem(ob.getModeType()); + } - initialDisplayTypeComboBox.setSelectedItem(ob.getInitialDisplayType()); + if (initialDisplayTypeComboBox != null){ + initialDisplayTypeComboBox.setSelectedItem(ob.getInitialDisplayType()); + } - topCategorySpinner.setValue(ob.getTopCategory()); + if (topCategorySpinner != null) { + topCategorySpinner.setValue(ob.getTopCategory()); + } - if (ob.getLeft() != null) { + if (ob.getLeft() != null && leftFormulaPane != null) { leftFormulaPane.populateBean(ob.getLeft().getContent()); } - if (ob.getRight() != null) { + if (ob.getRight() != null && rightFormulaPane != null) { rightFormulaPane.populateBean(ob.getRight().getContent()); } @@ -205,14 +218,25 @@ public class ZoomPane extends BasicBeanPane { public ZoomAttribute updateBean() { ZoomAttribute zoomAttribute = new ZoomAttribute(); - zoomAttribute.setModeType(modeTypeButtonGroup.getSelectedItem()); + if (modeTypeButtonGroup != null) { + zoomAttribute.setModeType(modeTypeButtonGroup.getSelectedItem()); + } + + if (initialDisplayTypeComboBox != null) { + zoomAttribute.setInitialDisplayType((ZoomInitialDisplayType) initialDisplayTypeComboBox.getSelectedItem()); + } - zoomAttribute.setInitialDisplayType((ZoomInitialDisplayType) initialDisplayTypeComboBox.getSelectedItem()); + if (topCategorySpinner != null){ + zoomAttribute.setTopCategory((int) topCategorySpinner.getValue()); + } - zoomAttribute.setTopCategory((int) topCategorySpinner.getValue()); + if (leftFormulaPane != null){ + zoomAttribute.setLeft(new StringFormula(leftFormulaPane.updateBean())); + } - zoomAttribute.setLeft(new StringFormula(leftFormulaPane.updateBean())); - zoomAttribute.setRight(new StringFormula(rightFormulaPane.updateBean())); + if (rightFormulaPane != null){ + zoomAttribute.setRight(new StringFormula(rightFormulaPane.updateBean())); + } if (selectionZoomGroup != null) { zoomAttribute.setSelectionZoom(selectionZoomGroup.getSelectedItem());