Browse Source

Merge pull request #11814 in DESIGN/design from bugfix/11.0 to feature/x

* commit 'bbfc87ed37ea370d8f0fdbd227807e72340d67ac': (23 commits)
  REPORT-92440 mac-数据源带叹号的宽度不正常
  REPORT-92440 mac-数据源带叹号的宽度不正常
  REPORT-92440 mac-数据源带叹号的宽度不正常
  REPORT-92439 mac下-展开收起图标的问题
  REPORT-92439 mac下-展开收起图标的问题
  REPORT-92440 mac-数据源带叹号的宽度不正常
  REPORT-92440 mac-数据源带叹号的宽度不正常
  REPORT-92439 mac下-展开收起图标的问题
  REPORT-92440 增加了SvgPaintWorker的execute方法的注释
  REPORT-92430 设计器-图标-mac下文件图标都丢失了,windows下正常
  REPORT-92439 mac下-展开收起图标的问题
  REPORT-92440 mac-数据源带叹号的宽度不正常
  REPORT-92439 优化了计算svg位置x,y的写法
  REPORT-92439 mac下-展开收起图标的问题
  REPORT-92440 mac-数据源带叹号的宽度不正常
  REPORT-92304 设计器-图标-三角形需要更新
  REPORT-91503 保存模板频繁报错锁定信息不一致,在这个弹窗另存为一定会失败。 处理创建模板备份文件时的锁定问题,以及锁定可能失败的问题
  REPORT-80651 模板版本管理重构一期(在11.0.15上回滚)
  REPORT-92325 修复环境初始化之前调用远程设计接口导致NPE问题
  REPORT-92304 设计器-图标-三角形需要更新,统一下SvgPaintUtils的处理位置
  ...
feature/x
superman 2 years ago
parent
commit
0774055ef7
  1. 12
      designer-base/src/main/java/com/fr/base/svg/SVGIcon.java
  2. 5
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 20
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  4. 18
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  5. 30
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  6. 27
      designer-base/src/main/java/com/fr/design/icon/WarningIcon.java
  7. 9
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  8. 3
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  9. 37
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  10. 16
      designer-base/src/main/java/com/fr/design/utils/SvgDraw.java
  11. 73
      designer-base/src/main/java/com/fr/design/utils/SvgDrawUtils.java
  12. 28
      designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java
  13. 85
      designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java
  14. 8
      designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java
  15. BIN
      designer-base/src/main/resources/com/fr/design/images/control/down_arrow.png
  16. BIN
      designer-base/src/main/resources/com/fr/design/images/control/east_arrow.png
  17. BIN
      designer-base/src/main/resources/com/fr/design/images/control/up_arrow.png
  18. BIN
      designer-base/src/main/resources/com/fr/design/images/control/west_arrow.png
  19. 4
      designer-base/src/main/resources/com/fr/design/images/lookandfeel/TreeLeafIcon.svg
  20. 3
      designer-base/src/main/resources/com/fr/design/standard/arrowlinear/down_arrow.svg
  21. 3
      designer-base/src/main/resources/com/fr/design/standard/arrowlinear/east_arrow.svg
  22. 3
      designer-base/src/main/resources/com/fr/design/standard/arrowlinear/up_arrow.svg
  23. 3
      designer-base/src/main/resources/com/fr/design/standard/arrowlinear/west_arrow.svg
  24. 2
      designer-base/src/main/resources/com/fr/design/standard/drag/left_normal.svg
  25. 2
      designer-base/src/main/resources/com/fr/design/standard/drag/left_pressed.svg
  26. 2
      designer-base/src/main/resources/com/fr/design/standard/drag/right_normal.svg
  27. 2
      designer-base/src/main/resources/com/fr/design/standard/drag/right_pressed.svg
  28. 6
      designer-base/src/main/resources/com/fr/design/standard/fileicon/minus.svg
  29. 4
      designer-base/src/main/resources/com/fr/design/standard/fileicon/plus.svg
  30. 13
      designer-base/src/main/resources/com/fr/design/standard/floatpop_normal.svg
  31. 10
      designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_down_arrow.svg
  32. 3
      designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_up_arrow.svg
  33. 3
      designer-base/src/main/resources/com/fr/design/standard/preview_down_icon_normal.svg
  34. 6
      designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_hover.svg
  35. 4
      designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_normal.svg
  36. 4
      designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_hover.svg
  37. 4
      designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_normal.svg
  38. 13
      designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollButton.java
  39. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java
  40. 9
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java

12
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);

