diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java index 66fed7afe2..9377c619a7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java @@ -5,7 +5,7 @@ import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.designer.EditingState; import com.fr.design.event.RemoveListener; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.grid.Grid; @@ -18,8 +18,6 @@ import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.util.ArrayList; @@ -85,7 +83,10 @@ public class ReportComponentComposite extends JComponent implements RemoveListen value = value > MAX ? MAX : value; value = value < MIN ? MIN : value; int resolution = (int) (ScreenResolution.getScreenResolution() * value / HUND); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (template != null) { + template.setScale(resolution); + } } }; @@ -119,8 +120,12 @@ public class ReportComponentComposite extends JComponent implements RemoveListen templateStateList.add(null); } centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement()); - // Yvan: REPORT-37950 普通报表-多sheet-报表块缩放失效 - //jSliderContainer = JFormSliderPane.getInstance(); + // 这里jSliderContainer有可能为null,做个判断 + if (jSliderContainer == null) { + jSliderContainer = JFormSliderPane.getInstance(); + } + // 为新建的sheet的缩放条初始值置为100 + jSliderContainer.setShowValue(HUND); } if (centerCardPane.editingComponet.elementCasePane == null) { @@ -206,8 +211,9 @@ public class ReportComponentComposite extends JComponent implements RemoveListen hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar()); JPanel southPane = new JPanel(new BorderLayout()); - jSliderContainer = JFormSliderPane.getInstance(); - + if (jSliderContainer == null) { + jSliderContainer = JFormSliderPane.getInstance(); + } southPane.add(hbarContainer, BorderLayout.NORTH); southPane.add(sheetNameTab, BorderLayout.CENTER); southPane.add(jSliderContainer, BorderLayout.EAST);