diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java index 89c35b9a9f..67b369a6c9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleBlock.java @@ -96,6 +96,7 @@ public class PredefinedStyleBlock extends JPanel { private void initPane(boolean supportEdit) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); PredefinedStylePreviewPane content = new PredefinedStylePreviewPane(0.387, 0.384); + content.setParent(this); content.setPreferredSize(new Dimension(200, 180)); UILabel label = new UILabel(previewObject.getStyleName()); label.setToolTipText(previewObject.getStyleName()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java index b876d723f9..5d03d0e2fb 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java @@ -39,6 +39,8 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen private int COLUMN_CHART_WIDTH = 517; private int COLUMN_CHART_HEIGHT = 300; + private JPanel parent; + public PredefinedStylePreviewPane() { this(1.0, 1.0); } @@ -53,6 +55,10 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen this.add(this.elementCasePreview); } + public void setParent(JPanel parent) { + this.parent = parent; + } + private JPanel initChartPreViewPane() { columnChartPane = new ChartPreStylePreView(initVanColumnChart()); columnChartPane.setPreferredSize(new Dimension(COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT)); @@ -142,6 +148,10 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen @Override public void callback() { - this.repaint(); + if (parent != null) { + parent.repaint(); + } else { + this.repaint(); + } } }