5
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);
}
/**

20
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");

18
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));
}
}
}

30
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);

27
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;
}
{

9
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)) {

3
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));
}
}

37
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<Workspace>() {
@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<VcsEntity> 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) {

16
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<T> {
/**
* 绘制svg图标的具体逻辑,方法体
* */
void drawSVG();
}

73
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<Graphics> 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);
}
}

28
designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java

@ -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);
}
}
}

85
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<Void, Void>() {
private static void createAndOpenTemplate0(FILE file, String oldPath, boolean createByEditingTemplate, boolean openNewTemplate, Runnable doAfterCreateTemplate) {
new SwingWorker<Boolean, Void>() {
@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) {

8
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));
}
}
}

BIN
designer-base/src/main/resources/com/fr/design/images/control/down_arrow.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

BIN
designer-base/src/main/resources/com/fr/design/images/control/east_arrow.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 B

BIN
designer-base/src/main/resources/com/fr/design/images/control/up_arrow.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

BIN
designer-base/src/main/resources/com/fr/design/images/control/west_arrow.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

4
designer-base/src/main/resources/com/fr/design/images/lookandfeel/TreeLeafIcon.svg

@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 15V1H10L14 5.001V15H2ZM9 2H3V14H13V6.0002H10H9V5.0002V2ZM10 2.41412V5.0002H12.5853L10 2.41412Z" fill="#333334"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 3H4V13H6H8H12V7H8V3Z" fill="#FEF6DE"/>
</svg>

After

Width:  |  Height:  |  Size: 366 B

3
designer-base/src/main/resources/com/fr/design/standard/arrowlinear/down_arrow.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8 9.29289L11.6464 5.64645C11.8417 5.45118 12.1583 5.45118 12.3536 5.64645C12.5488 5.84171 12.5488 6.15829 12.3536 6.35355L8.35355 10.3536C8.15829 10.5488 7.84171 10.5488 7.64645 10.3536L3.64645 6.35355C3.45118 6.15829 3.45118 5.84171 3.64645 5.64645C3.84171 5.45118 4.15829 5.45118 4.35355 5.64645L8 9.29289Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 443 B

3
designer-base/src/main/resources/com/fr/design/standard/arrowlinear/east_arrow.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.29289 8L5.64645 11.6464C5.45118 11.8417 5.45118 12.1583 5.64645 12.3536C5.84171 12.5488 6.15829 12.5488 6.35355 12.3536L10.3536 8.35355C10.5488 8.15829 10.5488 7.84171 10.3536 7.64645L6.35355 3.64645C6.15829 3.45118 5.84171 3.45118 5.64645 3.64645C5.45118 3.84171 5.45118 4.15829 5.64645 4.35355L9.29289 8Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 443 B

3
designer-base/src/main/resources/com/fr/design/standard/arrowlinear/up_arrow.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.5 7.20711L4.85355 10.8536C4.65829 11.0488 4.34171 11.0488 4.14645 10.8536C3.95118 10.6583 3.95118 10.3417 4.14645 10.1464L8.14645 6.14645C8.34171 5.95118 8.65829 5.95118 8.85355 6.14645L12.8536 10.1464C13.0488 10.3417 13.0488 10.6583 12.8536 10.8536C12.6583 11.0488 12.3417 11.0488 12.1464 10.8536L8.5 7.20711Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 447 B

3
designer-base/src/main/resources/com/fr/design/standard/arrowlinear/west_arrow.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.70711 8L10.3536 11.6464C10.5488 11.8417 10.5488 12.1583 10.3536 12.3536C10.1583 12.5488 9.84171 12.5488 9.64645 12.3536L5.64645 8.35355C5.45118 8.15829 5.45118 7.84171 5.64645 7.64645L9.64645 3.64645C9.84171 3.45118 10.1583 3.45118 10.3536 3.64645C10.5488 3.84171 10.5488 4.15829 10.3536 4.35355L6.70711 8Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 443 B

2
designer-base/src/main/resources/com/fr/design/standard/drag/left_normal.svg

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity="0.4" fill-rule="evenodd" clip-rule="evenodd" d="M10 4.48284C10 4.30466 9.78457 4.21543 9.65858 4.34142L6 8L9.65858 11.6586C9.78457 11.7846 10 11.6953 10 11.5172V4.48284Z" fill="#333334"/>
</svg>

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 309 B

