diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 6c8e2f1199..763c822a9f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -4,13 +4,17 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.NoResultModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.impl.HotIssuesManager; +import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager; - +import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManeger; import com.fr.general.ProcessCanceledException; import com.fr.json.JSONArray; import com.fr.json.JSONException; @@ -104,7 +108,7 @@ public class AlphaFineHelper { public static SearchResult getModelListFromJSONArray(String result, String keyword) throws ClassCastException, JSONException { SearchResult allModelList = new SearchResult(); - JSONArray jsonArray = (JSONArray)JSONUtils.jsonDecode(result); + JSONArray jsonArray = (JSONArray) JSONUtils.jsonDecode(result); for (int i = 0; i < jsonArray.length(); i++) { AlphaFineHelper.checkCancel(); JSONObject jsonObject = jsonArray.optJSONObject(i); @@ -120,5 +124,25 @@ public class AlphaFineHelper { return allModelList; } - + /** + * 网络异常时的处理 + * @param object + * @return + */ + public static SearchResult getNoConnectList(Object object) { + SearchResult result = new SearchResult(); + if (object instanceof RecommendSearchManager) { + result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"))); + } else if (object instanceof DocumentSearchManager) { + result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"))); + } else if (object instanceof PluginSearchManager) { + result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"))); + } else if (object instanceof SimilarSearchManeger) { + result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Relation_Item"))); + } else if (object instanceof HotIssuesManager) { + return new SearchResult(); + } + result.add(AlphaFineHelper.NO_CONNECTION_MODEL); + return result; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index ffcac3f232..07f5b4d4ed 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -9,15 +9,14 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.stable.StringUtils; - import javax.swing.BorderFactory; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListCellRenderer; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; import java.awt.Component; +import java.awt.Dimension; /** * Created by XiaXiang on 2017/4/20. @@ -50,7 +49,6 @@ public class ContentCellRender implements ListCellRenderer { JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(null); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); - if (model.hasAction()) { if (isSelected) { titleLabel.setText(StringUtils.BLANK + model.getName()); @@ -63,7 +61,6 @@ public class ContentCellRender implements ListCellRenderer { titleLabel.setIcon(IconLoader.getIcon(iconUrl)); } } else { - titleLabel.setText(highLightModelName(model.getName(), segmentationResult)); String iconUrl = CELL_PATH + model.getType().getTypeValue() + SUFFIX; if (value instanceof RobotModel && ((RobotModel) value).isHotItemModel()) { @@ -74,6 +71,7 @@ public class ContentCellRender implements ListCellRenderer { } } else { + titleLabel.setText(model.getName()); titleLabel.setIcon(null); titleLabel.setForeground(AlphaFineConstants.MEDIUM_GRAY); } @@ -115,7 +113,11 @@ public class ContentCellRender implements ListCellRenderer { modelName = modelName.replaceAll(strings[i], primaryStr); } } - modelName = "" + modelName.replaceAll("\\|", "") + ""; + modelName = "" + modelName.replaceAll("\\|", StringUtils.EMPTY) + ""; return modelName; } 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 7fd1dc09c5..10a3387e81 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 @@ -19,7 +19,6 @@ import com.fr.design.mainframe.alphafine.cell.model.PluginModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.model.SearchResult; -import com.fr.design.mainframe.alphafine.preview.ContainsCirclePane; import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane; import com.fr.design.mainframe.alphafine.preview.FilePreviewPane; import com.fr.design.mainframe.alphafine.preview.NoResultPane; @@ -40,6 +39,7 @@ import com.fr.form.main.Form; import com.fr.form.main.FormIO; import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; +import com.fr.general.http.HttpToolbox; import com.fr.io.TemplateWorkBookIO; import com.fr.io.exporter.ImageExporter; import com.fr.json.JSONException; @@ -49,6 +49,7 @@ import com.fr.main.impl.WorkBook; import com.fr.stable.CodeUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.third.org.apache.http.client.methods.HttpGet; import javax.imageio.ImageIO; import javax.swing.BorderFactory; @@ -142,6 +143,7 @@ public class AlphaFineDialog extends UIDialog { private static String beforeSearchStr = ""; private static boolean alreadySearch = false; private static boolean alreadyInitHot = false; + public static String[][] data; public AlphaFineDialog(Frame parent, boolean forceOpen) { super(parent); @@ -224,6 +226,7 @@ public class AlphaFineDialog extends UIDialog { * 初始化热门界面 */ private void initHotPane() { + removeHotPane(); hotPane = new JPanel(); hotPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); hotPane.setPreferredSize(AlphaFineConstants.CONTENT_SIZE); @@ -232,25 +235,28 @@ public class AlphaFineDialog extends UIDialog { UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot")); uiLabel.setFont(AlphaFineConstants.SMALL_FONT); uiLabel.setForeground(AlphaFineConstants.DARK_GRAY); - JPanel panel = new JPanel(); - - hotPane.add(uiLabel, BorderLayout.NORTH); - hotPane.add(panel, BorderLayout.CENTER); GridLayout gridLayout = new GridLayout(2, 3, 3, 3); + JPanel panel = new JPanel(); panel.setLayout(gridLayout); - - String[][] ss = HotIssuesManager.getInstance().getHotIssues(); - - if(ss != null){ - for (int i = 0; i < ss.length; i++) { - panel.add(new HotIssueJpanel(ss[i], i + 1)); + try { + HttpGet getHelp = new HttpGet(AlphaFineConstants.ALPHA_HOT_SEARCH); + HttpToolbox.getHttpClient(AlphaFineConstants.ALPHA_HOT_SEARCH).execute(getHelp).getStatusLine(); + if (data == null) { + data = HotIssuesManager.getInstance().getHotIssues(); } - }else { + for (int i = 0; i < data.length; i++) { + panel.add(new HotIssueJpanel(data[i], i + 1)); + } + } catch (Exception e) { + data = null; for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) { - panel.add(new HotIssueJpanel(new String[]{" "}, i + 1)); + panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1)); } } + + hotPane.add(uiLabel, BorderLayout.NORTH); + hotPane.add(panel, BorderLayout.CENTER); add(hotPane, BorderLayout.SOUTH); setSize(AlphaFineConstants.FULL_SIZE); } @@ -313,10 +319,8 @@ public class AlphaFineDialog extends UIDialog { return; } if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { - if (hotPane == null) { - initHotPane(); - } - }else{ + initHotPane(); + } else { removeHotPane(); setSize(AlphaFineConstants.FIELD_SIZE); refreshContainer(); @@ -706,19 +710,19 @@ public class AlphaFineDialog extends UIDialog { this.showWorker = new SwingWorker() { @Override protected String doInBackground() { - if(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item").equals((selectedValue).getName())){ + if (com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item").equals((selectedValue).getName())) { return StringUtils.EMPTY; } String content = RobotModel.getContent((selectedValue).getName()); - if(StringUtils.isNotEmpty(content)){ + if (StringUtils.isNotEmpty(content)) { //1.去掉小帆底部的信息。2.修改链接标签,使点击能够正常跳转。 content = content.replaceAll(AlphaFineConstants.BOTTOM_REGEX_FIRST, StringUtils.EMPTY) .replaceAll(AlphaFineConstants.BOTTOM_REGEX_SECOND, StringUtils.EMPTY) - .replaceAll(AlphaFineConstants.LINK_REGEX,StringUtils.EMPTY) - .replaceAll("'\\)",StringUtils.EMPTY) - .replaceAll(AlphaFineConstants.LINK_REGEX_ANOTHER,StringUtils.EMPTY); + .replaceAll(AlphaFineConstants.LINK_REGEX, StringUtils.EMPTY) + .replaceAll("'\\)", StringUtils.EMPTY) + .replaceAll(AlphaFineConstants.LINK_REGEX_ANOTHER, StringUtils.EMPTY); return content; - }else{ + } else { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item"); } } @@ -816,11 +820,9 @@ public class AlphaFineDialog extends UIDialog { removeSearchResult(); refreshContainer(); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { - if (hotPane == null) { - initHotPane(); - setSize(AlphaFineConstants.FULL_SIZE); - } - }else{ + initHotPane(); + setSize(AlphaFineConstants.FULL_SIZE); + } else { setSize(AlphaFineConstants.FIELD_SIZE); } refreshContainer(); @@ -834,17 +836,17 @@ public class AlphaFineDialog extends UIDialog { refreshContainer(); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedSegmentationCheckbox()) { //是高级搜索 - if(searchTextField.getText().toLowerCase().startsWith(ADVANCED_SEARCH_MARK)){ + if (searchTextField.getText().toLowerCase().startsWith(ADVANCED_SEARCH_MARK)) { segmentationResult = SegmentationManager.getInstance().startSegmentation(getStoreText(searchTextField.getText().toLowerCase())); } //是普通搜索 - else{ + else { segmentationResult = SegmentationManager.getInstance().startSegmentation(searchTextField.getText().toLowerCase()); } } else { - if(StringUtils.isEmpty(getRealSearchText(searchTextField.getText()))){ + if (StringUtils.isEmpty(getRealSearchText(searchTextField.getText()))) { segmentationResult = null; - }else{ + } else { segmentationResult = new String[]{getRealSearchText(searchTextField.getText())}; } } @@ -867,7 +869,7 @@ public class AlphaFineDialog extends UIDialog { /** * 去除特殊字符,空格等 */ - private String getRealSearchText(String searchText){ + private String getRealSearchText(String searchText) { searchText = searchText.toLowerCase(); Pattern p = Pattern.compile(AlphaFineConstants.SPECIAL_CHARACTER_REGEX); Matcher m = p.matcher(searchText); @@ -936,7 +938,7 @@ public class AlphaFineDialog extends UIDialog { * @param cellModel */ private void saveLocalHistory(final AlphaCellModel cellModel) { - if(cellModel instanceof BottomModel){ + if (cellModel instanceof BottomModel) { return; } Thread sendThread = new Thread(new Runnable() { @@ -1170,7 +1172,7 @@ public class AlphaFineDialog extends UIDialog { } else if (e.getClickCount() == 1) { if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { dealWithMoreOrLessResult(selectedIndex, (MoreModel) selectedValue); - }else if(selectedValue instanceof BottomModel){ + } else if (selectedValue instanceof BottomModel) { dealWithSearchResult(selectedValue); } } @@ -1198,6 +1200,7 @@ public class AlphaFineDialog extends UIDialog { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } + @Override public void mouseDragged(MouseEvent e) { } @@ -1330,12 +1333,12 @@ public class AlphaFineDialog extends UIDialog { protected Object doInBackground() throws Exception { resetContainer(); - if(modeList.size() == ONLY_ONE_AVAILABLE_MODEL && "".equals(modeList.get(1).getName())){ + if (modeList.size() == ONLY_ONE_AVAILABLE_MODEL && "".equals(modeList.get(1).getName())) { RobotModel model = new RobotModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item"), null); searchListModel.addElement(model); - }else { + } else { for (AlphaCellModel object : modeList) { - if(!searchListModel.contains(object)){ + if (!searchListModel.contains(object)) { searchListModel.addElement(object); } } @@ -1363,6 +1366,7 @@ public class AlphaFineDialog extends UIDialog { hotPane = null; } } + /** * 增加返回面板 */ @@ -1382,11 +1386,9 @@ public class AlphaFineDialog extends UIDialog { searchResultPane = null; } if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { - if (hotPane == null) { - initHotPane(); - } + initHotPane(); setSize(AlphaFineConstants.FULL_SIZE); - }else{ + } else { setSize(AlphaFineConstants.FIELD_SIZE); } refreshContainer(); @@ -1407,14 +1409,19 @@ public class AlphaFineDialog extends UIDialog { this.setSize(AlphaFineConstants.HOT_ISSUES_JAPNEL_SIZE); JPanel pane1 = new JPanel(new BorderLayout()); - ContainsCirclePane circle = new ContainsCirclePane(pngIndex); - circle.setBorder(BorderFactory.createEmptyBorder(20,0,10,0)); - pane1.add(circle, BorderLayout.NORTH); + 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)); + pane1.add(iconLabel, BorderLayout.NORTH); add(pane1, BorderLayout.NORTH); JPanel centerPanel = new JPanel(new BorderLayout()); centerPanel.setBackground(Color.white); UILabel title = new UILabel(); + if (StringUtils.isEmpty(str[0])) { + title.setText(StringUtils.EMPTY); + } title.setText(str[0]); title.setFont(AlphaFineConstants.MEDIUM_FONT_ANOTHER); title.setForeground(AlphaFineConstants.DARK_GRAY); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/ContainsCirclePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/ContainsCirclePane.java deleted file mode 100644 index 15076d5754..0000000000 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/ContainsCirclePane.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fr.design.mainframe.alphafine.preview; - -import com.bulenkov.iconloader.IconLoader; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.mainframe.alphafine.AlphaFineConstants; - -import javax.swing.JPanel; -import java.awt.Color; -import java.awt.Graphics; - -/** - * @Author alex.sung - * created by 2018.08.15 - */ -public class ContainsCirclePane extends JPanel { - - public ContainsCirclePane(int pngIndex) { - UILabel iconLabel = new UILabel(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + AlphaFineConstants.ALPHA_HOT_IMAGE_NAME + pngIndex + ".png")); - iconLabel.setPreferredSize(AlphaFineConstants.HOT_ICON_LABEL_SIZE); - iconLabel.setOpaque(true); - iconLabel.setBackground(Color.WHITE); - add(iconLabel); - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); - int height = AlphaFineConstants.HOT_ICON_LABEL_HEIGHT; - setBackground(Color.white); - int x0 = getSize().width / 2; - int y0 = height / 2 + 23; - int r = height / 2 + 9; - g.setColor(AlphaFineConstants.LIGHT_GRAY); - g.drawOval(x0 - r, y0 - r, r * 2, r * 2); - } -} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java index b8ba403aa8..cb1f91cda7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java @@ -6,6 +6,7 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.DocumentModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; +import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.http.HttpToolbox; @@ -52,6 +53,11 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { @Override public SearchResult getLessSearchResult(String[] searchText) { + if (ArrayUtils.isEmpty(searchText)) { + return new SearchResult(); + } else if (AlphaFineDialog.data == null) { + return AlphaFineHelper.getNoConnectList(instance); + } lessModelList = new SearchResult(); moreModelList = new SearchResult(); if (ArrayUtils.isEmpty(searchText)) { @@ -99,18 +105,6 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { return lessModelList; } - /** - * 无连接 - * - * @return - */ - private SearchResult getNoConnectList() { - SearchResult result = new SearchResult(); - result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"))); - result.add(AlphaFineHelper.NO_CONNECTION_MODEL); - return result; - } - @Override public SearchResult getMoreSearchResult(String searchText) { return moreModelList; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java index 181d794174..c1dd0ea820 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java @@ -12,7 +12,7 @@ import com.fr.json.JSONObject; import com.fr.json.JSONUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import java.io.IOException; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -73,7 +73,6 @@ public class HotIssuesManager { try { String result = HttpToolbox.get(AlphaFineConstants.ALPHA_HOT_SEARCH); - AlphaFineHelper.checkCancel(); JSONArray jsonArray = (JSONArray)JSONUtils.jsonDecode(result); if(jsonArray != null){ for (int i = 0; i < HOT_ITEM_NUM; i++) { @@ -82,10 +81,9 @@ public class HotIssuesManager { data[i] = getTitleStrings(jsonObject); } } - } catch (JSONException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error("hotissues search error: " + e.getMessage()); - } catch (IOException e) { - FineLoggerFactory.getLogger().error("hotissues search get result error: " + e.getMessage()); + return null; } return data; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index 4a78e34e35..5aafe29faf 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -6,6 +6,7 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.PluginModel; +import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.ComparatorUtils; @@ -99,6 +100,8 @@ public class PluginSearchManager implements AlphaFineSearchProvider { public SearchResult getLessSearchResult(String[] searchText) { if (ArrayUtils.isEmpty(searchText)) { return new SearchResult(); + } else if (AlphaFineDialog.data == null) { + return AlphaFineHelper.getNoConnectList(instance); } this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); @@ -147,13 +150,6 @@ public class PluginSearchManager implements AlphaFineSearchProvider { return this.lessModelList; } - private SearchResult getNoConnectList() { - SearchResult result = new SearchResult(); - result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"))); - result.add(AlphaFineHelper.NO_CONNECTION_MODEL); - return result; - } - @Override public SearchResult getMoreSearchResult(String searchText) { return this.moreModelList; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java index beac652fff..7a234838aa 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java @@ -8,6 +8,7 @@ import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; +import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.http.HttpToolbox; @@ -49,6 +50,8 @@ public class RecommendSearchManager implements AlphaFineSearchProvider { public SearchResult getLessSearchResult(String[] searchText) { if (ArrayUtils.isEmpty(searchText)) { return new SearchResult(); + } else if(AlphaFineDialog.data == null){ + return AlphaFineHelper.getNoConnectList(instance); } this.modelList = new SearchResult(); this.recommendModelList = new SearchResult(); @@ -56,7 +59,8 @@ public class RecommendSearchManager implements AlphaFineSearchProvider { for (int j = 0; j < searchText.length; j++) { searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY); try { - String result = HttpToolbox.get(AlphaFineConstants.SEARCH_API + CodeUtils.cjkEncode(searchText[j])); + String url = AlphaFineConstants.SEARCH_API + CodeUtils.cjkEncode(searchText[j]); + String result = HttpToolbox.get(url); AlphaFineHelper.checkCancel(); JSONObject jsonObject = new JSONObject(result); if ("success".equals(jsonObject.optString("status"))) { @@ -179,14 +183,6 @@ public class RecommendSearchManager implements AlphaFineSearchProvider { return RecentSearchManager.getInstance().getRecentModelList().contains(cellModel) || this.recommendModelList.contains(cellModel); } - private SearchResult getNoConnectList() { - SearchResult result = new SearchResult(); - result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"))); - result.add(AlphaFineHelper.NO_CONNECTION_MODEL); - return result; - } - - @Override public SearchResult getMoreSearchResult(String searchText) { return moreModelList; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java index fc2c173e0a..661eba0ff0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java @@ -6,19 +6,18 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel; +import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.http.HttpToolbox; -import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; -import com.fr.json.JSONUtils; import com.fr.log.FineLoggerFactory; -import java.io.IOException; - -import com.fr.stable.StringUtils; +import com.fr.stable.ArrayUtils; import com.fr.third.org.apache.commons.codec.digest.DigestUtils; +import java.io.IOException; + /** * Created by alex.sung on 2018/8/3. */ @@ -40,6 +39,11 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider { @Override public SearchResult getLessSearchResult(String[] searchText) { + if (ArrayUtils.isEmpty(searchText)) { + return new SearchResult(); + } else if (AlphaFineDialog.data == null) { + return AlphaFineHelper.getNoConnectList(instance); + } lessModelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { SearchResult allModelList = new SearchResult(); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java index 07ed1eaf9f..cc6154aec1 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java @@ -437,6 +437,8 @@ public class NativePrintSettingPane extends JPanel { pageMarginSettingPane.populate(nativePrintAttr.getMargin()); fitPaperSizeCheck.setSelected(nativePrintAttr.isFitPaperSize()); scalePercentField.setValue(nativePrintAttr.getScalePercent()); + + checkEnabled(); } public void update(NativePrintAttr nativePrintAttr) { diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1.png index a46dba3420..7f1f514add 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1@2x.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1@2x.png index 7263c72737..d16b39adfa 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1@2x.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1@2x.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2.png index fb5e7c60f1..e312a2a58f 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2@2x.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2@2x.png index 7c8d133c34..cb3fc0c51e 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2@2x.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2@2x.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3.png index 4313550571..7bf8c7ca9c 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3@2x.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3@2x.png index 761a362e91..74d612ba17 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3@2x.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3@2x.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4.png index ddfd50c8dc..784e25edb1 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4@2x.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4@2x.png index b504d2de22..d452fa90d9 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4@2x.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4@2x.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5.png index 23522960fe..706f04c3ab 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5@2x.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5@2x.png index aca56d637f..19b1c415df 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5@2x.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5@2x.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6.png index 66d6c9530b..ba8ced22cc 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6@2x.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6@2x.png index 84ede5a553..c60ecb7d4c 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6@2x.png and b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6@2x.png differ