From af3e1586b25fbe3cc5871fbb970c2152ea4d49ef Mon Sep 17 00:00:00 2001 From: Anner Date: Mon, 21 Oct 2024 12:01:15 +0800 Subject: [PATCH 01/14] =?UTF-8?q?REPORT-130954=20fix:=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E5=B1=8F=E8=94=BD=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adaptation/DesignServerSupportModule.java | 62 +++++++++++++++++++ .../adaptation/ReportAdaptationComponent.java | 5 +- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java diff --git a/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java b/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java new file mode 100644 index 0000000000..df486b1d72 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java @@ -0,0 +1,62 @@ +package com.fanruan.boot.adaptation; + +import com.fanruan.portal.module.PortalModuleManager; +import com.fr.third.guava.collect.Sets; + +import java.util.Optional; +import java.util.Set; + +import static com.fanruan.portal.authority.PortalAuthorityItems.ENTERPRISE_GENERAL_ID; +import static com.fanruan.portal.authority.PortalAuthorityItems.ENTERPRISE_ID; +import static com.fanruan.portal.authority.PortalAuthorityItems.MAP_ID; +import static com.fanruan.portal.authority.PortalAuthorityItems.PORTAL_MANAGEMENT_ID; +import static com.fanruan.portal.authority.PortalAuthorityItems.SECURITY_ID; + +/** + * 内置服务器支持展示的模块,预期调用顺序在业务模块之后 + * + * @author Anner + * @since 11.0 + * Created on 2024/10/15 + */ +public class DesignServerSupportModule { + private final static Set SUPPORT_MODULE = Sets.newHashSet( + // 系统管理 + PORTAL_MANAGEMENT_ID, + // 企业设置 + ENTERPRISE_ID, + // 企业设置 - 通用设置 + ENTERPRISE_GENERAL_ID, + // 安全管理 + SECURITY_ID, + // 地图管理 + MAP_ID + ); + + /** + * 注册一下支持展示的模块 + * + * @param moduleName name + */ + public static void register(String moduleName) { + Optional.of(moduleName).ifPresent(SUPPORT_MODULE::add); + } + + /** + * 取消注册展示的模块 + * + * @param moduleName name + */ + public static void unregister(String moduleName) { + Optional.of(moduleName).ifPresent(SUPPORT_MODULE::remove); + } + + /** + * 启动入口,重建一下展示的module + */ + public static void rebuild() { + PortalModuleManager.allModules().keySet().stream() + .filter(m -> !SUPPORT_MODULE.contains(m)) + .forEach(PortalModuleManager::unregister); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java b/designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java index d09e3db108..7a1a90af3d 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java @@ -1,6 +1,7 @@ package com.fanruan.boot.adaptation; import com.fanruan.carina.Carina; +import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; import com.fanruan.plugins.resource.PluginResourceHelper; @@ -57,8 +58,8 @@ import java.util.TreeSet; * Created on 2024/6/24 */ @FineComponent(name = "fine_report_adaptation") +@DependsOn(dependencies = {"fine_report"}) public class ReportAdaptationComponent { - /** * 启动 */ @@ -74,6 +75,8 @@ public class ReportAdaptationComponent { // 插件controller注册 PluginControllerManager.getInstance().init(); + // 过滤掉内置服务器不支持的模块 + DesignServerSupportModule.rebuild(); } private void listenEmbedServletFilter(ServletContext servletContext) { From 202947feacdfb01e9e81d3865b1836d07edee87f Mon Sep 17 00:00:00 2001 From: Anner Date: Mon, 21 Oct 2024 19:04:53 +0800 Subject: [PATCH 02/14] =?UTF-8?q?REPORT-138114=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E8=AE=BE=E7=BD=AE=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20&=20=E8=A7=84=E9=81=BF=E6=9C=8D=E5=8A=A1=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=9A=84=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adaptation/DesignServerSupportModule.java | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java b/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java index df486b1d72..e1bffecddd 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java +++ b/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java @@ -1,16 +1,32 @@ package com.fanruan.boot.adaptation; +import com.fanruan.carina.Carina; +import com.fanruan.carina.context.ContextListener; import com.fanruan.portal.module.PortalModuleManager; import com.fr.third.guava.collect.Sets; import java.util.Optional; import java.util.Set; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_ADD_DEPARTMENT_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_ADD_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_ADD_ROLE_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_DELETE_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_DELETE_ROLE_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_EDIT_DEP_ROLE_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_EDIT_EDIT_INFO_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_EDIT_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_EDIT_RESET_PASSWORD_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_FORBIDDEN_ID; +import static com.fanruan.auth.authority.AuthAuthorityItems.USER_ID; +import static com.fanruan.messenger.ums.authority.UMSAuthorityItems.PORTAL_MANAGEMENT_ENTERPRISE_UMS_ID; import static com.fanruan.portal.authority.PortalAuthorityItems.ENTERPRISE_GENERAL_ID; import static com.fanruan.portal.authority.PortalAuthorityItems.ENTERPRISE_ID; import static com.fanruan.portal.authority.PortalAuthorityItems.MAP_ID; import static com.fanruan.portal.authority.PortalAuthorityItems.PORTAL_MANAGEMENT_ID; import static com.fanruan.portal.authority.PortalAuthorityItems.SECURITY_ID; +import static com.fr.decision.authority.base.constant.ReportAuthorityItems.ENTERPRISE_REPORT_BASE_SETTINGS_ID; +import static com.fr.decision.authority.base.constant.ReportAuthorityItems.ENTERPRISE_REPORT_ID; /** * 内置服务器支持展示的模块,预期调用顺序在业务模块之后 @@ -23,10 +39,28 @@ public class DesignServerSupportModule { private final static Set SUPPORT_MODULE = Sets.newHashSet( // 系统管理 PORTAL_MANAGEMENT_ID, + // 用户管理 + USER_ID, + USER_ADD_ROLE_ID, + USER_ADD_DEPARTMENT_ID, + USER_ADD_ID, + USER_EDIT_ID, + USER_EDIT_RESET_PASSWORD_ID, + USER_EDIT_EDIT_INFO_ID, + USER_EDIT_DEP_ROLE_ID, + USER_DELETE_ID, + USER_DELETE_ROLE_ID, + USER_FORBIDDEN_ID, // 企业设置 ENTERPRISE_ID, + // 企业设置 - 通知中心 + PORTAL_MANAGEMENT_ENTERPRISE_UMS_ID, // 企业设置 - 通用设置 ENTERPRISE_GENERAL_ID, + // 报表设置 + ENTERPRISE_REPORT_ID, + // 报表设置 - 基础设置 + ENTERPRISE_REPORT_BASE_SETTINGS_ID, // 安全管理 SECURITY_ID, // 地图管理 @@ -55,8 +89,13 @@ public class DesignServerSupportModule { * 启动入口,重建一下展示的module */ public static void rebuild() { - PortalModuleManager.allModules().keySet().stream() - .filter(m -> !SUPPORT_MODULE.contains(m)) - .forEach(PortalModuleManager::unregister); + Carina.getApplicationContext().addListener(new ContextListener() { + @Override + public void onStart() { + PortalModuleManager.allModules().keySet().stream() + .filter(m -> !SUPPORT_MODULE.contains(m)) + .forEach(PortalModuleManager::unregister); + } + }); } } From 09dcec30b3dd032500d42a014c267b2549286ace Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 24 Oct 2024 17:00:15 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE=E4=B8=AD=E5=BF=83=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledata/datacenter/DCTableDataPane.java | 30 ++++++++++++++----- .../com/fr/design/jxbrowser/JxUIPane.java | 4 ++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataPane.java index c5950ae57d..61cf5aefbe 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataPane.java @@ -9,6 +9,7 @@ import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.i18n.Toolkit; import com.fr.design.jxbrowser.JxEngine; import com.fr.design.jxbrowser.JxUIPane; +import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.json.revise.EmbedJson; import com.fr.stable.StringUtils; import com.fr.third.guava.collect.ImmutableMap; @@ -36,6 +37,7 @@ public class DCTableDataPane extends AbstractTableDataPane { private static final String DATA_CENTER_HELPER = "dcHelper"; private static final String DATA_CENTER_INJECT_URL = "fineServletURL"; private static final String DC_INDEX_HTML = "com/fr/design/data/tabledata/datacenter/web/data-choose.prod.html"; + private static final String DATACENTERS_URL = System.getProperty("devMode.datacenters.url"); private final JxUIPane dataCenterJxUIPane; private final JxTableDataNamePane namePane = new JxTableDataNamePane(this); // 用于复制粘贴场景 @@ -62,13 +64,22 @@ public class DCTableDataPane extends AbstractTableDataPane { } private static JxUIPane getJxUIPane() { - - return new JxUIPane.Builder() - .engine(JX_ENGINE) - .namespace(DATA_CENTER) - .bindWindow(DATA_CENTER_HELPER, DCTableDataJSBridge::getBridge) - .withEMB(DC_INDEX_HTML, ImmutableMap.of(DATA_CENTER_INJECT_URL, getDatacentersUrl())) - .build(); + if (DesignerUIModeConfig.getInstance().isUIDevMode() + && StringUtils.isNotBlank(DATACENTERS_URL)) { + return new JxUIPane.Builder() + .engine(JX_ENGINE) + .namespace(DATA_CENTER) + .bindWindow(DATA_CENTER_HELPER, DCTableDataJSBridge::getBridge) + .withURL(DATACENTERS_URL, ImmutableMap.of(DATA_CENTER_INJECT_URL, getDatacentersUrl())) + .build(); + } else { + return new JxUIPane.Builder() + .engine(JX_ENGINE) + .namespace(DATA_CENTER) + .bindWindow(DATA_CENTER_HELPER, DCTableDataJSBridge::getBridge) + .withEMB(DC_INDEX_HTML, ImmutableMap.of(DATA_CENTER_INJECT_URL, getDatacentersUrl())) + .build(); + } } private static String getDatacentersUrl() { @@ -96,7 +107,10 @@ public class DCTableDataPane extends AbstractTableDataPane { } private void reload() { - dataCenterJxUIPane.redirect(EMB_TAG + SCHEME_HEADER + DC_INDEX_HTML, + dataCenterJxUIPane.redirect( + DesignerUIModeConfig.getInstance().isUIDevMode() && StringUtils.isNotBlank(DATACENTERS_URL) + ? DATACENTERS_URL + : EMB_TAG + SCHEME_HEADER + DC_INDEX_HTML, ImmutableMap.of(DATA_CENTER_INJECT_URL, getDatacentersUrl())); } diff --git a/designer-base/src/main/java/com/fr/design/jxbrowser/JxUIPane.java b/designer-base/src/main/java/com/fr/design/jxbrowser/JxUIPane.java index a40a11e3bc..8de367df08 100644 --- a/designer-base/src/main/java/com/fr/design/jxbrowser/JxUIPane.java +++ b/designer-base/src/main/java/com/fr/design/jxbrowser/JxUIPane.java @@ -6,6 +6,7 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerUIModeConfig; import com.fr.design.ui.ModernUIConstants; import com.fr.stable.StringUtils; import com.fr.stable.collections.combination.Pair; @@ -99,7 +100,8 @@ public class JxUIPane extends BasicPane { * 按需初始化debug界面UI */ private void initDebugIfNeeded() { - if (DesignerEnvManager.getEnvManager().isOpenDebug()) { + if (DesignerEnvManager.getEnvManager().isOpenDebug() + || DesignerUIModeConfig.getInstance().isUIDevMode()) { UIToolbar toolbar = new UIToolbar(); add(toolbar, BorderLayout.NORTH); UIButton openDebugButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window")); From e15f63daf5e5ad1862ff949a55be81663e07b1f2 Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 25 Oct 2024 17:53:46 +0800 Subject: [PATCH 04/14] =?UTF-8?q?REPORT-138763=20fix:=20=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E5=B1=95=E7=A4=BA=E6=A1=86=20=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E8=B0=83=E6=95=B4=E3=80=82=E6=BC=8F=E7=BF=BB=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BA=86=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=20render?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/foldablepane/UIExpandablePane.java | 5 ++--- .../controlpane/UISimpleListControlPane.java | 20 +++++++++++-------- .../designer/mobile/ParaMobileDefinePane.java | 3 ++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java b/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java index 140aa74c83..faae8d9f84 100644 --- a/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java +++ b/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java @@ -59,15 +59,14 @@ public class UIExpandablePane extends JPanel { headerPanel = new HeaderPane(title); headerPanel.addMouseListener(new PanelAction()); setcontentPanelontentPanelBorder(); - this.add(headerPanel, BorderLayout.NORTH); - this.add(contentPanel, BorderLayout.CENTER); if (withUnderline) { this.add(column( cell(headerPanel), cell(contentPanel).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 10, 0))), fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder()))) .getComponent()); } else { - this.add(column(cell(headerPanel), cell(contentPanel)).getComponent()); + this.add(headerPanel, BorderLayout.NORTH); + this.add(contentPanel, BorderLayout.CENTER); } setOpaque(false); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java index c6536e138b..a7934c928a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java @@ -1,6 +1,9 @@ package com.fr.design.gui.controlpane; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.actions.UpdateAction; import com.fr.design.border.FineBorderFactory; import com.fr.design.constants.UIConstants; @@ -9,6 +12,7 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.UIList; +import com.fr.design.gui.ilist.UINameEdList; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.menu.ShortCut; @@ -26,12 +30,14 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListCellRenderer; import javax.swing.ListSelectionModel; +import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.awt.Dimension; import java.awt.Point; import java.awt.Toolkit; import java.awt.event.ActionEvent; @@ -49,7 +55,7 @@ import java.util.Comparator; public class UISimpleListControlPane extends BasicPane { public static final String LIST_NAME = "UISimpleControl_List"; - protected UIList nameList; + protected UINameEdList nameList; protected String selectedName; private ShortCut4JControlPane[] shorts; private ToolBarDef toolbarDef; @@ -108,10 +114,8 @@ public class UISimpleListControlPane extends BasicPane { protected void initListPane(JPanel listPane) { nameList = createJNameList(); nameList.setName(LIST_NAME); - nameList.setSelectionBackground(UIConstants.ATTRIBUTE_PRESS); listPane.add(new UIScrollPane(nameList), BorderLayout.CENTER); - nameList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); nameList.addMouseListener(listMouseListener); nameList.addListSelectionListener(new ListSelectionListener() { @@ -124,8 +128,8 @@ public class UISimpleListControlPane extends BasicPane { }); } - public UIList createJNameList() { - UIList nameList = new UIList(new DefaultListModel()) { + public UINameEdList createJNameList() { + UINameEdList nameList = new UINameEdList(new DefaultListModel()) { @Override public int locationToIndex(Point location) { int index = super.locationToIndex(location); @@ -411,6 +415,7 @@ public class UISimpleListControlPane extends BasicPane { label = new UILabel(); initialLabelForeground = label.getForeground(); this.setLayout(new BorderLayout()); + label.setBorder(new ScaledEmptyBorder(0, 6, 0, 0)); this.add(label, BorderLayout.CENTER); } @@ -425,6 +430,7 @@ public class UISimpleListControlPane extends BasicPane { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + setPreferredSize(new Dimension(list.getWidth(), FineUIScale.scale(UIManager.getInt("List.cellRender.height")))); setComponentOrientation(list.getComponentOrientation()); Color bg = null; @@ -442,9 +448,7 @@ public class UISimpleListControlPane extends BasicPane { } if (isSelected) { - setBackground(bg == null ? list.getSelectionBackground() : bg); - setForeground(fg == null ? list.getSelectionForeground() : fg); - label.setForeground(Color.WHITE); + setBackground(FlatUIUtils.getUIColor("List.selectionInactiveBackground", Color.GRAY)); } else { setBackground(list.getBackground()); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index d2a9bb4f73..66eeab2186 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -1,6 +1,7 @@ package com.fr.design.widget.ui.designer.mobile; import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; @@ -77,7 +78,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData()); JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); panelWrapper.add(mobileWidgetListPane, BorderLayout.CENTER); - + panelWrapper.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Order"), 280, 20, panelWrapper); } From 4c06c013e3073267b4732942c09d328755a79027 Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 25 Oct 2024 17:59:25 +0800 Subject: [PATCH 05/14] =?UTF-8?q?REPORT-138763=20fix:=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B4=A8=E9=87=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/controlpane/UISimpleListControlPane.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java index a7934c928a..e04ec6c82f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java @@ -128,6 +128,10 @@ public class UISimpleListControlPane extends BasicPane { }); } + /** + * 构造 list,设置 render + * @return UINameEdList + */ public UINameEdList createJNameList() { UINameEdList nameList = new UINameEdList(new DefaultListModel()) { @Override From 7dcceb8a90c7df7567514b726f568d9bed577301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Fri, 25 Oct 2024 18:11:15 +0800 Subject: [PATCH 06/14] =?UTF-8?q?REPORT-138771=20fix:=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=8F=96=E6=95=B0=E5=BC=82=E5=B8=B8=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E8=A7=A3=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/DesignTableDataManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index f7a682d891..04c5e0ba37 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -50,6 +50,7 @@ import javax.swing.JFrame; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.io.ByteArrayOutputStream; +import java.lang.reflect.UndeclaredThrowableException; import java.text.Collator; import java.util.ArrayList; import java.util.Collections; @@ -596,7 +597,11 @@ public abstract class DesignTableDataManager { } } catch (Exception e) { - throw new TableDataException(e.getMessage(), e); + String msg = e.getMessage(); + if (e instanceof UndeclaredThrowableException) { + msg = ((UndeclaredThrowableException) e).getUndeclaredThrowable().getMessage(); + } + throw new TableDataException(msg, e); } finally { ScheduledExecutorService scheduledExecutorService = ComponentUtils .getExecutor() From 8156f99eafc98745f44db70a910ba89873d2f9d4 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 25 Oct 2024 18:28:40 +0800 Subject: [PATCH 07/14] =?UTF-8?q?REPORT-137540=20-=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E4=B8=8B=E5=9C=B0=E5=9B=BE=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=8D=A1=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/map/DesignGEOJSONHelper.java | 36 +++++++++++++++++++ .../function/DesignChartBaseComponent.java | 4 +++ 2 files changed, 40 insertions(+) create mode 100644 designer-chart/src/main/java/com/fanruan/map/DesignGEOJSONHelper.java diff --git a/designer-chart/src/main/java/com/fanruan/map/DesignGEOJSONHelper.java b/designer-chart/src/main/java/com/fanruan/map/DesignGEOJSONHelper.java new file mode 100644 index 0000000000..740ccd72b2 --- /dev/null +++ b/designer-chart/src/main/java/com/fanruan/map/DesignGEOJSONHelper.java @@ -0,0 +1,36 @@ +package com.fanruan.map; + +import com.fr.decision.webservice.v10.map.geojson.MapDataType; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.third.org.apache.commons.lang3.time.StopWatch; +import com.fr.workspace.server.repository.map.MapRepository; + +/** + * 设计器地图资源Helper + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/9/27 + */ +public class DesignGEOJSONHelper extends GEOJSONHelper { + + @Override + protected void init() { + try { + + StopWatch watch = new StopWatch(); + watch.start(); + URL_JSON_MAP.putAll(MapRepository.getInstance().getMapResource(GEOJSONUtils.getMapDataTypePath(MapDataType.GEOGRAPHIC))); + URL_JSON_MAP.putAll(MapRepository.getInstance().getMapResource(GEOJSONUtils.getMapDataTypePath(MapDataType.IMAGE))); + + FineLoggerFactory.getLogger().info("Load chart map resources spend time {} ms", watch.getTime()); + watch.stop(); + + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java index 3a41a04c13..daf742e338 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java @@ -1,11 +1,14 @@ package com.fanruan.boot.env.function; import com.fanruan.boot.ChartBaseComponent; +import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Supplemental; +import com.fanruan.map.DesignGEOJSONHelper; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelperShell; /** @@ -42,6 +45,7 @@ public class DesignChartBaseComponent extends ChartBaseComponent { @Supplemental public void prepare() { super.prepare(); + Carina.getApplicationContext().singleton(GEOJSONHelperShell.class).set(DesignGEOJSONHelper.class); } } From f56fd271d9ba90326d10b6a474cff4cc3b5994d7 Mon Sep 17 00:00:00 2001 From: "Richard.Fang" Date: Mon, 28 Oct 2024 13:50:59 +0800 Subject: [PATCH 08/14] =?UTF-8?q?REPORT-138740=20fix:=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E9=BC=A0=E6=A0=87=E6=82=AC=E6=B5=AE=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=80=89=E4=B8=AD=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/ilist/TableViewList.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index 50c050b013..25ac17ec03 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java @@ -3,8 +3,6 @@ package com.fr.design.gui.ilist; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.ui.FlatUIUtils; -import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; -import com.fr.base.BaseUtils; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.dialect.base.key.check.DataBaseDetail; @@ -19,7 +17,6 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import com.fr.workspace.server.entity.connection.ConnectionBean; import com.fr.workspace.server.repository.connection.ConnectionRepository; import javax.swing.DefaultListCellRenderer; @@ -47,9 +44,10 @@ import java.util.concurrent.CancellationException; * 表或者视图或者存储过程组成的一个下拉列表 * * @author zhou - * @since 2012-3-28下午10:07:34 + * @Created on 2012-3-28下午10:07:34 + * @since 11.0 */ -public class TableViewList extends UIList { +public class TableViewList extends JList { /** * @@ -162,7 +160,7 @@ public class TableViewList extends UIList { * august:databaseName是数据库名字,searchFilter是输入的过滤条件,typesFilter是视图、表、 * 存储过程中的一者或者几者 * - * @param databaseName + * @param datasource * @param searchFilter * @param typesFilter */ @@ -267,7 +265,7 @@ public class TableViewList extends UIList { icon = new LazyIcon("store_procedure"); } this.setIcon(icon); - + this.setToolTipText(getPreferredSize().width > list.getVisibleRect().width ? this.getText() : null); return this; } From 270c81e96262cdf90bd4c4d6a5738426b4553bce Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 28 Oct 2024 14:44:02 +0800 Subject: [PATCH 09/14] =?UTF-8?q?REPORT-137540=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E4=B8=8B=E5=9C=B0=E5=9B=BE=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=8D=A1=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/boot/init/DesignWorkContextComponent.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index dfba3b1279..198f543bb8 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -63,6 +63,7 @@ import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; import com.fanruan.repository.ConfigRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository; +import com.fr.workspace.server.repository.map.MapRepository; import com.fr.workspace.server.repository.plugin.PluginRepository; import com.fr.workspace.server.repository.resource.PublicResourceRepository; import com.fr.workspace.server.repository.resource.WorkResourceRepository; @@ -114,6 +115,7 @@ public class DesignWorkContextComponent { RepositoryManager.getInstance().pureRegisterRepo4Start(PublicResourceRepository.getInstance()); RepositoryManager.getInstance().pureRegisterRepo4Start(ConfigRepository.getInstance()); RepositoryManager.getInstance().pureRegisterRepo4Start(PluginRepository.getInstance()); + RepositoryManager.getInstance().pureRegisterRepo4Start(MapRepository.getInstance()); RepositoryManager.getInstance().initLocalRepository(); CompatibleRegister.registerCompatibleEnv(); for (WorkRPCRegister workRPCRegister : ServiceContext.group(WorkspaceKey.class).getAll()) { From eba7b2517861a2ce1a294ae2803dd20cf09a3fa9 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 28 Oct 2024 17:14:30 +0800 Subject: [PATCH 10/14] =?UTF-8?q?REPORT-138856=20fix:=20=E5=BA=8F=E5=8F=B7?= =?UTF-8?q?=E5=88=97=E4=B8=BA=E5=B1=85=E4=B8=AD=E5=B1=95=E7=A4=BA=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E6=96=87=E5=AD=97=E5=B7=A6=E9=97=B4?= =?UTF-8?q?=E8=B7=9D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledata/tabledatapane/EmbeddedTableDataPane.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java index 8d2798ae62..d926141cbd 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java @@ -16,9 +16,11 @@ import com.fr.general.DateUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import javax.swing.BorderFactory; import javax.swing.DefaultCellEditor; import javax.swing.JPanel; import javax.swing.JTable; +import javax.swing.UIManager; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.AbstractTableModel; @@ -350,10 +352,12 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane Date: Mon, 28 Oct 2024 18:02:45 +0800 Subject: [PATCH 11/14] =?UTF-8?q?REPORT-137540=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E4=B8=8B=E5=9C=B0=E5=9B=BE=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=8D=A1=E6=85=A2=20=E5=9B=9E=E9=80=80=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/boot/env/function/DesignChartBaseComponent.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java index daf742e338..3a41a04c13 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java @@ -1,14 +1,11 @@ package com.fanruan.boot.env.function; import com.fanruan.boot.ChartBaseComponent; -import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Supplemental; -import com.fanruan.map.DesignGEOJSONHelper; -import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelperShell; /** @@ -45,7 +42,6 @@ public class DesignChartBaseComponent extends ChartBaseComponent { @Supplemental public void prepare() { super.prepare(); - Carina.getApplicationContext().singleton(GEOJSONHelperShell.class).set(DesignGEOJSONHelper.class); } } From 58e39422783a0a5cfc89c9e598884b9029107b9c Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 30 Oct 2024 22:08:28 +0800 Subject: [PATCH 12/14] =?UTF-8?q?REPORT-139220=20=E3=80=90fr-fbp=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E3=80=90=E6=95=B0=E6=8D=AE=E6=BA=90=E3=80=91?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=EF=BC=8C=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=97=B6=E5=81=B6=E5=8F=91=E6=8A=A5=E9=94=99=E9=87=8D=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ConnectionListPane.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 93780213d5..2c67e71210 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -231,7 +231,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh List removedConnNames = new ArrayList<>(); List addConnections = new ArrayList<>(); List updateConnection = new ArrayList<>(); - List validConnection = new ArrayList<>(); + Map validConnection = new HashMap<>(); MapCompareUtils.contrastMapEntries(populatedConnectionsSnapshot, updatedMap, (entryEventKind, s, connection) -> { try { switch (entryEventKind) { @@ -242,7 +242,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh ConnectionInfoBean add = ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true); if (StringUtils.isNotEmpty(add.getConnectionData())) { addConnections.add(add); - validConnection.add(connection); + validConnection.put(s, connection); } else { FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", connection.getClass()); } @@ -251,7 +251,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh ConnectionInfoBean update = ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true); if (StringUtils.isNotEmpty(update.getConnectionData())) { updateConnection.add(update); - validConnection.add(connection); + validConnection.put(s, connection); } else { FineLoggerFactory.getLogger().error("Unable to find the corresponding processor : {}", connection.getClass()); } @@ -297,7 +297,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh }); /// 先不管 //this.validateDatabaseType(validConnection); - this.alterConnections(addConnections, removedConnNames, updateConnection); + this.alterConnections(addConnections, removedConnNames, updateConnection, validConnection); } /** @@ -344,17 +344,20 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } - private void alterConnections(List addConnections, List removedConnNames, List updateConnection) throws Exception { + private void alterConnections(List addConnections, List removedConnNames, List updateConnection, Map validConnection) throws Exception { try { for (ConnectionInfoBean bean : addConnections) { ConnectionRepository.getInstance().add(bean); + populatedConnectionsSnapshot.put(bean.getConnectionName(), validConnection.get(bean.getConnectionName())); } for (ConnectionInfoBean bean : updateConnection) { ConnectionRepository.getInstance().update(bean); + populatedConnectionsSnapshot.put(bean.getConnectionName(), validConnection.get(bean.getConnectionName())); } for (String name : removedConnNames) { ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name)); + populatedConnectionsSnapshot.remove(name); } // hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效 if (!WorkContext.getCurrent().isLocal()) { From f802ebc0c259a42a951ce6a80a18842b7d5c2db5 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 30 Oct 2024 23:50:25 +0800 Subject: [PATCH 13/14] =?UTF-8?q?REPORT-139278=20=E3=80=90fr-fbp=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E3=80=90=E6=95=B0=E6=8D=AE=E6=BA=90=E3=80=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=80=89=E6=8B=A9=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E9=A9=B1=E5=8A=A8=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E6=A3=80=E6=B5=8B=E6=97=B6=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E9=A9=B1=E5=8A=A8=EF=BC=8C=E7=82=B9=E5=87=BB=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=8C=89=E9=92=AE=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=AE=9E=E9=99=85=E4=B8=8A=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/TableDataPaneListPane.java | 3 ++- .../fr/design/data/datapane/connect/ConnectionListPane.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java index 304ed35eae..706f4cb434 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java @@ -336,9 +336,10 @@ public class TableDataPaneListPane extends JListControlPane implements TableData for (ServerDataSetBean bean : deleteDatas) { TableDataRepository.getInstance().delete(bean); } - TableDataRepository.getInstance().invalidCache(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + } finally { + TableDataRepository.getInstance().invalidCache(); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 2c67e71210..b78199d6cf 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -363,10 +363,11 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); } - ConnectionRepository.getInstance().invalidCache(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); throw e; + } finally { + ConnectionRepository.getInstance().invalidCache(); } } From 809b85083a9049f9d5bfd956acc2cadf55aa6047 Mon Sep 17 00:00:00 2001 From: "Richard.Fang" Date: Fri, 1 Nov 2024 15:47:17 +0800 Subject: [PATCH 14/14] =?UTF-8?q?REPORT-136131=20fix:AlphaFine=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E7=BC=A9=E6=94=BE=E9=80=82=E9=85=8D=E5=8F=8A=E8=A7=86?= =?UTF-8?q?=E8=A7=89=E8=A7=84=E8=8C=83=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/utils/FineUIStyle.java | 3 + .../help/alphafine/AlphaFineConstants.java | 45 ++--- .../com/fine/theme/icon/alphafine/bulb.svg | 4 + .../fine/theme/icon/alphafine/bulb_click.svg | 4 + .../fine/theme/icon/alphafine/bulb_hover.svg | 4 + .../fine/theme/icon/alphafine/minimize.svg | 3 + .../theme/icon/alphafine/minimize_disable.svg | 3 + .../fine/theme/icon/alphafine/no_result.svg | 20 ++ .../fine/theme/icon/alphafine/search_hint.svg | 28 +++ .../fine/theme/light/ui/fine_light.icon.json | 8 +- .../light/ui/laf/FineLightLaf.properties | 14 +- .../alphafine/component/AlphaFineDialog.java | 28 ++- .../alphafine/component/AlphaFineFrame.java | 190 +++++++++--------- .../ProductNewsContentCellRender.java | 21 +- .../ProductNewsSearchResultPane.java | 4 +- .../alphafine/component/SearchHintPane.java | 51 ++--- .../alphafine/component/SearchListModel.java | 7 - .../SearchResultContentCellRender.java | 10 +- .../alphafine/component/SearchResultPane.java | 15 +- .../TemplateResourcePageGridPane.java | 13 +- .../component/TemplateResourcePanel.java | 3 +- .../preview/DefaultProductNewsPane.java | 39 ++-- .../preview/HelpDocumentNoResultPane.java | 23 +-- .../alphafine/preview/NoResultPane.java | 33 +-- .../preview/NoResultWithLinkPane.java | 4 +- 25 files changed, 326 insertions(+), 251 deletions(-) create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb_click.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb_hover.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/alphafine/minimize.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/alphafine/minimize_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/alphafine/no_result.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/alphafine/search_hint.svg 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 e2186efc4e..294fdd57ce 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 @@ -30,6 +30,9 @@ public interface FineUIStyle { String LABEL_BOLD = "boldLabel"; String LABEL_TIP_WINDOW_TITLE = "tipWindowTitleLabel"; String LABEL_SECONDARY = "secondaryLabel"; + String LABEL_HIGHLIGHT = "highLightLabel"; + String LABEL_PRIMARY = "primaryLabel"; + String LABEL_DISABLED = "disabledLabel"; String LABEL_TIP = "tipLabel"; String LABEL_WARNING_TIP = "warningTipLabel"; String LABEL_UILIST = "uiListLabel"; diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConstants.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConstants.java index b723e08b16..c18b153924 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConstants.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConstants.java @@ -1,10 +1,10 @@ package com.fr.design.actions.help.alphafine; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; import com.fr.base.extension.FileExtension; -import com.fr.base.svg.IconUtils; import com.fr.design.i18n.Toolkit; import com.fr.design.utils.DesignUtils; -import com.fr.general.IOUtils; import javax.swing.Icon; import java.awt.Color; @@ -40,23 +40,20 @@ public class AlphaFineConstants { public static final int LATEST_SHOW_SIZE = 3; - public static final int HEIGHT = 680; + public static final int HEIGHT = FineUIScale.scale(680); - public static final int WIDTH = 460; + public static final int WIDTH = FineUIScale.scale(460); - public static final int LEFT_WIDTH = 300; + public static final int LEFT_WIDTH = FineUIScale.scale(320); - public static final int RIGHT_WIDTH = 380; + public static final int RIGHT_WIDTH = FineUIScale.scale(320); - public static final int FIELD_HEIGHT = 55; + public static final int CONTENT_HEIGHT = FineUIScale.scale(280); - public static final int CONTENT_HEIGHT = 405; + public static final int CELL_HEIGHT = FineUIScale.scale(24); - public static final int CELL_HEIGHT = 29; + public static final int CELL_TITLE_HEIGHT = FineUIScale.scale(24); - public static final int CELL_TITLE_HEIGHT = 24; - - public static final int HOT_ICON_LABEL_HEIGHT = 36; public static final int HOT_ITEMS = 6; @@ -70,24 +67,20 @@ public class AlphaFineConstants { */ public static final long DOCUMENT_SEARCH_GAP = 1000; - public static final Dimension FULL_SIZE = new Dimension(680, 460); - - public static final Dimension CONTENT_SIZE = new Dimension(680, 405); + public static final Dimension FULL_SIZE = FineUIScale.createScaleDimension(680, 490); - public static final Dimension FIELD_SIZE = new Dimension(680, 55); + public static final Dimension CONTENT_SIZE = FineUIScale.createScaleDimension(640, 280); - public static final Dimension ICON_LABEL_SIZE = new Dimension(64, 64); + public static final Dimension FIELD_SIZE = FineUIScale.createScaleDimension(680, 55); - public static final Dimension HOT_ICON_LABEL_SIZE = new Dimension(36, 36); + public static final Dimension ICON_LABEL_SIZE = FineUIScale.createScaleDimension(64, 64); - public static final Dimension HOT_ISSUES_JAPNEL_SIZE = new Dimension(213, 182); + public static final Dimension HOT_ISSUES_JAPNEL_SIZE = FineUIScale.createScaleDimension(213, 182); /** * 展示面板的尺寸 */ - public static final Dimension PREVIEW_SIZE = new Dimension(680, 305); - - public static final Dimension CLOSE_BUTTON_SIZE = new Dimension(40, 40); + public static final Dimension PREVIEW_SIZE = FineUIScale.createScaleDimension(640, 300); public static final Color WHITE = new Color(0xf9f9f9); @@ -149,7 +142,7 @@ public class AlphaFineConstants { public static final String BACK_ICON_NAME = "back@1x.png"; - public static final Icon NO_RESULT_ICON = IOUtils.readIcon(AlphaFineConstants.IMAGE_URL + "noresult.png"); + public static final Icon NO_RESULT_ICON = new LazyIcon("no_result", 110); public static final Color SUSPENDED_COLOR = new Color(84, 165, 249); @@ -166,11 +159,11 @@ public class AlphaFineConstants { public static final Color BACKGROUND_COLOR = new Color(245, 245, 247); - public static final Icon BULB_ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bulb.svg"); + public static final Icon BULB_ICON = new LazyIcon("bulb"); - public static final Icon YELLOW_BULB_ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/yellow_bulb.svg"); + public static final Icon YELLOW_BULB_ICON = new LazyIcon("bulb_hover"); - public static final Icon LIGHT_YELLOW_BULB_ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/light_yellow_bulb.svg"); + public static final Icon LIGHT_YELLOW_BULB_ICON = new LazyIcon("bulb_click"); public static final String HOT_SEARCH = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot_Search"); diff --git a/designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb.svg b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb.svg new file mode 100644 index 0000000000..c08c0ea671 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb_click.svg b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb_click.svg new file mode 100644 index 0000000000..aa8edbf6b6 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb_click.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb_hover.svg b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb_hover.svg new file mode 100644 index 0000000000..339ec4bc38 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/bulb_hover.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/alphafine/minimize.svg b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/minimize.svg new file mode 100644 index 0000000000..7226802a7e --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/minimize.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/alphafine/minimize_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/minimize_disable.svg new file mode 100644 index 0000000000..674423958d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/minimize_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/alphafine/no_result.svg b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/no_result.svg new file mode 100644 index 0000000000..e87a383159 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/no_result.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/alphafine/search_hint.svg b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/search_hint.svg new file mode 100644 index 0000000000..b7e6de9cec --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/alphafine/search_hint.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 4cfeeb7521..81d2177697 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 @@ -481,6 +481,12 @@ "arrange_vertical_center": "arrange/arrange_vertical_center.svg", "arrange_bottom_align": "arrange/arrange_bottom_align.svg", "arrange_horizontal_distribute": "arrange/arrange_horizontal_distribute.svg", - "arrange_vertical_distribute": "arrange/arrange_vertical_distribute.svg" + "arrange_vertical_distribute": "arrange/arrange_vertical_distribute.svg", + "bulb": "alphafine/bulb.svg", + "bulb_click": "alphafine/bulb_click.svg", + "bulb_hover": "alphafine/bulb_hover.svg", + "minimize": "alphafine/minimize.svg", + "search_hint": "alphafine/search_hint.svg", + "no_result": "alphafine/no_result.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 0adc8cf686..df47e34cf2 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 @@ -414,7 +414,10 @@ Label.borderColor = $defaultBorderColor Label.hyperLinkColor = #2576EF Label.strongHintColor = #FF0000 Label.warningColor = #F1393C -Label.secondaryColor = #0A1C38A8 +Label.disabledColor = fade(@foreground, 29%) +Label.secondaryColor = fade(@foreground, 47%) +Label.primaryColor = fade(@foreground, 78%) +Label.highLightColor = fade(@foreground, 90%) # ---- Calendar ---- Calendar.background = $fill.normal @@ -1379,9 +1382,18 @@ chart.selectedBorderColor = #2576EF [style]Label.warningTipLabel = \ foreground: $Label.warningColor +[style]Label.disabledLabel = \ + foreground: $Label.disabledColor + [style]Label.secondaryLabel = \ foreground: $Label.secondaryColor +[style]Label.primaryLabel = \ + foreground: $Label.primaryColor + +[style]Label.highLightLabel = \ + foreground: $Label.highLightColor + [style]Label.uiListLabel = \ foreground: $List.wrapper.text.fontColor; \ background: $background.normal diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 4c2f611715..337bdc219f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -1,6 +1,9 @@ package com.fr.design.mainframe.alphafine.component; import com.bulenkov.iconloader.IconLoader; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineCloudConstants; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; @@ -204,8 +207,7 @@ public class AlphaFineDialog extends UIDialog { super.paintComponent(g); } }; - closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE); - closeButton.setIcon(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + "alphafine_close.png")); + closeButton.setIcon(new LazyIcon("close", 40)); closeButton.set4ToolbarButton(); closeButton.setBorderPainted(false); closeButton.setRolloverEnabled(false); @@ -229,12 +231,12 @@ public class AlphaFineDialog extends UIDialog { private void initHotPane() { removeHotPane(); hotPane = new JPanel(); - hotPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + hotPane.setBorder(new ScaledEmptyBorder(5, 5, 5, 5)); hotPane.setPreferredSize(AlphaFineConstants.CONTENT_SIZE); hotPane.setLayout(new BorderLayout()); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot")); - uiLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + uiLabel.setBorder(new ScaledEmptyBorder(0, 5, 0, 0)); uiLabel.setFont(AlphaFineConstants.SMALL_FONT); uiLabel.setForeground(AlphaFineConstants.DARK_GRAY); @@ -283,7 +285,6 @@ public class AlphaFineDialog extends UIDialog { */ private void initProperties() { setUndecorated(true); -//addComponentListener(new ComponentHandler()); setSize(AlphaFineConstants.FIELD_SIZE); centerWindow(this); @@ -1238,12 +1239,6 @@ public class AlphaFineDialog extends UIDialog { @Override protected void fireContentsChanged(Object source, int index0, int index1) { - if (myDelegate.size() > MAX_SHOW_SIZE) { - leftSearchResultPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); - leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 2)); - } else { - leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - } super.fireContentsChanged(source, index0, index1); } @@ -1367,8 +1362,8 @@ public class AlphaFineDialog extends UIDialog { backPane = new JPanel(new BorderLayout()); JLabel jLabel = new JLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Back")); jLabel.setIcon(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + AlphaFineConstants.BACK_ICON_NAME)); - jLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); - jLabel.setPreferredSize(new Dimension(80, 20)); + jLabel.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + jLabel.setPreferredSize(FineUIScale.createScaleDimension(80, 20)); jLabel.setFont(AlphaFineConstants.SMALL_FONT); jLabel.setForeground(AlphaFineConstants.DARK_GRAY); jLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); @@ -1401,14 +1396,15 @@ public class AlphaFineDialog extends UIDialog { public HotIssueJpanel(String[] str, int pngIndex) { this.setLayout(new BorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + this.setBorder(new ScaledEmptyBorder(5, 5, 5, 5)); this.setSize(AlphaFineConstants.HOT_ISSUES_JAPNEL_SIZE); JPanel pane1 = new JPanel(new BorderLayout()); + // 图标待替换 UILabel iconLabel = new UILabel(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + AlphaFineConstants.ALPHA_HOT_IMAGE_NAME + pngIndex + ".png")); iconLabel.setOpaque(true); iconLabel.setBackground(Color.WHITE); - iconLabel.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0)); + iconLabel.setBorder(new ScaledEmptyBorder(20, 0, 0, 0)); pane1.add(iconLabel, BorderLayout.NORTH); add(pane1, BorderLayout.NORTH); @@ -1454,7 +1450,7 @@ public class AlphaFineDialog extends UIDialog { bottomPanel.add(subTitle); } bottomPanel.setLayout(gridLayout); - bottomPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 22, 0)); + bottomPanel.setBorder(new ScaledEmptyBorder(0, 20, 20, 0)); add(bottomPanel, BorderLayout.SOUTH); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index 23625aa6ea..7c28c28f7d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -1,13 +1,18 @@ package com.fr.design.mainframe.alphafine.component; +import com.fine.swing.ui.layout.Row; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; +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.base.svg.IconUtils; import com.fr.base.svg.SVGLoader; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineShortCutUtil; -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.borders.UITextFieldBorder; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineHelper; @@ -37,19 +42,18 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; import com.fr.design.mainframe.alphafine.search.manager.impl.TemplateResourceSearchManager; -import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; -import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.SwingConstants; import javax.swing.Timer; +import javax.swing.border.LineBorder; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import java.awt.BorderLayout; @@ -61,7 +65,6 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; -import java.awt.Insets; import java.awt.RenderingHints; import java.awt.Toolkit; import java.awt.Window; @@ -81,6 +84,13 @@ import java.util.Map; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jetbrains.annotations.NotNull; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; + /** * @author hades @@ -123,7 +133,7 @@ public class AlphaFineFrame extends JFrame { private static final Image SEARCH_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/search.svg"); - private static final Color BORDER_COLOR = new Color(232, 232, 233); + private static final Color FLESH_BLUE = FlatUIUtils.getUIColor("brand.normal", Color.BLUE); private final CardLayout cardLayout = new CardLayout(); @@ -259,45 +269,46 @@ public class AlphaFineFrame extends JFrame { * 初始化全部组件 */ private void initComponents() { - add(createTopPane(), BorderLayout.NORTH); - initSearchTextField(); - add(createSearchPane(), BorderLayout.CENTER); - add(createShowPane(), BorderLayout.SOUTH); + add(column(10, + cell(createTopPane()), + cell(createSearchPane()), + cell(createShowPane()) + ).getComponent()); this.getContentPane().setBackground(Color.WHITE); this.setIconImage(SEARCH_IMAGE); // 应用图标 } private JPanel createTopPane() { JPanel topPane = new JPanel(new BorderLayout()); - topPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - topPane.setBackground(Color.WHITE); - JPanel topLeftPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); - topLeftPane.setBackground(Color.WHITE); - UILabel alphaFineLabel = new UILabel(AlphaFineConstants.TITLE); - alphaFineLabel.setFont(new Font("Arial Black", Font.PLAIN, 20)); - alphaFineLabel.setForeground(UIConstants.FLESH_BLUE); - topLeftPane.add(alphaFineLabel); + topPane.setBorder(new ScaledEmptyBorder(10, 20, 0, 20)); + UILabel topLeftPane = new UILabel(AlphaFineConstants.TITLE); + topLeftPane.setFont(new Font("Arial Black", Font.PLAIN, FineUIScale.scale(20))); + topLeftPane.setForeground(FLESH_BLUE); + topLeftPane.setOpaque(false); topPane.add(topLeftPane, BorderLayout.WEST); - JPanel topRightPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); - topRightPane.setBackground(Color.WHITE); - JPanel tipPane = new JPanel(new BorderLayout()); - tipPane.setBackground(Color.WHITE); tipIconLabel = new UILabel(AlphaFineConstants.BULB_ICON); tipIconLabel.addMouseListener(tipMouseListener); - useTipLabel = new UILabel(SKILLS); + useTipLabel = new UILabel(SKILLS, FineUIStyle.LABEL_HIGHLIGHT); useTipLabel.addMouseListener(tipMouseListener); - useTipLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); - tipPane.add(tipIconLabel, BorderLayout.WEST); - tipPane.add(useTipLabel, BorderLayout.CENTER); - topRightPane.add(tipPane); - UIButton minimizeButton = createButton(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/minimize.svg")); + UIButton minimizeButton = new UIButton(new LazyIcon("minimize")); minimizeButton.addActionListener(e -> AlphaFineFrame.this.setExtendedState(JFrame.ICONIFIED)); - topRightPane.add(minimizeButton); - UIButton closeButton = createButton(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/close.svg")); + FineUIStyle.setStyle(minimizeButton, FineUIStyle.ORIGINAL_BUTTON); + minimizeButton.setBackground(Color.WHITE); + UIButton closeButton = new UIButton(new LazyIcon("close")); closeButton.addActionListener(e -> AlphaFineFrame.this.dispose()); - topRightPane.add(closeButton); - topPane.add(topRightPane, BorderLayout.EAST); + FineUIStyle.setStyle(closeButton, FineUIStyle.ORIGINAL_BUTTON); + closeButton.setBackground(Color.WHITE); + + JPanel topRightPane = new JPanel(new BorderLayout()); + topRightPane.setOpaque(false); + topRightPane.add(row(16, + row(cell(tipIconLabel), cell(useTipLabel)), + cell(minimizeButton), + cell(closeButton) + ).getComponent()); + topPane.add(column(flex(), cell(topRightPane), flex()).getComponent(), BorderLayout.EAST); + topPane.setOpaque(false); return topPane; } @@ -313,30 +324,29 @@ public class AlphaFineFrame extends JFrame { @Override public void mouseExited(MouseEvent e) { if (popupMenu == null || !popupMenu.isShowing()) { - useTipLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); + useTipLabel.setForeground(FineUIUtils.getUIColor("Label.highLightColor", "Label.highLightColor")); tipIconLabel.setIcon(AlphaFineConstants.BULB_ICON); } } @Override public void mousePressed(MouseEvent e) { - useTipLabel.setForeground(UIConstants.FLESH_BLUE); + useTipLabel.setForeground(FLESH_BLUE); tipIconLabel.setIcon(AlphaFineConstants.LIGHT_YELLOW_BULB_ICON); popupMenu = createTipPop(); - GUICoreUtils.showPopupMenu(popupMenu, e.getComponent(), e.getComponent().getX() - 60, e.getComponent().getY() + 20); + GUICoreUtils.showPopupMenu(popupMenu, e.getComponent(), e.getComponent().getX() - FineUIScale.scale(60), e.getComponent().getY() + FineUIScale.scale(20)); } }; private JPopupMenu createTipPop() { JPanel panel = new JPanel(new BorderLayout()); String toolTip = AlphaFineShortCutUtil.getDisplayShortCut(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Short_Cut", DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortcuts())); - UILabel label = new UILabel(toolTip); - label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); + UILabel label = new UILabel(toolTip, FineUIStyle.LABEL_HIGHLIGHT); label.setBackground(Color.WHITE); panel.add(label); panel.setBackground(Color.WHITE); JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(BorderFactory.createEmptyBorder(20, 5, 10, 5)); + popupMenu.setBorder(new ScaledEmptyBorder(20, 5, 10, 5)); popupMenu.add(panel); popupMenu.setBackground(Color.WHITE); popupMenu.addPopupMenuListener(new PopupMenuListener() { @@ -347,7 +357,7 @@ public class AlphaFineFrame extends JFrame { @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - useTipLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); + useTipLabel.setForeground(FineUIUtils.getUIColor("Label.highLightColor", "Label.highLightColor")); tipIconLabel.setIcon(AlphaFineConstants.BULB_ICON); } @@ -361,15 +371,14 @@ public class AlphaFineFrame extends JFrame { private JPanel createSearchPane() { JPanel searchPane = new JPanel(new BorderLayout()); - searchPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); - searchTextFieldWrapperPane = new JPanel(new BorderLayout()) { - @Override - protected void paintBorder(Graphics g) { - g.setColor(BORDER_COLOR); - g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 5, 5); - } - }; - searchTextFieldWrapperPane.setBorder(new UITextFieldBorder(new Insets(2, 3, 2, 3))); + searchPane.setPreferredSize(FineUIScale.createScaleDimension(632, 32)); + searchPane.setBorder(new ScaledEmptyBorder(0, 20, 0, 20)); + + searchTextField = new AlphaFineTextField(PLACE_HOLDER); + initTextFieldListener(); + searchTextField.setBackground(Color.WHITE); + + searchTextFieldWrapperPane = new JPanel(new BorderLayout()); searchTextFieldWrapperPane.setBackground(Color.WHITE); searchTextFieldWrapperPane.add(searchTextField, BorderLayout.CENTER); clearLabel = new UILabel(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/clear.svg")); @@ -383,14 +392,25 @@ public class AlphaFineFrame extends JFrame { } }); searchTextFieldWrapperPane.add(clearLabel, BorderLayout.EAST); + searchTextFieldWrapperPane.setBorder(BorderFactory.createCompoundBorder( + new LineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.BLACK)), + new ScaledEmptyBorder(0, 0, 0, 6) + )); searchPane.add(searchTextFieldWrapperPane, BorderLayout.CENTER); + JButton searchButton = getSearchButton(); + searchPane.add(searchButton, BorderLayout.EAST); + searchPane.setBackground(Color.WHITE); + return searchPane; + } + + private @NotNull JButton getSearchButton() { JButton searchButton = new JButton(SEARCH) { @Override public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setColor(UIConstants.FLESH_BLUE); - g2d.fillRoundRect(0, 0, getWidth(), getHeight(), 4, 4); + g2d.setColor(FLESH_BLUE); + g2d.fillRoundRect(0, 0, getWidth(), getHeight(), FineUIScale.scale(4), FineUIScale.scale(4)); super.paintComponent(g2d); } }; @@ -400,13 +420,10 @@ public class AlphaFineFrame extends JFrame { fireSearch(); } }); - searchButton.setPreferredSize(new Dimension(70, 60)); searchButton.setForeground(Color.WHITE); searchButton.setBorderPainted(false); searchButton.setContentAreaFilled(false); - searchPane.add(searchButton, BorderLayout.EAST); - searchPane.setBackground(Color.WHITE); - return searchPane; + return searchButton; } /** @@ -414,7 +431,6 @@ public class AlphaFineFrame extends JFrame { */ private JPanel createShowPane() { JPanel showPane = new JPanel(new BorderLayout()); - // 内容区,card layout resultPane.add(new DefaultProductNewsPane(), CellType.PRODUCT_NEWS.getFlagStr4None()); resultPane.add(new NoResultWithLinkPane(GO_FORUM, AlphaFineConstants.NO_RESULT_ICON), CellType.NO_RESULT.getFlagStr4None()); @@ -424,24 +440,25 @@ public class AlphaFineFrame extends JFrame { resultPane.add(new HelpDocumentNoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.DOCUMENT.getFlagStr4None()); resultPane.add(TemplateShopPane.getInstance(), CellType.TEMPLATE_SHOP.getFlagStr4None()); resultPane.add(new NetWorkFailedPane(this::reSearch), AlphaFineConstants.NETWORK_ERROR); - + //resultPane.setBackground(Color.WHITE); // label区,border layout labelPane = new JPanel(new BorderLayout()); - labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); labelPane.setBackground(Color.WHITE); labelContentPane = new JPanel(new BorderLayout()); tabLabel = createTabLabel(AlphaFineConstants.PRODUCT_NEWS); labelWestPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); labelWestPane.add(tabLabel); + labelWestPane.setOpaque(false); labelContentPane.add(labelWestPane, BorderLayout.WEST); + labelEastPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); // 一键已读 readLabel = new UILabel(ONE_CLICK_READ); readLabel.setHorizontalAlignment(SwingConstants.RIGHT); readLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); - readLabel.setPreferredSize(new Dimension(100, 30)); - readLabel.setForeground(UIConstants.FLESH_BLUE); + readLabel.setPreferredSize(FineUIScale.createScaleDimension(100, 30)); + readLabel.setForeground(FLESH_BLUE); readLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { @@ -450,14 +467,18 @@ public class AlphaFineFrame extends JFrame { } }); labelEastPane.add(readLabel); + labelEastPane.setOpaque(false); labelContentPane.add(labelEastPane, BorderLayout.EAST); - labelContentPane.setBackground(new Color(245, 245, 247)); + labelContentPane.setBackground(FineUIUtils.getUIColor("FineTabbedPane.background", "fill.gray")); labelPane.add(labelContentPane); - labelPane.setPreferredSize(new Dimension(AlphaFineConstants.FULL_SIZE.width, 30)); + labelPane.setPreferredSize(new Dimension(AlphaFineConstants.FULL_SIZE.width, FineUIScale.scale(28))); // tab区 flow layout - tabPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 10)); - tabPane.setBackground(Color.WHITE); + tabPane = new JPanel(new BorderLayout()); + Row tabRow = new Row(); + tabRow.setSpacing(20); + tabPane.add(tabRow); + tabPane.setOpaque(false); List selectedLabelList = createSelectedLabelList(); selectedTab = null; for (SelectedLabel label : selectedLabelList) { @@ -472,19 +493,22 @@ public class AlphaFineFrame extends JFrame { } for (SelectedLabel label : selectedLabelList) { label.addMouseListener(createMouseListener(selectedLabelList, label, tabPane, tabLabel, readLabel)); - tabPane.add(label); + tabRow.add(label); } - showPane.add(tabPane, BorderLayout.NORTH); - showPane.add(labelPane, BorderLayout.CENTER); - showPane.add(resultPane, BorderLayout.SOUTH); + showPane.setBackground(Color.WHITE); + showPane.setBorder(new ScaledEmptyBorder(0, 20, 0, 20)); + showPane.add(column(10, + cell(tabPane), + cell(labelPane), + cell(resultPane) + ).getComponent()); return showPane; } private UILabel createTabLabel(String labelName) { - UILabel label = new UILabel(labelName); - label.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); - label.setPreferredSize(new Dimension(60, 30)); - label.setForeground(AlphaFineConstants.LABEL_SELECTED); + UILabel label = new UILabel(labelName, FineUIStyle.STYLE_PRIMARY); + label.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); + label.setPreferredSize(FineUIScale.createScaleDimension(60, 30)); return label; } @@ -725,12 +749,7 @@ public class AlphaFineFrame extends JFrame { } private void initSearchTextField() { - searchTextField = new AlphaFineTextField(PLACE_HOLDER); - initTextFieldListener(); - searchTextField.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); - searchTextField.setBackground(Color.WHITE); - searchTextField.setPreferredSize(new Dimension(300, 60)); - searchTextField.setBorder(null); + } private void initTextFieldListener() { @@ -963,23 +982,6 @@ public class AlphaFineFrame extends JFrame { return searchText; } - private UIButton createButton(Icon icon) { - UIButton button = new UIButton() { - @Override - public void paintComponent(Graphics g) { - g.setColor(Color.WHITE); - g.fillRect(0, 0, getSize().width, getSize().height); - super.paintComponent(g); - } - }; - button.setPreferredSize(new Dimension(20, 20)); - button.setIcon(icon); - button.set4ToolbarButton(); - button.setBorderPainted(false); - button.setRolloverEnabled(false); - return button; - } - /** * 设置面板位置 * diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java index a8f51641c6..b59c1ef928 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java @@ -1,13 +1,14 @@ package com.fr.design.mainframe.alphafine.component; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.actions.help.alphafine.AlphaFineConstants; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.utils.DesignUtils; -import javax.swing.BorderFactory; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListCellRenderer; @@ -32,17 +33,17 @@ public class ProductNewsContentCellRender implements ListCellRenderer { /** * 透明灰色背景 Y方向偏移 */ - private static final int GRAY_BACKGROUND_Y_GAP = 39; + private static final int GRAY_BACKGROUND_Y_GAP = FineUIScale.scale(42); /** * 透明灰色背景 高度 */ - private static final int GRAY_BACKGROUND_HEIGHT = 23; + private static final int GRAY_BACKGROUND_HEIGHT = FineUIScale.scale(24); /** * 单行产品动态的高度与宽度尺寸 */ - private static final Dimension DEFAULT_DIMENSION = new Dimension(500, 100); + private static final Dimension DEFAULT_DIMENSION = FineUIScale.createScaleDimension(600, 100); private String[] segmentationResult; @@ -62,16 +63,16 @@ public class ProductNewsContentCellRender implements ListCellRenderer { boolean cellHasFocus) { ProductNews productNews = (ProductNews) value; JPanel panel = new JPanel(new BorderLayout()); - panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + panel.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); panel.setBackground(Color.WHITE); panel.add(new ProductNewsImagePanel(productNews), BorderLayout.WEST); JPanel textPane = new JPanel(new BorderLayout()); - textPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 0)); + textPane.setBorder(new ScaledEmptyBorder(0, 10, 10, 0)); UILabel titleLabel = new UILabel(AlphaFineUtil.highLightModelName(productNews.getTitle(), segmentationResult)); - titleLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(20)); + titleLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(16)); if (productNewsList.getHoverIndex() == index) { - titleLabel.setForeground(UIConstants.FLESH_BLUE); + titleLabel.setForeground(FlatUIUtils.getUIColor("brand.normal", Color.BLUE)); } textPane.add(titleLabel, BorderLayout.NORTH); @@ -89,7 +90,7 @@ public class ProductNewsContentCellRender implements ListCellRenderer { UILabel dateLabel = new UILabel(DATE_FORMAT.format(productNews.getPushDate())); dateLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); - dateLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + dateLabel.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); infoPane.setBackground(Color.WHITE); infoPane.add(dateLabel, BorderLayout.CENTER); textPane.setBackground(Color.WHITE); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java index 5e29eed073..e9f951e430 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java @@ -1,9 +1,9 @@ package com.fr.design.mainframe.alphafine.component; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.actions.help.alphafine.AlphaFineConstants; import com.fr.design.gui.icontainer.UIScrollPane; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Color; @@ -22,7 +22,7 @@ public class ProductNewsSearchResultPane extends JPanel { productNewsList = new ProductNewsList(); UIScrollPane scrollPane = new UIScrollPane(productNewsList); scrollPane.setBackground(Color.WHITE); - scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); + scrollPane.setBorder(new ScaledEmptyBorder(10, 20, 0, 20)); productNewsList.setCellRenderer(new ProductNewsContentCellRender(segmentationResult, productNewsList)); this.setLayout(new BorderLayout()); this.setBackground(Color.WHITE); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchHintPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchHintPane.java index 83a2fdffcd..5208e56d3b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchHintPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchHintPane.java @@ -1,24 +1,27 @@ package com.fr.design.mainframe.alphafine.component; -import com.fr.base.svg.IconUtils; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; import com.fr.common.util.Collections; -import com.fr.design.actions.help.alphafine.AlphaFineConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.utils.DesignUtils; import javax.swing.BorderFactory; import javax.swing.Icon; -import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -import java.awt.Dimension; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.fix; + /** * alphafine - 搜索提示面板 * @@ -30,11 +33,7 @@ public class SearchHintPane extends JPanel { private static final String TITLE = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Search_Title"); private static final String RECOMMEND = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend_Search"); - private static final Icon ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/search_hint.svg"); - private static final int HEIGHT = 200; - private static final int WIDTH = 300; - private static final int TITLE_LABEL_HEIGHT = 30; - private static final int TITLE_FONT_SIZE = 14; + private static final Icon ICON = new LazyIcon("search_hint", 110); public SearchHintPane() { this(new ArrayList<>()); @@ -48,31 +47,23 @@ public class SearchHintPane extends JPanel { setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(40,0,0,0)); setBackground(Color.white); - setPreferredSize(new Dimension(WIDTH, HEIGHT)); - setAlignmentY(SwingConstants.CENTER); UILabel image = new UILabel(); - image.setPreferredSize(new Dimension(150, 111)); - image.setHorizontalAlignment(SwingConstants.CENTER); + image.setPreferredSize(FineUIScale.createScaleDimension(110, 110)); image.setIcon(icon); - image.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - add(image, BorderLayout.NORTH); - add(generateDescription(title), BorderLayout.CENTER); - add(generateHintsLabel(hints), BorderLayout.SOUTH); - } - - protected Component generateDescription(String title) { - JLabel description = new JLabel(title); - description.setForeground(AlphaFineConstants.MEDIUM_GRAY); - description.setFont(DesignUtils.getDefaultGUIFont().applySize(TITLE_FONT_SIZE)); - description.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - description.setHorizontalAlignment(SwingConstants.CENTER); - description.setPreferredSize(new Dimension(WIDTH, TITLE_LABEL_HEIGHT)); - return description; + add(column( + flex(), + row(flex(), cell(image), flex()), + fix(4), + row(flex(), cell(new UILabel(title, FineUIStyle.LABEL_DISABLED)), flex()), + fix(10), + row(flex(), cell(generateHintsLabel(hints)), flex()), + flex() + ).getComponent()); } private Component generateHintsLabel(List hints) { if (Collections.isEmpty(hints)) { - return new JLabel(); + return new UILabel(); } return new RecommendSearchLabel(RECOMMEND, hints); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchListModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchListModel.java index f6948a57d3..f4f27cd694 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchListModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchListModel.java @@ -14,7 +14,6 @@ import javax.swing.DefaultListModel; */ public class SearchListModel extends DefaultListModel { - private static final int MAX_SHOW_SIZE = 12; private static final long serialVersionUID = 7230585307439551228L; @@ -47,12 +46,6 @@ public class SearchListModel extends DefaultListModel { @Override protected void fireContentsChanged(Object source, int index0, int index1) { - if (myDelegate.size() > MAX_SHOW_SIZE) { - leftSearchResultPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); - leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 2)); - } else { - leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - } super.fireContentsChanged(source, index0, index1); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java index b3fe2dc5b7..3d7016aa85 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.alphafine.component; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.actions.help.alphafine.AlphaFineConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineUtil; @@ -7,7 +9,6 @@ import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListCellRenderer; @@ -23,7 +24,7 @@ import java.awt.Dimension; */ public class SearchResultContentCellRender implements ListCellRenderer { - private static final int OFFSET = 45; + private static final int OFFSET = FineUIScale.scale(45); private static final String SELECTED_PATH = AlphaFineConstants.IMAGE_URL + "selected"; private static final String CELL_PATH = AlphaFineConstants.IMAGE_URL + "alphafine"; private static final String SUFFIX = ".png"; @@ -41,8 +42,8 @@ public class SearchResultContentCellRender implements ListCellRenderer { AlphaCellModel model = (AlphaCellModel) value; JPanel panel = new JPanel(new BorderLayout()); - panel.setBackground(null); - panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + panel.setBackground(Color.WHITE); + panel.setBorder(new ScaledEmptyBorder(0,10,0,0)); // 图标icon 样式 UILabel iconLabel = new UILabel(); if (isSelected) { @@ -56,7 +57,6 @@ public class SearchResultContentCellRender implements ListCellRenderer { String iconUrl = CELL_PATH + model.getType().getTypeValue() + SUFFIX; iconLabel.setIcon(IOUtils.readIcon(iconUrl)); } - iconLabel.setFont(AlphaFineConstants.MEDIUM_FONT); // 内容详情label 样式 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java index 642a0da2b2..a94abd33a1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.component; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.actions.help.alphafine.AlphaFineConstants; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.mainframe.alphafine.model.SearchResult; @@ -8,7 +9,9 @@ import com.fr.design.mainframe.alphafine.preview.ResultShowPane; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; /** * @author hades @@ -26,19 +29,17 @@ public class SearchResultPane extends JPanel { public SearchResultPane(String[] segmentationResult, ResultShowPane rightSearchResultPane) { searchResultList = new AlphaFineList(); + searchResultList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); searchResultList.setFixedCellHeight(AlphaFineConstants.CELL_HEIGHT); leftSearchResultPane = new UIScrollPane(searchResultList); - leftSearchResultPane.setBorder(null); - leftSearchResultPane.setBackground(Color.WHITE); - leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); + searchListModel = new SearchListModel(new SearchResult(), searchResultList, leftSearchResultPane); searchResultList.setModel(searchListModel); searchResultList.setCellRenderer(new SearchResultContentCellRender(segmentationResult)); searchResultList.setResultShowPane(rightSearchResultPane); - this.setPreferredSize(AlphaFineConstants.CONTENT_SIZE); this.setLayout(new BorderLayout()); - this.add(leftSearchResultPane, BorderLayout.WEST); - this.add(rightSearchResultPane, BorderLayout.EAST); + this.add(row(cell(leftSearchResultPane).weight(1), cell(rightSearchResultPane).weight(1)).getComponent()); + this.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePageGridPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePageGridPane.java index fc04587690..177ce2859c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePageGridPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePageGridPane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.alphafine.component; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.svg.IconUtils; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.TableLayoutHelper; @@ -38,12 +40,11 @@ public class TemplateResourcePageGridPane extends JPanel { List scrollPanes = new ArrayList<>(); private static final int PAGE_MAX_SIZE = 12; - private static final int TABLE_MAX_ROW_COUNT = 4; private static final int TABLE_COL_COUNT = 3; - private static final int TABLE_VGAP = 15; - private static final int TABLE_HGAP = 15; - private static final int RESOURCE_WIDTH = 197; - private static final int RESOURCE_HEIGHT = 128; + private static final int TABLE_VGAP = FineUIScale.scale(15); + private static final int TABLE_HGAP = FineUIScale.scale(15); + private static final int RESOURCE_WIDTH = FineUIScale.scale(200); + private static final int RESOURCE_HEIGHT = FineUIScale.scale(132); public TemplateResourcePageGridPane(List templateResourceList) { this.data = templateResourceList; @@ -51,7 +52,7 @@ public class TemplateResourcePageGridPane extends JPanel { createPages(); initComponents(); this.setBackground(Color.WHITE); - this.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); + this.setBorder(new ScaledEmptyBorder(0,0,0,0)); switchPage(1); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePanel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePanel.java index 31652c405d..2e08c8b4c0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePanel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePanel.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.component; +import com.fine.theme.utils.FineUIScale; import com.fr.common.util.Strings; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.alphafine.model.TemplateResource; @@ -141,6 +142,6 @@ public class TemplateResourcePanel extends JPanel { @Override public Dimension getPreferredSize() { - return new Dimension(180, 90); + return FineUIScale.createScaleDimension(200, 132); } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java index e32e6dd249..81d3971b2d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java @@ -1,8 +1,11 @@ package com.fr.design.mainframe.alphafine.preview; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.actions.help.alphafine.AlphaFineConstants; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.component.ProductNewsContentCellRender; @@ -10,18 +13,22 @@ import com.fr.design.mainframe.alphafine.component.ProductNewsList; import com.fr.design.mainframe.alphafine.exception.AlphaFineNetworkException; import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; -import com.fr.design.utils.DesignUtils; import com.fr.log.FineLoggerFactory; -import javax.swing.BorderFactory; +import java.awt.BorderLayout; +import java.awt.Color; import javax.swing.DefaultListModel; import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.SwingWorker; -import java.awt.BorderLayout; -import java.awt.Color; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.fix; + /** * @author hades * @version 11.0 @@ -38,23 +45,18 @@ public class DefaultProductNewsPane extends JPanel { public DefaultProductNewsPane() { setLayout(new BorderLayout()); - this.add(createLoadingPane()); + this.add(createLoadingPane(), BorderLayout.CENTER); this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE); + this.setBackground(Color.WHITE); this.worker = createWorker(); this.worker.execute(); } - private JPanel createLoadingPane() { JPanel loadingPane = new JPanel(new BorderLayout()); - UILabel loadingLabel = new UILabel(LOADING); - loadingLabel.setForeground(AlphaFineConstants.MEDIUM_GRAY); - loadingLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); - loadingLabel.setBorder(BorderFactory.createEmptyBorder(0, 280, 0, 0)); UILabel loadingIconLabel = new UILabel(LOADING_ICON); - loadingIconLabel.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0)); - loadingPane.add(loadingIconLabel, BorderLayout.NORTH); - loadingPane.add(loadingLabel, BorderLayout.CENTER); + UILabel loadingLabel = new UILabel(LOADING, FineUIStyle.LABEL_DISABLED); + loadingPane.add(row(flex(),column(flex(), cell(loadingIconLabel), fix(20), cell(loadingLabel), flex()), flex()).getComponent()); loadingPane.setBackground(Color.WHITE); return loadingPane; } @@ -113,9 +115,16 @@ public class DefaultProductNewsPane extends JPanel { ProductNewsList productNewsJList = new ProductNewsList(productNewsDefaultListModel); productNewsJList.setBackground(Color.WHITE); productNewsJList.setCellRenderer(new ProductNewsContentCellRender(productNewsJList)); - UIScrollPane scrollPane = new UIScrollPane(productNewsJList); + UIScrollPane scrollPane = new UIScrollPane(productNewsJList) { + @Override + public UIScrollBar createVerticalScrollBar() { + UIScrollBar verticalScrollBar = super.createVerticalScrollBar(); + verticalScrollBar.setOpaque(false); + return verticalScrollBar; + } + }; scrollPane.setBackground(Color.WHITE); - scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); + scrollPane.setBorder(new ScaledEmptyBorder(0, 0, 0, 0)); return scrollPane; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java index bee71f5859..05e034029f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java @@ -1,12 +1,13 @@ package com.fr.design.mainframe.alphafine.preview; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.actions.help.alphafine.AlphaFineCloudConstants; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.utils.BrowseUtils; -import com.fr.design.utils.DesignUtils; import com.fr.json.JSON; import com.fr.json.JSONArray; import com.fr.json.JSONFactory; @@ -22,7 +23,6 @@ import javax.swing.SwingWorker; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; -import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -74,7 +74,7 @@ public class HelpDocumentNoResultPane extends JPanel { HelpDocumentNoResultPane.this.removeAll(); try { if (get()) { - add(new NoResultPane(title, icon, 150), BorderLayout.CENTER); + add(new NoResultPane(title, icon, FineUIScale.scale(150))); add(createRecommendPane(linkMap), BorderLayout.EAST); } else { add(new NetWorkFailedPane(() -> { @@ -109,10 +109,10 @@ public class HelpDocumentNoResultPane extends JPanel { private JPanel createRecommendPane(Map linkMap) { JPanel wrapRecommendPane = new JPanel(new BorderLayout()); - wrapRecommendPane.setPreferredSize(new Dimension(200, 305)); + wrapRecommendPane.setPreferredSize(FineUIScale.createScaleDimension(200, 300)); JPanel recommendPane = new JPanel(); recommendPane.setLayout(new GridLayout(0, 1)); - recommendPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 130, 0)); + recommendPane.setBorder(new ScaledEmptyBorder(0, 5, 130, 0)); recommendPane.setBackground(Color.WHITE); recommendPane.add(new UILabel(RECOMMEND)); for (Map.Entry entry : linkMap.entrySet()) { @@ -122,7 +122,7 @@ public class HelpDocumentNoResultPane extends JPanel { JSeparator sep = new JSeparator(); sep.setOrientation(JSeparator.VERTICAL); sep.setLayout(new GridLayout(0, 1)); - sep.setPreferredSize(new Dimension(1, 285)); + sep.setPreferredSize(FineUIScale.createScaleDimension(1, 285)); sep.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); sep.add(new UILabel()); wrapRecommendPane.add(sep, BorderLayout.WEST); @@ -132,8 +132,8 @@ public class HelpDocumentNoResultPane extends JPanel { private JPanel createListLabel(String text, String link) { UILabel listLabel = new UILabel(String.format("%s", text)); - listLabel.setForeground(UIConstants.FLESH_BLUE); - listLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + listLabel.setForeground(FlatUIUtils.getUIColor("brand.normal", Color.BLUE)); + listLabel.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); listLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { @@ -145,13 +145,12 @@ public class HelpDocumentNoResultPane extends JPanel { JPanel listPane = new JPanel(new BorderLayout()); listPane.setBackground(Color.WHITE); UILabel dotLabel = new UILabel("·"); - dotLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - dotLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); + dotLabel.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); dotLabel.setHorizontalAlignment(SwingConstants.LEADING); dotLabel.setForeground(DOT_COLOR); listPane.add(dotLabel, BorderLayout.WEST); listPane.add(listLabel, BorderLayout.CENTER); - listPane.setPreferredSize(new Dimension(100, 20)); + listPane.setPreferredSize(FineUIScale.createScaleDimension(100, 20)); return listPane; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java index 33fb600f1a..a00f0e29c2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java @@ -1,18 +1,23 @@ package com.fr.design.mainframe.alphafine.preview; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; import com.fr.design.actions.help.alphafine.AlphaFineConstants; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.utils.DesignUtils; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; -import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.fix; + /** * Created by XiaXiang on 2017/8/14. */ @@ -24,22 +29,20 @@ public class NoResultPane extends JPanel { public NoResultPane(String title, Icon icon, int width) { setLayout(new BorderLayout()); setBackground(Color.white); - setPreferredSize(new Dimension(width, 305)); + setPreferredSize(new Dimension(width, FineUIScale.scale(300))); UILabel image = new UILabel(); - image.setPreferredSize(new Dimension(150, 111)); - image.setHorizontalAlignment(SwingConstants.CENTER); + image.setPreferredSize(FineUIScale.createScaleDimension(110, 110)); image.setIcon(icon); - image.setBorder(BorderFactory.createEmptyBorder(30, 0, 0, 0)); - add(image, BorderLayout.CENTER); - add(generateDescription(title), BorderLayout.SOUTH); + add(column( + flex(), + row(flex(), cell(image), flex()), + fix(4), + row(flex(), cell(generateDescription(title)), flex()), + flex() + ).getComponent()); } protected Component generateDescription(String title) { - UILabel description = new UILabel(title); - description.setForeground(AlphaFineConstants.MEDIUM_GRAY); - description.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); - description.setBorder(BorderFactory.createEmptyBorder(0, 0, 135, 0)); - description.setHorizontalAlignment(SwingConstants.CENTER); - return description; + return new UILabel(title, FineUIStyle.LABEL_DISABLED); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java index 0159959de2..2144e5d439 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java @@ -6,7 +6,6 @@ import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.DesignUtils; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; @@ -34,7 +33,7 @@ public class NoResultWithLinkPane extends NoResultPane { String[] para1 = title.split(TAG_A_START); String[] para2 = para1[1].split(TAG_A_END); - MessageWithLink messageWithLink = new MessageWithLink(para1[0], para2[0], AlphaFineCloudConstants.getAlphaGoToForum(), para2[1], Color.WHITE, DesignUtils.getDefaultGUIFont().applySize(14), AlphaFineConstants.MEDIUM_GRAY) { + MessageWithLink messageWithLink = new MessageWithLink(para1[0], para2[0], AlphaFineCloudConstants.getAlphaGoToForum(), para2[1], Color.WHITE, DesignUtils.getDefaultGUIFont(), AlphaFineConstants.MEDIUM_GRAY) { @Override protected void initListener(String link) { @@ -48,7 +47,6 @@ public class NoResultWithLinkPane extends NoResultPane { }); } }; - messageWithLink.setBorder(BorderFactory.createEmptyBorder(0, AlphaFineConstants.LEFT_WIDTH - 30, 135, 0)); return messageWithLink; }