2
designer-base/src/main/resources/com/fr/design/standard/drag/left_pressed.svg

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 4.48284C10 4.30466 9.78457 4.21543 9.65858 4.34142L6 8L9.65858 11.6586C9.78457 11.7846 10 11.6953 10 11.5172V4.48284Z" fill="#333334"/>
</svg>

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 295 B

2
designer-base/src/main/resources/com/fr/design/standard/drag/right_normal.svg

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path opacity="0.4" fill-rule="evenodd" clip-rule="evenodd" d="M6 4.48284C6 4.30466 6.21543 4.21543 6.34142 4.34142L10 8L6.34142 11.6586C6.21543 11.7846 6 11.6953 6 11.5172V4.48284Z" fill="#333334"/>
</svg>

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 306 B

2
designer-base/src/main/resources/com/fr/design/standard/drag/right_pressed.svg

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 4.48284C6 4.30466 6.21543 4.21543 6.34142 4.34142L10 8L6.34142 11.6586C6.21543 11.7846 6 11.6953 6 11.5172V4.48284Z" fill="#333334"/>
</svg>

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

6
designer-base/src/main/resources/com/fr/design/standard/fileicon/minus.svg

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5858 5C12.4767 5 12.9229 6.07714 12.2929 6.70711L8 11L3.70711 6.70711C3.07714 6.07714 3.52331 5 4.41421 5L11.5858 5Z" fill="#AEAEAE"/>
</svg>
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.51716 2C7.69534 2 7.78457 2.21543 7.65858 2.34142L4 6L0.341421 2.34142C0.215428 2.21543 0.304662 2 0.482843 2L7.51716 2Z" fill="#AEAEAE"/>
</svg>

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 293 B

4
designer-base/src/main/resources/com/fr/design/standard/fileicon/plus.svg

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 4.41421C5 3.52331 6.07714 3.07714 6.70711 3.70711L11 8L6.70711 12.2929C6.07714 12.9229 5 12.4767 5 11.5858V4.41421Z" fill="#AEAEAE"/>
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 0.482843C2 0.304662 2.21543 0.215428 2.34142 0.341421L6 4L2.34142 7.65858C2.21543 7.78457 2 7.69534 2 7.51716V0.482843Z" fill="#AEAEAE"/>
</svg>

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

13
designer-base/src/main/resources/com/fr/design/standard/floatpop_normal.svg

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="22px" height="16px" viewBox="0 0 22 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_悬浮元素&amp;三角_normal</title>
<g id="icon_悬浮元素&amp;三角_normal" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M2,0 L2,1 L14,1 L14,0 L15,0 L15,1 L16,1 L16,2 L15,2 L15,14 L16,14 L16,15 L15,15 L15,16 L14,16 L14,15 L2,15 L2,16 L1,16 L1,15 L0,15 L0,14 L1,14 L1,2 L0,2 L0,1 L1,1 L1,0 L2,0 Z M14,14 L14,2 L2,2 L2,14 L14,14 Z" id="Combined-Shape" fill="#333334"></path>
<polygon id="Fill-5" fill="#EEEEEF" points="2 14 14 14 14 2 2 2"></polygon>
<path d="M21.5741668,7.5 C21.9938502,7.5 22.0986659,7.73540497 21.797731,8.03633988 L19.3340709,10.5 L16.8704108,8.03633988 C16.5741985,7.74012754 16.6738481,7.5 17.0939751,7.5 L21.5741668,7.5 Z" id="Rectangle-6" fill="#333334"></path>
<svg width="26" height="16" viewBox="0 0 26 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="Property 1=&#230;&#173;&#163;&#229;&#184;&#184;">
<path id="Combined Shape" fill-rule="evenodd" clip-rule="evenodd" d="M1 16H2V15H14V16H15V15H16V14H15V2H16V1H15V0H14V1H2V0H1V1H0V2H1V14H0V15H1V16ZM14 2H2V14H14V2Z" fill="#333334"/>
<path id="Fill 5" fill-rule="evenodd" clip-rule="evenodd" d="M2 14H14V2H2V14Z" fill="#F0F0F3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M25.003 6.5C25.5537 6.5 25.6862 6.81387 25.2941 7.20591L22 10.5L18.706 7.20591C18.3161 6.81605 18.4531 6.5 18.9971 6.5H25.003Z" fill="#333334"/>
</g>
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 964 B

After

Width:  |  Height:  |  Size: 705 B

10
designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_down_arrow.svg

