diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java index ced2aa3767..3cd6b78773 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java @@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils; import com.fr.design.components.tooltip.ModernToolTip; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.FRGraphics2D; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.ColorUtils; @@ -17,6 +18,8 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JToolTip; +import javax.swing.JViewport; +import javax.swing.RepaintManager; import javax.swing.ScrollPaneConstants; import javax.swing.border.EmptyBorder; import java.awt.BasicStroke; @@ -28,9 +31,11 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; +import java.awt.Image; import java.awt.RenderingHints; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.image.ImageObserver; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -127,9 +132,15 @@ public class StartupPageWorkspacePanel extends JPanel { this.contentPanel = generateUnLimitContentPanel(this.partitions); this.add(contentPanel, BorderLayout.NORTH); } - private JComponent generateUnLimitContentPanel(List> partitions) { + JComponent panel = generateUnLimitContentPanel0(partitions); + ColorUtils.transparentBackground(panel); + return panel; + } + + private JComponent generateUnLimitContentPanel0(List> partitions) { + JPanel workspaceDescWrapper = new JPanel(); workspaceDescWrapper.setLayout(new BorderLayout(0, 0)); workspaceDescWrapper.setBorder(new EmptyBorder(0, 0, 0, 0)); @@ -142,16 +153,28 @@ public class StartupPageWorkspacePanel extends JPanel { } boolean needScroll = partitions.size() > 4; if (needScroll) { - // 滚动条 - UIScrollPane scrollPane = new UIScrollPane(workspaceDescPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setBorder(new EmptyBorder(10, 0, 0, 0)); - scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, SCROLL_HEIGHT)); - workspaceDescWrapper.add(scrollPane, BorderLayout.CENTER); - return workspaceDescWrapper; + return generateScrollUnLimitContentPanel(workspaceDescWrapper, workspaceDescPanel); } workspaceDescWrapper.add(workspaceDescPanel, BorderLayout.CENTER); - ColorUtils.transparentBackground(workspaceDescWrapper); + return workspaceDescWrapper; + } + + @NotNull + private JPanel generateScrollUnLimitContentPanel(JPanel workspaceDescWrapper, JPanel workspaceDescPanel) { + + // 滚动条 + UIScrollPane scrollPane = new UIScrollPane(workspaceDescPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + JViewport viewport = scrollPane.getViewport(); + JViewport scrollViewport = new TransparentScrollViewPort(); + // 动态画图 + scrollViewport.addChangeListener(e -> repaintAll()); + scrollViewport.setView(viewport.getView()); + scrollPane.setViewport(scrollViewport); + scrollPane.setBorder(new EmptyBorder(10, 0, 0, 0)); + scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, SCROLL_HEIGHT)); + workspaceDescWrapper.add(scrollPane, BorderLayout.CENTER); + return workspaceDescWrapper; } @@ -580,4 +603,27 @@ public class StartupPageWorkspacePanel extends JPanel { this.getRootPane().repaint(); } + + /** + * 支持透明的滚动视图 + */ + private class TransparentScrollViewPort extends JViewport { + + /** + * 从而屏蔽掉 {@link RepaintManager.PaintManager#paintDoubleBuffered(JComponent, Image, Graphics, int, int, int, int)} + * + * @return 创建一个不会实际画图的 Graphics + */ + @Override + public Graphics getGraphics() { + + Graphics graphics = super.getGraphics(); + return new FRGraphics2D((Graphics2D) graphics) { + @Override + public boolean drawImage(Image img, int x, int y, ImageObserver observer) { + return true; + } + }; + } + } } diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties index 0205e6ea2b..d1f8ee17b2 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties @@ -15,6 +15,7 @@ com.fr.design.report.fit.firstColumn=120*20 com.fr.design.report.fit.column=160*20 com.fr.design.lock.LockInfoDialog=500*180 com.fr.design.mainframe.ForbiddenPane.refreshButton=75*24 +com.fr.start.common.DesignerOpenEmptyPanel.createButton=120*24 com.fr.design.cell.expand.sort.pane=257*185 com.fr.design.sort.rule.item=125*20 com.fr.design.ds.column.sort.pane=250*180 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties index 9b143294f3..a5b3a03fe6 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties @@ -14,6 +14,7 @@ com.fr.design.report.fit.firstColumn=170*20 com.fr.design.report.fit.column=100*20 com.fr.design.lock.LockInfoDialog=500*180 com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24 +com.fr.start.common.DesignerOpenEmptyPanel.createButton=70*24 com.fr.design.cell.expand.sort.pane=257*170 com.fr.design.sort.rule.item=125*20 com.fr.design.ds.column.sort.pane=250*165 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties index e0f0130224..4e8b3f9cdb 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties @@ -14,6 +14,7 @@ com.fr.design.report.fit.firstColumn=130*20 com.fr.design.report.fit.column=100*20 com.fr.design.lock.LockInfoDialog=500*180 com.fr.design.mainframe.ForbiddenPane.refreshButton=80*24 +com.fr.start.common.DesignerOpenEmptyPanel.createButton=70*24 com.fr.design.cell.expand.sort.pane=267*165 com.fr.design.sort.rule.item=125*20 com.fr.design.ds.column.sort.pane=250*180 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties index c00c2b8a9a..82f86a3a43 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties @@ -14,6 +14,7 @@ com.fr.design.report.fit.firstColumn=80*20 com.fr.design.report.fit.column=100*20 com.fr.design.lock.LockInfoDialog=400*180 com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24 +com.fr.start.common.DesignerOpenEmptyPanel.createButton=70*24 com.fr.design.cell.expand.sort.pane=227*155 com.fr.design.sort.rule.item=80*20 com.fr.design.ds.column.sort.pane=220*150 diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java index fcaed6d990..7ab5058f7e 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java @@ -6,6 +6,7 @@ import com.fr.module.ModuleContext; import com.fr.value.ClearableLazyValue; import org.jetbrains.annotations.NotNull; +import javax.swing.SwingUtilities; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -32,12 +33,9 @@ public class ColorPickerPaneNumFiled extends UINumberField { @Override protected void attributeChange() { - ses.getValue().schedule(new Runnable() { - @Override - public void run() { - // kuns: 默认修改500, 在地图修改系列颜色text时, 快速响应. - runChange(); - } + ses.getValue().schedule(() -> { + // kuns: 默认修改500, 在地图修改系列颜色text时, 快速响应. + SwingUtilities.invokeLater(this::runChange); }, 500, TimeUnit.MILLISECONDS); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java index dd01157a75..e5ba60f703 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java @@ -138,7 +138,7 @@ public class ITReplaceMainDialog extends UIDialog { southPanel = new ITReplaceSouthPanel(); westPanel = new ITReplaceWestPanel(); - initCloseListener(); + //initCloseListener(); northPane.fitScreen(0, 0, jTemplate.getWidth()); JPanel center = new JPanel(new BorderLayout());