diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java index 172b10dac5..832fd33e91 100644 --- a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java +++ b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java @@ -1,9 +1,12 @@ package com.fr.base.svg; +import com.fr.design.utils.SvgDrawUtils; import com.fr.general.IOUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -34,10 +37,7 @@ public class SVGIcon implements Icon { public void paintIcon(Component c, Graphics g, int x, int y) { if (HI_DPI_SURPORT) { Graphics2D graphics = (Graphics2D) g.create(x, y, image.getWidth(null), image.getHeight(null)); - float scale = SYSTEM_SCALE; - graphics.scale(1 / scale, 1 / scale); - graphics.drawImage(image, 0, 0, null); - graphics.scale(1.0D, 1.0D); + SvgDrawUtils.doDrawSVG(graphics, () -> SvgDrawUtils.drawImage(graphics, image, 0, 0, null)); graphics.dispose(); } else { g.drawImage(image, x, y, null); diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index a83bcfd771..46485409bb 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -390,10 +390,7 @@ public class PreferencePane extends BasicPane { vcsPane.add(enableVcsPanel); vcsPane.add(intervalPanel); vcsPane.add(saveCommitCheckBox); - if (VcsHelper.getInstance().isLegacyMode()) { - // 老版本时才显示gc选项 - vcsPane.add(gcControlPane); - } + vcsPane.add(gcControlPane); } /** diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index da05a79dd5..eba4a5634a 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -153,10 +153,10 @@ public interface UIConstants { public static final BufferedImage DRAG_BAR = IOUtils.readImage("com/fr/design/images/control/bar.png"); public static final BufferedImage DRAG_BAR_LIGHT = IOUtils.readImage("com/fr/design/images/control/bar-light.png"); - public static final BufferedImage ARROW_NORTH = IOUtils.readImage("com/fr/design/images/control/up_arrow.png"); - public static final BufferedImage ARROW_SOUTH = IOUtils.readImage("com/fr/design/images/control/down_arrow.png"); - public static final BufferedImage ARROW_EAST = IOUtils.readImage("com/fr/design/images/control/east_arrow.png"); - public static final BufferedImage ARROW_WEST = IOUtils.readImage("com/fr/design/images/control/west_arrow.png"); + public static final Image ARROW_NORTH = SVGLoader.load("/com/fr/design/standard/arrowlinear/up_arrow.svg"); + public static final Image ARROW_SOUTH = SVGLoader.load("/com/fr/design/standard/arrowlinear/down_arrow.svg"); + public static final Image ARROW_EAST = SVGLoader.load("/com/fr/design/standard/arrowlinear/east_arrow.svg"); + public static final Image ARROW_WEST = SVGLoader.load("/com/fr/design/standard/arrowlinear/west_arrow.svg"); public static final BufferedImage DRAG_BAR_RIGHT = IOUtils.readImage("com/fr/design/images/control/barm.png"); public static final BufferedImage DRAG_BAR_LEFT = IOUtils.readImage("com/fr/design/images/control/barl.png"); @@ -172,24 +172,24 @@ public interface UIConstants { public static final Image DRAG_LINE = SVGLoader.load("/com/fr/design/standard/dot_line_normal.svg"); public static final BufferedImage ACCESSIBLE_EDITOR_DOT = IOUtils.readImage("com/fr/design/images/control/dot.png"); public static final BufferedImage DRAG_DOT_VERTICAL = IOUtils.readImage("com/fr/design/images/control/dotv.png"); - public static final BufferedImage POP_BUTTON_DOWN = IOUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png"); - public static final BufferedImage POP_BUTTON_UP = IOUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png"); + public static final Image POP_BUTTON_DOWN = SVGLoader.load("/com/fr/design/standard/poparrow/pop_down_arrow.svg"); + public static final Image POP_BUTTON_UP = SVGLoader.load("/com/fr/design/standard/poparrow/pop_up_arrow.svg"); public static final BufferedImage DRAG_DOWN_SELECTED_SMALL = IOUtils.readImage("com/fr/design/images/buttonicon/downSelected.png"); public static final BufferedImage DRAG_LEFT_NORMAL_SMALL = IOUtils.readImage("com/fr/design/images/buttonicon/leftNormal.png"); public static final BufferedImage WATERMARK_BACKGROUND = IOUtils.readImage("/com/fr/design/images/dialog/watermark/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_WaterMark_Background_Icon_File_Name")); public static final int MODEL_NORMAL = 0; public static final int MODEL_PRESS = 1; - public static final Icon ARROW_DOWN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png"); + public static final Icon ARROW_DOWN_ICON = IconUtils.readIcon("/com/fr/design/standard/arrowlinear/down_arrow.svg"); public static final Icon ARROW_UP_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/arrowup.png"); public static final Icon YES_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/yes.png"); public static final Icon CHOOSEN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/select_item.png"); public static final Icon PRE_WIDGET_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png"); public static final Icon PRE_WIDGET_NORMAL_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/prewidget"); public static final Icon EDIT_NORMAL_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/edit"); - public static final Icon EDIT_PRESSED_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/edit"); + public static final Icon EDIT_PRESSED_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/edit_pressed.svg"); public static final Icon HIDE_NORMAL_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/hide"); - public static final Icon HIDE_PRESSED_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/hide"); + public static final Icon HIDE_PRESSED_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/hide_pressed.svg"); public static final Icon VIEW_NORMAL_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/view"); //public static final Icon VIEW_PRESSED_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/view"); @@ -221,7 +221,7 @@ public interface UIConstants { public static final int BUTTON_GROUP_ARC = 0; public static final int LARGEARC = 6; public static final Stroke BS = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 2f, new float[]{3, 1}, 0); - public static final Icon PREVIEW_DOWN = IOUtils.readIcon("com/fr/design/images/buttonicon/prevew_down_icon.png"); + public static final Icon PREVIEW_DOWN = IconUtils.readIcon("/com/fr/design/standard/preview_down_icon"); public static final Icon CLOSE_OF_AUTHORITY = IOUtils.readIcon("/com/fr/design/images/m_report/close.png"); public static final Icon CLOSE_OVER_AUTHORITY = IOUtils.readIcon("/com/fr/design/images/m_report/close_over.png"); public static final Icon CLOSE_PRESS_AUTHORITY = IOUtils.readIcon("/com/fr/design/images/m_report/close_press.png"); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java index f00fbee498..cec4b840a7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -5,10 +5,21 @@ import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.utils.SvgDrawUtils; import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.LayoutManager; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; @@ -313,7 +324,6 @@ public class UIEastResizableContainer extends JPanel { @Override public void paint(Graphics g) { Image button; - if (containerWidth == leftPaneWidth) { if (model == UIConstants.MODEL_NORMAL) { button = UIConstants.DRAG_LEFT_NORMAL; @@ -327,7 +337,7 @@ public class UIEastResizableContainer extends JPanel { button = UIConstants.DRAG_RIGHT_PRESS; } } - g.drawImage(button, 18, 7, this); + SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, 10, 7, null)); } } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index 8e562cc3ce..a7682107ec 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -3,12 +3,22 @@ package com.fr.design.gui.icontainer; import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.utils.SvgPaintUtils; -import com.fr.stable.Constants; +import com.fr.design.utils.SvgDrawUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.Constants; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.LayoutManager; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; @@ -411,11 +421,9 @@ public class UIResizableContainer extends JPanel { Image upButton = (upModel == UIConstants.MODEL_NORMAL ? UIConstants.DRAG_UP_NORMAL : UIConstants.DRAG_UP_PRESS); Image downButton = (downModel == UIConstants.MODEL_NORMAL ? UIConstants.DRAG_DOWN_NORMAL : UIConstants.DRAG_DOWN_PRESS); g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, getWidth(), getHeight(), null); - SvgPaintUtils.beforePaint((Graphics2D) g); - g.drawImage(UIConstants.DRAG_LINE, (getWidth() - toolPaneHeight) / 2, 3, null); - g.drawImage(upButton, ARROW_MARGIN, 1, null); - g.drawImage(downButton, getWidth() - toolPaneHeight - ARROW_MARGIN, 1, null); - SvgPaintUtils.afterPaint((Graphics2D) g); + SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, UIConstants.DRAG_LINE, (getWidth() - toolPaneHeight) / 2, 3, null)); + SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, upButton, ARROW_MARGIN, 0, null)); + SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, downButton, (getWidth() - toolPaneHeight - ARROW_MARGIN), 0, null)); } } @@ -512,7 +520,7 @@ public class UIResizableContainer extends JPanel { button = UIConstants.DRAG_LEFT_PRESS; } } - g.drawImage(button, -1, ARROW_MARGIN_VERTICAL, this); + SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, -6, ARROW_MARGIN_VERTICAL, VerticalToolPane.this)); } else { g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, toolPaneHeight, getHeight(), null); if (containerWidth == toolPaneHeight) { @@ -528,7 +536,7 @@ public class UIResizableContainer extends JPanel { button = UIConstants.DRAG_RIGHT_PRESS; } } - g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, this); + SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, 10, ARROW_MARGIN_VERTICAL, VerticalToolPane.this)); } if (isLeftRightDragEnabled) { g.drawImage(UIConstants.DRAG_DOT_VERTICAL, 2, getHeight() / 2, 5, toolPaneHeight, null); diff --git a/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java b/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java index 08d5b5a55a..a50bb39969 100644 --- a/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java +++ b/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java @@ -1,12 +1,17 @@ package com.fr.design.icon; import com.fr.base.svg.SVGLoader; -import com.fr.design.utils.SvgPaintUtils; +import com.fr.base.svg.SystemScaleUtils; +import com.fr.design.utils.SvgDrawUtils; import com.fr.log.FineLoggerFactory; import javax.swing.GrayFilter; import javax.swing.ImageIcon; -import java.awt.*; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.MediaTracker; import java.awt.image.ImageObserver; /** @@ -20,7 +25,8 @@ public class WarningIcon extends ImageIcon { }; protected final static MediaTracker TRACKER = new MediaTracker(COMPONENT); private final static Image WARNING_IMAGE = SVGLoader.load("/com/fr/design/standard/warning.svg"); - + private static final boolean HI_DPI_SUPPORT = SystemScaleUtils.isJreHiDPIEnabled(); + public static final float SYSTEM_SCALE = SystemScaleUtils.sysScale(); private Image mainImage = null; private ImageObserver imageObserver; private int width = -1; @@ -36,14 +42,15 @@ public class WarningIcon extends ImageIcon { @Override public synchronized void paintIcon(Component c, Graphics g, int x, int y) { - SvgPaintUtils.beforePaint((Graphics2D) g); + //裁剪绘制svg的位置,以免影响到图标右侧的文字 + Graphics2D graphics = (Graphics2D) g.create(x, y, WARNING_IMAGE.getWidth(null), WARNING_IMAGE.getHeight(null)); if (mainImage != null) { - g.drawImage(mainImage, x, y, c); + SvgDrawUtils.doDrawSVG(graphics, () -> SvgDrawUtils.drawImage(graphics, mainImage, x, y, null)); } if (WARNING_IMAGE != null) { - g.drawImage(WARNING_IMAGE, x, y, c); + SvgDrawUtils.doDrawSVG(graphics, () -> SvgDrawUtils.drawImage(graphics, WARNING_IMAGE, x, y, null)); } - SvgPaintUtils.afterPaint((Graphics2D) g); + graphics.dispose(); } /** @@ -91,7 +98,8 @@ public class WarningIcon extends ImageIcon { * @return the width in pixels of this icon */ public int getIconWidth() { - return width; + //如果环境支持高清化,drawImage可能会缩放绘制的图像比例,需要保证svg正常显示的同时调整绘制范围 + return HI_DPI_SUPPORT ? (int) (width / SYSTEM_SCALE) : width; } /** @@ -100,7 +108,8 @@ public class WarningIcon extends ImageIcon { * @return the height in pixels of this icon */ public int getIconHeight() { - return height; + //如果环境支持高清化,drawImage可能会缩放绘制的图像比例,需要保证svg正常显示的同时调整绘制范围 + return HI_DPI_SUPPORT ? (int) (height / SYSTEM_SCALE) : height; } { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index d21dd1b7cf..8cfd263421 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -325,7 +325,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt if (VcsHelper.getInstance().needInit()) { vcsAction = new VcsAction(); - if (!isLegacyOnCluster()) { + if (!WorkContext.getCurrent().isCluster()) { vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title")); } else { vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote")); @@ -509,7 +509,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private void fireVcsActionChange(boolean enable) { if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() || VcsHelper.getInstance().isUnSelectedTemplate() - || isLegacyOnCluster()) { + || WorkContext.getCurrent().isCluster()) { setEnabled(false); return; } @@ -810,11 +810,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } } - private boolean isLegacyOnCluster() { - // 老模式且为集群,用于代替之前的只判断集群逻辑 - return WorkContext.getCurrent().isCluster() && VcsHelper.getInstance().isLegacyMode(); - } - private String doCheck (String userInput, String suffix) { String errorMsg = StringUtils.EMPTY; if (selectedOperation.duplicated(userInput, suffix, true)) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index b033fa6171..c8f7281a32 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -19,6 +19,7 @@ import com.fr.design.notification.SnapChat; import com.fr.design.notification.SnapChatFactory; import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; +import com.fr.design.utils.SvgDrawUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.log.FineLoggerFactory; @@ -1313,7 +1314,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } else { button = UIConstants.POP_BUTTON_UP; } - g.drawImage(button, ARROW_RANGE_START + 8, 4, 16, 16, null); + SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, (ARROW_RANGE_START + 8), 4, null)); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 0c8924e9d0..980ccb5a3a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -12,9 +12,6 @@ import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplateActionListener; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.ui.FileVersionTable; -import com.fr.event.Event; -import com.fr.event.EventDispatcher; -import com.fr.event.Listener; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; @@ -23,14 +20,11 @@ import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import com.fr.workspace.Workspace; -import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; import com.fr.workspace.server.vcs.git.config.GcConfig; import javax.swing.Icon; -import javax.swing.SwingUtilities; import javax.swing.border.EmptyBorder; import java.awt.Color; import java.util.List; @@ -61,22 +55,10 @@ public class VcsHelper implements JTemplateActionListener { private final static String SERVICE_NAME_MOVE = "moveVcs"; private static final VcsHelper INSTANCE = new VcsHelper(); - private volatile boolean legacyMode; - public static VcsHelper getInstance() { return INSTANCE; } - private VcsHelper() { - legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode(); - EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener() { - @Override - public void on(Event event, Workspace param) { - legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode(); - } - }); - } - private int containsFolderCounts() { TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); if (fileTree.getSelectionPaths() == null) { @@ -155,18 +137,20 @@ public class VcsHelper implements JTemplateActionListener { String fileName = getEditingFilename(); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); - boolean replace = needDeleteVersion(entity); int latestFileVersion = 0; if (entity != null) { latestFileVersion = entity.getVersion(); } if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); + operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - List updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)); - SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList)); + FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY))); } else { - operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); + operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1); + } + VcsEntity oldEntity = WorkContext.getCurrent().get(VcsOperator.class).getFileVersionByIndexAndUsername(fileName, getCurrentUsername(), 1); + if (needDeleteVersion(oldEntity)) { + operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion()); } if (GcConfig.getInstance().isGcEnable()) { operator.gc(); @@ -204,13 +188,6 @@ public class VcsHelper implements JTemplateActionListener { moveVcs.shutdown(); } - /** - * 判断是否为老模式 - * @return 是否为老模式 - */ - public boolean isLegacyMode() { - return legacyMode; - } @Override public void templateOpened(JTemplate jt) { diff --git a/designer-base/src/main/java/com/fr/design/utils/SvgDraw.java b/designer-base/src/main/java/com/fr/design/utils/SvgDraw.java new file mode 100644 index 0000000000..0ae7ff7af8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/utils/SvgDraw.java @@ -0,0 +1,16 @@ +package com.fr.design.utils; + +/** + * 绘制SVG图标的函数式接口 + * + * @author obo + * @since 11.0 + * Created on 2023/3/24 + */ +public interface SvgDraw { + + /** + * 绘制svg图标的具体逻辑,方法体 + * */ + void drawSVG(); +} diff --git a/designer-base/src/main/java/com/fr/design/utils/SvgDrawUtils.java b/designer-base/src/main/java/com/fr/design/utils/SvgDrawUtils.java new file mode 100644 index 0000000000..5754b2f8d7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/utils/SvgDrawUtils.java @@ -0,0 +1,73 @@ +package com.fr.design.utils; + +import com.fr.base.svg.SVGLoader; +import com.fr.base.svg.SystemScaleUtils; +import org.jetbrains.annotations.NotNull; + +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.image.ImageObserver; + +/** + * 用于绘制svg图片缩放(高分屏下) + * + * @author hades + * @since 11.0 + * Created on 2022/5/6 + */ +public class SvgDrawUtils { + + private static final boolean HI_DPI_ENABLED = SystemScaleUtils.isJreHiDPIEnabled(); + + /** + * 绘制svg前若环境支持高清化则对缩放比例进行适配 + * */ + public static void beforeDraw(Graphics2D g2) { + if (HI_DPI_ENABLED) { + g2.scale(1 / SVGLoader.SYSTEM_SCALE, 1 / SVGLoader.SYSTEM_SCALE); + } + } + + /** + * 绘制svg后还原缩放矩阵 + * */ + public static void afterDraw(Graphics2D g2) { + if (HI_DPI_ENABLED) { + g2.scale(SVGLoader.SYSTEM_SCALE, SVGLoader.SYSTEM_SCALE); + } + } + + /** + * 计算高缩放下绘制svg图标时新的的位置x,y + * @param position 旧坐标的值 + * @return 新的position值 + * */ + public static int calculatePosition(int position) { + return HI_DPI_ENABLED ? (int) (position * SVGLoader.SYSTEM_SCALE) : position; + } + + /** + * 绘制svg图像的完整逻辑 + * @param graphics 绘图 + * @param svgDraw 具体绘制逻辑 + * */ + public static void doDrawSVG(@NotNull Graphics graphics, @NotNull final SvgDraw svgDraw) { + SvgDrawUtils.beforeDraw((Graphics2D) graphics); + svgDraw.drawSVG(); + SvgDrawUtils.afterDraw((Graphics2D) graphics); + } + + /** + * 绘制前对坐标x和y进行处理 + * @param graphics 绘图 + * @param image svg的Image对象 + * @param x x坐标 + * @param y y坐标 + * @param imageObserver 图像观察器 + * */ + public static void drawImage(Graphics graphics, Image image, int x, int y, ImageObserver imageObserver) { + //如果环境支持高清化,在调整缩放比例时绘制svg会影响到位置的变化,若图标无确定裁剪位置,则需要进行调整 + graphics.drawImage(image, SvgDrawUtils.calculatePosition(x), SvgDrawUtils.calculatePosition(y), imageObserver); + } +} diff --git a/designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java b/designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java deleted file mode 100644 index fdb460eb41..0000000000 --- a/designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fr.design.utils; - -import com.fr.base.svg.SVGLoader; -import com.fr.base.svg.SystemScaleUtils; -import java.awt.Graphics2D; - -/** - * 用于绘制svg图片缩放(高分屏下) - * - * @author hades - * @version 11.0 - * Created by hades on 2022/5/6 - */ -public class SvgPaintUtils { - - public static void beforePaint(Graphics2D g2) { - if (SystemScaleUtils.isJreHiDPIEnabled()) { - g2.scale(1 / SVGLoader.SYSTEM_SCALE, 1 / SVGLoader.SYSTEM_SCALE); - } - } - - public static void afterPaint(Graphics2D g2) { - if (SystemScaleUtils.isJreHiDPIEnabled()) { - g2.scale(SVGLoader.SYSTEM_SCALE, SVGLoader.SYSTEM_SCALE); - } - } - -} diff --git a/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java b/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java index 9fb1e632af..ce01d9992f 100644 --- a/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java @@ -16,6 +16,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreConstants; import com.fr.stable.ProductConstants; +import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; @@ -33,14 +34,30 @@ public class TemplateUtils { /** * 创建新的模板文件并打开模板 - * @param prefix 模板文件名称前缀 - * @param file 模板文件 + * + * @param prefix 模板文件名称前缀 + * @param file 模板文件 * @param createByEditingTemplate 是否根据 当前编辑模板 来创建新模板 * 为true时以CurrentEditingTemplate为准创建新模板 * 为false时以传入的File文件为准创建新模板,此文件可以不是编辑状态 - * @param openNewTemplate 是否需要在创建后打开模板 + * @param openNewTemplate 是否需要在创建后打开模板 */ public static void createAndOpenTemplate(String prefix, FILE file, boolean createByEditingTemplate, boolean openNewTemplate) { + createAndOpenTemplate(prefix, file, createByEditingTemplate, openNewTemplate, () -> {}); + } + + /** + * 创建新的模板文件并打开模板,并在创建备份模板成功后执行doAfterCreate + * + * @param prefix 模板文件名称前缀 + * @param file 模板文件 + * @param createByEditingTemplate 是否根据 当前编辑模板 来创建新模板 + * 为true时以CurrentEditingTemplate为准创建新模板 + * 为false时以传入的File文件为准创建新模板,此文件可以不是编辑状态 + * @param openNewTemplate 是否需要在创建后打开模板 + * @param doAfterCreateTemplate 创建备份模板成功后调用 + */ + public static void createAndOpenTemplate(String prefix, FILE file, boolean createByEditingTemplate, boolean openNewTemplate, Runnable doAfterCreateTemplate) { String fileName = file.getName(); String oldPath = file.getPath(); int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); @@ -48,7 +65,7 @@ public class TemplateUtils { return; } String suffix = fileName.substring(indexOfLastDot + 1); - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); + FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); fileChooserPane.setFileNameTextField(prefix + fileName, suffix); FileExtension fileExtension = FileExtension.parse(suffix); fileChooserPane.addChooseFILEFilter(new ChooseFileFilter(fileExtension, ProductConstants.APP_NAME + Toolkit.i18nText("Fine-Design_Report_Template_File"))); @@ -62,31 +79,26 @@ public class TemplateUtils { if (isOk(result)) { file = fileChooserPane.getSelectedFILE(); - _createAndOpenTemplate(file, oldPath, createByEditingTemplate, openNewTemplate); + createAndOpenTemplate0(file, oldPath, createByEditingTemplate, openNewTemplate, doAfterCreateTemplate); } } - private static void _createAndOpenTemplate(FILE file, String oldPath, boolean createByEditingTemplate, boolean openNewTemplate){ - new SwingWorker() { + private static void createAndOpenTemplate0(FILE file, String oldPath, boolean createByEditingTemplate, boolean openNewTemplate, Runnable doAfterCreateTemplate) { + new SwingWorker() { @Override - protected Void doInBackground() throws Exception { - byte[] content = new byte[0]; - if (createByEditingTemplate) { - // 从当前编辑模板中生成备份文件 - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - content = template.exportData(); - } else { - content = WorkContext.getWorkResource().readFully(oldPath); - } - if (ArrayUtils.isEmpty(content)) { - throw new Exception(oldPath + " content is empty" ); - } + protected Boolean doInBackground() throws Exception { + // 读取模板数据 + byte[] content = getTemplateData(createByEditingTemplate, oldPath); OutputStream out = null; try { // 加锁 - WorkContext.getCurrent().get(TplOperator.class).saveAs(file.getPath()); + boolean saveAsLock = WorkContext.getCurrent().get(TplOperator.class).saveAs(file.getPath()); + if (!saveAsLock) { + // 加锁失败时,直接返回 + return false; + } out = file.asOutputStream(); out.write(content); } finally { @@ -98,15 +110,18 @@ public class TemplateUtils { // 解锁 WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); } - } - return null; + return true; } @Override protected void done() { try { - get(); + if (!get()) { + throw new Exception("[RemoteDesign] back up template file failed"); + } + // 创建备份成功后,关闭原模板 + doAfterCreateTemplate.run(); if (openNewTemplate) { DesignerContext.getDesignerFrame().openTemplate(file); } @@ -118,7 +133,31 @@ public class TemplateUtils { } } }.execute(); + } + /** + * 读取模板文件数据 + * + * @param readCurrentEditingTemplate 是否读取当前编辑模板 + * @param path 模板路径 + * @return 模板文件数据 + */ + private static byte[] getTemplateData(boolean readCurrentEditingTemplate, String path) throws Exception { + byte[] content = new byte[0]; + if (readCurrentEditingTemplate) { + // 从当前编辑模板中读取模板文件数据 + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (JTemplate.isValid(template)) { + content = template.exportData(); + } + } else { + // 从给定的模板路径中读取模板文件数据 + content = WorkContext.getWorkResource().readFully(path); + } + if (ArrayUtils.isEmpty(content)) { + throw new Exception(StringUtils.messageFormat("{} content is empty", path)); + } + return content; } private static boolean isCancel(int result) { diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java index 080b9ddbcd..119668ec68 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java @@ -133,14 +133,14 @@ public class SaveFailureHandler implements ThrowableHandler { new Object[] {Toolkit.i18nText("Fine_Design_Template_SaveAs_Backup"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); if (option == JOptionPane.YES_OPTION) { JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (template != null) { + if (JTemplate.isValid(template)) { TemplateUtils.createAndOpenTemplate( Toolkit.i18nText("Fine_Design_Template_Backup"), new FileNodeFILE(new FileNode(template.getPath(), false)), true, - true); - // 创建并打开备份模板后,关闭原模板 - HistoryTemplateListCache.getInstance().closeSelectedReport(template); + true, + // 创建并打开备份模板后,关闭原模板,无需释放原模板锁(锁定信息不一致 = 此用户模板锁信息已被清除) + () -> HistoryTemplateListCache.getInstance().closeSelectedReport(template)); } } } diff --git a/designer-base/src/main/resources/com/fr/design/images/control/down_arrow.png b/designer-base/src/main/resources/com/fr/design/images/control/down_arrow.png deleted file mode 100644 index 26a780d5e2..0000000000 Binary files a/designer-base/src/main/resources/com/fr/design/images/control/down_arrow.png and /dev/null differ diff --git a/designer-base/src/main/resources/com/fr/design/images/control/east_arrow.png b/designer-base/src/main/resources/com/fr/design/images/control/east_arrow.png deleted file mode 100644 index 918d75a9f9..0000000000 Binary files a/designer-base/src/main/resources/com/fr/design/images/control/east_arrow.png and /dev/null differ diff --git a/designer-base/src/main/resources/com/fr/design/images/control/up_arrow.png b/designer-base/src/main/resources/com/fr/design/images/control/up_arrow.png deleted file mode 100644 index 3d79ee07bd..0000000000 Binary files a/designer-base/src/main/resources/com/fr/design/images/control/up_arrow.png and /dev/null differ diff --git a/designer-base/src/main/resources/com/fr/design/images/control/west_arrow.png b/designer-base/src/main/resources/com/fr/design/images/control/west_arrow.png deleted file mode 100644 index 5693190f96..0000000000 Binary files a/designer-base/src/main/resources/com/fr/design/images/control/west_arrow.png and /dev/null differ diff --git a/designer-base/src/main/resources/com/fr/design/images/lookandfeel/TreeLeafIcon.svg b/designer-base/src/main/resources/com/fr/design/images/lookandfeel/TreeLeafIcon.svg new file mode 100644 index 0000000000..c2971da642 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/lookandfeel/TreeLeafIcon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/down_arrow.svg b/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/down_arrow.svg new file mode 100644 index 0000000000..fc5d318bf7 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/down_arrow.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/east_arrow.svg b/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/east_arrow.svg new file mode 100644 index 0000000000..b4b54dea89 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/east_arrow.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/up_arrow.svg b/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/up_arrow.svg new file mode 100644 index 0000000000..cf615f3f37 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/up_arrow.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/west_arrow.svg b/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/west_arrow.svg new file mode 100644 index 0000000000..d5260bfd0f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/standard/arrowlinear/west_arrow.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/drag/left_normal.svg b/designer-base/src/main/resources/com/fr/design/standard/drag/left_normal.svg index 0809e2e261..d20fea5a83 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/drag/left_normal.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/drag/left_normal.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/drag/left_pressed.svg b/designer-base/src/main/resources/com/fr/design/standard/drag/left_pressed.svg index 7f293e9a15..db0dca3958 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/drag/left_pressed.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/drag/left_pressed.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/drag/right_normal.svg b/designer-base/src/main/resources/com/fr/design/standard/drag/right_normal.svg index a9bc6d2c6b..4b3cb3aadd 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/drag/right_normal.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/drag/right_normal.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/drag/right_pressed.svg b/designer-base/src/main/resources/com/fr/design/standard/drag/right_pressed.svg index 7fa6c4e056..fafe763882 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/drag/right_pressed.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/drag/right_pressed.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/fileicon/minus.svg b/designer-base/src/main/resources/com/fr/design/standard/fileicon/minus.svg index 067df99f84..db4e76f2a9 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/fileicon/minus.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/fileicon/minus.svg @@ -1,3 +1,3 @@ - - - + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/fileicon/plus.svg b/designer-base/src/main/resources/com/fr/design/standard/fileicon/plus.svg index c2b0e9d9c4..f012490aee 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/fileicon/plus.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/fileicon/plus.svg @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/floatpop_normal.svg b/designer-base/src/main/resources/com/fr/design/standard/floatpop_normal.svg index 95806104dc..a9e45f1c8d 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/floatpop_normal.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/floatpop_normal.svg @@ -1,9 +1,8 @@ - - icon_悬浮元素&三角_normal - - - - + + + + + - + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_down_arrow.svg b/designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_down_arrow.svg new file mode 100644 index 0000000000..8e4260b37d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_down_arrow.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_up_arrow.svg b/designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_up_arrow.svg new file mode 100644 index 0000000000..5c797c1f03 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_up_arrow.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/preview_down_icon_normal.svg b/designer-base/src/main/resources/com/fr/design/standard/preview_down_icon_normal.svg new file mode 100644 index 0000000000..da4dd8c300 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/standard/preview_down_icon_normal.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_hover.svg b/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_hover.svg index f83d881a5d..b89e826352 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_hover.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_hover.svg @@ -1,3 +1,3 @@ - - - + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_normal.svg b/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_normal.svg index 478b58eba7..597fe8c9c6 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_normal.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_normal.svg @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_hover.svg b/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_hover.svg index 67045e796a..9ddff69714 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_hover.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_hover.svg @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_normal.svg b/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_normal.svg index 2297284274..cfd49c95d1 100644 --- a/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_normal.svg +++ b/designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_normal.svg @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollButton.java b/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollButton.java index 20bb70d668..cc0ab91809 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollButton.java +++ b/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollButton.java @@ -1,11 +1,18 @@ package com.fr.design.cell.bar; import com.fr.design.constants.UIConstants; +import com.fr.design.utils.SvgDrawUtils; import com.fr.general.ComparatorUtils; -import javax.swing.*; +import javax.swing.SwingConstants; import javax.swing.plaf.basic.BasicArrowButton; -import java.awt.*; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Insets; import java.awt.image.BufferedImage; import java.util.HashMap; @@ -62,6 +69,7 @@ public class DynamicScrollButton extends BasicArrowButton { private void paintArrow(Graphics g, Dimension size) { + SvgDrawUtils.beforeDraw((Graphics2D) g); switch (direction) { case SwingConstants.NORTH: g.drawImage(UIConstants.ARROW_NORTH, 0, 0, this); @@ -76,6 +84,7 @@ public class DynamicScrollButton extends BasicArrowButton { g.drawImage(UIConstants.ARROW_WEST, 0, 0, this); break; } + SvgDrawUtils.afterDraw((Graphics2D) g); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java index b46d094d8b..1baa092cec 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java @@ -2,19 +2,18 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.base.GraphHelper; import com.fr.base.svg.SVGLoader; -import com.fr.base.svg.SystemScaleUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.alphafine.model.ProductNews; -import com.fr.design.utils.SvgPaintUtils; +import com.fr.design.utils.SvgDrawUtils; + +import javax.swing.JPanel; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; - import java.awt.RenderingHints; import java.util.Set; -import javax.swing.JPanel; /** * @author hades @@ -58,9 +57,9 @@ public class ProductNewsImagePanel extends JPanel { } Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); if (!readSet.contains(productNews.getId())) { - SvgPaintUtils.beforePaint(g2); + SvgDrawUtils.beforeDraw(g2); g2.drawImage(NEW_TIP_IMAGE, 0, 0, this); - SvgPaintUtils.afterPaint(g2); + SvgDrawUtils.afterDraw(g2); } g2.setColor(BACKGROUND_COLOR); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java index b2c186a9ea..f96622d5ca 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java @@ -4,13 +4,14 @@ import com.fr.base.svg.SVGLoader; import com.fr.base.svg.SystemScaleUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.alphafine.AlphaFineUtil; -import com.fr.design.utils.SvgPaintUtils; +import com.fr.design.utils.SvgDrawUtils; + +import javax.swing.JPanel; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; -import javax.swing.JPanel; /** * @author hades @@ -33,7 +34,7 @@ public class QuestionPane extends JPanel { protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; - SvgPaintUtils.beforePaint(g2); + SvgDrawUtils.beforeDraw(g2); // 宽高保持 int width = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getWidth() * SVGLoader.SYSTEM_SCALE) : getWidth(); int height = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getHeight() * SVGLoader.SYSTEM_SCALE) : getHeight(); @@ -47,7 +48,7 @@ public class QuestionPane extends JPanel { int imageWidth = QUESTION_IMAGE.getWidth(this); int imageHeight = QUESTION_IMAGE.getHeight(this); g2.drawImage(QUESTION_IMAGE, (width - imageWidth) / 2 - 2, (height - imageHeight) / 2 - 2,this); - SvgPaintUtils.afterPaint(g2); + SvgDrawUtils.afterDraw(g2); }