From 8db8b207d2cbe79b0d45c8f5e95864d38523821a Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Tue, 20 Sep 2022 10:17:39 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-79093=20=E8=BF=90=E8=90=A5=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=8C=96=E4=BA=8C=E6=9C=9F=EF=BC=88=E9=81=97=E7=95=99?= =?UTF-8?q?=EF=BC=89=201=E3=80=81=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConfigManager.java | 46 ++++++++----------- .../alphafine/component/CustomSortPane.java | 17 +++---- .../help/alphafine/component/MenuLabel.java | 15 +++--- .../alphafine/component/MenuLabelPane.java | 3 +- .../component/RecommendSearchLabel.java | 5 +- .../alphafine/component/SearchHintPane.java | 3 +- .../alphafine/preview/DefaultContentPane.java | 5 +- .../preview/DefaultPluginContentPane.java | 10 ++-- .../manager/SearchProviderRegistry.java | 5 +- 9 files changed, 55 insertions(+), 54 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index 8661324bd6..c74ddaa65a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -29,6 +29,7 @@ import java.util.Stack; */ public class AlphaFineConfigManager implements XMLable { + public static final String COMMA = ","; private static final long serialVersionUID = -8170289826729582122L; private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager(); /** @@ -91,27 +92,20 @@ public class AlphaFineConfigManager implements XMLable { * 是否提醒 */ private boolean needRemind = true; - /** * 产品动态 */ private boolean productDynamics = true; - /** * 模板商城是否展示 - * */ + */ private boolean showTemplateShop = true; - - /** * tab页排序 * 默认排序:动态,模板商城,帮助文档,插件中心,功能,我的模板 - * */ + */ private String[] tabOrder; - public static final String COMMA = ","; - private Map actionSearchTextCache = new HashMap<>(8); - private String cacheBuildNO; @@ -207,7 +201,7 @@ public class AlphaFineConfigManager implements XMLable { if (ComparatorUtils.equals(reader.getTagName(), "history")) { String tmpVal = reader.getElementValue(); if (tmpVal != null) { - tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY); + tmpVal = tmpVal.replace("[", StringUtils.EMPTY).replace("]", StringUtils.EMPTY); Stack stack = new SizedStack<>(3); String[] historyList = tmpVal.split(","); for (String history : historyList) { @@ -231,7 +225,7 @@ public class AlphaFineConfigManager implements XMLable { if (ComparatorUtils.equals(reader.getTagName(), "readId")) { String tmpVal = reader.getElementValue(); if (tmpVal != null) { - tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY); + tmpVal = tmpVal.replace("[", StringUtils.EMPTY).replace("]", StringUtils.EMPTY); String[] idArr = tmpVal.split(","); Set setId = new HashSet<>(); for (String id : idArr) { @@ -329,7 +323,7 @@ public class AlphaFineConfigManager implements XMLable { /** * 返回默认排序 - * */ + */ private String getDefaultTabOrder() { return AlphaFineConstants.PRODUCT_NEWS + COMMA + AlphaFineConstants.TEMPLATE_SHOP + COMMA + AlphaFineConstants.HELP + COMMA + AlphaFineConstants.PLUGIN + COMMA + AlphaFineConstants.FUNCTION + COMMA + AlphaFineConstants.MY_TEMPLATES; } @@ -350,14 +344,14 @@ public class AlphaFineConfigManager implements XMLable { this.containDocument = containDocument; } - public void setContainMyTemplate(boolean containMyTemplate) { - this.containMyTemplate = containMyTemplate; - } - public boolean isContainMyTemplate() { return containMyTemplate; } + public void setContainMyTemplate(boolean containMyTemplate) { + this.containMyTemplate = containMyTemplate; + } + public boolean isContainTemplate() { return containTemplate; } @@ -478,6 +472,10 @@ public class AlphaFineConfigManager implements XMLable { return productDynamics && FRContext.isChineseEnv(); } + public void setProductDynamics(boolean productDynamics) { + this.productDynamics = productDynamics; + } + public boolean hasTemplateShop() { return showTemplateShop && FRContext.isChineseEnv(); } @@ -486,13 +484,9 @@ public class AlphaFineConfigManager implements XMLable { this.showTemplateShop = showTemplateShop; } - public void setProductDynamics(boolean productDynamics) { - this.productDynamics = productDynamics; - } - /** * 返回tab显示顺序 - * */ + */ public String[] getTabOrder() { if (tabOrder == null) { tabOrder = getDefaultTabOrder().split(COMMA); @@ -500,9 +494,13 @@ public class AlphaFineConfigManager implements XMLable { return tabOrder; } + public void setTabOrder(String[] tabOrder) { + this.tabOrder = tabOrder; + } + /** * getTabOrder的tostring - * */ + */ public String getTabOrderString() { StringBuilder sb = new StringBuilder(); for (String s : getTabOrder()) { @@ -510,8 +508,4 @@ public class AlphaFineConfigManager implements XMLable { } return sb.toString(); } - - public void setTabOrder(String[] tabOrder) { - this.tabOrder = tabOrder; - } } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java index e080b3e7c3..09415d5327 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java @@ -24,10 +24,11 @@ import java.util.Map; import java.util.function.Function; /** + * alphafine设置 - 搜索范围 - 自定义排序 - 弹出面板 + * * @author Link * @version 11.0 * Created by Link on 2022/9/18 - * alphafine设置 - 搜索范围 - 自定义排序 - 弹出面板 */ public class CustomSortPane extends JPanel { @@ -78,7 +79,7 @@ public class CustomSortPane extends JPanel { up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg")); down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg")); top.addActionListener(e -> { - SwingUtilities.invokeLater(()->{ + SwingUtilities.invokeLater(() -> { sortItemPane.setComponentZOrder(selectedLabel, 0); CustomSortPane.this.revalidate(); CustomSortPane.this.repaint(); @@ -87,7 +88,7 @@ public class CustomSortPane extends JPanel { }); bottom.addActionListener(e -> { - SwingUtilities.invokeLater(()->{ + SwingUtilities.invokeLater(() -> { sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentCount() - 1); CustomSortPane.this.revalidate(); CustomSortPane.this.repaint(); @@ -96,8 +97,8 @@ public class CustomSortPane extends JPanel { }); up.addActionListener(e -> { - SwingUtilities.invokeLater(()->{ - sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) - 1); + SwingUtilities.invokeLater(() -> { + sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) - 1); CustomSortPane.this.revalidate(); CustomSortPane.this.repaint(); refreshCurrentOrder(); @@ -105,7 +106,7 @@ public class CustomSortPane extends JPanel { }); down.addActionListener(e -> { - SwingUtilities.invokeLater(()->{ + SwingUtilities.invokeLater(() -> { sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) + 1); CustomSortPane.this.revalidate(); CustomSortPane.this.repaint(); @@ -157,7 +158,7 @@ public class CustomSortPane extends JPanel { // 计算当前排序 String[] newOrder = new String[currentTabOrder.length]; - Component[] components =sortItemPane.getComponents(); + Component[] components = sortItemPane.getComponents(); for (String s : exTab.keySet()) { newOrder[exTab.get(s)] = s; } @@ -165,7 +166,7 @@ public class CustomSortPane extends JPanel { int t = 0; for (int i = 0; i < newOrder.length; i++) { if (StringUtils.isEmpty(newOrder[i])) { - newOrder[i] = ((MenuLabel)components[t++]).getText(); + newOrder[i] = ((MenuLabel) components[t++]).getText(); } } parentPane.setCurrentOrder(newOrder); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java index dfe83b7083..96c7a17971 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java @@ -13,10 +13,11 @@ import java.awt.event.MouseListener; import java.util.function.Function; /** + * 菜单选项label + * * @author Link * @version 11.0 * Created by Link on 2022/9/18 - * 菜单选项label */ public class MenuLabel extends UILabel { @@ -27,7 +28,7 @@ public class MenuLabel extends UILabel { private static final int WIDTH = 147; private MenuLabelPane parentMenu; - private Function function; + private final Function function; private boolean selected; public MenuLabel(String text, Function function) { @@ -46,11 +47,15 @@ public class MenuLabel extends UILabel { public void setUI(LabelUI ui) { super.setUI(ui); this.setBackground(BACKGROUND_COLOR); - this.setBorder(BorderFactory.createEmptyBorder(2,10,1,10)); + this.setBorder(BorderFactory.createEmptyBorder(2, 10, 1, 10)); this.setPreferredSize(new Dimension(WIDTH, HEIGHT)); this.setFont(DesignUtils.getDefaultGUIFont().applySize(12)); } + public boolean isSelected() { + return selected; + } + public void setSelected(boolean selected) { if (selected) { parentMenu.setNoneSelected(); @@ -63,10 +68,6 @@ public class MenuLabel extends UILabel { } } - public boolean isSelected() { - return selected; - } - MouseListener createMouseListener() { return new MouseAdapter() { @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java index 83a15ff5d2..929f54837c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java @@ -5,10 +5,11 @@ import java.awt.FlowLayout; import java.util.List; /** + * 简单菜单面板 + * * @author Link * @version 11.0 * Created by Link on 2022/9/18 - * 简单菜单面板 */ public class MenuLabelPane extends JPanel { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchLabel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchLabel.java index acf3e1f3a5..8d3b760706 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchLabel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchLabel.java @@ -12,10 +12,11 @@ import java.awt.event.MouseEvent; import java.util.List; /** + * alphaFine - 推荐搜索词标签 + * * @author Link * @version 11.0 * Created by Link on 2022/9/19 - * alphaFine - 推荐搜索词标签 */ public class RecommendSearchLabel extends JPanel { @@ -36,7 +37,7 @@ public class RecommendSearchLabel extends JPanel { /** * 推荐搜索词,绑定alphaFine搜索事件 - * */ + */ public class SearchKeyLabel extends JLabel { String searchKey; 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 43394e0a7d..adc5fc8352 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 @@ -20,10 +20,11 @@ import java.util.ArrayList; import java.util.List; /** + * alphafine - 搜索提示面板 + * * @author Link * @version 11.0 * Created by Link on 2022/9/18 - * alphafine - 搜索提示面板 */ public class SearchHintPane extends JPanel { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultContentPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultContentPane.java index ef4487f7ea..56c14dc28a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultContentPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultContentPane.java @@ -11,10 +11,11 @@ import javax.swing.JPanel; import java.awt.BorderLayout; /** + * alphaFine - 默认展示页面 + * * @author Link * @version 11.0 * Created by Link on 2022/9/18 - * alphaFine - 默认展示页面 */ public class DefaultContentPane extends JPanel { @@ -25,7 +26,7 @@ public class DefaultContentPane extends JPanel { public DefaultContentPane(CellType cellType, AlphaFineFrame parentWindow) { this.setLayout(new BorderLayout()); this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE); - this.searchWorkerManager = new SearchWorkerManager( + this.searchWorkerManager = new SearchWorkerManager( cellType, searchTextBean -> SearchProviderRegistry.getSearchProvider(cellType).getDefaultResult(), parentWindow, diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultPluginContentPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultPluginContentPane.java index 87deed7a8c..fc9838e9fb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultPluginContentPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultPluginContentPane.java @@ -16,24 +16,24 @@ import java.util.ArrayList; import java.util.List; /** + * alphafine插件默认页 + * * @author Link * @version 11.0 * Created by Link on 2022/9/18 - * alphafine插件默认页 */ public class DefaultPluginContentPane extends DefaultContentPane { + private static final String[] HINTS = CloudCenter.getInstance().acquireConf("alphafine.plugin.recommend", "JS,API,JSON").split(","); // 左边展示内容,右边展示搜索提示 private SearchWorkerManager searchWorkerManager; private CellType cellType; - private static final String[] HINTS = CloudCenter.getInstance().acquireConf("alphafine.plugin.recommend", "JS,API,JSON").split(","); - public DefaultPluginContentPane(CellType cellType, AlphaFineFrame parentWindow) { super(); this.setLayout(new BorderLayout()); this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE); - new SwingWorker(){ + new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { add(new SearchLoadingPane()); @@ -53,7 +53,7 @@ public class DefaultPluginContentPane extends DefaultContentPane { for (String s : HINTS) { searchKeys.add(s); } - searchWorkerManager = new SearchWorkerManager( + searchWorkerManager = new SearchWorkerManager( cellType, searchTextBean -> SearchProviderRegistry.getSearchProvider(cellType).getDefaultResult(), parentWindow, diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/SearchProviderRegistry.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/SearchProviderRegistry.java index 0cf7abae95..02d1fc35c2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/SearchProviderRegistry.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/SearchProviderRegistry.java @@ -10,10 +10,11 @@ import java.util.HashMap; import java.util.Map; /** + * alphafine搜索提供者注册到这里 + * * @author Link * @version 11.0 * Created by Link on 2022/9/18 - * alphafine搜索提供者注册到这里 */ public class SearchProviderRegistry { private static Map map; @@ -27,7 +28,7 @@ public class SearchProviderRegistry { /** * 根据celltype获得对应searchProvider - * */ + */ public static AlphaFineSearchProvider getSearchProvider(CellType cellType) { return map.get(cellType); }