From c6d8d3253b4b25e2f350190d7cf23ea554d84211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 8 Aug 2024 15:15:51 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-113994=20=E3=80=90NewUI=E3=80=91?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E9=A1=B5=E7=BF=BB?= =?UTF-8?q?=E6=96=B0=E3=80=81=E8=BF=9B=E5=BA=A6=E6=9D=A1=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/light/ui/laf/FineLaf.java | 4 +- .../theme/utils/FineClientProperties.java | 4 + .../com/fine/theme/utils/FineUIStyle.java | 1 + .../com/fine/theme/utils/FineUIUtils.java | 23 +- .../gui/iprogressbar/ProgressDialog.java | 4 +- .../gui/itree/filetree/FileTreeIcon.java | 32 +- .../start/common/DesignerOpenEmptyPanel.java | 46 +- .../fr/startup/ui/StartupPageConstants.java | 2 +- .../com/fr/startup/ui/StartupPageUtil.java | 13 +- .../com/fr/startup/ui/StartupPageWindow.java | 61 ++- .../startup/ui/StartupPageWorkspacePanel.java | 468 ++++++++---------- .../com/fine/theme/icon/add_hover.svg | 5 + .../icon/filetree/filetype/fvs_locked.svg | 15 + .../icon/startup/local_server_background.svg | 16 + .../com/fine/theme/icon/startup/more.svg | 3 + .../fine/theme/icon/startup/more_hover.svg | 3 + .../icon/startup/remote_server_background.svg | 18 + .../com/fine/theme/icon/startup/show_less.svg | 3 + .../com/fine/theme/icon/startup/show_more.svg | 3 + .../fine/theme/light/ui/fine_light.icon.json | 10 +- .../light/ui/laf/FineLightLaf.properties | 20 +- .../share/ui/base/DownloadProgressPane.java | 1 - 22 files changed, 402 insertions(+), 353 deletions(-) create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/add_hover.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/fvs_locked.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/startup/local_server_background.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/startup/more.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/startup/more_hover.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/startup/remote_server_background.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/startup/show_less.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/startup/show_more.svg diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java index fa29de7466..f5bcbafe76 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java @@ -43,8 +43,8 @@ public abstract class FineLaf extends FlatLaf { */ private static void resetWindowDecorations() { if (SystemInfo.isWindows_10_orLater) { - System.setProperty("flatlaf.useWindowDecorations", "false"); - System.setProperty("flatlaf.menuBarEmbedded", "false"); + System.setProperty("flatlaf.useWindowDecorations", "true"); + System.setProperty("flatlaf.menuBarEmbedded", "true"); } } } diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java b/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java index 038e53a8cf..3b1e5933b2 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java @@ -28,6 +28,10 @@ public interface FineClientProperties extends FlatClientProperties { String PANEL_TYPE = "panelType"; String ROUNDED_PANEL = "roundedPanel"; + //--------------------------- ComboBox ---------------------------- + String COMBO_BOX_TYPE = "comboBoxType"; + String ADAPTIVE_COMBO_BOX = "adaptiveComboBox"; + int GROUP_BUTTON_POSITION_INNER = 0; int GROUP_BUTTON_POSITION_LEFT = 1; int GROUP_BUTTON_POSITION_RIGHT = 2; diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java index 5e15fffb0b..d2b64bea31 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java @@ -38,6 +38,7 @@ public interface FineUIStyle { String POPUP_MENU_TOOL_BAR = "popupMenuToolBar"; String POPUP_MENU_DROPDOWN = "dropdownPopupMenu"; String TRANSPARENT_TEXT_FIELD = "transparentTextField"; + String TRANSPARENT_BACKGROUND = "transparentBackground"; String PURE_LIST = "pureList"; String PURE_TREE = "pureTree"; String PASTEL_BUTTON = "pastelButton"; diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java index 1ca238934e..458be0dc6d 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java @@ -13,14 +13,7 @@ import javax.swing.JLabel; import javax.swing.JLayer; import javax.swing.ScrollPaneConstants; import javax.swing.UIManager; -import java.awt.Color; -import java.awt.Component; -import java.awt.Composite; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.awt.Insets; +import java.awt.*; import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; import java.lang.reflect.Field; @@ -388,7 +381,7 @@ public class FineUIUtils { * 面板元素头部添加小标题 * * @param component 面板元素 - * @param title 标题文本 + * @param title 标题文本 * @return 包装面板 */ public static Component wrapComponentWithTitle(Component component, String title) { @@ -422,4 +415,16 @@ public class FineUIUtils { return new JLayer<>(new UIScrollPane(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), new CollapsibleScrollBarLayerUI(verticalPolicy, horizontalPolicy)); } + + /** + * 设置组件字体大小,已适配字体缩放 + * + * @param c 组件 + * @param size 字体大小 + */ + public static void setFontSize(Component c, int size) { + Font font = c.getFont(); + Font newSizeFont = font.deriveFont(font.getStyle(), scale(size)); + c.setFont(newSizeFont); + } } diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index 44e697d043..67f696569e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -1,5 +1,6 @@ package com.fr.design.gui.iprogressbar; +import com.fine.theme.utils.FineUIScale; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; @@ -58,7 +59,7 @@ public class ProgressDialog extends UIDialog { protected void initCenterDialog(Frame parent) { centerDialog = new JDialog(this); - centerDialog.setSize(new Dimension(482, 124)); + centerDialog.setSize(FineUIScale.scale(new Dimension(482, 124))); centerDialog.setUndecorated(true); centerDialog.setLocationRelativeTo(parent); centerDialog.getContentPane().add(progressPanel); @@ -66,7 +67,6 @@ public class ProgressDialog extends UIDialog { protected void initProgressBar() { progressBar = new JProgressBar(); - progressBar.setUI(new ModernUIProgressBarUI()); progressBar.setBorderPainted(false); progressBar.setOpaque(false); progressBar.setBorder(null); diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index 4a2525d7c1..ca26e435aa 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -28,6 +28,7 @@ public class FileTreeIcon { public static final Icon FOLDER_OPEN_IMAGE_ICON = new LazyIcon("folder_open"); public static final Icon MODERN_CPT_FILE_IMAGE_ICON = new LazyIcon("cpt_icon"); public static final Icon MODERN_FRM_FILE_IMAGE_ICON = new LazyIcon("frm_icon"); + public static final Icon MODERN_FVS_FILE_IMAGE_ICON = new LazyIcon("fvs_icon"); public static final Icon FILE_IMAGE_ICON = UIManager.getIcon("FileView.fileIcon"); @@ -44,6 +45,10 @@ public class FileTreeIcon { public static final Icon MODERN_CHT_FILE_IMAGE_ICON = new LazyIcon("chtFile"); public static final Icon CPTX_ICON = new LazyIcon("cpt_icon"); + public static final Icon CPT_FILE_LOCK_ICON = new LazyIcon("cpt_locked"); + public static final Icon FRM_FILE_LOCK_ICON = new LazyIcon("frm_locked"); + public static final Icon FVS_FILE_LOCK_ICON = new LazyIcon("fvs_locked"); + // TODO: 以下Icon视觉暂未提供,需提供后替换 public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif"); public static final Icon FOLDER_HALF_IMAGE_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/folder_half_authority.svg"); @@ -76,10 +81,6 @@ public class FileTreeIcon { new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/jpgFile.gif")); public static final LockIcon BMP_FILE_LOCK_ICON = new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/bmpFile.gif")); - public static final LockIcon CPT_FILE_LOCK_ICON = - new LockIcon(BaseUtils.readImage("/com/fr/base/images/oem/cptlocked.png")); - public static final LockIcon FRM_FILE_LOCK_ICON = - new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/frmlocked.png")); public static final LockIcon CHT_FILE_LOCK_ICON = new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/frmlocked.png")); /** @@ -110,6 +111,7 @@ public class FileTreeIcon { public final static int FRM_FILE = 12; //.form .frm public final static int CHT_FILE = 13; //.chart .cht public final static int CPTX_FILE = 14; //.cptx + public final static int FVS_FILE = 15; //.fvs public static Icon getIcon(File file) { return FileTreeIcon.getIcon(file, false); @@ -143,6 +145,20 @@ public class FileTreeIcon { return getIcon(node, showLock); } + /** + * 获取文件名对应的图标 + * + * @param filename 文件名 + * @return 文件的图标 + */ + public static Icon getIconByFileName(String filename) { + Icon icon = getExtraIcon(filename, false); + if (icon != null) { + return icon; + } + return getIcon(getFileType(filename), false); + } + /** * 获取文件节点对应的图标(含展开与否的属性) * @@ -298,6 +314,12 @@ public class FileTreeIcon { } else { return FileTreeIcon.MODERN_CHT_FILE_IMAGE_ICON; } + } else if (fileType == FVS_FILE) { // fvs + if (isLocked) { + return FileTreeIcon.FVS_FILE_LOCK_ICON; + } else { + return FileTreeIcon.MODERN_FVS_FILE_IMAGE_ICON; + } } else { if (isLocked) { return FileTreeIcon.FILE_LOCK_ICON; @@ -354,6 +376,8 @@ public class FileTreeIcon { return FRM_FILE; } else if (fileName.endsWith(".cht") || fileName.endsWith(".chart")) { return CHT_FILE; + } else if (fileName.endsWith(".fvs")) { + return FVS_FILE; } else { return TEXT_FILE; } diff --git a/designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java b/designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java index b42cc4ed8f..9ef7a9c1ef 100644 --- a/designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java +++ b/designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java @@ -1,36 +1,32 @@ package com.fr.start.common; +import com.fine.theme.utils.FineUIStyle; import com.fr.base.svg.IconUtils; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MultiTemplateTabPane; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.utils.ColorUtils; import javax.swing.JButton; import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIStyle.setStyle; + /** * created by Harrison on 2022/07/09 **/ public class DesignerOpenEmptyPanel extends JPanel { - private static final Color BUTTON_COLOR = new Color(63, 155, 249); - private static final int ARC = 4; - private final JPanel body; public DesignerOpenEmptyPanel() { @@ -38,20 +34,8 @@ public class DesignerOpenEmptyPanel extends JPanel { this.body = FRGUIPaneFactory.createBorderLayout_S_Pane(); UILabel createIcon = new UILabel(IconUtils.readIcon("/com/fr/design/startup/create_new_template.svg")); - JButton createButton = new JButton(Toolkit.i18nText("Fine-Design_New_Template")) { - @Override - public void paintComponent(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setColor(BUTTON_COLOR); - g2d.fillRoundRect(0, 0, getWidth(), getHeight(), ARC, ARC); - super.paintComponent(g2d); - } - }; - createButton.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.start.common.DesignerOpenEmptyPanel.createButton")); - createButton.setForeground(Color.WHITE); - createButton.setBorderPainted(false); - createButton.setContentAreaFilled(false); + JButton createButton = new JButton(Toolkit.i18nText("Fine-Design_New_Template")); + setStyle(createButton, FineUIStyle.STYLE_PRIMARY); createButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -62,18 +46,14 @@ public class DesignerOpenEmptyPanel extends JPanel { MultiTemplateTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); } }); - createButton.setBorder(new EmptyBorder(0, 10, 0, 10)); - JPanel createButtonPanel = new JPanel(FRGUIPaneFactory.createCenterFlowLayout()); - createButtonPanel.add(createButton); - createButtonPanel.setBorder(new EmptyBorder(0, 0, 0, 0)); - createButtonPanel.setBackground(Color.WHITE); this.body.add(createIcon, BorderLayout.NORTH); - this.body.add(createButtonPanel, BorderLayout.SOUTH); + this.body.add(row( + flex(),cell(createButton),flex() + ).getComponent(), BorderLayout.SOUTH); setLayout(FRGUIPaneFactory.createCenterLayout(this.body, 0.4d, 0.4d)); - - ColorUtils.syncBackground(this, Color.WHITE); - + setStyle(this.body, FineUIStyle.NORMAL_COLOR); + setStyle(this, FineUIStyle.NORMAL_COLOR); add(this.body); } } diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java index 8c414cecfe..2dab229850 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java @@ -10,7 +10,7 @@ public class StartupPageConstants { /** * 圆弧长度 */ - public static final int ARC_DIAMETER = 20; + public static final int ARC_DIAMETER = 10; /** * 内容宽度 diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageUtil.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageUtil.java index 153aa4ce0e..20bf1c8464 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageUtil.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageUtil.java @@ -1,7 +1,8 @@ package com.fr.startup.ui; -import com.fr.base.svg.SVGIcon; +import com.fine.theme.icon.LazyIcon; import com.fr.design.env.DesignerWorkspaceType; +import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; @@ -27,9 +28,9 @@ public class StartupPageUtil { public static Icon getIcon4RecentAreaByWorkspace(StartupWorkspaceBean workspaceBean) { if (workspaceBean.getType() == DesignerWorkspaceType.Local) { - return SVGIcon.readSVGIcon("/com/fr/design/startup/local_server_background_36.svg", 36, 36); + return new LazyIcon("local_server_background", 36); } - return SVGIcon.readSVGIcon("/com/fr/design/startup/remote_server_background_36.svg", 36, 36); + return new LazyIcon("remote_server_background", 36); } /** @@ -41,11 +42,11 @@ public class StartupPageUtil { public static Icon getIcon4DescAreaByWorkspace(StartupWorkspaceBean workspaceBean) { if (workspaceBean.getType() == DesignerWorkspaceType.Local) { - return SVGIcon.readSVGIcon("/com/fr/design/startup/local_server_background_28.svg", 28, 28); + return new LazyIcon("local_server_background", 28); } - return SVGIcon.readSVGIcon("/com/fr/design/startup/remote_server_background_28.svg", 28, 28); + return new LazyIcon("remote_server_background", 28); } - + /** * 返回 ip : port * diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java index a2d9965e50..b758ac6c49 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java @@ -1,11 +1,14 @@ package com.fr.startup.ui; -import com.fr.base.svg.IconUtils; -import com.fr.concurrent.NamedThreadFactory; +import com.fine.theme.utils.FineUIStyle; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.UIExpandDialog; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.VerticalFlowLayout; @@ -13,7 +16,6 @@ import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.ColorUtils; -import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exit.DesignerExiter; import com.fr.general.GeneralUtils; @@ -26,7 +28,6 @@ import com.fr.start.common.DesignerStartupContext; import com.fr.startup.metric.DesignerMetrics; import org.jetbrains.annotations.NotNull; -import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; @@ -34,12 +35,10 @@ import javax.swing.JSeparator; import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; import javax.swing.SwingWorker; -import javax.swing.border.EmptyBorder; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; -import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; @@ -52,8 +51,8 @@ import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; + +import static com.fine.theme.utils.FineUIScale.scale; /** * 启动页 @@ -66,12 +65,12 @@ public class StartupPageWindow extends JFrame { private static final Color HOVER_COLOR = new Color(65, 155, 249); private static final Color SEP_COLOR = new Color(224, 224, 225); - private static final int GROUP_WIDTH = 600; + private static final int GROUP_WIDTH = scale(600); + private static final int WORKSPACE_PANEL_WIDTH = scale(180); private static final int RECENT_FILE_LIMIT = 6; - private static final int RECENT_FILE_SCROLL = RECENT_FILE_LIMIT + 1; - private static final int WORKSPACE_PANEL_WIDTH = 180; private static final int TITLE_FONT_SIZE = 24; private static final int ITEM_VERTICAL_GAP = 5; + private static final Dimension SCREEN_SIZE = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); @@ -117,7 +116,7 @@ public class StartupPageWindow extends JFrame { } private void initHeaderPanel() { - this.body = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.body = new JPanel(new BorderLayout(0, scale(20))); this.body.setBackground(new Color(0, 0, 0, 0)); JPanel headerPanel = createHeader(); this.body.add(headerPanel, BorderLayout.NORTH); @@ -169,9 +168,7 @@ public class StartupPageWindow extends JFrame { // Header UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Select_Workspace")); - Font font = label.getFont(); - Font titleFont = font.deriveFont(font.getStyle(), TITLE_FONT_SIZE); - label.setFont(titleFont); + FineUIUtils.setFontSize(label, TITLE_FONT_SIZE); JPanel headerPanel = new JPanel(); LayoutManager centerFlowLayout = FRGUIPaneFactory.createCenterFlowLayout(); headerPanel.setLayout(centerFlowLayout); @@ -288,18 +285,18 @@ public class StartupPageWindow extends JFrame { } private JPanel generateRecentOpenPanel(StartupPageModel pageModel) { - + Color color = FlatUIUtils.getUIColor("fill.normal", Color.WHITE); JPanel recentOpenPanel = new JPanel() { @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setColor(Color.WHITE); - g2d.fillRoundRect(0, 0, getWidth(), getHeight(), StartupPageConstants.ARC_DIAMETER, StartupPageConstants.ARC_DIAMETER); + g2d.setColor(color); + g2d.fillRoundRect(0, 0, getWidth(), getHeight(), 2 * StartupPageConstants.ARC_DIAMETER, 2 * StartupPageConstants.ARC_DIAMETER); } }; recentOpenPanel.setLayout(new BorderLayout()); - recentOpenPanel.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 6)); + recentOpenPanel.setBorder(new ScaledEmptyBorder(25, 25, 25, 6)); StartupWorkspaceBean workspaceInfo = pageModel.getSelectWorkspaceInfo(); JPanel workspaceWrapperYPanel = new JPanel(); @@ -309,15 +306,15 @@ public class StartupPageWindow extends JFrame { JPanel workspaceWrapperXPanel = new JPanel(); workspaceWrapperXPanel.setLayout(new FlowLayout()); - workspaceWrapperXPanel.setBorder(BorderFactory.createEmptyBorder()); - + JPanel workspacePanel = new JPanel(); - workspacePanel.setLayout(new BorderLayout(0, 15)); + workspacePanel.setLayout(new BorderLayout(0, scale(15))); UILabel workspaceIcon = new UILabel(StartupPageUtil.getIcon4RecentAreaByWorkspace(workspaceInfo)); workspacePanel.add(workspaceIcon, BorderLayout.NORTH); UILabel nameLabel = new UILabel(workspaceInfo.getName()); + FineUIUtils.setFontSize(nameLabel, 15); nameLabel.setHorizontalAlignment(SwingConstants.CENTER); workspacePanel.add(nameLabel, BorderLayout.SOUTH); workspaceWrapperXPanel.add(workspacePanel); @@ -340,18 +337,17 @@ public class StartupPageWindow extends JFrame { JComponent recentOpenGroupPanel = generateRecentOpenGroupPanel(pageModel, workspaceInfo); recentOpenPanel.add(recentOpenGroupPanel, BorderLayout.EAST); - ColorUtils.syncBackground(recentOpenPanel, Color.WHITE); - + ColorUtils.syncBackground(recentOpenPanel, color); + Dimension preferredSize = recentOpenPanel.getPreferredSize(); - recentOpenPanel.setPreferredSize(new Dimension(StartupPageConstants.CONTENT_WIDTH, (int) preferredSize.getHeight())); + recentOpenPanel.setPreferredSize(new Dimension(scale(StartupPageConstants.CONTENT_WIDTH), (int) preferredSize.getHeight())); JPanel recentOpenWrapperPanel = new JPanel(); recentOpenWrapperPanel.setName("recentOpenWrapper"); recentOpenWrapperPanel.setLayout(new BorderLayout(0, 0)); - recentOpenWrapperPanel.setBorder(new EmptyBorder(0, 0, 0, 20)); recentOpenWrapperPanel.add(recentOpenPanel, BorderLayout.CENTER); - ColorUtils.syncBackgroundIfAbsent(recentOpenWrapperPanel, new Color(0,0,0,0), ThemeUtils.BACK_COLOR); + FineUIStyle.setStyle(recentOpenWrapperPanel, FineUIStyle.TRANSPARENT_BACKGROUND); return recentOpenWrapperPanel; } @@ -372,8 +368,9 @@ public class StartupPageWindow extends JFrame { for (String recentFile : recentFiles) { JPanel recentItemPanel = new JPanel(); recentItemPanel.setLayout(new FlowLayout(FlowLayout.LEFT, ITEM_VERTICAL_GAP, 0)); - recentItemPanel.add(new UILabel(IconUtils.readIcon("/com/fr/design/standard/system/cpt"))); + recentItemPanel.add(new UILabel(FileTreeIcon.getIconByFileName(recentFile))); UILabel recentFileLabel = new UILabel(recentFile); + FineUIUtils.setFontSize(recentFileLabel, 13); Color recentFileLabelForeground = recentFileLabel.getForeground(); recentItemPanel.add(recentFileLabel); recentItemPanel.addMouseListener(new MouseAdapter() { @@ -406,7 +403,7 @@ public class StartupPageWindow extends JFrame { if (needScroll) { int scrollHeight = (int) Math.round(itemHeight * RECENT_FILE_LIMIT + ITEM_VERTICAL_GAP * (RECENT_FILE_LIMIT)); UIScrollPane scrollPane = new UIScrollPane(recentOpenGroupPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0)); + scrollPane.setBorder(new ScaledEmptyBorder(0, 0, 0, 0)); scrollPane.setPreferredSize(new Dimension(GROUP_WIDTH, scrollHeight)); return scrollPane; } @@ -414,10 +411,8 @@ public class StartupPageWindow extends JFrame { } private StartupPageWorkspacePanel generateWorkspacePanel(StartupPageModel pageModel) { - - StartupPageWorkspacePanel startupPageWorkspacePanel = new StartupPageWorkspacePanel(pageModel); - ColorUtils.syncBackgroundIfAbsent(startupPageWorkspacePanel, new Color(0, 0, 0, 0), ThemeUtils.BACK_COLOR); - return startupPageWorkspacePanel; + + return new StartupPageWorkspacePanel(pageModel); } protected LayoutManager getCenterLayout(JComponent centerBody) { diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java index e41304e23b..2767f8945b 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java @@ -1,211 +1,223 @@ package com.fr.startup.ui; -import com.fr.base.svg.IconUtils; +import com.fine.swing.ui.layout.Column; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIStyle; +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.components.tooltip.ModernToolTip; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.FRGraphics2D; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.ColorUtils; import com.fr.start.common.DesignerStartupContext; import com.fr.startup.metric.DesignerMetrics; import com.fr.third.guava.collect.Lists; import org.jetbrains.annotations.NotNull; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; +import javax.swing.JScrollBar; import javax.swing.JToolTip; import javax.swing.JViewport; -import javax.swing.RepaintManager; import javax.swing.ScrollPaneConstants; -import javax.swing.border.EmptyBorder; import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; -import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.GridLayout; import java.awt.Image; import java.awt.RenderingHints; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.geom.Path2D; import java.awt.image.ImageObserver; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import static com.fine.theme.utils.FineUIScale.scale; +import static com.fine.theme.utils.FineUIStyle.setStyle; import static com.fr.startup.ui.StartupPageConstants.ARC_DIAMETER; /** * created by Harrison on 2022/07/06 **/ public class StartupPageWorkspacePanel extends JPanel { - + /* color */ - - private static final Color SHALLOW_WHITE_COLOR = new Color(248, 250, 254); + private static final Color HOVER_COLOR = new Color(65, 155, 249); private static final Color PATH_COLOR = new Color(51, 51, 52, (int) Math.round(255 * 0.5)); - + /* 长度 */ private static final int SCROLL_BAR_WIDTH = 20; - private static final int CONTENT_WIDTH = StartupPageConstants.CONTENT_WIDTH + SCROLL_BAR_WIDTH; + private static final int CONTENT_WIDTH = scale(StartupPageConstants.CONTENT_WIDTH + SCROLL_BAR_WIDTH); private static final int BORDER_THIN = 2; - - private static final int ITEM_VERTICAL_GAP = 20; - private static final int SINGLE_ITEM_HEIGHT = 72; + + private static final int ITEM_VERTICAL_GAP = scale(20); + private static final int SINGLE_ITEM_HEIGHT = scale(72); private static final int SCROLL_HEIGHT = SINGLE_ITEM_HEIGHT * 4 + ITEM_VERTICAL_GAP * 4; - + private static final int NAME_LABEL_SIZE = 15; private static final int PATH_LABEL_SIZE = 10; - - private static final Dimension LABEL_DIMENSION = new Dimension(28, 28); - private static final Dimension PATH_DIMENSION = new Dimension(100, 20); - private static final Dimension SELECT_WORKSPACE_DIMENSION = new Dimension(210, 72); - private static final Dimension SELECT_CREATE_DIMENSION = new Dimension(60, 72); - + + private static final Dimension LABEL_DIMENSION = scale(new Dimension(28, 28)); + private static final Dimension PATH_DIMENSION = scale(new Dimension(100, 20)); + private static final Dimension SELECT_WORKSPACE_DIMENSION = scale(new Dimension(210, 72)); + private static final Dimension SELECT_CREATE_DIMENSION = scale(new Dimension(70, 72)); + private static final int COLUMN_LIMIT = 3; private static final int DOUBLE_CLICK_COUNT = 2; public static final int PARTITION_LIMIT = 2; - + /* model */ - + private final StartupPageModel pageModel; - + private final List> partitions; - + private Runnable selectWorkspaceRunnable; - + private final Runnable createNewTemplateRunnable; - + private final Runnable openEmptyTemplateRunnable; - + private JComponent contentPanel; - + private JPanel tailPanel; - + private boolean showMore = true; - + public StartupPageWorkspacePanel(StartupPageModel pageModel) { - - this.setLayout(new BorderLayout(0, 0)); - this.setBorder(new EmptyBorder(15, 0, 20, 0)); - + + this.setLayout(new BorderLayout(0, scale(10))); + this.pageModel = pageModel; - + List workspaceInfos = pageModel.getWorkspaceInfos(); this.partitions = Lists.partition(workspaceInfos, COLUMN_LIMIT); - + this.contentPanel = generateLimitContentPanel(partitions); + this.add(contentPanel, BorderLayout.NORTH); - + if (partitions.size() > PARTITION_LIMIT) { this.tailPanel = generateTailPanel(); this.add(tailPanel, BorderLayout.SOUTH); } - + this.createNewTemplateRunnable = pageModel.getCreateNewTemplateRunnable(); this.openEmptyTemplateRunnable = pageModel.getOpenEmptyTemplateRunnable(); - + + setStyle(contentPanel, FineUIStyle.TRANSPARENT_BACKGROUND); + setStyle(this, FineUIStyle.TRANSPARENT_BACKGROUND); + this.repaint(); } - + public void showLessContent() { - + this.remove(this.contentPanel); - + this.contentPanel = generateLimitContentPanel(this.partitions); this.add(contentPanel, BorderLayout.NORTH); } - + public void showMoreContent() { - + this.remove(this.contentPanel); - + this.contentPanel = generateUnLimitContentPanel(this.partitions); + this.contentPanel.setOpaque(false); this.add(contentPanel, BorderLayout.NORTH); } private JComponent generateUnLimitContentPanel(List> partitions) { - + JComponent panel = generateUnLimitContentPanel0(partitions); - ColorUtils.transparentBackground(panel); + setStyle(panel, FineUIStyle.TRANSPARENT_BACKGROUND); return panel; } - + private JComponent generateUnLimitContentPanel0(List> partitions) { - + JPanel workspaceDescWrapper = new JPanel(); - workspaceDescWrapper.setLayout(new BorderLayout(0, 0)); - workspaceDescWrapper.setBorder(new EmptyBorder(0, 0, 0, 0)); - - JPanel workspaceDescPanel = new JPanel(); - workspaceDescPanel.setLayout(new GridLayout(partitions.size(), 1, 0, 0)); + setStyle(workspaceDescWrapper, FineUIStyle.TRANSPARENT_BACKGROUND); + workspaceDescWrapper.setLayout(new BorderLayout()); + Column workSpaceDescPanel = new Column(); + workSpaceDescPanel.setSpacing(20); + setStyle(workSpaceDescPanel, FineUIStyle.TRANSPARENT_BACKGROUND); for (List partition : partitions) { JPanel partitionPanel = generatePartitionPanel(partition); - workspaceDescPanel.add(partitionPanel); + workSpaceDescPanel.add(partitionPanel); } boolean needScroll = partitions.size() > 4; if (needScroll) { - return generateScrollUnLimitContentPanel(workspaceDescWrapper, workspaceDescPanel); + return generateScrollUnLimitContentPanel(workspaceDescWrapper, workSpaceDescPanel); } - workspaceDescWrapper.add(workspaceDescPanel, BorderLayout.CENTER); - + workspaceDescWrapper.add(workSpaceDescPanel, BorderLayout.CENTER); return workspaceDescWrapper; } - + @NotNull private JPanel generateScrollUnLimitContentPanel(JPanel workspaceDescWrapper, JPanel workspaceDescPanel) { - + // 滚动条 - UIScrollPane scrollPane = new UIScrollPane(workspaceDescPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + UIScrollPane scrollPane = new UIScrollPane(workspaceDescPanel, + ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + workspaceDescWrapper.setPreferredSize(new Dimension(CONTENT_WIDTH + SCROLL_BAR_WIDTH, SCROLL_HEIGHT)); + JViewport viewport = scrollPane.getViewport(); JViewport scrollViewport = new TransparentScrollViewPort(); // 动态画图 scrollViewport.addChangeListener(e -> repaintAll()); scrollViewport.setView(viewport.getView()); scrollPane.setViewport(scrollViewport); - scrollPane.setBorder(new EmptyBorder(10, 0, 0, 0)); - scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, SCROLL_HEIGHT)); + // 透明度配置 + InReactiveScrollBar bar = new InReactiveScrollBar(); + scrollPane.setVerticalScrollBar(bar); + setStyle(bar, FineUIStyle.TRANSPARENT_BACKGROUND); + scrollViewport.setOpaque(false); + workspaceDescWrapper.add(scrollPane, BorderLayout.CENTER); - return workspaceDescWrapper; } - + private JPanel generateLimitContentPanel(List> partitions) { - - JPanel workspaceDescPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEFT, 0, 0); + + Column workspaceDescPanel = new Column(); + workspaceDescPanel.setSpacing(20); int limit = 2; for (int i = 0; i < partitions.size(); i++) { if (i >= limit) { break; } List partition = partitions.get(i); - + JPanel partitionPanel = generatePartitionPanel(partition); workspaceDescPanel.add(partitionPanel); } - - ColorUtils.transparentBackground(workspaceDescPanel); - + + setStyle(workspaceDescPanel, FineUIStyle.TRANSPARENT_BACKGROUND); return workspaceDescPanel; } - + @NotNull private JPanel generateTailPanel() { - + AtomicReference hoverBackColorRef = new AtomicReference<>(); - + JPanel tailPanel = new JPanel(); { tailPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); - tailPanel.setBorder(new EmptyBorder(0, 0, 0, 20)); JPanel showAllPanel = new JPanel() { @Override protected void paintComponent(Graphics g) { @@ -217,34 +229,17 @@ public class StartupPageWorkspacePanel extends JPanel { } } }; - showAllPanel.setLayout(new BorderLayout(5, 0)); - showAllPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - + showAllPanel.setLayout(new BorderLayout()); + UILabel fontLabel = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Expand_All")); - fontLabel.setForeground(HOVER_COLOR); - showAllPanel.setBackground(new Color(0, 0, 0, 0)); + fontLabel.setForeground(FlatUIUtils.getUIColor("brand.normal", HOVER_COLOR)); showAllPanel.add(fontLabel, BorderLayout.WEST); - - UILabel iconLabel = new UILabel(IconUtils.readIcon("/com/fr/design/startup/show_more.svg")); + setStyle(showAllPanel, FineUIStyle.TRANSPARENT_BACKGROUND); + + UILabel iconLabel = new UILabel(new LazyIcon("show_more")); showAllPanel.add(iconLabel, BorderLayout.EAST); - - Color showAllBackground = showAllPanel.getBackground(); - - showAllPanel.addMouseListener(new MouseAdapter() { - @Override - public void mouseEntered(MouseEvent e) { - Color hoverBackColor = new Color(217, 235, 254); - hoverBackColorRef.set(hoverBackColor); - repaintAll(); - } - @Override - public void mouseExited(MouseEvent e) { - hoverBackColorRef.set(null); - ColorUtils.syncBackground(showAllPanel, showAllBackground); - repaintAll(); - } - + showAllPanel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { doShowAllAction(fontLabel, iconLabel); @@ -252,172 +247,132 @@ public class StartupPageWorkspacePanel extends JPanel { }); tailPanel.add(showAllPanel); Dimension preferredSize = tailPanel.getPreferredSize(); - tailPanel.setPreferredSize(new Dimension(CONTENT_WIDTH, (int) preferredSize.getHeight())); + tailPanel.setPreferredSize(new Dimension(scale(StartupPageConstants.CONTENT_WIDTH), (int) preferredSize.getHeight())); } + setStyle(tailPanel, FineUIStyle.TRANSPARENT_BACKGROUND); return tailPanel; } - + @NotNull private JPanel generatePartitionPanel(List partition) { - - JPanel partitionPanelWrapper = new JPanel(); - partitionPanelWrapper.setBorder(new EmptyBorder(10,0,10,0)); - partitionPanelWrapper.setLayout(new BorderLayout()); - - JPanel partitionPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 20, 0); - partitionPanel.setName("partitionPanel"); - + + List workSpacePaneList = new ArrayList<>(); for (StartupWorkspaceBean workspaceInfo : partition) { - + JPanel workspaceItemDesc = FRGUIPaneFactory.createBorderLayout_S_Pane(); - + layoutSelectWorkspacePanel(workspaceInfo, workspaceItemDesc); - + layoutSelectAndCreatePanel(workspaceInfo, workspaceItemDesc); - - partitionPanel.add(workspaceItemDesc); - - Dimension preferredSize = partitionPanel.getPreferredSize(); - partitionPanel.setPreferredSize(new Dimension(CONTENT_WIDTH, (int) preferredSize.getHeight())); + + setStyle(workspaceItemDesc, FineUIStyle.TRANSPARENT_BACKGROUND); + + workSpacePaneList.add(workspaceItemDesc); } - - partitionPanelWrapper.add(partitionPanel, BorderLayout.CENTER); + + JPanel singleRow = FineLayoutBuilder.createCommonTableLayout(3, 20, 0, workSpacePaneList); + singleRow.setName("partitionPanel"); + + JPanel partitionPanelWrapper = FineLayoutBuilder.asBorderLayoutWrapped(singleRow); + setStyle(singleRow, FineUIStyle.TRANSPARENT_BACKGROUND); + setStyle(partitionPanelWrapper, FineUIStyle.TRANSPARENT_BACKGROUND); return partitionPanelWrapper; } - + private void layoutSelectWorkspacePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) { - + // 选择工作目录 // 图标 / 分隔符 / 说明-进入 // 选择并新建 AtomicReference borderColorRef = new AtomicReference<>(null); - + JPanel selectWorkspacePanel = new JPanel() { @Override public JToolTip createToolTip() { return new ModernToolTip(); } - + @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - Color borderColor = borderColorRef.get(); - - Color backColor = Color.WHITE; + + Color backColor = FlatUIUtils.getUIColor("fill.normal", Color.WHITE); g2d.setColor(backColor); - // 直角和圆角上下叠合在一起 - int rectOffset = 10; - int roundOffset = 15; - // 填充一个直角 - g2d.fillRoundRect(0, 0, getWidth() - rectOffset, getHeight(), ARC_DIAMETER, ARC_DIAMETER); - // 填充一个圆角 - g2d.fillRoundRect(getWidth() - roundOffset, 0, roundOffset, getHeight(), 0, 0); + Path2D path2D = FineUIUtils.createLeftRoundRectangle(0, 0, this.getWidth(), this.getHeight(), ARC_DIAMETER); + g2d.fill(path2D); + + Color borderColor = borderColorRef.get(); paintBorderIfHover(g2d, borderColor, backColor); } - + /** * 当悬浮的时候,将边框展示出来 - * 会叠合,然后填充中间 - * - * |----【-|--】 - * | A 【C| B】 - * |----【-|--】 - * - * 见上面有两种线,分别是 A-| 和 B-【 - * 这里会将 A 和 B 叠在一起,中间则存在 C,然后将 C 的部分扩大一点,然后填充上背景 - * 则形成下面这种图形 - * - * |----】 - * |----】 - * * @param g2d 绘画 * @param borderColor 边框颜色 * @param backColor 背景颜色 */ private void paintBorderIfHover(Graphics2D g2d, Color borderColor, Color backColor) { - + if (borderColor != null) { g2d.setColor(borderColor); g2d.setStroke(new BasicStroke(BORDER_THIN)); - // 需要一个修正值 - int strokeOffset = BORDER_THIN / 2; - // 直角和圆角上下叠合在一起 - int rectOffset = 10; - int roundOffset = 15; - // 画一个圆角 - int fixRoundWidth = getWidth() - rectOffset; - int fixRoundHeight = getHeight() - BORDER_THIN; - g2d.drawRoundRect(strokeOffset, strokeOffset, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER); - - g2d.setColor(backColor); - - // 绘制一个矩形,覆盖住多余的相交线 - // 需要考虑上下的线宽 - int coverHeight = getHeight() - (BORDER_THIN * 2); - // 偏左一点的 fixedX - int fixedX = getWidth() - roundOffset - BORDER_THIN; - // 圆角和直角相交的区域 - int coverWidth = 15; - g2d.fillRect(fixedX, BORDER_THIN, coverWidth, coverHeight); - - g2d.setColor(borderColor); - g2d.drawLine(getWidth() / 2, strokeOffset, getWidth(), strokeOffset); - g2d.drawLine(getWidth() / 2, getHeight() - strokeOffset, getWidth(), getHeight() - strokeOffset); - g2d.drawLine(getWidth() - strokeOffset, strokeOffset, getWidth() - strokeOffset, getHeight() - strokeOffset); + FlatUIUtils.setRenderingHints(g2d); + Path2D path2D = FineUIUtils.createLeftRoundRectangle(0, 0, + getWidth() - BORDER_THIN, getHeight() - BORDER_THIN, ARC_DIAMETER); + g2d.draw(path2D); } } }; - selectWorkspacePanel.setLayout(new BorderLayout(0,0)); + selectWorkspacePanel.setLayout(new BorderLayout()); selectWorkspacePanel.setToolTipText(Toolkit.i18nText("Fine-Design_Startup_Page_Double_Click_Enter_Workspace")); - selectWorkspacePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + selectWorkspacePanel.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); { - + JPanel iconPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); - iconPanel.setBorder(new EmptyBorder(0, 10, 0, 10)); Icon icon = StartupPageUtil.getIcon4DescAreaByWorkspace(workspaceInfo); UILabel label = new UILabel(icon); label.setPreferredSize(LABEL_DIMENSION); iconPanel.add(label, BorderLayout.CENTER); + iconPanel.setOpaque(false); selectWorkspacePanel.add(iconPanel, BorderLayout.WEST); - + // desc / >箭头 JPanel descPanel = new JPanel(); + descPanel.setOpaque(false); descPanel.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - descPanel.setBorder(new EmptyBorder(0, 10, 0, 0)); JPanel simpleDescPanelWrapper = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.CENTER, 0, 0); JPanel simpleDescPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); UILabel nameLabel = new UILabel(workspaceInfo.getName()); - Font font = nameLabel.getFont(); - Font newSizeFont = font.deriveFont(font.getStyle(), NAME_LABEL_SIZE); - nameLabel.setFont(newSizeFont); + FineUIUtils.setFontSize(nameLabel, NAME_LABEL_SIZE); nameLabel.setPreferredSize(PATH_DIMENSION); Color nameForeground = nameLabel.getForeground(); simpleDescPanel.add(nameLabel,BorderLayout.NORTH); - + UILabel pathLabel = new UILabel(workspaceInfo.getPath()); pathLabel.setPreferredSize(PATH_DIMENSION); - Font pathFont = pathLabel.getFont(); - pathLabel.setFont(pathFont.deriveFont(pathFont.getStyle(), PATH_LABEL_SIZE)); + FineUIUtils.setFontSize(pathLabel, PATH_LABEL_SIZE); Color pathColor = PATH_COLOR; pathLabel.setForeground(pathColor); simpleDescPanel.add(pathLabel, BorderLayout.SOUTH); + simpleDescPanel.setOpaque(false); simpleDescPanelWrapper.add(simpleDescPanel); - + simpleDescPanelWrapper.setOpaque(false); + descPanel.add(simpleDescPanelWrapper, BorderLayout.WEST); - + MouseAdapter selectWorkspaceMouseListener = new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { - Color hoverColor = HOVER_COLOR; + Color hoverColor = FlatUIUtils.getUIColor("brand.normal", HOVER_COLOR); borderColorRef.set(hoverColor); nameLabel.setForeground(hoverColor); pathLabel.setForeground(hoverColor ); repaintAll(); } - + @Override public void mouseExited(MouseEvent e) { borderColorRef.set(Color.WHITE); @@ -436,10 +391,10 @@ public class StartupPageWorkspacePanel extends JPanel { } doSwitchWorkspace(workspaceInfo); } - + }; - - UILabel arrowLabel = new UILabel(IconUtils.readIcon("/com/fr/design/startup/more.svg")) { + + UILabel arrowLabel = new UILabel(new LazyIcon("more_arrow", 20)) { @Override public JToolTip createToolTip() { return new ModernToolTip(); @@ -449,13 +404,13 @@ public class StartupPageWorkspacePanel extends JPanel { arrowLabel.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { - arrowLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/more_hover.svg")); + arrowLabel.setIcon(new LazyIcon("more_arrow_hover", 20)); selectWorkspaceMouseListener.mouseEntered(e); } - + @Override public void mouseExited(MouseEvent e) { - arrowLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/more.svg")); + arrowLabel.setIcon(new LazyIcon("more_arrow", 20)); selectWorkspaceMouseListener.mouseExited(e); } @@ -465,18 +420,16 @@ public class StartupPageWorkspacePanel extends JPanel { } }); descPanel.add(arrowLabel, BorderLayout.EAST); - selectWorkspacePanel.add(descPanel, BorderLayout.CENTER); selectWorkspacePanel.addMouseListener(selectWorkspaceMouseListener); } - - ColorUtils.syncBackground(selectWorkspacePanel, Color.WHITE); + selectWorkspacePanel.setPreferredSize(SELECT_WORKSPACE_DIMENSION); workspaceItemDesc.add(selectWorkspacePanel, BorderLayout.WEST); } - + private void layoutSelectAndCreatePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) { - + // 选择并新建 AtomicReference borderColorRef = new AtomicReference<>(null); JPanel selectAndCreatePanel = new JPanel() { @@ -489,58 +442,43 @@ public class StartupPageWorkspacePanel extends JPanel { protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - Color borderColor = borderColorRef.get(); - - Color backColor = SHALLOW_WHITE_COLOR; + + Color backColor = FlatUIUtils.getUIColor("fill.deep", Color.GRAY); g2d.setColor(backColor); - - // 见 layoutSelectWorkspacePanel 部分的分析 - // 直角和圆角上下叠合在一起 - int rectOffset = 10; - int roundOffset = 15; - int strokeOffset = BORDER_THIN / 2; - int fixedRoundOffset = roundOffset + strokeOffset; - g2d.fillRoundRect(0, 0, getWidth() - rectOffset, getHeight(), 0, 0); - g2d.fillRoundRect(getWidth() - fixedRoundOffset, 0, roundOffset, getHeight(), ARC_DIAMETER, ARC_DIAMETER); + Path2D shape = FineUIUtils.createRightRoundRectangle(0, 0, this.getWidth(), this.getHeight(), ARC_DIAMETER); + g2d.fill(shape); + + Color borderColor = borderColorRef.get(); if (borderColor != null) { g2d.setColor(borderColor); g2d.setStroke(new BasicStroke(BORDER_THIN)); - - int borderOffset = BORDER_THIN * 2; - // 画画的笔触需要调整一下 - g2d.drawRoundRect(strokeOffset, strokeOffset, getWidth() - borderOffset, getHeight() - BORDER_THIN, ARC_DIAMETER, ARC_DIAMETER); - g2d.setColor(backColor); - int fillWidth = 15; - g2d.fillRect(0, 0, fillWidth, getHeight()); - - g2d.setColor(borderColor); - g2d.drawLine(strokeOffset, strokeOffset, fillWidth, strokeOffset); - g2d.drawLine(strokeOffset, getHeight() - strokeOffset, fillWidth, getHeight() - strokeOffset); - g2d.drawLine(strokeOffset, strokeOffset, strokeOffset, getHeight() - strokeOffset); + FlatUIUtils.setRenderingHints(g2d); + Path2D path2D = FineUIUtils.createRightRoundRectangle(0, 0, + getWidth() - BORDER_THIN, getHeight() - BORDER_THIN, ARC_DIAMETER); + g2d.draw(path2D); } } - + }; selectAndCreatePanel.setToolTipText(Toolkit.i18nText("Fine-Design_Startup_Page_Enter_Workspace_And_Create")); - selectAndCreatePanel.setBorder(new EmptyBorder(0, 0, 0, 0)); selectAndCreatePanel.setLayout(new BorderLayout()); { - UILabel label = new UILabel(IconUtils.readIcon("/com/fr/design/standard/system/add")); + UILabel label = new UILabel(new LazyIcon("add", 20)); label.setPreferredSize(new Dimension(ARC_DIAMETER, ARC_DIAMETER)); - label.setForeground(HOVER_COLOR); + label.setForeground(FlatUIUtils.getUIColor("brand.normal", HOVER_COLOR)); selectAndCreatePanel.add(label, BorderLayout.CENTER); selectAndCreatePanel.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { - borderColorRef.set(HOVER_COLOR); - label.setIcon(IconUtils.readIcon("/com/fr/design/standard/system/add_hover.svg")); + borderColorRef.set(FlatUIUtils.getUIColor("brand.normal", HOVER_COLOR)); + label.setIcon(new LazyIcon("add_hover", 20)); repaintAll(); } - + @Override public void mouseExited(MouseEvent e) { borderColorRef.set(null); - label.setIcon(IconUtils.readIcon("/com/fr/design/standard/system/add")); + label.setIcon(new LazyIcon("add", 20)); repaintAll(); } @Override @@ -550,73 +488,91 @@ public class StartupPageWorkspacePanel extends JPanel { } }); } - ColorUtils.syncBackground(selectAndCreatePanel, Color.GREEN); selectAndCreatePanel.setPreferredSize(SELECT_CREATE_DIMENSION); workspaceItemDesc.add(selectAndCreatePanel, BorderLayout.EAST); } - + public void setSelectWorkspaceRunnable(Runnable selectWorkspaceRunnable) { - + this.selectWorkspaceRunnable = selectWorkspaceRunnable; } - + private void doOpenEmptyTemplate(StartupWorkspaceBean workspaceInfo) { - + pageModel.setSelectWorkspaceInfo(workspaceInfo); openEmptyTemplateRunnable.run(); - + DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); designerMetrics.getStatistic().recordOpenEmptyTemplate(); } - + private void doSwitchWorkspace(StartupWorkspaceBean workspaceInfo) { - + StartupWorkspaceBean lastWorkspaceInfo = pageModel.getSelectWorkspaceInfo(); // selectWorkspaceRunnable pageModel.setSelectWorkspaceInfo(workspaceInfo); selectWorkspaceRunnable.run(); - + DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); designerMetrics.getStatistic().recordSwitchWorkspace(lastWorkspaceInfo, workspaceInfo); } - + private void doShowAllAction(UILabel fontLabel, UILabel iconLabel) { - + if (showMore) { fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Collapse_Workspace")); - iconLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/show_less.svg")); + iconLabel.setIcon(new LazyIcon("show_less")); showMoreContent(); showMore = !showMore; } else { fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Expand_All")); - iconLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/show_more.svg")); + iconLabel.setIcon(new LazyIcon("show_more")); showLessContent(); showMore = !showMore; } DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); designerMetrics.getStatistic().recordShowAllAction(); - + repaintAll(); } - + private void repaintAll() { - + this.getRootPane().repaint(); } - + /** * 支持透明的滚动视图 */ - private class TransparentScrollViewPort extends JViewport { - + private static class TransparentScrollViewPort extends JViewport { + /** - * 从而屏蔽掉 {@link RepaintManager.PaintManager#paintDoubleBuffered(JComponent, Image, Graphics, int, int, int, int)} - * * @return 创建一个不会实际画图的 Graphics */ @Override public Graphics getGraphics() { - + + Graphics graphics = super.getGraphics(); + return new FRGraphics2D((Graphics2D) graphics) { + @Override + public boolean drawImage(Image img, int x, int y, ImageObserver observer) { + return true; + } + }; + } + } + + /** + * 支持透明的滚动条 + */ + private static class InReactiveScrollBar extends JScrollBar { + + /** + * @return 创建一个不会实际画图的 Graphics + */ + @Override + public Graphics getGraphics() { + Graphics graphics = super.getGraphics(); return new FRGraphics2D((Graphics2D) graphics) { @Override diff --git a/designer-base/src/main/resources/com/fine/theme/icon/add_hover.svg b/designer-base/src/main/resources/com/fine/theme/icon/add_hover.svg new file mode 100644 index 0000000000..f1e8fadf5d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/add_hover.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/fvs_locked.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/fvs_locked.svg new file mode 100644 index 0000000000..1213c7fde6 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/fvs_locked.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/startup/local_server_background.svg b/designer-base/src/main/resources/com/fine/theme/icon/startup/local_server_background.svg new file mode 100644 index 0000000000..f4fbedca90 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/startup/local_server_background.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/startup/more.svg b/designer-base/src/main/resources/com/fine/theme/icon/startup/more.svg new file mode 100755 index 0000000000..65f7b7c701 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/startup/more.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/startup/more_hover.svg b/designer-base/src/main/resources/com/fine/theme/icon/startup/more_hover.svg new file mode 100644 index 0000000000..5b4ee1d6fd --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/startup/more_hover.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/startup/remote_server_background.svg b/designer-base/src/main/resources/com/fine/theme/icon/startup/remote_server_background.svg new file mode 100644 index 0000000000..7313efc9c4 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/startup/remote_server_background.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/startup/show_less.svg b/designer-base/src/main/resources/com/fine/theme/icon/startup/show_less.svg new file mode 100755 index 0000000000..b929630e7f --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/startup/show_less.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/startup/show_more.svg b/designer-base/src/main/resources/com/fine/theme/icon/startup/show_more.svg new file mode 100755 index 0000000000..1b7c059d97 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/startup/show_more.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json index f80479a974..34d8c06713 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json @@ -18,6 +18,7 @@ "remove": "remove.svg", "search": "search.svg", "add": "add.svg", + "add_hover": "add_hover.svg", "detail": "detail.svg", "dataLink": "dataLink.svg", "jumpHelp": "jumpHelp.svg", @@ -78,6 +79,7 @@ "excelFile": "filetree/filetype/excelFile.svg", "flashFile": "filetree/filetype/flashFile.svg", "frm_locked": "filetree/filetype/frm_locked.svg", + "fvs_locked": "filetree/filetype/fvs_locked.svg", "gifFile": "filetree/filetype/gifFile.svg", "htmlFile": "filetree/filetype/htmlFile.svg", "jarFile": "filetree/filetype/jarFile.svg", @@ -341,6 +343,12 @@ "data_analysis": "preview/data_analysis.svg", "variable": "variable/variable.svg", "dataItem": "variable/dataItem.svg", - "param_global": "variable/param_global.svg" + "param_global": "variable/param_global.svg", + "local_server_background": "startup/local_server_background.svg", + "remote_server_background": "startup/remote_server_background.svg", + "more_arrow": "startup/more.svg", + "more_arrow_hover": "startup/more_hover.svg", + "show_less": "startup/show_less.svg", + "show_more": "startup/show_more.svg" } } diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index 5310524e57..35bc2aa9fe 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -142,6 +142,7 @@ border.divider=#DADEE7 tooltip.normal=#3F506A tooltip.disabled=#A3ADBD hover.deep=#e2fbe6 +fill.deep=#F6F9FE #---- Button ---- @@ -583,14 +584,14 @@ PopupMenuSeparator.Insets=0,10,0,10 #---- ProgressBar ---- ProgressBar.border = com.formdev.flatlaf.ui.FlatEmptyBorder -ProgressBar.arc = 4 +ProgressBar.arc = 10 ProgressBar.horizontalSize = 146,4 ProgressBar.verticalSize = 4,146 ProgressBar.cycleTime = 4000 ProgressBar.repaintInterval = 15 ProgressBar.font = -2 -ProgressBar.background = darken(@background,13%) -ProgressBar.foreground = @accentSliderColor +ProgressBar.background = #E8E8E9 +ProgressBar.foreground = #419BF9 ProgressBar.selectionBackground = @foreground ProgressBar.selectionForeground = contrast($ProgressBar.foreground, @foreground, @componentBackground) @@ -658,7 +659,7 @@ ScrollBar.allowsAbsolutePositioning = true ScrollBar.track = #00000000 ScrollBar.thumb = #0a1c3833 -ScrollBar.hoverTrackColor = darken($ScrollBar.track,3%,derived noAutoInverse) +ScrollBar.hoverTrackColor = fade(@background, 0%) ScrollBar.hoverThumbColor = darken($ScrollBar.thumb,10%,derived noAutoInverse) ScrollBar.pressedThumbColor = #0a1c3849 ScrollBar.hoverButtonBackground = darken(@background,5%,derived noAutoInverse) @@ -671,7 +672,7 @@ ScrollBar.largeBar.thumbInsets = 0,4,0,4 ScrollBar.largeBar.buttonBackground = $ScrollBar.track #---- Panel ---- -Panel.arc = 5 +Panel.arc = 20 #---- ScrollPane ---- @@ -1294,6 +1295,10 @@ CellOtherSetPane.height=$Component.defaultHeight background: fade(@background, 0%); \ borderInsets: 0,0,0,0; +[style]Panel.transparentBackground=\ + background: fade(@background, 0%); \ + border: null; + #---- clearButton ---- # for clear/cancel button in text fields @@ -1333,3 +1338,8 @@ CellOtherSetPane.height=$Component.defaultHeight [style]Tree.pureTree = \ background: $fill.normal + +[style]ScrollBar.transparentBackground = \ + background: null;\ + track: fade(@background, 0%); \ + hoverTrackColor : fade(@background, 0%) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/DownloadProgressPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/DownloadProgressPane.java index c7f09f453b..5401ffafb4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/DownloadProgressPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/DownloadProgressPane.java @@ -79,7 +79,6 @@ public class DownloadProgressPane extends JPanel { private JProgressBar createProgressBar() { JProgressBar jProgressBar = new JProgressBar(); - jProgressBar.setUI(new ModernUIProgressBarUI()); jProgressBar.setBorderPainted(false); jProgressBar.setOpaque(false); jProgressBar.setBorder(null); From 585ac611b09cb448dfb5958f3bec9ba5a41e5cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 8 Aug 2024 15:17:13 +0800 Subject: [PATCH 2/7] =?UTF-8?q?REPORT-113994=20=E3=80=90NewUI=E3=80=91UICo?= =?UTF-8?q?mboBox=E5=8F=8AButtonGroup=E6=80=A7=E8=83=BD=E8=B0=83=E4=BC=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fine/theme/light/ui/FineComboBoxUI.java | 28 ++++++++++++++++++- .../design/actions/file/PreferencePane.java | 4 +++ .../tabledatapane/DBTableDataPane.java | 4 +++ .../fr/design/gui/ibutton/UIButtonGroup.java | 1 - .../fr/design/report/fit/BaseFitAttrPane.java | 3 ++ .../write/submit/DBManipulationPane.java | 6 +++- .../cell/style/ReportFontNameAction.java | 6 ++-- .../design/dscolumn/DSColumnAdvancedPane.java | 3 ++ .../fr/design/report/ReportColumnsPane.java | 9 +----- 9 files changed, 49 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.java index a335aba921..1e712238df 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.java @@ -1,11 +1,16 @@ package com.fine.theme.light.ui; +import com.fine.theme.utils.FineClientProperties; +import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.ui.FlatComboBoxUI; +import com.formdev.flatlaf.ui.FlatUIUtils; +import org.jetbrains.annotations.Nullable; -import javax.swing.JComponent; import javax.swing.JButton; +import javax.swing.JComponent; import javax.swing.SwingConstants; import javax.swing.plaf.ComponentUI; +import java.awt.Dimension; import java.awt.Graphics2D; /** @@ -38,4 +43,25 @@ public class FineComboBoxUI extends FlatComboBoxUI { super.paintArrow(g); } } + + @Override + public Dimension getMinimumSize(JComponent c) { + // ComboBox基于子组件计算适配尺寸性能一般,仅考虑部分ComboBox进行适配计算,其他采用默认值 + if (FineClientProperties.ADAPTIVE_COMBO_BOX.equals(getComboBoxTypeStr(c))) { + return super.getMinimumSize(c); + } + return FineUIScale.scale(new Dimension( + FlatUIUtils.getUIInt("ComboBox.minimumWidth", 72), + FlatUIUtils.getUIInt("ComboBox.comboHeight", 24) + )); + } + + @Nullable + static String getComboBoxTypeStr(JComponent c) { + Object value = c.getClientProperty(FineClientProperties.COMBO_BOX_TYPE); + if (value instanceof String) { + return (String) value; + } + return 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 82042e978c..6ea6b1775c 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 @@ -114,6 +114,8 @@ import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.fix; import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; +import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12; import static com.fr.design.i18n.Toolkit.i18nText; @@ -615,6 +617,7 @@ public class PreferencePane extends BasicPane { String[] undoTimes = {i18nText("Fine-Design_Basic_Max_Undo_Limit"), MAX_UNDO_LIMIT_5 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_10 + i18nText("Fine-Design_Basic_Time(s)") , MAX_UNDO_LIMIT_15 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_20 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_50 + i18nText("Fine-Design_Basic_Time(s)")}; maxUndoLimit = new UIComboBox(undoTimes); + maxUndoLimit.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); //不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数 supportUndoCheckBox.addActionListener(new ActionListener() { @@ -811,6 +814,7 @@ public class PreferencePane extends BasicPane { i++; } UIDictionaryComboBox languageComboBox = new UIDictionaryComboBox<>(keys, values); + languageComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, SCALE_FONT_SIZE_12));//为了在中文系统中显示韩文 return languageComboBox; } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index cf0b739337..d587c2cafe 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -90,6 +90,9 @@ import java.awt.event.KeyListener; import java.util.ArrayList; import java.util.List; +import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; +import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; + /** * @author rinoux * @version 10.0 @@ -337,6 +340,7 @@ public class DBTableDataPane extends AbstractTableDataPane implemen private void createToolbarEsdComponents(final UIToolbar editToolBar) { this.esdSettingsLabel = new UILabel(Toolkit.i18nText("Fine-Design_ESD_Cache_Settings")); this.esdConfigOption = new UIComboBox(StrategyConfigFrom.values()); + this.esdConfigOption.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); this.esdEnabled = new UICheckBox(Toolkit.i18nText("Fine-Design_ESD_Enable_Cache")); this.barErrorTips = new UILabel(); this.barErrorTips.setForeground(Color.RED); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java index 1468e9255a..ddb402db2d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -237,7 +237,6 @@ public class UIButtonGroup extends Column implements GlobalNameObserver, UIOb } protected void initButton(UIToggleButton labelButton, int index) { - labelButton.setBorder(new FineRoundBorder()); labelButton.setBorderPainted(false); labelButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_GROUP); labelButton.putClientProperty(BUTTON_GROUP_POSITION, getGroupButtonPosition(index)); diff --git a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java index 901f1b6010..128972b755 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java @@ -19,6 +19,8 @@ import java.util.stream.Collectors; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; +import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; import static com.fr.design.i18n.Toolkit.i18nText; public abstract class BaseFitAttrPane extends BasicBeanPane { @@ -96,6 +98,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane { private void initItemChoose() { belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); itemChoose = new UIComboBox(getItemNames()); + itemChoose.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); ItemListener itemListener = getItemListener(); itemChoose.addItemListener(itemListener); //以下设置横向布局 diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index 605d84b40e..f7f20e311c 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -3,6 +3,7 @@ package com.fr.design.write.submit; import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; import com.fine.swing.ui.layout.Spacer; +import com.fine.theme.utils.FineClientProperties; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; import com.fr.base.BaseFormula; @@ -98,6 +99,7 @@ import java.util.stream.Collectors; import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; //august:这个东西应该分成两类,一类是有单元格的情况,一类是没有单元格的情况 public class DBManipulationPane extends BasicBeanPane { @@ -153,6 +155,7 @@ public class DBManipulationPane extends BasicBeanPane { JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); dmlConfigComboBox = new UIComboBox(DML_CONFIG_TYPES); + dmlConfigComboBox.putClientProperty(FineClientProperties.COMBO_BOX_TYPE, FineClientProperties.ADAPTIVE_COMBO_BOX); JPanel typePane = new JPanel(new BorderLayout()); typePane.add(row(10, @@ -162,7 +165,7 @@ public class DBManipulationPane extends BasicBeanPane { chooseTable.setTableNameComboBoxPopSize(FineUIScale.scale(160), FineUIScale.scale(320)); // peter:编辑的TablePane - JPanel editTablePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel editTablePane = new JPanel(new BorderLayout(FineUIScale.scale(10), 0)); editTablePane.setBounds(0, 0, FineUIScale.scale(280), FineUIScale.scale(180)); keyColumnValuesTable = new KeyColumnNameValueTable(); editTablePane.add(new UIScrollPane(keyColumnValuesTable), BorderLayout.CENTER); @@ -707,6 +710,7 @@ public class DBManipulationPane extends BasicBeanPane { // 设置column1的editor columnsComboBox = new UIComboBox(new DefaultComboBoxModel()); + columnsComboBox.setRenderer(new UIComboBoxRenderer() { @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java index 2b423e0ab0..c6f0f6416d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java @@ -3,6 +3,7 @@ */ package com.fr.design.actions.cell.style; +import com.fine.theme.utils.FineUIScale; import com.fr.design.utils.DesignUtils; import com.fr.stable.os.OperatingSystem; import java.awt.Dimension; @@ -11,7 +12,6 @@ import javax.swing.ComboBoxModel; import javax.swing.JComponent; import com.fr.base.Style; -import com.fr.base.Utils; import com.fr.base.core.StyleUtils; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.general.ComparatorUtils; @@ -84,9 +84,7 @@ public class ReportFontNameAction extends AbstractStyleAction { UIComboBox itemComponent = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()); this.putValue(UIComboBox.class.getName(), itemComponent); //设置最佳宽度. - itemComponent.setPreferredSize(new Dimension( - Math.min(140, itemComponent.getPreferredSize().width), - itemComponent.getPreferredSize().height)); + itemComponent.setPreferredSize(FineUIScale.scale(new Dimension(140, 24))); itemComponent.setEnabled(this.isEnabled()); itemComponent.addActionListener(this); diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index ae5268a711..5bae0b22d0 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -35,6 +35,8 @@ import java.awt.event.ActionListener; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; +import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY; @@ -236,6 +238,7 @@ public class DSColumnAdvancedPane extends BasicPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Odd"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Even"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Specify"),}); + selectCountComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); selectCountComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java index 9723d494af..aea44cbe50 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java @@ -105,14 +105,7 @@ public class ReportColumnsPane extends BasicPane{ com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_TurnOn"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_TurnOff") }; - onOffButtonGroup = new UIButtonGroup(textArray) { - @Override - protected void initButton(UIToggleButton labelButton, int index) { - labelButton.setSize(new Dimension(60,20)); - labelButton.setPreferredSize(FineUIScale.scale(new Dimension(60, 20))); - super.initButton(labelButton, index); - } - }; + onOffButtonGroup = new UIButtonGroup(textArray); onOffButtonGroup.addActionListener(onOffListener); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns")); From 4462b3258b5face9d2177d34f683e3df63a02d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 8 Aug 2024 15:17:49 +0800 Subject: [PATCH 3/7] =?UTF-8?q?REPORT-113994=20=E3=80=90NewUI=E3=80=91?= =?UTF-8?q?=E6=96=B0=E5=A2=9EUI=E5=BC=80=E5=8F=91=E8=80=85=E9=80=89?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerUIModeConfig.java | 14 ++++++++++++++ .../design/mainframe/toolbar/ToolBarMenuDock.java | 6 +++++- .../src/main/java/com/fr/start/MainDesigner.java | 14 ++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java index cd99f728a2..99e7d0335b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java @@ -9,13 +9,18 @@ import com.fr.general.ComparatorUtils; */ public class DesignerUIModeConfig { private DesignerUIMode mode = AbsoluteMeasureUIMode.getInstance(); + private boolean uiDevMode = false; private static class DesignerUIModeConfigHolder { private static final DesignerUIModeConfig designerUIModeConfig = new DesignerUIModeConfig(); } private DesignerUIModeConfig() { + init(); + } + private void init() { + uiDevMode = Boolean.parseBoolean(System.getProperty("uiDevMode", "false")); } public static DesignerUIModeConfig getInstance() { @@ -32,6 +37,15 @@ public class DesignerUIModeConfig { return ComparatorUtils.equals(SimulateWebUIMode.getInstance(), mode); } + /** + * 判断是否是ui开发者模式 + * + * @return boolean + */ + public boolean isUIDevMode() { + return uiDevMode; + } + /** * 设置新ui模式 */ diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index b15e7f9ed6..83ca502a1e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -57,6 +57,7 @@ import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenuBar; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.locale.impl.SupportLocaleImpl; +import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.platform.ServicePlatformAction; import com.fr.design.menu.MenuDef; @@ -295,7 +296,10 @@ public abstract class ToolBarMenuDock { } }, SupportLocaleImpl.COMMUNITY); - menuList.add(createLookAndFeel()); + // 当前仅UI开发者模式显示外观配置选项 + if (DesignerUIModeConfig.getInstance().isUIDevMode()) { + menuList.add(createLookAndFeel()); + } // 添加全部UpdateAction到actionmanager中 addAllUpdateActionsToList(menuList); diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index dccf53bbef..a796ad3882 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -30,6 +30,7 @@ import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JWorkBook; @@ -158,9 +159,18 @@ public class MainDesigner extends BaseDesigner { FineLoggerFactory.getLogger().info("Designer started.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS)); DesignerStartupContext.getRecorder().stop(); SwitchForSwingChecker.initThreadMonitoring(); -// new UiInspector(); -// EdtInvocationManager.installEDTCheckers(); DesignerLatencyMetric.getInstance().start(); + + installUIDevModeTools(); + } + + /** + * 进入UI开发者模式 + */ + private static void installUIDevModeTools() { + if (DesignerUIModeConfig.getInstance().isUIDevMode()) { + new UiInspector(); + } } /** From 1daa6a0e02ff905fc00c8259fc7a1dd330c02418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 8 Aug 2024 15:18:21 +0800 Subject: [PATCH 4/7] =?UTF-8?q?REPORT-113994=20=E3=80=90NewUI=E3=80=91?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=81=97=E7=95=99=E9=97=AE=E9=A2=98=E8=A7=A3?= =?UTF-8?q?=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/frpane/FineTabbedPane.java | 3 + .../design/mainframe/vcs/ui/VcsMovePanel.java | 1 - .../mainframe/vcs/ui/VcsProgressDialog.java | 1 - .../VanChartCustomPlotUITabGroup.java | 64 ------------------- .../style/VanChartCustomPlotSeriesPane.java | 19 ++---- 5 files changed, 7 insertions(+), 81 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java index 08cd1f5eb2..ac6a869a85 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java @@ -19,6 +19,8 @@ import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.fix; import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineClientProperties.PANEL_TYPE; +import static com.fine.theme.utils.FineClientProperties.ROUNDED_PANEL; /** * Tab面板组件 @@ -118,6 +120,7 @@ public class FineTabbedPane extends Column { private void initLayout() { cards = new CardLayout(); centerPane = new JPanel(cards); + centerPane.putClientProperty(PANEL_TYPE, ROUNDED_PANEL); tabComponents.forEach((key, value) -> { value.setOpaque(false); centerPane.add(value, key); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java index 8340b53e01..ed6290b798 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java @@ -174,7 +174,6 @@ public class VcsMovePanel extends BasicPane { JPanel processPane = new JPanel(); JPanel body = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); PROGRESS_BAR.setStringPainted(true); - PROGRESS_BAR.setUI(new ModernUIProgressBarUI()); PROGRESS_BAR.setBorderPainted(false); PROGRESS_BAR.setOpaque(false); PROGRESS_BAR.setBorder(null); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsProgressDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsProgressDialog.java index 33b57e1f3e..8427d45569 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsProgressDialog.java @@ -38,7 +38,6 @@ public class VcsProgressDialog{ }; JPanel body = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); progressBar.setStringPainted(true); - progressBar.setUI(new ModernUIProgressBarUI()); progressBar.setBorderPainted(false); progressBar.setOpaque(false); progressBar.setBorder(null); diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotUITabGroup.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotUITabGroup.java index e4ce883912..5e65a0e26c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotUITabGroup.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotUITabGroup.java @@ -2,14 +2,10 @@ package com.fr.van.chart.custom.component; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UITabGroup; -import com.fr.design.gui.ibutton.UIToggleButton; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.LayoutManager; @@ -36,66 +32,6 @@ public class VanChartCustomPlotUITabGroup extends UITabGroup{ return new GridBagLayout(); } - @Override - protected void initButton(UIToggleButton labelButton, int buttonIndex) { - - int ButtonWidth = WIDTH / 3; - if (listNum <= 1){ - return; - }else if (listNum == 2){ - ButtonWidth = WIDTH / 2; - } - - //将button加入到pane中,以便可以对边框进行控制 - labelButton.setRoundBorder(false); - labelButton.setBorderPainted(false); - - - - labelButtonList.add(labelButton); - - int index = labelButtonList.size() - 1; - - JPanel panel = getButtonPanel(labelButton, index); - - GridBagConstraints constraints=new GridBagConstraints(); - - int end = listNum % 3; - - if (end == 1 && index == 0){ - constraints.gridy = 0; - constraints.gridx = 0; - constraints.gridheight = 1; - constraints.gridwidth = 6; - ButtonWidth = WIDTH + 2; - }else if (end == 2 && (index == 0 || index == 1) && listNum != 2){ - constraints.gridy = 0; - constraints.gridx = index == 1 ? 4 : 0; - constraints.gridheight = 1; - constraints.gridwidth = index == 0 ? 4 : 2; - ButtonWidth = index == 0 ? ButtonWidth * 2 + 1 : ButtonWidth; - }else { - int l = ((index + ((end == 0) ? end : (3 - end))) / 3); - constraints.gridy = l; - constraints.gridx = ((index - (l * 3 - (end == 0 ? end : 3 - end))))*2; - constraints.gridheight = 1; - constraints.gridwidth = 2; - } - labelButton.setPreferredSize(new Dimension(ButtonWidth, BUTTON_HEIGHT)); - - this.add(panel, constraints); - } - - private JPanel getButtonPanel(UIToggleButton labelButton, int index) { - JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.add(labelButton,BorderLayout.CENTER); - - setPanelBorder(panel, index); - - return panel; - } - public void setPanelBorder(JPanel panel, int index) { int end = listNum % 3; int num = listNum; diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotSeriesPane.java index 1951e0df63..19c102b867 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotSeriesPane.java @@ -1,20 +1,17 @@ package com.fr.van.chart.custom.style; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; +import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; /** * Created by Fangjie on 2016/4/26. */ public class VanChartCustomPlotSeriesPane extends BasicBeanPane { - private static final int WIDTH = 236; - private static final int DELTA_HEIGHT = 300; private BasicBeanPane axisPane; private AbstractPlotSeriesPane seriesPane; public VanChartCustomPlotSeriesPane(BasicBeanPane axisPane, AbstractPlotSeriesPane seriesPane) { @@ -25,15 +22,7 @@ public class VanChartCustomPlotSeriesPane extends BasicBeanPane { } private void initContentPane() { - - seriesPane.setPreferredSize(new Dimension(WIDTH, (int) (seriesPane.getPreferredSize().getHeight() + DELTA_HEIGHT))); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - - double[] columnSize = {f}; - double[] rowSize = {p, p, p}; - + setLayout(new BorderLayout()); if (axisPane == null) { this.add(seriesPane); }else { @@ -41,7 +30,7 @@ public class VanChartCustomPlotSeriesPane extends BasicBeanPane { new Component[]{axisPane}, new Component[]{seriesPane} }; - this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize)); + this.add(FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1})); } } From 7f507453cde95636cc746adaabc84131fd286581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 8 Aug 2024 15:22:53 +0800 Subject: [PATCH 5/7] =?UTF-8?q?REPORT-113994=20=E3=80=90NewUI=E3=80=91?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=81=97=E7=95=99=E9=97=AE=E9=A2=98=E8=A7=A3?= =?UTF-8?q?=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fine/theme/light/ui/laf/FineLaf.java | 4 ++-- .../main/java/com/fine/theme/utils/FineUIUtils.java | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java index f5bcbafe76..fa29de7466 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java @@ -43,8 +43,8 @@ public abstract class FineLaf extends FlatLaf { */ private static void resetWindowDecorations() { if (SystemInfo.isWindows_10_orLater) { - System.setProperty("flatlaf.useWindowDecorations", "true"); - System.setProperty("flatlaf.menuBarEmbedded", "true"); + System.setProperty("flatlaf.useWindowDecorations", "false"); + System.setProperty("flatlaf.menuBarEmbedded", "false"); } } } diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java index 458be0dc6d..bf48c66c6d 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java @@ -13,7 +13,15 @@ import javax.swing.JLabel; import javax.swing.JLayer; import javax.swing.ScrollPaneConstants; import javax.swing.UIManager; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Composite; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Insets; import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; import java.lang.reflect.Field; From a4817ff6260b0a925e2750c9f8646e433e5d2a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 8 Aug 2024 15:38:04 +0800 Subject: [PATCH 6/7] =?UTF-8?q?REPORT-113994=20=E3=80=90NewUI=E3=80=91?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=81=97=E7=95=99=E9=97=AE=E9=A2=98=E8=A7=A3?= =?UTF-8?q?=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/ReportColumnsPane.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java index aea44cbe50..b1b296e110 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java @@ -100,12 +100,19 @@ public class ReportColumnsPane extends BasicPane{ } }; north.setPreferredSize(FineUIScale.scale(new Dimension(549, 59))); - north.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(11, 23, 6, 23), new UIRoundedBorder(new Color(204, 204, 204), 1, 10))); + north.setBorder(BorderFactory.createCompoundBorder(new ScaledEmptyBorder(11, 23, 6, 23), new UIRoundedBorder(new Color(204, 204, 204), 1, 10))); String[] textArray = new String[] { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_TurnOn"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_TurnOff") }; - onOffButtonGroup = new UIButtonGroup(textArray); + onOffButtonGroup = new UIButtonGroup(textArray) { + @Override + protected void initButton(UIToggleButton labelButton, int index) { + labelButton.setSize(FineUIScale.scale(new Dimension(60,20))); + labelButton.setPreferredSize(FineUIScale.scale(new Dimension(60, 20))); + super.initButton(labelButton, index); + } + }; onOffButtonGroup.addActionListener(onOffListener); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns")); From 7257713ef64ad0b510a9d16698a2f41c028c1eab Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 8 Aug 2024 17:22:04 +0800 Subject: [PATCH 7/7] =?UTF-8?q?feat=EF=BC=9AFVS=E5=9F=BA=E4=BA=8E=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E6=A0=B7=E5=BC=8F=E7=BF=BB=E6=96=B0=E8=B0=83?= =?UTF-8?q?=E6=95=B4=20REPORT-125972?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/MultiTemplateTabPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index c68bb5dbab..8d25db7470 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -428,7 +428,7 @@ public class MultiTemplateTabPane extends Row { public void closeOther() { JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(false); - if (saveSomeTemplatePane.showSavePane(null, false, true)) { + if (saveSomeTemplatePane.showSavePane(null, false, false)) { List> openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList(); JTemplate[] templates = new JTemplate[openedTemplate.size()];