@ -0,0 +1,10 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_102_14157)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.45974 10.0667L3.95113 8.55807C3.89838 8.50533 3.82468 8.47786 3.74623 8.48172C3.58286 8.48975 3.44392 8.6287 3.43588 8.79207L3.19669 13.6556L8.06019 13.4164C8.13864 13.4125 8.21541 13.3776 8.27361 13.3194C8.3948 13.1982 8.40401 13.011 8.29418 12.9011L6.78557 11.3925L13.7347 4.44336C14.1387 4.03937 14.1694 3.41507 13.8033 3.04895C13.4372 2.68284 12.8129 2.71354 12.4089 3.11753L5.45974 10.0667Z" fill="#419BF9"/>
</g>
<defs>
<clipPath id="clip0_102_14157">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 766 B

3
designer-base/src/main/resources/com/fr/design/standard/poparrow/pop_up_arrow.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5403 6.63783L13.0489 8.14644C13.1016 8.19919 13.1753 8.22665 13.2538 8.22279C13.4171 8.21476 13.5561 8.07581 13.5641 7.91245L13.8033 3.04896L8.93981 3.28815C8.86136 3.292 8.78459 3.32687 8.72639 3.38507C8.6052 3.50627 8.59599 3.69355 8.70582 3.80339L10.2144 5.312L3.26528 12.2612C2.86129 12.6651 2.83059 13.2894 3.1967 13.6556C3.56282 14.0217 4.18712 13.991 4.59111 13.587L11.5403 6.63783Z" fill="#419BF9"/>
</svg>

After

Width:  |  Height:  |  Size: 567 B

3
designer-base/src/main/resources/com/fr/design/standard/preview_down_icon_normal.svg

@ -0,0 +1,3 @@
<svg width="32" height="8" viewBox="0 0 32 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.2071 2C12.7617 2 12.5386 2.53857 12.8536 2.85355L15.6464 5.64645C15.8417 5.84171 16.1583 5.84171 16.3536 5.64645L19.1464 2.85355C19.4614 2.53857 19.2383 2 18.7929 2H13.2071Z" fill="#AEAEAE"/>
</svg>

After

Width:  |  Height:  |  Size: 349 B

6
designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_hover.svg

@ -1,3 +1,3 @@
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.58579 2C6.47669 2 6.92286 3.07714 6.29289 3.70711L4 6L1.70711 3.70711C1.07714 3.07714 1.52331 2 2.41421 2L5.58579 2Z" fill="#62646E"/>
</svg>
<svg width="10" height="10" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.51716 2C7.69534 2 7.78457 2.21543 7.65858 2.34142L4 6L0.341421 2.34142C0.215428 2.21543 0.304662 2 0.482843 2L7.51716 2Z" fill="#62646E"/>
</svg>

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 295 B

4
designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/down_normal.svg

@ -1,3 +1,3 @@
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.58579 2C6.47669 2 6.92286 3.07714 6.29289 3.70711L4 6L1.70711 3.70711C1.07714 3.07714 1.52331 2 2.41421 2L5.58579 2Z" fill="#AEAEAE"/>
<svg width="10" height="10" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.51716 2C7.69534 2 7.78457 2.21543 7.65858 2.34142L4 6L0.341421 2.34142C0.215428 2.21543 0.304662 2 0.482843 2L7.51716 2Z" fill="#AEAEAE"/>
</svg>

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 295 B

4
designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_hover.svg

@ -1,3 +1,3 @@
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.58579 6C6.47669 6 6.92286 4.92286 6.29289 4.29289L4 2L1.70711 4.29289C1.07714 4.92286 1.52331 6 2.41421 6H5.58579Z" fill="#62646E"/>
<svg width="10" height="10" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.51716 6C7.69534 6 7.78457 5.78457 7.65858 5.65858L4 2L0.341421 5.65858C0.215428 5.78457 0.304662 6 0.482843 6L7.51716 6Z" fill="#62646E"/>
</svg>

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 295 B

4
designer-base/src/main/resources/com/fr/design/standard/triangle.arrow/up_normal.svg

@ -1,3 +1,3 @@
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.58579 6C6.47669 6 6.92286 4.92286 6.29289 4.29289L4 2L1.70711 4.29289C1.07714 4.92286 1.52331 6 2.41421 6H5.58579Z" fill="#AEAEAE"/>
<svg width="10" height="10" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.51716 6C7.69534 6 7.78457 5.78457 7.65858 5.65858L4 2L0.341421 5.65858C0.215428 5.78457 0.304662 6 0.482843 6L7.51716 6Z" fill="#AEAEAE"/>
</svg>

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 295 B

13
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);
}

11
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<Long> 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);

9
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);
}

Loading…
Cancel
Save