From 4931a23c401d7b07708dc4219a266b793a749f95 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Wed, 17 Aug 2022 19:20:15 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-75093=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=20pr=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/RecommendSearchPane.java | 11 +++--- .../component/TemplateResourcePanel.java | 28 ++++++++++++-- .../TemplateResourceSearchWorkerManager.java | 37 +++++++++---------- 3 files changed, 49 insertions(+), 27 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchPane.java index b15dc2a215..27b0a56097 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchPane.java @@ -18,12 +18,12 @@ public class RecommendSearchPane extends TemplateResourcePanel { public RecommendSearchPane(TemplateResource templateResource) { super(); - this.templateResource = templateResource; + setTemplateResource(templateResource); initComponent(); this.setLayout(new BorderLayout()); this.setBorder(BorderFactory.createLineBorder(new Color(0xe8e8e9), 1)); - this.add(northPane, BorderLayout.NORTH); - this.add(southPane, BorderLayout.SOUTH); + this.add(getNorthPane(), BorderLayout.NORTH); + this.add(getSouthPane(), BorderLayout.SOUTH); } private void initComponent() { @@ -33,12 +33,13 @@ public class RecommendSearchPane extends TemplateResourcePanel { private void createSouthPane() { - southPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); + setSouthPane(new JPanel(new FlowLayout(FlowLayout.LEFT))); + JPanel southPane = getSouthPane(); southPane.setBackground(Color.WHITE); JLabel recommend = new JLabel(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Resource_Recommend_For_You")); southPane.add(recommend); - List searchKeys = templateResource.getRecommendSearchKey(); + List searchKeys = getTemplateResource().getRecommendSearchKey(); for (String key : searchKeys) { JLabel keyLabel = new SearchKeyLabel(key); 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 ea32ed635e..00ee75de75 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 @@ -18,9 +18,9 @@ import java.awt.event.MouseEvent; public class TemplateResourcePanel extends JPanel { - protected JPanel northPane; - protected JPanel southPane; - protected TemplateResource templateResource; + private JPanel northPane; + private JPanel southPane; + private TemplateResource templateResource; protected TemplateResourcePanel() { @@ -54,6 +54,28 @@ public class TemplateResourcePanel extends JPanel { } } + public JPanel getNorthPane() { + return northPane; + } + public JPanel getSouthPane() { + return southPane; + } + public TemplateResource getTemplateResource() { + return templateResource; + } + + public void setNorthPane(JPanel northPane) { + this.northPane = northPane; + } + + public void setSouthPane(JPanel southPane) { + this.southPane = southPane; + } + + public void setTemplateResource(TemplateResource templateResource) { + this.templateResource = templateResource; + } + private void initComponent() { createNorthPane(); createSouthPane(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/TemplateResourceSearchWorkerManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/TemplateResourceSearchWorkerManager.java index 03fbe39bb1..ac1ef39a78 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/TemplateResourceSearchWorkerManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/TemplateResourceSearchWorkerManager.java @@ -22,7 +22,7 @@ public class TemplateResourceSearchWorkerManager implements SearchManager { private AlphaFineFrame alphaFineFrame; - private volatile boolean hasSearchResult = true; + private volatile boolean searchResult = true; private volatile boolean searchOver = false; @@ -58,37 +58,36 @@ public class TemplateResourceSearchWorkerManager implements SearchManager { if (!isCancelled()) { try { List list = get(); - hasSearchResult = !list.isEmpty(); + searchResult = !list.isEmpty(); showResult(list); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } + }; + this.searchWorker.execute(); + } - void showResult(List list) { - if (networkError && !hasSearchResult) { - alphaFineFrame.showResult(AlphaFineConstants.NETWORK_ERROR); - return; - } + void showResult(List list) { + if (networkError && !searchResult) { + alphaFineFrame.showResult(AlphaFineConstants.NETWORK_ERROR); + return; + } - if (alphaFineFrame.getSelectedType() == cellType) { - if (!hasSearchResult) { - alphaFineFrame.showResult(CellType.NO_RESULT.getFlagStr4None()); - } else { - TemplateShopPane.getInstance().refreshPagePane(list); - AlphaFineHelper.getAlphaFineDialog().showResult(cellType.getFlagStr4None()); - } - } + if (alphaFineFrame.getSelectedType() == cellType) { + if (!searchResult) { + alphaFineFrame.showResult(CellType.NO_RESULT.getFlagStr4None()); + } else { + TemplateShopPane.getInstance().refreshPagePane(list); + AlphaFineHelper.getAlphaFineDialog().showResult(cellType.getFlagStr4None()); } - - }; - this.searchWorker.execute(); + } } @Override public boolean hasSearchResult() { - return hasSearchResult; + return searchResult; } @Override