From a7befe9e3612a5f513ae1c1bb38bb449d5dace49 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 15 May 2017 15:04:12 +0800 Subject: [PATCH 01/28] rt --- .../src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 3c1b30ddaa..572de96a72 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -22,7 +22,7 @@ public class AlphaFineHelper { } public static String findFolderName (String text) { - String[] textArray = text.split(File.separator); + String[] textArray = text.split("/"); if (textArray != null && textArray.length > 1) { return textArray[textArray.length - 2]; From fee19f5913afbd1204d684b9d8a5d59dc6647d00 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 15 May 2017 15:13:03 +0800 Subject: [PATCH 02/28] rt --- .../alphafine/component/AlphaFineDialog.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 4f3899c599..3598bb5c77 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -44,6 +44,7 @@ import java.io.*; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.net.URLEncoder; import java.util.concurrent.ExecutionException; /** @@ -224,7 +225,6 @@ public class AlphaFineDialog extends UIDialog { } catch (InterruptedException e) { FRLogger.getLogger().error(e.getMessage()); } catch (ExecutionException e) { - searchResultList.setModel(null); FRLogger.getLogger().error(e.getMessage()); } @@ -284,7 +284,7 @@ public class AlphaFineDialog extends UIDialog { if (selectedValue instanceof FileModel) { final String fileName = ((FileModel) selectedValue).getFilePath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1); showDefaultPreviewPane(); - if (fileName.endsWith("frm")) { + if (fileName.endsWith(ProjectConstants.FRM_SUFFIX)) { if (this.searchWorker != null && !this.searchWorker.isDone()) { this.searchWorker.cancel(true); this.searchWorker = null; @@ -314,7 +314,7 @@ public class AlphaFineDialog extends UIDialog { } }; this.searchWorker.execute(); - } else if (fileName.endsWith("cpt")) { + } else if (fileName.endsWith(ProjectConstants.CPT_SUFFIX)) { if (this.searchWorker != null && !this.searchWorker.isDone()) { this.searchWorker.cancel(true); this.searchWorker = null; @@ -363,7 +363,7 @@ public class AlphaFineDialog extends UIDialog { this.searchWorker = new SwingWorker() { @Override protected Image doInBackground() throws Exception { - BufferedImage bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); + BufferedImage bufferedImage = ImageIO.read(new URL(URLEncoder.encode(((PluginModel) selectedValue).getImageUrl()))); return bufferedImage; } @@ -393,11 +393,11 @@ public class AlphaFineDialog extends UIDialog { private void HandleMoreOrLessResult(int index, MoreModel selectedValue) { if (selectedValue.getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"))) { selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowLess")); - rebuildList(index, selectedValue); + rebuildShowMoreList(index, selectedValue); } else { selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowAll")); - rebuildList(index, selectedValue); + rebuildShowMoreList(index, selectedValue); } } @@ -564,7 +564,7 @@ public class AlphaFineDialog extends UIDialog { } - private void rebuildList(int index, MoreModel selectedValue) { + private void rebuildShowMoreList(int index, MoreModel selectedValue) { SearchResult moreResult = getMoreResult(selectedValue); if((selectedValue).getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowLess"))) { for (int i = 0; i < moreResult.size(); i++) { @@ -583,6 +583,17 @@ public class AlphaFineDialog extends UIDialog { } + private void rebuildList() { + this.searchResultList.validate(); + this.searchResultList.repaint(); + validate(); + repaint(); + } + + private void updatePopup() { + + } + private SearchResult getMoreResult(MoreModel selectedValue) { SearchResult moreResult; switch (selectedValue.getType()) { From 7a187cd18290f4f28ed15e8b6b3e818ff246421f Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 15 May 2017 17:24:25 +0800 Subject: [PATCH 03/28] rt --- .../mainframe/alphafine/AlphaFineConstants.java | 6 ++++-- .../alphafine/component/AlphaFineDialog.java | 13 +++++++------ .../searchManager/PluginSearchManager.java | 12 +++++++++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index dd4aadcbcb..2ca448178b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -72,13 +72,15 @@ public class AlphaFineConstants { public static final String PLUGIN_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); - public static final String PLUGIN_IMAGE_URL = "http://shop.finereport.com/plugin/"; + public static final String PLUGIN_URL = "http://shop.finereport.com/plugin/"; - public static final String REUSE_IMAGE_URL = "http://shop.finereport.com/reuse/"; + public static final String REUSE_URL = "http://shop.finereport.com/reuse/"; public static final String DOCUMENT_DOC_URL = "http://help.finereport.com/doc-view-"; public static final String DOCUMENT_SEARCH_URL = "http://help.finereport.com/?api-search-title-"; + public static final String PLUGIN_IMAGE_URL = "http://shopres.finereport.com/"; + } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 3598bb5c77..8fd84be963 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -44,7 +44,6 @@ import java.io.*; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.net.URLEncoder; import java.util.concurrent.ExecutionException; /** @@ -363,17 +362,19 @@ public class AlphaFineDialog extends UIDialog { this.searchWorker = new SwingWorker() { @Override protected Image doInBackground() throws Exception { - BufferedImage bufferedImage = ImageIO.read(new URL(URLEncoder.encode(((PluginModel) selectedValue).getImageUrl()))); + BufferedImage bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); return bufferedImage; } @Override protected void done() { try { - rightSearchResultPane.removeAll(); - rightSearchResultPane.add(new PluginPreviewPane(((PluginModel) selectedValue).getName(), get(), ((PluginModel) selectedValue).getVersion(), ((PluginModel) selectedValue).getJartime(), ((PluginModel) selectedValue).getType(), ((PluginModel) selectedValue).getPrice())); - validate(); - repaint(); + if (!isCancelled()) { + rightSearchResultPane.removeAll(); + rightSearchResultPane.add(new PluginPreviewPane(((PluginModel) selectedValue).getName(), get(), ((PluginModel) selectedValue).getVersion(), ((PluginModel) selectedValue).getJartime(), ((PluginModel) selectedValue).getType(), ((PluginModel) selectedValue).getPrice())); + validate(); + repaint(); + } } catch (InterruptedException e) { FRLogger.getLogger().error(e.getMessage()); } catch (ExecutionException e) { diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java index b43317f06d..5e5410a790 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java @@ -14,6 +14,7 @@ import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; +import java.io.UnsupportedEncodingException; import java.net.URLEncoder; /** @@ -80,8 +81,13 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { JSONObject object = jsonArray.getJSONObject(i); String name = (String) object.get("name"); String content = ((String) object.get("description")); - String pluginUrl = AlphaFineConstants.REUSE_IMAGE_URL + object.get("id"); - String imageUrl = ((String) object.get("pic")); + String pluginUrl = AlphaFineConstants.REUSE_URL + object.get("id"); + String imageUrl = null; + try { + imageUrl = AlphaFineConstants.PLUGIN_IMAGE_URL + URLEncoder.encode(object.get("pic").toString().substring(AlphaFineConstants.PLUGIN_IMAGE_URL.length()), "utf8"); + } catch (UnsupportedEncodingException e) { + FRLogger.getLogger().error(e.getMessage()); + } String version = null; String jartime = null; CellType type = CellType.REUSE; @@ -90,7 +96,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { version = (String) object.get("version"); jartime = (String) object.get("jartime"); type = CellType.PLUGIN; - pluginUrl = AlphaFineConstants.PLUGIN_IMAGE_URL + object.get("id"); + pluginUrl = AlphaFineConstants.PLUGIN_URL + object.get("id"); } int price = (int) object.get("price"); return new PluginModel(name, content, pluginUrl, imageUrl, version, jartime, type, price); From e5d066a6b17135279ea0d12759433cfe9f3c5b00 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 15 May 2017 17:36:37 +0800 Subject: [PATCH 04/28] rt --- .../mainframe/alphafine/searchManager/FileSearchManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java index eded07189e..e502dea680 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java @@ -94,7 +94,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor { } } if (test && !isAlreadyContain) { - FileModel model = new FileModel(node.getName(), node.getEnvPath().substring(node.getName().length(), node.getEnvPath().length()),node.getEnvPath()); + FileModel model = new FileModel(node.getName(), node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length()), node.getEnvPath()); this.filterModelList.add(model); } reader.close(); From fecd0deb7d90dba391109f449684a2d9b32b09f5 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 16 May 2017 10:34:43 +0800 Subject: [PATCH 05/28] rt --- .../alphafine/component/AlphaFineDialog.java | 28 +-- .../xmlManager/RecentSearchManager.java | 194 ++++++++++++++++++ .../design/locale/designer_zh_CN.properties | 2 +- .../design/locale/designer_zh_TW.properties | 3 +- 4 files changed, 208 insertions(+), 19 deletions(-) create mode 100644 designer/src/com/fr/design/mainframe/alphafine/xmlManager/RecentSearchManager.java diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 8fd84be963..8a8ac6b5a6 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -19,6 +19,7 @@ import com.fr.design.mainframe.alphafine.previewPane.DocumentPreviewPane; import com.fr.design.mainframe.alphafine.previewPane.FilePreviewPane; import com.fr.design.mainframe.alphafine.previewPane.PluginPreviewPane; import com.fr.design.mainframe.alphafine.searchManager.*; +import com.fr.design.mainframe.alphafine.xmlManager.RecentSearchManager; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.form.main.Form; @@ -172,7 +173,7 @@ public class AlphaFineDialog extends UIDialog { private void showSearchResult(String searchText) { if (searchResultPane == null) { initSearchResultComponents(); - initListListener(); + initListListener(searchText); } initSearchWorker(searchText); } @@ -233,7 +234,7 @@ public class AlphaFineDialog extends UIDialog { this.searchWorker.execute(); } - private void initListListener() { + private void initListListener(final String searchText) { searchResultList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -244,11 +245,7 @@ public class AlphaFineDialog extends UIDialog { searchResultList.setSelectedIndex(i); doNavigate(selectedIndex); if (selectedValue instanceof AlphaCellModel) { - SearchResult originalResultList = LatestSearchManager.getLatestSearchManager().getLatestModelList(); - originalResultList.add(searchResultList.getSelectedValue()); - LatestSearchManager.getLatestSearchManager().setLatestModelList(originalResultList); - //保存最近搜索 - saveHistory(originalResultList); + saveHistory(searchText, (AlphaCellModel) selectedValue); } } else if (e.getClickCount() == 1) { if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { @@ -542,17 +539,14 @@ public class AlphaFineDialog extends UIDialog { } /** - * todo:保存到本地的逻辑待修改 - * @param searchResult + * 保存本地(本地常用) + * @param searchText + * @param cellModel */ - private void saveHistory(SearchResult searchResult) { - try { - ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(AlphaFineHelper.getInfoFile())); - os.writeObject(searchResult); - os.close(); - } catch (IOException e) { - FRLogger.getLogger().error(e.getMessage()); - } + private void saveHistory(String searchText, AlphaCellModel cellModel) { + RecentSearchManager recentSearchManager = RecentSearchManager.getInstance(); + recentSearchManager.getModelMap().put(cellModel.getName(), cellModel.getType().getCellType()); + recentSearchManager.saveXMLFile(); sendToServer(); diff --git a/designer/src/com/fr/design/mainframe/alphafine/xmlManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/xmlManager/RecentSearchManager.java new file mode 100644 index 0000000000..8a7bf57932 --- /dev/null +++ b/designer/src/com/fr/design/mainframe/alphafine/xmlManager/RecentSearchManager.java @@ -0,0 +1,194 @@ +package com.fr.design.mainframe.alphafine.xmlManager; + +import com.fr.base.FRContext; +import com.fr.base.Utils; +import com.fr.file.XMLFileManager; +import com.fr.general.IOUtils; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLTools; +import com.fr.stable.xml.XMLableReader; + +import java.io.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by XiaXiang on 2017/5/15. + */ +public class RecentSearchManager extends XMLFileManager { + + private static final String XML_TAG = "AlphafineRecent"; + + private List fileList; + + private List actionList; + + private List documentList; + + private List pluginList; + + private Map modelMap = new HashMap<>(); + + private static RecentSearchManager recentSearchManager = null; + + public synchronized static RecentSearchManager getInstance() { + if (recentSearchManager == null) { + recentSearchManager = new RecentSearchManager(); + } + try { + XMLTools.readFileXML(recentSearchManager, recentSearchManager.getRecentEnvFile()); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + return recentSearchManager; + + } + + @Override + public void readXML(XMLableReader reader) { + if (reader.isAttr()) { + reader.readXMLObject(new XMLReadable() { + public void readXML(XMLableReader reader) { + if (reader.isChildNode()) { + String nodeName = reader.getTagName(); + if (nodeName.equals("RecentModel")) { + modelMap.put(reader.getAttrAsString("name", StringUtils.EMPTY), reader.getAttrAsInt("celltype", 0)); + } + } + } + }); + } + + } + + @Override + public void writeXML(XMLPrintWriter writer) { + writer.startTAG(XML_TAG); + if (!modelMap.isEmpty()) { + for (String name : modelMap.keySet()) { + writer.startTAG("RecentModel"); + writer.attr("name", name); + writer.attr("celltype", modelMap.get(name)); + writer.end(); + } + } + writer.end(); + + } + + @Override + public String fileName() { + return "alphafine_recent.xml"; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public List getActionList() { + return actionList; + } + + public void setActionList(List actionList) { + this.actionList = actionList; + } + + public List getDocumentList() { + return documentList; + } + + public void setDocumentList(List documentList) { + this.documentList = documentList; + } + + public List getPluginList() { + return pluginList; + } + + public void setPluginList(List pluginList) { + this.pluginList = pluginList; + } + + public Map getModelMap() { + return modelMap; + } + + public void setModelMap(Map modelMap) { + this.modelMap = modelMap; + } + + private static File recentFile = null; + + private File getRecentFile() { + if (recentFile == null) { + recentFile = new File(ProductConstants.getEnvHome() + File.separator + fileName()); + } + return recentFile; + } + + private File getRecentEnvFile() { + File envFile = getRecentFile(); + if (!envFile.exists()) { + createRecentFile(envFile); + } + + return envFile; + } + + private void createRecentFile(File envFile) { + try { + FileWriter fileWriter = new FileWriter(envFile); + StringReader stringReader = new StringReader(""); + Utils.copyCharTo(stringReader, fileWriter); + stringReader.close(); + fileWriter.close(); + } catch (IOException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + + /** + * 保存设计器的配置文件, 该文件不在env的resource目录下 + * 而是在Consts.getEnvHome() + File.separator + Consts.APP_NAME + * + * + * @date 2014-9-29-上午11:04:23 + * + */ + public void saveXMLFile() { + File xmlFile = this.getRecentEnvFile(); + if (xmlFile == null) { + return; + } + if (!xmlFile.getParentFile().exists()) {//建立目录. + StableUtils.mkdirs(xmlFile.getParentFile()); + } + + String tempName = xmlFile.getName() + ProjectConstants.TEMP_SUFFIX; + File tempFile = new File(xmlFile.getParentFile(), tempName); + + writeTempFile(tempFile); + IOUtils.renameTo(tempFile, xmlFile); + } + + private void writeTempFile(File tempFile){ + try{ + OutputStream fout = new FileOutputStream(tempFile); + XMLTools.writeOutputStreamXML(this, fout); + fout.flush(); + fout.close(); + }catch (Exception e) { + FRContext.getLogger().error(e.getMessage()); + } + } +} diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index a124cfc454..0da090b680 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -1997,7 +1997,7 @@ FR-Designer_AlphaFine_SearchRange=\u641C\u7D22\u8303\u56F4 FR-Designer-Plugin_Addon=\u5E94\u7528\u4E2D\u5FC3 FR-Designer_Templates=\u6A21\u677F FR-Designer_Templates_Content=\u6A21\u677F\u5185\u5BB9 -FR-Designer_AlphaFine_ShowAll=\u986F\u793A\u5168\u90E8 +FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8 FR-Designer_AlphaFine_Conclude=\u731C\u60A8\u9700\u8981 FR-Designer_AlphaFine_Latest=\u6700\u8FD1\u5E38\u7528 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 9f03c41dcd..867b50f709 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -1998,4 +1998,5 @@ FR-Designer_Templates=\u6A21\u677F FR-Designer_Templates_Content=\u6A21\u677F\u5167\u5BB9 FR-Designer_AlphaFine_Latest=\u6700\u8FD1\u5E38\u7528 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 -FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 \ No newline at end of file +FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 +FR-Designer_AlphaFine_ShowAll=\u986F\u793A\u5168\u90E8 \ No newline at end of file From b7e3a23d471d78bb1e78cec64c993fcb46c208bf Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 18 May 2017 10:35:01 +0800 Subject: [PATCH 06/28] =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/CellType.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/CellType.java b/designer/src/com/fr/design/mainframe/alphafine/CellType.java index d102491245..016490e44c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/CellType.java +++ b/designer/src/com/fr/design/mainframe/alphafine/CellType.java @@ -6,13 +6,36 @@ package com.fr.design.mainframe.alphafine; public enum CellType { PLUGIN(0), DOCUMENT(1), FILE(2), ACTION(3), REUSE(4); - private int cellType; + CellType(int type) { this.cellType = type; } + public static CellType parse(int cellType) { + CellType type; + switch (cellType) { + case 0: + type = PLUGIN; + break; + case 1: + type = DOCUMENT; + break; + case 2: + type = FILE; + break; + case 3: + type = ACTION; + break; + case 4: + type = REUSE; + break; + default: + type = FILE; + } + return type; + } public int getCellType() { return cellType; } From 811f042a9ae18d2d9aaa6e3925e0a3574b7b017a Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 18 May 2017 10:35:17 +0800 Subject: [PATCH 07/28] rt --- .../fr/design/mainframe/alphafine/AlphaFineConstants.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index 2ca448178b..eaff21c5da 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -12,6 +12,8 @@ public class AlphaFineConstants { public static final int SHOW_SIZE = 5; + public static final int MAX_FILE_SIZE = 100; + public static final int LATEST_SHOW_SIZE = 3; public static final int HEIGHT = 680; @@ -82,5 +84,8 @@ public class AlphaFineConstants { public static final String PLUGIN_IMAGE_URL = "http://shopres.finereport.com/"; + public static final String SERVER_URL = "http://cloud.fanruan.com/api/monitor/record_of_afsearch/single"; + + public static final String testurl = "http://localhost:8080/monitor/monitor/record_of_afsearch/single"; } From 2cea885f4be2c0fc64fdd9fdd8800d57b2dfe24c Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Thu, 18 May 2017 13:39:16 +0800 Subject: [PATCH 08/28] rt --- .../mainframe/alphafine/AlphaFineHelper.java | 3 + .../alphafine/cell/CellModelHelper.java | 42 +++ .../alphafine/cell/cellModel/ActionModel.java | 46 +++ .../cell/cellModel/AlphaCellModel.java | 12 +- .../cell/cellModel/DocumentModel.java | 37 +++ .../alphafine/cell/cellModel/FileModel.java | 36 +++ .../alphafine/cell/cellModel/ModelHandel.java | 13 + .../alphafine/cell/cellModel/PluginModel.java | 59 ++++ .../alphafine/component/AlphaFineDialog.java | 42 ++- .../recentSearch/RecentSearchManager.java | 294 ++++++++++++++++++ .../searchManager/LatestSearchManager.java | 4 + .../searchManager/PluginSearchManager.java | 2 + .../xmlManager/RecentSearchManager.java | 194 ------------ .../src/com/fr/design/utils/DesignUtils.java | 12 +- 14 files changed, 589 insertions(+), 207 deletions(-) create mode 100644 designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java create mode 100644 designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ModelHandel.java create mode 100644 designer/src/com/fr/design/mainframe/alphafine/recentSearch/RecentSearchManager.java delete mode 100644 designer/src/com/fr/design/mainframe/alphafine/xmlManager/RecentSearchManager.java diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 572de96a72..b25c6af301 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine; import com.fr.base.FRContext; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.alphafine.cell.cellModel.*; import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.stable.StableUtils; @@ -31,4 +32,6 @@ public class AlphaFineHelper { } + + } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java new file mode 100644 index 0000000000..11ae7f8a90 --- /dev/null +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java @@ -0,0 +1,42 @@ +package com.fr.design.mainframe.alphafine.cell; + +import com.fr.design.mainframe.alphafine.CellType; +import com.fr.design.mainframe.alphafine.cell.cellModel.*; +import com.fr.json.JSONObject; + +/** + * Created by XiaXiang on 2017/5/17. + */ +public class CellModelHelper { + public static AlphaCellModel jsonToModel(JSONObject object) { + int cellType = object.optInt("cellType"); + switch (CellType.parse(cellType)) { + case ACTION: + return ActionModel.jsonToModel(object); + case DOCUMENT: + return DocumentModel.jsonToModel(object); + case FILE: + return FileModel.jsonToModel(object); + case PLUGIN: + case REUSE: + return PluginModel.jsonToModel(object); + + } + return null; + } + + public static String getResultValueFromModel(AlphaCellModel cellModel) { + switch (cellModel.getType()) { + case ACTION: + return cellModel.getName(); + case DOCUMENT: + return ((DocumentModel)cellModel).getDocumentUrl(); + case FILE: + return ((FileModel)cellModel).getFilePath(); + case REUSE: + case PLUGIN: + return ((PluginModel)cellModel).getPluginUrl(); + } + return null; + } +} diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java index 8cbfae7e8c..c3c7f71531 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java @@ -1,6 +1,9 @@ package com.fr.design.mainframe.alphafine.cell.cellModel; import com.fr.design.mainframe.alphafine.CellType; +import com.fr.general.FRLogger; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; import javax.swing.*; import java.io.Serializable; @@ -15,6 +18,21 @@ public class ActionModel extends AlphaCellModel implements Serializable { super(name, content, type); } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof ActionModel)) return false; + + ActionModel that = (ActionModel) o; + + return action != null ? action.equals(that.action) : that.action == null; + } + + @Override + public int hashCode() { + return action != null ? action.hashCode() : 0; + } + public ActionModel(String name, Action action) { super(name, null, CellType.ACTION); this.action = action; @@ -27,4 +45,32 @@ public class ActionModel extends AlphaCellModel implements Serializable { public void setAction(Action action) { this.action = action; } + + @Override + public JSONObject ModelToJson() { + JSONObject object = JSONObject.create(); + try { + object.put("name", getName()).put("action", getAction().getClass().getName()).put("cellType", getType().getCellType()); + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + return object; + } + + public static ActionModel jsonToModel(JSONObject object ) { + String name = object.optString("name"); + String actionName = object.optString("action"); + Action action = null; + try { + Class className = Class.forName(actionName); + action = (Action) className.newInstance(); + } catch (ClassNotFoundException e) { + FRLogger.getLogger().error(e.getMessage()); + } catch (IllegalAccessException e) { + FRLogger.getLogger().error(e.getMessage()); + } catch (InstantiationException e) { + FRLogger.getLogger().error(e.getMessage()); + } + return new ActionModel(name, action); + } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java index 61867e3d2f..c8a42d78e3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java @@ -1,13 +1,14 @@ package com.fr.design.mainframe.alphafine.cell.cellModel; import com.fr.design.mainframe.alphafine.CellType; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; -import java.io.Serializable; /** * Created by XiaXiang on 2017/3/23. */ -public class AlphaCellModel implements Serializable{ +public abstract class AlphaCellModel implements ModelHandel { private String name; private String content; private String description; @@ -58,4 +59,11 @@ public class AlphaCellModel implements Serializable{ public void setDescription(String description) { this.description = description; } + + @Override + public JSONObject ModelToJson() throws JSONException { + return null; + } + + } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java index 8877631184..5be4ccbf30 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java @@ -1,6 +1,10 @@ package com.fr.design.mainframe.alphafine.cell.cellModel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; +import com.fr.general.FRLogger; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; /** * Created by XiaXiang on 2017/4/20. @@ -24,4 +28,37 @@ public class DocumentModel extends AlphaCellModel { public void setDocumentUrl(String documentUrl) { this.documentUrl = documentUrl; } + + @Override + public JSONObject ModelToJson() { + JSONObject object = JSONObject.create(); + try { + object.put("name", getName()).put("content", getContent()).put("documentUrl", getDocumentUrl()).put("cellType", getType().getCellType()); + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + return object; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof DocumentModel)) return false; + + DocumentModel that = (DocumentModel) o; + + return documentUrl != null ? documentUrl.equals(that.documentUrl) : that.documentUrl == null; + } + + @Override + public int hashCode() { + return documentUrl != null ? documentUrl.hashCode() : 0; + } + + public static DocumentModel jsonToModel(JSONObject object) { + String name = object.optString("title"); + String content = object.optString("summary"); + String documentUrl = AlphaFineConstants.DOCUMENT_DOC_URL + object.optString("did") + ".html"; + return new DocumentModel(name, content, documentUrl); + } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java index 81e2295529..5ca5e0870a 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java @@ -2,6 +2,9 @@ package com.fr.design.mainframe.alphafine.cell.cellModel; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; +import com.fr.general.FRLogger; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; /** * Created by XiaXiang on 2017/4/20. @@ -26,4 +29,37 @@ public class FileModel extends AlphaCellModel{ public void setFilePath(String filePath) { this.filePath = filePath; } + + @Override + public JSONObject ModelToJson() { + JSONObject object = JSONObject.create(); + try { + object.put("name", getName()).put("content", getContent()).put("filePath", getFilePath()).put("cellType", getType().getCellType()); + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + return object; + } + + public static FileModel jsonToModel(JSONObject object) { + String name = object.optString("name"); + String content = object.optString("content"); + String filePath = object.optString("filePath"); + return new FileModel(name, content, filePath); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof FileModel)) return false; + + FileModel fileModel = (FileModel) o; + + return filePath != null ? filePath.equals(fileModel.filePath) : fileModel.filePath == null; + } + + @Override + public int hashCode() { + return filePath != null ? filePath.hashCode() : 0; + } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ModelHandel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ModelHandel.java new file mode 100644 index 0000000000..99609cda22 --- /dev/null +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ModelHandel.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe.alphafine.cell.cellModel; + +import com.fr.json.JSONException; +import com.fr.json.JSONObject; + +/** + * Created by XiaXiang on 2017/5/16. + */ +public interface ModelHandel { + + JSONObject ModelToJson() throws JSONException; + +} diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java index 9be4e4dfd5..ddbfa34e8e 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java @@ -1,7 +1,14 @@ package com.fr.design.mainframe.alphafine.cell.cellModel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; /** * Created by XiaXiang on 2017/4/20. @@ -74,4 +81,56 @@ public class PluginModel extends AlphaCellModel { public void setPrice(int price) { this.price = price; } + + @Override + public JSONObject ModelToJson() { + JSONObject object = JSONObject.create(); + try { + object.put("name", getName()).put("content", getContent()).put("pluginUrl", getPluginUrl()).put("imageUrl", getImageUrl()).put("cellType", getType().getCellType()).put("jartime", getJartime()).put("version", getVersion()).put("price", getPrice()); + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + + return object; + } + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof PluginModel)) return false; + + PluginModel that = (PluginModel) o; + + return pluginUrl != null ? pluginUrl.equals(that.pluginUrl) : that.pluginUrl == null; + } + + @Override + public int hashCode() { + return pluginUrl != null ? pluginUrl.hashCode() : 0; + } + + public static PluginModel jsonToModel(JSONObject object) { + String name = object.optString("name"); + String content = object.optString("description"); + String pluginUrl = AlphaFineConstants.REUSE_URL + object.optString("id"); + String imageUrl = null; + try { + imageUrl = AlphaFineConstants.PLUGIN_IMAGE_URL + URLEncoder.encode(object.optString("pic").toString().substring(AlphaFineConstants.PLUGIN_IMAGE_URL.length()), "utf8"); + } catch (UnsupportedEncodingException e) { + FRLogger.getLogger().error(e.getMessage()); + } + String version = null; + String jartime = null; + CellType type = CellType.REUSE; + String link = object.optString("link"); + if (ComparatorUtils.equals(link, "plugin")) { + version = object.optString("version"); + jartime = object.optString("jartime"); + type = CellType.PLUGIN; + pluginUrl = AlphaFineConstants.PLUGIN_URL + object.optString("id"); + } + int price = object.optInt("price"); + return new PluginModel(name, content, pluginUrl, imageUrl, version, jartime, type, price); + } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 8a8ac6b5a6..675466cd17 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -9,6 +9,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.cellRender.ContentCellRender; import com.fr.design.mainframe.alphafine.cell.cellModel.*; import com.fr.design.mainframe.alphafine.listener.ComponentHandler; @@ -19,7 +20,7 @@ import com.fr.design.mainframe.alphafine.previewPane.DocumentPreviewPane; import com.fr.design.mainframe.alphafine.previewPane.FilePreviewPane; import com.fr.design.mainframe.alphafine.previewPane.PluginPreviewPane; import com.fr.design.mainframe.alphafine.searchManager.*; -import com.fr.design.mainframe.alphafine.xmlManager.RecentSearchManager; +import com.fr.design.mainframe.alphafine.recentSearch.RecentSearchManager; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.form.main.Form; @@ -27,9 +28,13 @@ import com.fr.form.main.FormIO; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.general.http.HttpClient; import com.fr.io.TemplateWorkBookIO; import com.fr.io.exporter.ImageExporter; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; import com.fr.main.impl.WorkBook; +import com.fr.stable.CodeUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; @@ -45,6 +50,9 @@ import java.io.*; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.HashMap; import java.util.concurrent.ExecutionException; /** @@ -545,18 +553,42 @@ public class AlphaFineDialog extends UIDialog { */ private void saveHistory(String searchText, AlphaCellModel cellModel) { RecentSearchManager recentSearchManager = RecentSearchManager.getInstance(); - recentSearchManager.getModelMap().put(cellModel.getName(), cellModel.getType().getCellType()); + recentSearchManager.addRecentModel(searchText, cellModel); recentSearchManager.saveXMLFile(); - - sendToServer(); + sendToServer(searchText, cellModel); } /** *todo:还没做上传服务器 */ - private void sendToServer() { + private void sendToServer(String searchKey, AlphaCellModel cellModel) { + String username = DesignerEnvManager.getEnvManager().getBBSName(); + String uuid = DesignerEnvManager.getEnvManager().getUUID(); + String activitykey = DesignerEnvManager.getEnvManager().getActivationKey(); + String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime()); + String key = searchKey; + int resultkind = cellModel.getType().getCellType(); + String resultValue = CellModelHelper.getResultValueFromModel(cellModel); + JSONObject object = JSONObject.create(); + try { + object.put("uuid", uuid).put("activitykey", activitykey).put("username", username).put("createtime", createTime).put("key", key).put("resultkind", resultkind).put("resultValue", resultValue); + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + HashMap para = new HashMap<>(); + String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); + para.put("token", CodeUtils.md5Encode(date, "", "MD5")); + para.put("content", object.toString()); + HttpClient httpClient = new HttpClient(AlphaFineConstants.testurl, para, true); + httpClient.setTimeout(5000); + httpClient.asGet(); + + if (!httpClient.isServerAlive()) { + //return false; + } + String res = httpClient.getResponseText(); } private void rebuildShowMoreList(int index, MoreModel selectedValue) { diff --git a/designer/src/com/fr/design/mainframe/alphafine/recentSearch/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/recentSearch/RecentSearchManager.java new file mode 100644 index 0000000000..ce0302d971 --- /dev/null +++ b/designer/src/com/fr/design/mainframe/alphafine/recentSearch/RecentSearchManager.java @@ -0,0 +1,294 @@ +package com.fr.design.mainframe.alphafine.recentSearch; + +import com.fr.base.FRContext; +import com.fr.base.Utils; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.cell.CellModelHelper; +import com.fr.design.mainframe.alphafine.cell.cellModel.AlphaCellModel; +import com.fr.file.XMLFileManager; +import com.fr.general.FRLogger; +import com.fr.general.IOUtils; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLTools; +import com.fr.stable.xml.XMLableReader; + +import java.io.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by XiaXiang on 2017/5/15. + */ +public class RecentSearchManager extends XMLFileManager { + + private static final String XML_TAG = "AlphafineRecent"; + private static RecentSearchManager recentSearchManager = null; + private static File recentFile = null; + private List fileList; + private List actionList; + private List documentList; + + //private List recentKVModelList = new ArrayList<>(); + private List pluginList; + private List recentModelList = new ArrayList<>(); + private Map> recentKVModelMap = new HashMap<>(); + + public synchronized static RecentSearchManager getInstance() { + if (recentSearchManager == null) { + recentSearchManager = new RecentSearchManager(); + try { + XMLTools.readFileXML(recentSearchManager, recentSearchManager.getRecentEnvFile()); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + return recentSearchManager; + + } + + @Override + public void readXML(XMLableReader reader) { + if (reader.isAttr()) { + reader.readXMLObject(new XMLReadable() { + public void readXML(XMLableReader reader) { + if (reader.isChildNode()) { + String nodeName = reader.getTagName(); + if (nodeName.equals("RecentModel")) { + String key = reader.getAttrAsString("searchKey", StringUtils.EMPTY); + final ArrayList list = new ArrayList(); + reader.readXMLObject(new XMLReadable() { + @Override + public void readXML(XMLableReader reader) { + if (reader.isChildNode()) { + String nodeName = reader.getTagName(); + if (nodeName.equals("modelList")) { + String name = reader.getAttrAsString("cellModel", StringUtils.EMPTY); + try { + list.add(CellModelHelper.jsonToModel(new JSONObject(name))); + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + } + } + } + ); + recentKVModelMap.put(key, list); + } + } + } + }); + } + + } + + @Override + public void writeXML(XMLPrintWriter writer) { + writer.startTAG(XML_TAG); + if (!recentKVModelMap.isEmpty()) { + for (String key : recentKVModelMap.keySet()) { + writer.startTAG("RecentModel"); + writer.attr("searchKey", key); + writer.startTAG("modelList"); + for (AlphaCellModel model : recentKVModelMap.get(key)) { + try { + String name = model.ModelToJson().toString(); + writer.attr("cellModel", name); + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + writer.end(); + writer.end(); + } + } + writer.end(); + + } + + @Override + public String fileName() { + return "alphafine_recent.xml"; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public List getActionList() { + return actionList; + } + + public void setActionList(List actionList) { + this.actionList = actionList; + } + + public List getDocumentList() { + return documentList; + } + + public void setDocumentList(List documentList) { + this.documentList = documentList; + } + + public List getPluginList() { + return pluginList; + } + + public void setPluginList(List pluginList) { + this.pluginList = pluginList; + } + + private File getRecentFile() { + if (recentFile == null) { + recentFile = new File(ProductConstants.getEnvHome() + File.separator + fileName()); + } + return recentFile; + } + + private File getRecentEnvFile() { + File envFile = getRecentFile(); + if (!envFile.exists()) { + createRecentFile(envFile); + } + + return envFile; + } + + private void createRecentFile(File envFile) { + try { + FileWriter fileWriter = new FileWriter(envFile); + StringReader stringReader = new StringReader(""); + Utils.copyCharTo(stringReader, fileWriter); + stringReader.close(); + fileWriter.close(); + } catch (IOException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + + /** + * 保存XML到设计器安装目录 + */ + public void saveXMLFile() { + File xmlFile = this.getRecentEnvFile(); + if (xmlFile == null) { + return; + } + if (!xmlFile.getParentFile().exists()) {//建立目录. + StableUtils.mkdirs(xmlFile.getParentFile()); + } + + String tempName = xmlFile.getName() + ProjectConstants.TEMP_SUFFIX; + File tempFile = new File(xmlFile.getParentFile(), tempName); + + writeTempFile(tempFile); + IOUtils.renameTo(tempFile, xmlFile); + } + + private void writeTempFile(File tempFile) { + try { + OutputStream fout = new FileOutputStream(tempFile); + XMLTools.writeOutputStreamXML(this, fout); + fout.flush(); + fout.close(); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage()); + } + } + + + public List getRecentModelList() { + return recentModelList; + } + + public void setRecentModelList(List recentModelList) { + this.recentModelList = recentModelList; + } + + public List getRecentModelList(String searchText) { + for (String key : recentKVModelMap.keySet()) { + if (recentKVModelMap.keySet().contains(searchText)) { + List list = recentKVModelMap.get(searchText); + return list; + } + } + return null; + } + + public void addRecentModel(String searchKey, AlphaCellModel cellModel) { + + //final AlphaCellModel alphaCellModel = getCellModel(cellModel); + if (recentKVModelMap.keySet().contains(searchKey)) { + List cellModels = recentKVModelMap.get(searchKey); + if (cellModels.contains(cellModel)) { + cellModels.remove(cellModel); + cellModels.add(cellModel); + } else { + cellModels.add(cellModel); + } + } else { + List list = new ArrayList<>(); + list.add(cellModel); + recentKVModelMap.put(searchKey, list); + } +// if (alphaCellModel != null) { +// moveOnTop(alphaCellModel); +// } else { +// this.recentModelList.add(cellModel); +// } +// trimToSize(); + } + + private void moveOnTop(AlphaCellModel alphaCellModel) { + recentModelList.remove(alphaCellModel); + recentModelList.add(alphaCellModel); + } + + private synchronized void trimToSize() { + if (recentModelList.size() > AlphaFineConstants.MAX_FILE_SIZE) { + recentModelList.remove(0); + } + } + + private synchronized AlphaCellModel getCellModel(AlphaCellModel model) { + for (int i = recentModelList.size() - 1; i >= 0; i--) { + final AlphaCellModel entry = recentModelList.get(i); + String name = entry.getName(); + if (name.equals(model.getName())) { + return entry; + } + } + return null; + } + + public Map> getRecentKVModelMap() { + return recentKVModelMap; + } + + public void setRecentKVModelMap(Map> recentKVModelMap) { + this.recentKVModelMap = recentKVModelMap; + } + +// public List getRecentKVModelList() { +// return recentKVModelList; +// } +// +// public void setRecentKVModelList(List recentKVModelList) { +// this.recentKVModelList = recentKVModelList; +// } +} diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/LatestSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/LatestSearchManager.java index 8fb3919463..9d35de211c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/LatestSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/LatestSearchManager.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine.searchManager; import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.recentSearch.RecentSearchManager; import com.fr.general.Inter; /** @@ -23,6 +24,9 @@ public class LatestSearchManager implements AlphaFineSearchProcessor { this.modelList = new SearchResult(); modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Latest"), false)); //todo: 本地常用逻辑需要重新设计 + if (RecentSearchManager.getInstance().getRecentModelList(searchText) != null) { + modelList.addAll(RecentSearchManager.getInstance().getRecentModelList(searchText)); + } // if (getLatestModelList() != null && getLatestModelList().size() > 0) { // modelList.addAll(getLatestModelList()); // } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java index 5e5410a790..71f9a76975 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java @@ -108,4 +108,6 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { } + + } diff --git a/designer/src/com/fr/design/mainframe/alphafine/xmlManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/xmlManager/RecentSearchManager.java deleted file mode 100644 index 8a7bf57932..0000000000 --- a/designer/src/com/fr/design/mainframe/alphafine/xmlManager/RecentSearchManager.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.fr.design.mainframe.alphafine.xmlManager; - -import com.fr.base.FRContext; -import com.fr.base.Utils; -import com.fr.file.XMLFileManager; -import com.fr.general.IOUtils; -import com.fr.stable.ProductConstants; -import com.fr.stable.StableUtils; -import com.fr.stable.StringUtils; -import com.fr.stable.project.ProjectConstants; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLReadable; -import com.fr.stable.xml.XMLTools; -import com.fr.stable.xml.XMLableReader; - -import java.io.*; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by XiaXiang on 2017/5/15. - */ -public class RecentSearchManager extends XMLFileManager { - - private static final String XML_TAG = "AlphafineRecent"; - - private List fileList; - - private List actionList; - - private List documentList; - - private List pluginList; - - private Map modelMap = new HashMap<>(); - - private static RecentSearchManager recentSearchManager = null; - - public synchronized static RecentSearchManager getInstance() { - if (recentSearchManager == null) { - recentSearchManager = new RecentSearchManager(); - } - try { - XMLTools.readFileXML(recentSearchManager, recentSearchManager.getRecentEnvFile()); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } - return recentSearchManager; - - } - - @Override - public void readXML(XMLableReader reader) { - if (reader.isAttr()) { - reader.readXMLObject(new XMLReadable() { - public void readXML(XMLableReader reader) { - if (reader.isChildNode()) { - String nodeName = reader.getTagName(); - if (nodeName.equals("RecentModel")) { - modelMap.put(reader.getAttrAsString("name", StringUtils.EMPTY), reader.getAttrAsInt("celltype", 0)); - } - } - } - }); - } - - } - - @Override - public void writeXML(XMLPrintWriter writer) { - writer.startTAG(XML_TAG); - if (!modelMap.isEmpty()) { - for (String name : modelMap.keySet()) { - writer.startTAG("RecentModel"); - writer.attr("name", name); - writer.attr("celltype", modelMap.get(name)); - writer.end(); - } - } - writer.end(); - - } - - @Override - public String fileName() { - return "alphafine_recent.xml"; - } - - public List getFileList() { - return fileList; - } - - public void setFileList(List fileList) { - this.fileList = fileList; - } - - public List getActionList() { - return actionList; - } - - public void setActionList(List actionList) { - this.actionList = actionList; - } - - public List getDocumentList() { - return documentList; - } - - public void setDocumentList(List documentList) { - this.documentList = documentList; - } - - public List getPluginList() { - return pluginList; - } - - public void setPluginList(List pluginList) { - this.pluginList = pluginList; - } - - public Map getModelMap() { - return modelMap; - } - - public void setModelMap(Map modelMap) { - this.modelMap = modelMap; - } - - private static File recentFile = null; - - private File getRecentFile() { - if (recentFile == null) { - recentFile = new File(ProductConstants.getEnvHome() + File.separator + fileName()); - } - return recentFile; - } - - private File getRecentEnvFile() { - File envFile = getRecentFile(); - if (!envFile.exists()) { - createRecentFile(envFile); - } - - return envFile; - } - - private void createRecentFile(File envFile) { - try { - FileWriter fileWriter = new FileWriter(envFile); - StringReader stringReader = new StringReader(""); - Utils.copyCharTo(stringReader, fileWriter); - stringReader.close(); - fileWriter.close(); - } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); - } - } - - /** - * 保存设计器的配置文件, 该文件不在env的resource目录下 - * 而是在Consts.getEnvHome() + File.separator + Consts.APP_NAME - * - * - * @date 2014-9-29-上午11:04:23 - * - */ - public void saveXMLFile() { - File xmlFile = this.getRecentEnvFile(); - if (xmlFile == null) { - return; - } - if (!xmlFile.getParentFile().exists()) {//建立目录. - StableUtils.mkdirs(xmlFile.getParentFile()); - } - - String tempName = xmlFile.getName() + ProjectConstants.TEMP_SUFFIX; - File tempFile = new File(xmlFile.getParentFile(), tempName); - - writeTempFile(tempFile); - IOUtils.renameTo(tempFile, xmlFile); - } - - private void writeTempFile(File tempFile){ - try{ - OutputStream fout = new FileOutputStream(tempFile); - XMLTools.writeOutputStreamXML(this, fout); - fout.flush(); - fout.close(); - }catch (Exception e) { - FRContext.getLogger().error(e.getMessage()); - } - } -} diff --git a/designer_base/src/com/fr/design/utils/DesignUtils.java b/designer_base/src/com/fr/design/utils/DesignUtils.java index 8ed8aa6175..9e4c924635 100644 --- a/designer_base/src/com/fr/design/utils/DesignUtils.java +++ b/designer_base/src/com/fr/design/utils/DesignUtils.java @@ -50,12 +50,12 @@ public class DesignUtils { * @return 启动了返回true */ public static boolean isStarted() { - try { - new Socket("localhost", port); - return true; - } catch (Exception exp) { - - } +// try { +// new Socket("localhost", port); +// return true; +// } catch (Exception exp) { +// +// } return false; } From 3d6a95e5a7184df01cfe0b5158b43703fcd1eb84 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Mon, 22 May 2017 15:19:23 +0800 Subject: [PATCH 09/28] =?UTF-8?q?alphafine=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConstants.java | 2 + .../mainframe/alphafine/AlphaFineHelper.java | 16 +++- .../alphafine/cell/CellModelHelper.java | 18 +++-- .../alphafine/cell/cellModel/ActionModel.java | 25 +++---- .../cell/cellModel/AlphaCellModel.java | 3 +- .../cell/cellModel/DocumentModel.java | 29 ++++++-- .../alphafine/cell/cellModel/FileModel.java | 8 +- .../alphafine/cell/cellModel/ModelHandel.java | 13 ---- .../alphafine/cell/cellModel/PluginModel.java | 56 +++++++------- .../alphafine/component/AlphaFineDialog.java | 26 +++++-- .../alphafine/images/default_product.png | Bin 0 -> 2736 bytes .../searchManager/ActionSearchManager.java | 55 +++++++++----- .../searchManager/AlphaSearchManager.java | 26 +------ .../searchManager/ConcludeSearchManager.java | 38 +++++++++- .../searchManager/DocumentSearchManager.java | 56 +++++++------- .../searchManager/FileSearchManager.java | 8 ++ .../searchManager/LatestSearchManager.java | 59 --------------- .../searchManager/PluginSearchManager.java | 69 ++++++++++-------- .../RecentSearchManager.java | 43 ++++++++--- 19 files changed, 286 insertions(+), 264 deletions(-) delete mode 100644 designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ModelHandel.java create mode 100644 designer/src/com/fr/design/mainframe/alphafine/images/default_product.png delete mode 100644 designer/src/com/fr/design/mainframe/alphafine/searchManager/LatestSearchManager.java rename designer/src/com/fr/design/mainframe/alphafine/{recentSearch => searchManager}/RecentSearchManager.java (89%) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index eaff21c5da..93d389d11c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -82,6 +82,8 @@ public class AlphaFineConstants { public static final String DOCUMENT_SEARCH_URL = "http://help.finereport.com/?api-search-title-"; + public static final String DOCUMENT_INFORMATION_URL = "http://help.finereport.com/?api-search-did-"; + public static final String PLUGIN_IMAGE_URL = "http://shopres.finereport.com/"; public static final String SERVER_URL = "http://cloud.fanruan.com/api/monitor/record_of_afsearch/single"; diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index b25c6af301..cfc028b902 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -5,6 +5,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.alphafine.cell.cellModel.*; import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import java.io.File; @@ -23,14 +24,23 @@ public class AlphaFineHelper { } public static String findFolderName (String text) { - String[] textArray = text.split("/"); - if (textArray != null && textArray.length > 1) { - return textArray[textArray.length - 2]; + return getSplitText(text, 2); + } + private static String getSplitText(String text, int index) { + if (StringUtils.isNotBlank(text)) { + String[] textArray = text.split("/"); + if (textArray != null && textArray.length > 1) { + return textArray[textArray.length - index]; + } } return null; } + public static String findFileName (String text) { + return getSplitText(text, 1); + } + diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java index 11ae7f8a90..9938034077 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java @@ -2,6 +2,10 @@ package com.fr.design.mainframe.alphafine.cell; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.cellModel.*; +import com.fr.design.mainframe.alphafine.searchManager.ActionSearchManager; +import com.fr.design.mainframe.alphafine.searchManager.DocumentSearchManager; +import com.fr.design.mainframe.alphafine.searchManager.FileSearchManager; +import com.fr.design.mainframe.alphafine.searchManager.PluginSearchManager; import com.fr.json.JSONObject; /** @@ -12,14 +16,14 @@ public class CellModelHelper { int cellType = object.optInt("cellType"); switch (CellType.parse(cellType)) { case ACTION: - return ActionModel.jsonToModel(object); + return ActionSearchManager.getModelFromCloud(object.optString("result")); case DOCUMENT: - return DocumentModel.jsonToModel(object); + return DocumentSearchManager.getModelFromCloud(object.optJSONObject("result")); case FILE: - return FileModel.jsonToModel(object); + return FileSearchManager.getModelFromCloud(object.optString("result")); case PLUGIN: case REUSE: - return PluginModel.jsonToModel(object); + return PluginSearchManager.getModelFromCloud(object.optJSONObject("result")); } return null; @@ -28,14 +32,14 @@ public class CellModelHelper { public static String getResultValueFromModel(AlphaCellModel cellModel) { switch (cellModel.getType()) { case ACTION: - return cellModel.getName(); + return ((ActionModel)cellModel).getActionName(); case DOCUMENT: - return ((DocumentModel)cellModel).getDocumentUrl(); + return ((DocumentModel)cellModel).getInformationUrl(); case FILE: return ((FileModel)cellModel).getFilePath(); case REUSE: case PLUGIN: - return ((PluginModel)cellModel).getPluginUrl(); + return ((PluginModel)cellModel).getInformationUrl(); } return null; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java index c3c7f71531..2e8a4510bf 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java @@ -14,6 +14,8 @@ import java.io.Serializable; public class ActionModel extends AlphaCellModel implements Serializable { private Action action; + private String actionName; + public ActionModel(String name, String content, CellType type) { super(name, content, type); } @@ -50,27 +52,18 @@ public class ActionModel extends AlphaCellModel implements Serializable { public JSONObject ModelToJson() { JSONObject object = JSONObject.create(); try { - object.put("name", getName()).put("action", getAction().getClass().getName()).put("cellType", getType().getCellType()); + object.put("result", getAction().getClass().getName()).put("cellType", getType().getCellType()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } return object; } - public static ActionModel jsonToModel(JSONObject object ) { - String name = object.optString("name"); - String actionName = object.optString("action"); - Action action = null; - try { - Class className = Class.forName(actionName); - action = (Action) className.newInstance(); - } catch (ClassNotFoundException e) { - FRLogger.getLogger().error(e.getMessage()); - } catch (IllegalAccessException e) { - FRLogger.getLogger().error(e.getMessage()); - } catch (InstantiationException e) { - FRLogger.getLogger().error(e.getMessage()); - } - return new ActionModel(name, action); + public String getActionName() { + return getAction().getClass().getName(); + } + + public void setActionName(String actionName) { + this.actionName = actionName; } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java index c8a42d78e3..81de0b33ac 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java @@ -8,7 +8,7 @@ import com.fr.json.JSONObject; /** * Created by XiaXiang on 2017/3/23. */ -public abstract class AlphaCellModel implements ModelHandel { +public abstract class AlphaCellModel { private String name; private String content; private String description; @@ -60,7 +60,6 @@ public abstract class AlphaCellModel implements ModelHandel { this.description = description; } - @Override public JSONObject ModelToJson() throws JSONException { return null; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java index 5be4ccbf30..ab9397a684 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java @@ -11,14 +11,18 @@ import com.fr.json.JSONObject; */ public class DocumentModel extends AlphaCellModel { private String documentUrl; + private String informationUrl; + private int documentId; public DocumentModel(String name, String content, CellType type) { super(name, content, type); } - public DocumentModel(String name, String content, String documentUrl) { + public DocumentModel(String name, String content, int documentId) { super(name, content, CellType.DOCUMENT); - this.documentUrl = documentUrl; + this.documentId = documentId; + this.informationUrl = AlphaFineConstants.DOCUMENT_INFORMATION_URL + documentId; + this.documentUrl = AlphaFineConstants.DOCUMENT_DOC_URL + documentId + ".html"; } public String getDocumentUrl() { @@ -33,7 +37,7 @@ public class DocumentModel extends AlphaCellModel { public JSONObject ModelToJson() { JSONObject object = JSONObject.create(); try { - object.put("name", getName()).put("content", getContent()).put("documentUrl", getDocumentUrl()).put("cellType", getType().getCellType()); + object.put("result", getInformationUrl()).put("cellType", getType().getCellType()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } @@ -55,10 +59,19 @@ public class DocumentModel extends AlphaCellModel { return documentUrl != null ? documentUrl.hashCode() : 0; } - public static DocumentModel jsonToModel(JSONObject object) { - String name = object.optString("title"); - String content = object.optString("summary"); - String documentUrl = AlphaFineConstants.DOCUMENT_DOC_URL + object.optString("did") + ".html"; - return new DocumentModel(name, content, documentUrl); + public int getDocumentId() { + return documentId; + } + + public void setDocumentId(int documentId) { + this.documentId = documentId; + } + + public String getInformationUrl() { + return informationUrl; + } + + public void setInformationUrl(String informationUrl) { + this.informationUrl = informationUrl; } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java index 5ca5e0870a..aa295a04c2 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java @@ -34,19 +34,13 @@ public class FileModel extends AlphaCellModel{ public JSONObject ModelToJson() { JSONObject object = JSONObject.create(); try { - object.put("name", getName()).put("content", getContent()).put("filePath", getFilePath()).put("cellType", getType().getCellType()); + object.put("result", getFilePath()).put("cellType", getType().getCellType()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } return object; } - public static FileModel jsonToModel(JSONObject object) { - String name = object.optString("name"); - String content = object.optString("content"); - String filePath = object.optString("filePath"); - return new FileModel(name, content, filePath); - } @Override public boolean equals(Object o) { diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ModelHandel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ModelHandel.java deleted file mode 100644 index 99609cda22..0000000000 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ModelHandel.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fr.design.mainframe.alphafine.cell.cellModel; - -import com.fr.json.JSONException; -import com.fr.json.JSONObject; - -/** - * Created by XiaXiang on 2017/5/16. - */ -public interface ModelHandel { - - JSONObject ModelToJson() throws JSONException; - -} diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java index ddbfa34e8e..eb26d0fa93 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java @@ -19,15 +19,27 @@ public class PluginModel extends AlphaCellModel { private String version; private String jartime; private String link; + private String informationUrl; + private int pluginId; private int price; + private static final String PLUGIN_INFORMATION_URL = "http://shop.finereport.com/ShopServer?pg=plugin&pid="; + private static final String REUSE_INFORMATION_URL = "http://shop.finereport.com/reuses/"; public PluginModel(String name, String content, CellType type) { super(name, content, type); } - public PluginModel(String name, String content, String pluginUrl, String imageUrl, String version, String jartime, CellType type, int price) { + public PluginModel(String name, String content, String imageUrl, String version, String jartime, CellType type, int price, int pluginId) { super(name, content); setType(type); - this.pluginUrl = pluginUrl; + this.pluginId = pluginId; + if (getType() == CellType.PLUGIN) { + this.pluginUrl = AlphaFineConstants.PLUGIN_URL + pluginId; + this.informationUrl = PLUGIN_INFORMATION_URL + this.pluginId; + } else { + this.pluginUrl = AlphaFineConstants.REUSE_URL + pluginId; + this.informationUrl = REUSE_INFORMATION_URL + this.pluginId; + + } this.imageUrl = imageUrl; this.jartime = jartime; this.version = version; @@ -86,7 +98,7 @@ public class PluginModel extends AlphaCellModel { public JSONObject ModelToJson() { JSONObject object = JSONObject.create(); try { - object.put("name", getName()).put("content", getContent()).put("pluginUrl", getPluginUrl()).put("imageUrl", getImageUrl()).put("cellType", getType().getCellType()).put("jartime", getJartime()).put("version", getVersion()).put("price", getPrice()); + object.put("result", getInformationUrl()).put("cellType", getType().getCellType()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } @@ -110,27 +122,21 @@ public class PluginModel extends AlphaCellModel { return pluginUrl != null ? pluginUrl.hashCode() : 0; } - public static PluginModel jsonToModel(JSONObject object) { - String name = object.optString("name"); - String content = object.optString("description"); - String pluginUrl = AlphaFineConstants.REUSE_URL + object.optString("id"); - String imageUrl = null; - try { - imageUrl = AlphaFineConstants.PLUGIN_IMAGE_URL + URLEncoder.encode(object.optString("pic").toString().substring(AlphaFineConstants.PLUGIN_IMAGE_URL.length()), "utf8"); - } catch (UnsupportedEncodingException e) { - FRLogger.getLogger().error(e.getMessage()); - } - String version = null; - String jartime = null; - CellType type = CellType.REUSE; - String link = object.optString("link"); - if (ComparatorUtils.equals(link, "plugin")) { - version = object.optString("version"); - jartime = object.optString("jartime"); - type = CellType.PLUGIN; - pluginUrl = AlphaFineConstants.PLUGIN_URL + object.optString("id"); - } - int price = object.optInt("price"); - return new PluginModel(name, content, pluginUrl, imageUrl, version, jartime, type, price); + + + public int getPluginId() { + return pluginId; + } + + public void setPluginId(int pluginId) { + this.pluginId = pluginId; + } + + public String getInformationUrl() { + return informationUrl; + } + + public void setInformationUrl(String informationUrl) { + this.informationUrl = informationUrl; } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 675466cd17..51f3b427d7 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -20,7 +20,7 @@ import com.fr.design.mainframe.alphafine.previewPane.DocumentPreviewPane; import com.fr.design.mainframe.alphafine.previewPane.FilePreviewPane; import com.fr.design.mainframe.alphafine.previewPane.PluginPreviewPane; import com.fr.design.mainframe.alphafine.searchManager.*; -import com.fr.design.mainframe.alphafine.recentSearch.RecentSearchManager; +import com.fr.design.mainframe.alphafine.searchManager.RecentSearchManager; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.form.main.Form; @@ -216,7 +216,7 @@ public class AlphaFineDialog extends UIDialog { this.searchWorker = new SwingWorker() { @Override - protected SearchListModel doInBackground() throws Exception { + protected SearchListModel doInBackground() { return setjListModel(new SearchListModel(AlphaSearchManager.getSearchManager().showLessSearchResult(searchText))); } @@ -366,8 +366,17 @@ public class AlphaFineDialog extends UIDialog { } this.searchWorker = new SwingWorker() { @Override - protected Image doInBackground() throws Exception { - BufferedImage bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); + protected Image doInBackground() { + BufferedImage bufferedImage = null; + try { + bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); + } catch (IOException e) { + try { + bufferedImage = ImageIO.read(getClass().getResource("/com/fr/design/mainframe/alphafine/images/default_product.png")); + } catch (IOException e1) { + FRLogger.getLogger().error(e.getMessage()); + } + } return bufferedImage; } @@ -560,7 +569,9 @@ public class AlphaFineDialog extends UIDialog { } /** - *todo:还没做上传服务器 + * 上传数据到服务器 + * @param searchKey + * @param cellModel */ private void sendToServer(String searchKey, AlphaCellModel cellModel) { String username = DesignerEnvManager.getEnvManager().getBBSName(); @@ -583,12 +594,10 @@ public class AlphaFineDialog extends UIDialog { HttpClient httpClient = new HttpClient(AlphaFineConstants.testurl, para, true); httpClient.setTimeout(5000); httpClient.asGet(); - if (!httpClient.isServerAlive()) { - //return false; + FRLogger.getLogger().error("404"); } - String res = httpClient.getResponseText(); } private void rebuildShowMoreList(int index, MoreModel selectedValue) { @@ -656,6 +665,7 @@ public class AlphaFineDialog extends UIDialog { public SearchListModel setjListModel(SearchListModel jListModel) { this.searchListModel = jListModel; + System.out.print(this.searchListModel); return this.searchListModel; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/default_product.png b/designer/src/com/fr/design/mainframe/alphafine/images/default_product.png new file mode 100644 index 0000000000000000000000000000000000000000..8a6a096d95258ee1db69307ed6f000d030f2bbde GIT binary patch literal 2736 zcmaLZWn2^L9tUtja-?(&kdQclh)4{WloHZ0CZbX!q$C`SfkBKI90UaqATd%Tht465 zYzQMJu}KZ|ASsBnh_H*^bML!*Up&wM#q<08KF|N%H`U(OoSRdelYxPO+tR|!@nrV> zI_yj*w=77n|73_oUWP_Gh5ANDd4|InjD14AU^14$o_;V#n5PdStRH5;z`*HfX=dyk zJ+)S7ct^lo6t#P9plLz+p-nHxV{6}RCLN4SlCli9fSs?>W32#7Mm3iytykq38%~SI zVrRw3?@y&QvvX$z_z!xB1|=w5qprNmu4r5KI`d`8=jznhJ>74?o5BZ0D3S=HFZ111a$0~HSITPJ zzQjJsiFzxEKB@a%`>X$?*2H6>P)Pv2>vc}rWiv71|3r{4wM6fP=HA9l;R4xD=`I!W zEkYCjX%YN)?FbiSHj^*a>|`GeQG)AIcI8H+Y+3^w8{2m`^{0V2@#$~v&_$QT%v+56 zhew}47!dPo-wN9|wrHQ5)4^vyj~w=IWJ+oh=+xH{K|x%dbC(DOo`Vry-Q}B`oBmp> zZ+V;Q)F|CH*4ROLVKi|*Y$ryYKI0FZa90%uQr#R>v#e}vZDkdtVW!C@0s;c>|0pIS zjnDNEP5e$(pb9LwnNU3M0gScwN;2J5(5)^7Yx&bDF5*Q6hCG*Nnp6kI$7ijv8tMi4 z`SI65#qxg(n*^vo?dcool9+A-G5zSs%M%-_yA8h1rTk4|Og+&uC#rmDY-}vygC4EQ zvD!y7FCl@sj4+B}0)HnH=VYq0kzeE{Nxm7om!c zoZitF>XUDzmq1^oh2$yaA|PV(kOzgzN+<5t1+f!&EE>?lmL^AV7@3iMT z@aF9#o&j^0Yt8tOx;B+s80lOs$yv8iOXSAQl(>CMcUp4cvuD;7j$7)Fn@RfOQy8h| zJbjTzbHLc(OQ+iJwMTOnDgPKbh`kpYYF7k}Uv!!t^Oy;(q=oNpC8(KIhs-hHzuqcx zied_#ZBrKHq_Li#3HE(|&(oPhKgNiyrfU^m?X4jp-0$NEX;N5mH`fI)AY3*&H0$o{ z0cuTrEwLy&T}f(N{kCiaJcKEn0eQqr6h9j?%o6My=60aTZESoM1x<1J+EA~TU$D(RlrazJuFk8dGDaSB|L#pqF|&tQz<9S7bnQ8c8(wk>MmGvk2(E- zza!<>lZ_^I`qnT!-SYduoO)6Cw)GXqetqQ@*IBu&zQMutvx*U+w3g%M-4)UhQTfAL zmxM@A-NBSp+#eh8n@M*rPQ7YRvZF`iu7fqR=>0mW~>Q5yOE@rzS@cW{p zt4}IrAMWi0$|I^41%Bd$ui_^yYNjjp*z~Q6KkF)T2wn}uYS)s&K6l}1(KDVuNOd?` z$Q&>K=0JhhioP@eGYiCi1(T=4Rc(_;#wKy^qdG&ynd{qBWFkWQ>&26Y>ANlG6#}C= zTXH8u_g2>N(#od+Hs$M7-XCcT$MvT0nN_*olKX4I_}E=#owVCk7DhOr1gjEtGys?B zMIC*StwFn@tx3pk{jD#@S7Qrj6 z-VJS%1Ah(PSb6@)Yc~(ne1*(W8uKUTx&se!%b&32Ynm5(1i@e3FQRu!eG4+!*)^%1 zR((%d_qwl4-%8$C+zW!{QBe0|@Ld#$=H7k(@EfVEU2X^y?4(|+GtOtT z)J7(gdAG=RM;(~2Gaf>+x!_9z*Vzi~!Uf(|Gogb&&t?86zj6>!^h3XiXb72eNdfal5zVQ^wa_XOt`*@qIZ_=`z zNBFOf>1}-eYXTXmkC%U&eduaGMnYEb_`!D5zxd03)%NZ)%D0J>+z|pW2fUEOrz+(Z zJ`kZCEv-s1+t=QEPPv`Gfr_>k96}k*`?pfk?Y8}r>QgIT`84VR`Dwa>HFnOIhMh#P zN)UQGrswprCnnOk+HOeO(qFjn(75<`%y)+GkFq_gD?irVKbMjJ8;ati*>4qaA;${l z=V$%^n&0VpQ9MJO{`QA}gQ{==fICe}e%ic-QqSQp!}rK=3FtZZX&%9?m6S4yO|R}B z&U7$LdNNhSh2?woJ@K7uvAkRbkf2(*yvGw|hoO7e7eSkyvR=hZs=RvedhEw3G|bN} z-<5^($+m8y%nK7HvEjJwk!nn}Q3&c*={1vDN_0vOk|? z(N||Ye*0oNW5zXl@GvB+Sw7GD%5oBa+!ip)6|u32_<5X~%8?AjXvr6o%h`%UwOkds!Kd7q%Rzqr19DM}^4b&iIqKqXXF})5$ zc;l&u9b|wN!lKrBWe6GT7i_>Y^UfL|RTzY|#Yf4-t5e5NOv g#j!MzeoB-<H}Q!77wX_Wpa1{> literal 0 HcmV?d00001 diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java index fa12b13af7..3ed38b79ff 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java @@ -8,7 +8,9 @@ import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; import com.fr.design.mainframe.alphafine.cell.cellModel.ActionModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.toolbar.UpdateActionManager; +import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.json.JSONObject; import java.util.List; @@ -17,9 +19,9 @@ import java.util.List; */ public class ActionSearchManager implements AlphaFineSearchProcessor { private static ActionSearchManager actionSearchManager = null; - private SearchResult filterModelList; - private SearchResult lessModelList; - private SearchResult moreModelList; + private SearchResult filterModelList = new SearchResult(); + private SearchResult lessModelList = new SearchResult(); + private SearchResult moreModelList = new SearchResult(); public synchronized static ActionSearchManager getActionSearchManager() { if (actionSearchManager == null) { @@ -30,9 +32,6 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { @Override public synchronized SearchResult showLessSearchResult(String searchText) { - this.filterModelList = new SearchResult(); - this.lessModelList = new SearchResult(); - this.moreModelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); for (UpdateAction updateAction : updateActions) { @@ -40,20 +39,23 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { filterModelList.add(new ActionModel(updateAction.getName() ,updateAction)); } } - final int length = Math.min(AlphaFineConstants.SHOW_SIZE, filterModelList.size()); - for (int i = 0; i < length; i++) { - lessModelList.add(filterModelList.get(i)); - } - for (int i = length; i < filterModelList.size(); i++) { - moreModelList.add(filterModelList.get(i)); - } - if (filterModelList.size() > 0) { - if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE) { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.ACTION)); - } else { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION)); + if (filterModelList != null && filterModelList.size() >0) { + final int length = Math.min(AlphaFineConstants.SHOW_SIZE, filterModelList.size()); + for (int i = 0; i < length; i++) { + lessModelList.add(filterModelList.get(i)); + } + for (int i = length; i < filterModelList.size(); i++) { + moreModelList.add(filterModelList.get(i)); + } + if (filterModelList.size() > 0) { + if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE) { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.ACTION)); + } else { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION)); + } } } + } return lessModelList; } @@ -62,4 +64,21 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { public SearchResult showMoreSearchResult() { return moreModelList; } + + public static ActionModel getModelFromCloud(String actionName ) { + UpdateAction action = null; + String name = null; + try { + Class className = Class.forName(actionName); + action = (UpdateAction) className.newInstance(); + name = action.getName(); + } catch (ClassNotFoundException e) { + FRLogger.getLogger().error(e.getMessage()); + } catch (IllegalAccessException e) { + FRLogger.getLogger().error(e.getMessage()); + } catch (InstantiationException e) { + FRLogger.getLogger().error(e.getMessage()); + } + return new ActionModel(name, action); + } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java index a5e862e55b..abb036a09b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java @@ -1,12 +1,9 @@ package com.fr.design.mainframe.alphafine.searchManager; -import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.general.Inter; -import java.io.*; - /** * Created by XiaXiang on 2017/3/28. */ @@ -17,7 +14,7 @@ public class AlphaSearchManager implements AlphaFineSearchProcessor { private static FileSearchManager fileSearchManager; private static ActionSearchManager actionSearchManager; private static ConcludeSearchManager concludeSearchManager; - private static LatestSearchManager latestSearchManager; + private static RecentSearchManager recentSearchManager; public synchronized static AlphaSearchManager getSearchManager() { init(); @@ -33,13 +30,13 @@ public class AlphaSearchManager implements AlphaFineSearchProcessor { fileSearchManager = FileSearchManager.getFileSearchManager(); actionSearchManager = ActionSearchManager.getActionSearchManager(); concludeSearchManager = ConcludeSearchManager.getConcludeSearchManager(); - latestSearchManager = LatestSearchManager.getLatestSearchManager(); + recentSearchManager = RecentSearchManager.getInstance(); } } @Override public synchronized SearchResult showLessSearchResult(String searchText) { - SearchResult latestModelList = latestSearchManager.showLessSearchResult(searchText); + SearchResult latestModelList = recentSearchManager.showLessSearchResult(searchText); SearchResult concludeModelList = concludeSearchManager.showLessSearchResult(searchText); SearchResult actionModelList = actionSearchManager.showLessSearchResult(searchText); SearchResult fileModelList = fileSearchManager.showLessSearchResult(searchText); @@ -69,21 +66,4 @@ public class AlphaSearchManager implements AlphaFineSearchProcessor { return null; } - public SearchResult getLatestSearchResult() { - ObjectInputStream is; - SearchResult searchResult; - try { - is = new ObjectInputStream(new FileInputStream(AlphaFineHelper.getInfoFile())); - searchResult = (SearchResult) is.readObject(); - - } catch (IOException e) { - searchResult = new SearchResult(); - } catch (ClassNotFoundException e) { - searchResult = new SearchResult(); - - } - return searchResult; - - } - } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ConcludeSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/ConcludeSearchManager.java index e4ab5ef482..435a8836fe 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ConcludeSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/ConcludeSearchManager.java @@ -1,8 +1,17 @@ package com.fr.design.mainframe.alphafine.searchManager; +import com.fr.design.mainframe.alphafine.cell.CellModelHelper; +import com.fr.design.mainframe.alphafine.cell.cellModel.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.cellModel.DocumentModel; import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.general.http.HttpClient; +import com.fr.json.JSONArray; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.stable.CodeUtils; /** * Created by XiaXiang on 2017/3/31. @@ -10,6 +19,7 @@ import com.fr.general.Inter; public class ConcludeSearchManager implements AlphaFineSearchProcessor { private static ConcludeSearchManager concludeSearchManager = null; private SearchResult modelList; + private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/?searchKey="; public synchronized static ConcludeSearchManager getConcludeSearchManager() { if (concludeSearchManager == null) { @@ -19,15 +29,37 @@ public class ConcludeSearchManager implements AlphaFineSearchProcessor { } @Override public synchronized SearchResult showLessSearchResult(String searchText) { - //todo: 猜您喜欢逻辑需要重新设计 + String result; this.modelList = new SearchResult(); - modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false)); + HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); + httpClient.asGet(); + result = httpClient.getResponseText(); + try { + JSONObject jsonObject = new JSONObject(result); + if (jsonObject.optString("status").equals("success")) { + JSONArray jsonArray = jsonObject.optJSONArray("result"); + if (jsonArray != null && jsonArray.length() > 0) { + for (int i = 0; i < jsonArray.length(); i++) { + AlphaCellModel alphaCellModel = CellModelHelper.jsonToModel((JSONObject) jsonArray.get(i)); + if (!RecentSearchManager.getInstance().getRecentModelList().contains(alphaCellModel)) { + this.modelList.add(alphaCellModel); + } + } + } + } + + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + if (modelList.size() > 0) { + modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false)); + } return modelList; } @Override public SearchResult showMoreSearchResult() { - return null; + return new SearchResult(); } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java index 2074245ef9..8472d68f41 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java @@ -13,15 +13,13 @@ import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; -import java.security.AlgorithmConstraints; - /** * Created by XiaXiang on 2017/3/27. */ public class DocumentSearchManager implements AlphaFineSearchProcessor { private static DocumentSearchManager documentSearchManager = null; - private SearchResult lessModelList; - private SearchResult moreModelList; + private SearchResult lessModelList = new SearchResult(); + private SearchResult moreModelList = new SearchResult(); public synchronized static DocumentSearchManager getDocumentSearchManager() { if (documentSearchManager == null) { @@ -33,8 +31,6 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { @Override public synchronized SearchResult showLessSearchResult(String searchText) { - this.lessModelList = new SearchResult(); - this.moreModelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainDocument()) { String result; String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText + "-1"; @@ -44,26 +40,24 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { result = httpClient.getResponseText(); try { JSONObject jsonObject = new JSONObject(result); - JSONArray jsonArray = null; - if (jsonObject.get("docdata") != null) { - jsonArray = (JSONArray) jsonObject.get("docdata"); - } - if (jsonArray.length() > 0) { - if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) { - lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.DOCUMENT)); - } else { - lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), CellType.DOCUMENT)); + JSONArray jsonArray = jsonObject.optJSONArray("docdata"); + if (jsonArray != null && jsonArray.length() > 0) { + final int length = Math.min(AlphaFineConstants.SHOW_SIZE, jsonArray.length()); + for (int i = 0; i < length; i++) { + DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i)); + this.lessModelList.add(cellModel); + } + for (int i = length; i < jsonArray.length(); i++) { + DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i)); + this.moreModelList.add(cellModel); + } + if (jsonArray.length() > 0) { + if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.DOCUMENT)); + } else { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), CellType.DOCUMENT)); + } } - } - - final int length = Math.min(AlphaFineConstants.SHOW_SIZE, jsonArray.length()); - for (int i = 0; i < length; i++) { - DocumentModel cellModel = getDocumentModel(jsonArray, i); - this.lessModelList.add(cellModel); - } - for (int i = length; i < jsonArray.length(); i++) { - DocumentModel cellModel = getDocumentModel(jsonArray, i); - this.moreModelList.add(cellModel); } } catch (JSONException e) { @@ -71,16 +65,16 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { return lessModelList; } + } return lessModelList; } - private DocumentModel getDocumentModel(JSONArray jsonArray, int i) throws JSONException { - JSONObject object = jsonArray.getJSONObject(i); - String name = (String) object.get("title"); - String content = ((String) object.get("summary")); - String documentUrl = AlphaFineConstants.DOCUMENT_DOC_URL + object.get("did") + ".html"; - return new DocumentModel(name, content, documentUrl); + public static DocumentModel getModelFromCloud(JSONObject object) { + String name = object.optString("title"); + String content = object.optString("summary"); + int documentId = object.optInt("did"); + return new DocumentModel(name, content, documentId); } @Override diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java index e502dea680..b42049592c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java @@ -4,6 +4,7 @@ import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.cellModel.FileModel; import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; @@ -11,6 +12,7 @@ import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.file.filetree.FileNode; import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.json.JSONObject; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; @@ -148,4 +150,10 @@ public class FileSearchManager implements AlphaFineSearchProcessor { } } + public static FileModel getModelFromCloud(String filePath) { + String name = AlphaFineHelper.findFileName(filePath); + String content = AlphaFineHelper.findFolderName(filePath); + return new FileModel(name, content, filePath); + } + } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/LatestSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/LatestSearchManager.java deleted file mode 100644 index 9d35de211c..0000000000 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/LatestSearchManager.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.fr.design.mainframe.alphafine.searchManager; - -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; -import com.fr.design.mainframe.alphafine.model.SearchResult; -import com.fr.design.mainframe.alphafine.recentSearch.RecentSearchManager; -import com.fr.general.Inter; - -/** - * Created by XiaXiang on 2017/3/31. - */ -public class LatestSearchManager implements AlphaFineSearchProcessor { - private static LatestSearchManager latestSearchManager = null; - private SearchResult modelList; - private SearchResult latestModelList; - - public synchronized static LatestSearchManager getLatestSearchManager() { - if (latestSearchManager == null) { - latestSearchManager = new LatestSearchManager(); - } - return latestSearchManager; - } - @Override - public synchronized SearchResult showLessSearchResult(String searchText) { - this.modelList = new SearchResult(); - modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Latest"), false)); - //todo: 本地常用逻辑需要重新设计 - if (RecentSearchManager.getInstance().getRecentModelList(searchText) != null) { - modelList.addAll(RecentSearchManager.getInstance().getRecentModelList(searchText)); - } -// if (getLatestModelList() != null && getLatestModelList().size() > 0) { -// modelList.addAll(getLatestModelList()); -// } - return modelList; - } - - @Override - public SearchResult showMoreSearchResult() { - return null; - } - - public SearchResult getModelList() { - return modelList; - } - - public void setModelList(SearchResult modelList) { - this.modelList = modelList; - } - - public SearchResult getLatestModelList() { - if(this.latestModelList != null && this.latestModelList.size() > 0) { - return this.latestModelList; - } - return AlphaSearchManager.getSearchManager().getLatestSearchResult(); - } - - public void setLatestModelList(SearchResult latestModelList) { - this.latestModelList = latestModelList; - } -} diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java index 71f9a76975..2ac6501818 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java @@ -13,6 +13,7 @@ import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; +import com.fr.plugin.chart.designer.other.HyperlinkMapFactory; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -49,26 +50,28 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { result = httpClient.getResponseText(); JSONObject jsonObject = new JSONObject(result); JSONArray jsonArray = null; - if (jsonObject.get("result") != null) { - jsonArray = (JSONArray) jsonObject.get("result"); + if (jsonObject.optJSONObject("result") != null) { + jsonArray = jsonObject.optJSONArray("result"); } - if (jsonArray.length() > 0) { - if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) { - lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.PLUGIN)); - } else { - lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), CellType.PLUGIN)); + if (jsonArray != null && jsonArray.length() > 0) { + int length = Math.min(AlphaFineConstants.SHOW_SIZE, jsonArray.length()); + for (int i = 0; i < length; i++) { + PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false); + this.lessModelList.add(cellModel); + } + for (int i = length; i < jsonArray.length(); i++) { + PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false); + this.moreModelList.add(cellModel); + } + if (jsonArray.length() > 0) { + if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.PLUGIN)); + } else { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), CellType.PLUGIN)); + } } } - int length = Math.min(5, jsonArray.length()); - for (int i = 0; i < length; i++) { - PluginModel cellModel = getPluginModel(jsonArray, i); - this.lessModelList.add(cellModel); - } - for (int i = length; i < jsonArray.length(); i++) { - PluginModel cellModel = getPluginModel(jsonArray, i); - this.moreModelList.add(cellModel); - } } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); return lessModelList; @@ -77,29 +80,29 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { return this.lessModelList; } - private PluginModel getPluginModel(JSONArray jsonArray, int i) throws JSONException { - JSONObject object = jsonArray.getJSONObject(i); - String name = (String) object.get("name"); - String content = ((String) object.get("description")); - String pluginUrl = AlphaFineConstants.REUSE_URL + object.get("id"); + private static PluginModel getPluginModel(JSONObject object, boolean isFromCloud) { + String name = object.optString("name"); + String content = object.optString("description"); + int pluginId = object.optInt("id"); String imageUrl = null; try { - imageUrl = AlphaFineConstants.PLUGIN_IMAGE_URL + URLEncoder.encode(object.get("pic").toString().substring(AlphaFineConstants.PLUGIN_IMAGE_URL.length()), "utf8"); + imageUrl = AlphaFineConstants.PLUGIN_IMAGE_URL + URLEncoder.encode(object.optString("pic").toString().substring(AlphaFineConstants.PLUGIN_IMAGE_URL.length()), "utf8"); } catch (UnsupportedEncodingException e) { FRLogger.getLogger().error(e.getMessage()); } String version = null; String jartime = null; - CellType type = CellType.REUSE; - String link = (String) object.get("link"); + CellType type; + String link = object.optString("link"); if (ComparatorUtils.equals(link, "plugin")) { - version = (String) object.get("version"); - jartime = (String) object.get("jartime"); + version = isFromCloud? object.optString("pluginversion") : object.optString("version"); + jartime = object.optString("jartime"); type = CellType.PLUGIN; - pluginUrl = AlphaFineConstants.PLUGIN_URL + object.get("id"); + } else { + type = CellType.REUSE; } - int price = (int) object.get("price"); - return new PluginModel(name, content, pluginUrl, imageUrl, version, jartime, type, price); + int price = object.optInt("price"); + return new PluginModel(name, content, imageUrl, version, jartime, type, price, pluginId); } @Override @@ -107,6 +110,14 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { return this.moreModelList; } + public static PluginModel getModelFromCloud(JSONObject object) { + JSONObject jsonObject = object.optJSONObject("result"); + if (jsonObject != null) { + return getPluginModel(jsonObject, true); + } + return null; + } + diff --git a/designer/src/com/fr/design/mainframe/alphafine/recentSearch/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java similarity index 89% rename from designer/src/com/fr/design/mainframe/alphafine/recentSearch/RecentSearchManager.java rename to designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java index ce0302d971..0e979d2a27 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/recentSearch/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java @@ -1,14 +1,16 @@ -package com.fr.design.mainframe.alphafine.recentSearch; +package com.fr.design.mainframe.alphafine.searchManager; import com.fr.base.FRContext; import com.fr.base.Utils; import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.cellModel.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; +import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.file.XMLFileManager; import com.fr.general.FRLogger; import com.fr.general.IOUtils; +import com.fr.general.Inter; import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.stable.ProductConstants; @@ -29,7 +31,7 @@ import java.util.Map; /** * Created by XiaXiang on 2017/5/15. */ -public class RecentSearchManager extends XMLFileManager { +public class RecentSearchManager extends XMLFileManager implements AlphaFineSearchProcessor { private static final String XML_TAG = "AlphafineRecent"; private static RecentSearchManager recentSearchManager = null; @@ -37,8 +39,7 @@ public class RecentSearchManager extends XMLFileManager { private List fileList; private List actionList; private List documentList; - - //private List recentKVModelList = new ArrayList<>(); + private SearchResult modelList; private List pluginList; private List recentModelList = new ArrayList<>(); private Map> recentKVModelMap = new HashMap<>(); @@ -63,7 +64,7 @@ public class RecentSearchManager extends XMLFileManager { public void readXML(XMLableReader reader) { if (reader.isChildNode()) { String nodeName = reader.getTagName(); - if (nodeName.equals("RecentModel")) { + if (nodeName.equals("RecentModelList")) { String key = reader.getAttrAsString("searchKey", StringUtils.EMPTY); final ArrayList list = new ArrayList(); reader.readXMLObject(new XMLReadable() { @@ -71,7 +72,7 @@ public class RecentSearchManager extends XMLFileManager { public void readXML(XMLableReader reader) { if (reader.isChildNode()) { String nodeName = reader.getTagName(); - if (nodeName.equals("modelList")) { + if (nodeName.equals("model")) { String name = reader.getAttrAsString("cellModel", StringUtils.EMPTY); try { list.add(CellModelHelper.jsonToModel(new JSONObject(name))); @@ -97,18 +98,20 @@ public class RecentSearchManager extends XMLFileManager { writer.startTAG(XML_TAG); if (!recentKVModelMap.isEmpty()) { for (String key : recentKVModelMap.keySet()) { - writer.startTAG("RecentModel"); + writer.startTAG("RecentModelList"); writer.attr("searchKey", key); - writer.startTAG("modelList"); + for (AlphaCellModel model : recentKVModelMap.get(key)) { try { String name = model.ModelToJson().toString(); + writer.startTAG("model"); writer.attr("cellModel", name); + writer.end(); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } } - writer.end(); + writer.end(); } } @@ -222,12 +225,12 @@ public class RecentSearchManager extends XMLFileManager { public List getRecentModelList(String searchText) { for (String key : recentKVModelMap.keySet()) { - if (recentKVModelMap.keySet().contains(searchText)) { + if (key.equals(searchText)) { List list = recentKVModelMap.get(searchText); return list; } } - return null; + return recentModelList; } public void addRecentModel(String searchKey, AlphaCellModel cellModel) { @@ -284,6 +287,22 @@ public class RecentSearchManager extends XMLFileManager { this.recentKVModelMap = recentKVModelMap; } + @Override + public SearchResult showLessSearchResult(String searchText) { + this.modelList = new SearchResult(); + recentModelList = getRecentModelList(searchText); + if (recentModelList != null && recentModelList.size() > 0) { + modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Latest"), false)); + } + modelList.addAll(recentModelList); + return modelList; + } + + @Override + public SearchResult showMoreSearchResult() { + return new SearchResult(); + } + // public List getRecentKVModelList() { // return recentKVModelList; // } From bcabaebbbfc71b0440a1cc7020e4a854002607f9 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Mon, 22 May 2017 17:14:01 +0800 Subject: [PATCH 10/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/AlphaFineHelper.java | 4 -- .../cell/cellModel/DocumentModel.java | 4 +- .../alphafine/cell/cellModel/PluginModel.java | 4 +- .../alphafine/component/AlphaFineDialog.java | 27 +++++----- .../searchManager/ActionSearchManager.java | 13 +++-- .../AlphaFineSearchProcessor.java | 4 +- .../searchManager/AlphaSearchManager.java | 20 +++---- .../searchManager/DocumentSearchManager.java | 10 ++-- .../searchManager/FileSearchManager.java | 4 +- .../searchManager/PluginSearchManager.java | 9 ++-- .../searchManager/RecentSearchManager.java | 53 +++---------------- ...nager.java => RecommendSearchManager.java} | 19 ++++--- 12 files changed, 67 insertions(+), 104 deletions(-) rename designer/src/com/fr/design/mainframe/alphafine/searchManager/{ConcludeSearchManager.java => RecommendSearchManager.java} (76%) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index cfc028b902..3e26ab16a5 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -19,10 +19,6 @@ public class AlphaFineHelper { dialog.setVisible(true); } - public static File getInfoFile() { - return new File(StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), AlphaFineConstants.SAVE_FILE_NAME)); - } - public static String findFolderName (String text) { return getSplitText(text, 2); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java index ab9397a684..39fee53ada 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java @@ -37,7 +37,9 @@ public class DocumentModel extends AlphaCellModel { public JSONObject ModelToJson() { JSONObject object = JSONObject.create(); try { - object.put("result", getInformationUrl()).put("cellType", getType().getCellType()); + JSONObject modelObject = JSONObject.create(); + modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()); + object.put("result", modelObject).put("cellType", getType().getCellType()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java index eb26d0fa93..b55b7cc465 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java @@ -98,7 +98,9 @@ public class PluginModel extends AlphaCellModel { public JSONObject ModelToJson() { JSONObject object = JSONObject.create(); try { - object.put("result", getInformationUrl()).put("cellType", getType().getCellType()); + JSONObject modelObject = JSONObject.create(); + modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("type", getType().getCellType()).put("price", getPrice()).put("id", getPluginId()); + object.put("result", modelObject).put("cellType", getType().getCellType()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 51f3b427d7..057c3c6525 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -217,7 +217,7 @@ public class AlphaFineDialog extends UIDialog { @Override protected SearchListModel doInBackground() { - return setjListModel(new SearchListModel(AlphaSearchManager.getSearchManager().showLessSearchResult(searchText))); + return setListModel(new SearchListModel(AlphaSearchManager.getSearchManager().getLessSearchResult(searchText))); } @Override @@ -634,19 +634,19 @@ public class AlphaFineDialog extends UIDialog { SearchResult moreResult; switch (selectedValue.getType()) { case PLUGIN: - moreResult = PluginSearchManager.getPluginSearchManager().showMoreSearchResult(); + moreResult = PluginSearchManager.getPluginSearchManager().getMoreSearchResult(); break; case DOCUMENT: - moreResult = DocumentSearchManager.getDocumentSearchManager().showMoreSearchResult(); + moreResult = DocumentSearchManager.getDocumentSearchManager().getMoreSearchResult(); break; case FILE: - moreResult = FileSearchManager.getFileSearchManager().showMoreSearchResult(); + moreResult = FileSearchManager.getFileSearchManager().getMoreSearchResult(); break; case ACTION: - moreResult = ActionSearchManager.getActionSearchManager().showMoreSearchResult(); + moreResult = ActionSearchManager.getActionSearchManager().getMoreSearchResult(); break; default: - moreResult = AlphaSearchManager.getSearchManager().showMoreSearchResult(); + moreResult = AlphaSearchManager.getSearchManager().getMoreSearchResult(); } return moreResult; } @@ -655,17 +655,16 @@ public class AlphaFineDialog extends UIDialog { return (SearchListModel) searchResultList.getModel(); } - //测试 - public static void main(String[] args) { - AlphaFineDialog alphaFineDialog = new AlphaFineDialog(DesignerContext.getDesignerFrame()); - alphaFineDialog.setSize(new Dimension(680,55)); - alphaFineDialog.setVisible(true); - } +// //测试 +// public static void main(String[] args) { +// AlphaFineDialog alphaFineDialog = new AlphaFineDialog(DesignerContext.getDesignerFrame()); +// alphaFineDialog.setSize(new Dimension(680,55)); +// alphaFineDialog.setVisible(true); +// } - public SearchListModel setjListModel(SearchListModel jListModel) { + public SearchListModel setListModel(SearchListModel jListModel) { this.searchListModel = jListModel; - System.out.print(this.searchListModel); return this.searchListModel; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java index 3ed38b79ff..0c3a55699b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java @@ -19,9 +19,9 @@ import java.util.List; */ public class ActionSearchManager implements AlphaFineSearchProcessor { private static ActionSearchManager actionSearchManager = null; - private SearchResult filterModelList = new SearchResult(); - private SearchResult lessModelList = new SearchResult(); - private SearchResult moreModelList = new SearchResult(); + private SearchResult filterModelList; + private SearchResult lessModelList; + private SearchResult moreModelList; public synchronized static ActionSearchManager getActionSearchManager() { if (actionSearchManager == null) { @@ -31,7 +31,10 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { } @Override - public synchronized SearchResult showLessSearchResult(String searchText) { + public synchronized SearchResult getLessSearchResult(String searchText) { + filterModelList = new SearchResult(); + lessModelList = new SearchResult(); + moreModelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); for (UpdateAction updateAction : updateActions) { @@ -61,7 +64,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { } @Override - public SearchResult showMoreSearchResult() { + public SearchResult getMoreSearchResult() { return moreModelList; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java index eb1b2b68dc..aaeb510df8 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java @@ -6,7 +6,7 @@ import com.fr.design.mainframe.alphafine.model.SearchResult; * Created by XiaXiang on 2017/3/27. */ public interface AlphaFineSearchProcessor { - SearchResult showLessSearchResult(String searchText); + SearchResult getLessSearchResult(String searchText); - SearchResult showMoreSearchResult(); + SearchResult getMoreSearchResult(); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java index abb036a09b..8462fbb2d6 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java @@ -13,7 +13,7 @@ public class AlphaSearchManager implements AlphaFineSearchProcessor { private static DocumentSearchManager documentSearchManager; private static FileSearchManager fileSearchManager; private static ActionSearchManager actionSearchManager; - private static ConcludeSearchManager concludeSearchManager; + private static RecommendSearchManager recommendSearchManager; private static RecentSearchManager recentSearchManager; public synchronized static AlphaSearchManager getSearchManager() { @@ -29,19 +29,19 @@ public class AlphaSearchManager implements AlphaFineSearchProcessor { documentSearchManager = DocumentSearchManager.getDocumentSearchManager(); fileSearchManager = FileSearchManager.getFileSearchManager(); actionSearchManager = ActionSearchManager.getActionSearchManager(); - concludeSearchManager = ConcludeSearchManager.getConcludeSearchManager(); + recommendSearchManager = RecommendSearchManager.getRecommendSearchManager(); recentSearchManager = RecentSearchManager.getInstance(); } } @Override - public synchronized SearchResult showLessSearchResult(String searchText) { - SearchResult latestModelList = recentSearchManager.showLessSearchResult(searchText); - SearchResult concludeModelList = concludeSearchManager.showLessSearchResult(searchText); - SearchResult actionModelList = actionSearchManager.showLessSearchResult(searchText); - SearchResult fileModelList = fileSearchManager.showLessSearchResult(searchText); - SearchResult documentModelList = documentSearchManager.showLessSearchResult(searchText); - SearchResult pluginModelList = pluginSearchManager.showLessSearchResult(searchText); + public synchronized SearchResult getLessSearchResult(String searchText) { + SearchResult latestModelList = recentSearchManager.getLessSearchResult(searchText); + SearchResult concludeModelList = recommendSearchManager.getLessSearchResult(searchText); + SearchResult actionModelList = actionSearchManager.getLessSearchResult(searchText); + SearchResult fileModelList = fileSearchManager.getLessSearchResult(searchText); + SearchResult documentModelList = documentSearchManager.getLessSearchResult(searchText); + SearchResult pluginModelList = pluginSearchManager.getLessSearchResult(searchText); latestModelList.addAll(concludeModelList); latestModelList.addAll(actionModelList); latestModelList.addAll(fileModelList); @@ -62,7 +62,7 @@ public class AlphaSearchManager implements AlphaFineSearchProcessor { } @Override - public SearchResult showMoreSearchResult() { + public SearchResult getMoreSearchResult() { return null; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java index 8472d68f41..07b599a5a5 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java @@ -18,8 +18,8 @@ import com.fr.json.JSONObject; */ public class DocumentSearchManager implements AlphaFineSearchProcessor { private static DocumentSearchManager documentSearchManager = null; - private SearchResult lessModelList = new SearchResult(); - private SearchResult moreModelList = new SearchResult(); + private SearchResult lessModelList; + private SearchResult moreModelList; public synchronized static DocumentSearchManager getDocumentSearchManager() { if (documentSearchManager == null) { @@ -30,7 +30,9 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { } @Override - public synchronized SearchResult showLessSearchResult(String searchText) { + public synchronized SearchResult getLessSearchResult(String searchText) { + lessModelList = new SearchResult(); + moreModelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainDocument()) { String result; String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText + "-1"; @@ -78,7 +80,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { } @Override - public SearchResult showMoreSearchResult() { + public SearchResult getMoreSearchResult() { return moreModelList; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java index b42049592c..4312b4e6b4 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java @@ -41,7 +41,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor { } } - public synchronized SearchResult showLessSearchResult(String searchText) { + public synchronized SearchResult getLessSearchResult(String searchText) { this.filterModelList = new SearchResult(); this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); @@ -120,7 +120,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor { } @Override - public SearchResult showMoreSearchResult() { + public SearchResult getMoreSearchResult() { return moreModelList; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java index 2ac6501818..ad2077e2e2 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java @@ -35,7 +35,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { } @Override - public synchronized SearchResult showLessSearchResult(String searchText) { + public synchronized SearchResult getLessSearchResult(String searchText) { this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); @@ -49,10 +49,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { httpClient.asGet(); result = httpClient.getResponseText(); JSONObject jsonObject = new JSONObject(result); - JSONArray jsonArray = null; - if (jsonObject.optJSONObject("result") != null) { - jsonArray = jsonObject.optJSONArray("result"); - } + JSONArray jsonArray = jsonObject.optJSONArray("result"); if (jsonArray != null && jsonArray.length() > 0) { int length = Math.min(AlphaFineConstants.SHOW_SIZE, jsonArray.length()); for (int i = 0; i < length; i++) { @@ -106,7 +103,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { } @Override - public SearchResult showMoreSearchResult() { + public SearchResult getMoreSearchResult() { return this.moreModelList; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java index 0e979d2a27..8f730dd8aa 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java @@ -8,6 +8,7 @@ import com.fr.design.mainframe.alphafine.cell.cellModel.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.file.XMLFileManager; +import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.IOUtils; import com.fr.general.Inter; @@ -100,7 +101,6 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear for (String key : recentKVModelMap.keySet()) { writer.startTAG("RecentModelList"); writer.attr("searchKey", key); - for (AlphaCellModel model : recentKVModelMap.get(key)) { try { String name = model.ModelToJson().toString(); @@ -111,7 +111,6 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear FRLogger.getLogger().error(e.getMessage()); } } - writer.end(); } } @@ -225,7 +224,7 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear public List getRecentModelList(String searchText) { for (String key : recentKVModelMap.keySet()) { - if (key.equals(searchText)) { + if (ComparatorUtils.equals(key, searchText)) { List list = recentKVModelMap.get(searchText); return list; } @@ -234,8 +233,6 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear } public void addRecentModel(String searchKey, AlphaCellModel cellModel) { - - //final AlphaCellModel alphaCellModel = getCellModel(cellModel); if (recentKVModelMap.keySet().contains(searchKey)) { List cellModels = recentKVModelMap.get(searchKey); if (cellModels.contains(cellModel)) { @@ -244,51 +241,24 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear } else { cellModels.add(cellModel); } + trimToSize(cellModels); } else { List list = new ArrayList<>(); list.add(cellModel); recentKVModelMap.put(searchKey, list); } -// if (alphaCellModel != null) { -// moveOnTop(alphaCellModel); -// } else { -// this.recentModelList.add(cellModel); -// } -// trimToSize(); } - private void moveOnTop(AlphaCellModel alphaCellModel) { - recentModelList.remove(alphaCellModel); - recentModelList.add(alphaCellModel); - } - private synchronized void trimToSize() { - if (recentModelList.size() > AlphaFineConstants.MAX_FILE_SIZE) { - recentModelList.remove(0); + private synchronized void trimToSize(List cellModels) { + if (cellModels.size() > AlphaFineConstants.MAX_FILE_SIZE) { + cellModels.remove(0); } } - private synchronized AlphaCellModel getCellModel(AlphaCellModel model) { - for (int i = recentModelList.size() - 1; i >= 0; i--) { - final AlphaCellModel entry = recentModelList.get(i); - String name = entry.getName(); - if (name.equals(model.getName())) { - return entry; - } - } - return null; - } - - public Map> getRecentKVModelMap() { - return recentKVModelMap; - } - - public void setRecentKVModelMap(Map> recentKVModelMap) { - this.recentKVModelMap = recentKVModelMap; - } @Override - public SearchResult showLessSearchResult(String searchText) { + public SearchResult getLessSearchResult(String searchText) { this.modelList = new SearchResult(); recentModelList = getRecentModelList(searchText); if (recentModelList != null && recentModelList.size() > 0) { @@ -299,15 +269,8 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear } @Override - public SearchResult showMoreSearchResult() { + public SearchResult getMoreSearchResult() { return new SearchResult(); } -// public List getRecentKVModelList() { -// return recentKVModelList; -// } -// -// public void setRecentKVModelList(List recentKVModelList) { -// this.recentKVModelList = recentKVModelList; -// } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ConcludeSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java similarity index 76% rename from designer/src/com/fr/design/mainframe/alphafine/searchManager/ConcludeSearchManager.java rename to designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java index 435a8836fe..28232d8944 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ConcludeSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe.alphafine.searchManager; import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.cellModel.AlphaCellModel; -import com.fr.design.mainframe.alphafine.cell.cellModel.DocumentModel; import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.general.FRLogger; @@ -16,19 +15,19 @@ import com.fr.stable.CodeUtils; /** * Created by XiaXiang on 2017/3/31. */ -public class ConcludeSearchManager implements AlphaFineSearchProcessor { - private static ConcludeSearchManager concludeSearchManager = null; +public class RecommendSearchManager implements AlphaFineSearchProcessor { + private static RecommendSearchManager recommendSearchManager = null; private SearchResult modelList; - private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/?searchKey="; + private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchddKey="; - public synchronized static ConcludeSearchManager getConcludeSearchManager() { - if (concludeSearchManager == null) { - concludeSearchManager = new ConcludeSearchManager(); + public synchronized static RecommendSearchManager getRecommendSearchManager() { + if (recommendSearchManager == null) { + recommendSearchManager = new RecommendSearchManager(); } - return concludeSearchManager; + return recommendSearchManager; } @Override - public synchronized SearchResult showLessSearchResult(String searchText) { + public synchronized SearchResult getLessSearchResult(String searchText) { String result; this.modelList = new SearchResult(); HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); @@ -58,7 +57,7 @@ public class ConcludeSearchManager implements AlphaFineSearchProcessor { } @Override - public SearchResult showMoreSearchResult() { + public SearchResult getMoreSearchResult() { return new SearchResult(); } From d674797a8dcb41a5c067f2d6122d86279a72b41c Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Mon, 22 May 2017 20:46:11 +0800 Subject: [PATCH 11/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/cell/cellModel/PluginModel.java | 3 ++- .../alphafine/searchManager/DocumentSearchManager.java | 3 +++ .../alphafine/searchManager/PluginSearchManager.java | 9 +++++++-- .../alphafine/searchManager/RecommendSearchManager.java | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java index b55b7cc465..59f4e5a6c3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java @@ -28,8 +28,9 @@ public class PluginModel extends AlphaCellModel { public PluginModel(String name, String content, CellType type) { super(name, content, type); } - public PluginModel(String name, String content, String imageUrl, String version, String jartime, CellType type, int price, int pluginId) { + public PluginModel(String name, String content, String imageUrl, String version, String jartime, String link, CellType type, int price, int pluginId) { super(name, content); + this.link = link; setType(type); this.pluginId = pluginId; if (getType() == CellType.PLUGIN) { diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java index 07b599a5a5..772597bc56 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java @@ -39,6 +39,9 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { HttpClient httpClient = new HttpClient(url); httpClient.setTimeout(5000); httpClient.asGet(); + if (!httpClient.isServerAlive()) { + return lessModelList; + } result = httpClient.getResponseText(); try { JSONObject jsonObject = new JSONObject(result); diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java index ad2077e2e2..9694caf899 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java @@ -47,6 +47,9 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { HttpClient httpClient = new HttpClient(url); httpClient.setTimeout(5000); httpClient.asGet(); + if (!httpClient.isServerAlive()) { + return lessModelList; + } result = httpClient.getResponseText(); JSONObject jsonObject = new JSONObject(result); JSONArray jsonArray = jsonObject.optJSONArray("result"); @@ -99,7 +102,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { type = CellType.REUSE; } int price = object.optInt("price"); - return new PluginModel(name, content, imageUrl, version, jartime, type, price, pluginId); + return new PluginModel(name, content, imageUrl, version, jartime, link, type, price, pluginId); } @Override @@ -111,8 +114,10 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { JSONObject jsonObject = object.optJSONObject("result"); if (jsonObject != null) { return getPluginModel(jsonObject, true); + } else { + return getPluginModel(object, false); } - return null; + } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java index 28232d8944..c3045eba4b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java @@ -18,7 +18,7 @@ import com.fr.stable.CodeUtils; public class RecommendSearchManager implements AlphaFineSearchProcessor { private static RecommendSearchManager recommendSearchManager = null; private SearchResult modelList; - private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchddKey="; + private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchKey="; public synchronized static RecommendSearchManager getRecommendSearchManager() { if (recommendSearchManager == null) { @@ -32,6 +32,9 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { this.modelList = new SearchResult(); HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); httpClient.asGet(); + if (!httpClient.isServerAlive()) { + return modelList; + } result = httpClient.getResponseText(); try { JSONObject jsonObject = new JSONObject(result); From e08e03794c502ae4d4e13c8b3241377dbe35c261 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 00:37:54 +0800 Subject: [PATCH 12/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/cell/cellModel/DocumentModel.java | 2 +- .../mainframe/alphafine/cell/cellModel/PluginModel.java | 2 +- .../alphafine/searchManager/RecentSearchManager.java | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java index 39fee53ada..b5d29edc4f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java @@ -41,7 +41,7 @@ public class DocumentModel extends AlphaCellModel { modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()); object.put("result", modelObject).put("cellType", getType().getCellType()); } catch (JSONException e) { - FRLogger.getLogger().error(e.getMessage()); + FRLogger.getLogger().error("DocumentModel: " + e.getMessage()); } return object; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java index 59f4e5a6c3..b9df4ab670 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java @@ -100,7 +100,7 @@ public class PluginModel extends AlphaCellModel { JSONObject object = JSONObject.create(); try { JSONObject modelObject = JSONObject.create(); - modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("type", getType().getCellType()).put("price", getPrice()).put("id", getPluginId()); + modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("type", getType().getCellType()).put("price", getPrice()).put("id", getPluginId()).put("link", getLink()); object.put("result", modelObject).put("cellType", getType().getCellType()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java index 8f730dd8aa..d5337aa940 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java @@ -223,10 +223,11 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear } public List getRecentModelList(String searchText) { + recentModelList = new ArrayList<>(); for (String key : recentKVModelMap.keySet()) { if (ComparatorUtils.equals(key, searchText)) { - List list = recentKVModelMap.get(searchText); - return list; + recentModelList = recentKVModelMap.get(searchText); + return recentModelList; } } return recentModelList; From 99d6d29f6509686b6b3a588c3e68a9bd6c80df3d Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 08:15:12 +0800 Subject: [PATCH 13/28] rt --- .../alphafine/searchManager/RecommendSearchManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java index c3045eba4b..45f71b5b63 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java @@ -32,6 +32,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { this.modelList = new SearchResult(); HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); httpClient.asGet(); + httpClient.setTimeout(5000); if (!httpClient.isServerAlive()) { return modelList; } From e7df5160dc2ab1a29cf1e35f037cca72da9040c5 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 08:16:03 +0800 Subject: [PATCH 14/28] rt --- .../alphafine/searchManager/RecommendSearchManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java index 45f71b5b63..3febada364 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java @@ -18,6 +18,7 @@ import com.fr.stable.CodeUtils; public class RecommendSearchManager implements AlphaFineSearchProcessor { private static RecommendSearchManager recommendSearchManager = null; private SearchResult modelList; + //todo:for test private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchKey="; public synchronized static RecommendSearchManager getRecommendSearchManager() { From 12015bfad4846f522f18cfd9e613594b0b0164cd Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 08:23:52 +0800 Subject: [PATCH 15/28] rt --- .../fr/design/actions/help/AlphaFine/AlphafineConfigPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java b/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java index 45e7127712..470d041969 100644 --- a/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java +++ b/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java @@ -174,7 +174,7 @@ public class AlphafineConfigPane extends BasicPane { AlphafineConfigManager alphafineConfigManager = designerEnvManager.getAlphafineConfigManager(); alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected()); alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected()); - alphafineConfigManager.setContainDocument(this.isContainActionCheckbox.isSelected()); + alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected()); alphafineConfigManager.setContainConclude(this.isContainConcludeCheckbox.isSelected()); alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected()); alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected()); From 2bb3af76baccdc616c6f7b4356f4b97bb1f29119 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 08:28:30 +0800 Subject: [PATCH 16/28] rt --- .../mainframe/alphafine/cell/cellModel/AlphaCellModel.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java index 81de0b33ac..d39c7210da 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java @@ -60,9 +60,7 @@ public abstract class AlphaCellModel { this.description = description; } - public JSONObject ModelToJson() throws JSONException { - return null; - } + abstract public JSONObject ModelToJson() throws JSONException; } From 03713f55e67f3ea0ee2a344558c0d17ca5af8947 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 09:25:25 +0800 Subject: [PATCH 17/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/cell/CellModelHelper.java | 14 ++------------ .../alphafine/cell/cellModel/ActionModel.java | 5 +++++ .../alphafine/cell/cellModel/AlphaCellModel.java | 1 + .../alphafine/cell/cellModel/DocumentModel.java | 7 +++++-- .../alphafine/cell/cellModel/FileModel.java | 8 ++++++-- .../alphafine/cell/cellModel/PluginModel.java | 7 +++++-- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java index 9938034077..9a5a7e4d25 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java @@ -12,6 +12,7 @@ import com.fr.json.JSONObject; * Created by XiaXiang on 2017/5/17. */ public class CellModelHelper { + private static final String RESULT = "result"; public static AlphaCellModel jsonToModel(JSONObject object) { int cellType = object.optInt("cellType"); switch (CellType.parse(cellType)) { @@ -30,17 +31,6 @@ public class CellModelHelper { } public static String getResultValueFromModel(AlphaCellModel cellModel) { - switch (cellModel.getType()) { - case ACTION: - return ((ActionModel)cellModel).getActionName(); - case DOCUMENT: - return ((DocumentModel)cellModel).getInformationUrl(); - case FILE: - return ((FileModel)cellModel).getFilePath(); - case REUSE: - case PLUGIN: - return ((PluginModel)cellModel).getInformationUrl(); - } - return null; + return cellModel.getStoreInformation(); } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java index 2e8a4510bf..26cf95bcf4 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java @@ -59,6 +59,11 @@ public class ActionModel extends AlphaCellModel implements Serializable { return object; } + @Override + public String getStoreInformation() { + return getActionName(); + } + public String getActionName() { return getAction().getClass().getName(); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java index d39c7210da..8055c88127 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java @@ -62,5 +62,6 @@ public abstract class AlphaCellModel { abstract public JSONObject ModelToJson() throws JSONException; + abstract public String getStoreInformation(); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java index b5d29edc4f..047bea152a 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java @@ -46,10 +46,13 @@ public class DocumentModel extends AlphaCellModel { return object; } + @Override + public String getStoreInformation() { + return getInformationUrl(); + } + @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof DocumentModel)) return false; DocumentModel that = (DocumentModel) o; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java index aa295a04c2..bdcc57daf6 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java @@ -5,6 +5,7 @@ import com.fr.design.mainframe.alphafine.CellType; import com.fr.general.FRLogger; import com.fr.json.JSONException; import com.fr.json.JSONObject; +import org.apache.xerces.impl.xpath.regex.REUtil; /** * Created by XiaXiang on 2017/4/20. @@ -41,11 +42,14 @@ public class FileModel extends AlphaCellModel{ return object; } + @Override + public String getStoreInformation() { + return getFilePath(); + } + @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof FileModel)) return false; FileModel fileModel = (FileModel) o; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java index b9df4ab670..76225c8272 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java @@ -109,11 +109,14 @@ public class PluginModel extends AlphaCellModel { return object; } + @Override + public String getStoreInformation() { + return getInformationUrl(); + } + @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof PluginModel)) return false; PluginModel that = (PluginModel) o; From 96a8cf3d94eba4aef5518e3cb472c49bda135140 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 10:00:27 +0800 Subject: [PATCH 18/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/AlphaFineConstants.java | 3 ++- .../mainframe/alphafine/cell/CellModelHelper.java | 15 ++++++++++----- .../alphafine/cell/cellModel/ActionModel.java | 9 ++++++--- .../alphafine/cell/cellModel/DocumentModel.java | 7 ++++++- .../alphafine/cell/cellModel/FileModel.java | 8 ++++++-- .../alphafine/cell/cellModel/PluginModel.java | 7 ++++++- .../cell/cellRender/TitleCellRender.java | 1 + .../alphafine/component/AlphaFineDialog.java | 2 +- 8 files changed, 38 insertions(+), 14 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index 93d389d11c..b258cd727f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -88,6 +88,7 @@ public class AlphaFineConstants { public static final String SERVER_URL = "http://cloud.fanruan.com/api/monitor/record_of_afsearch/single"; - public static final String testurl = "http://localhost:8080/monitor/monitor/record_of_afsearch/single"; + //TODO:先用本地服务器测试一下,避免影响云中心正常信息收集 + public static final String CLOUD_TEST_URL = "http://localhost:8080/monitor/monitor/record_of_afsearch/single"; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java index 9a5a7e4d25..f797e17c40 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java @@ -15,19 +15,24 @@ public class CellModelHelper { private static final String RESULT = "result"; public static AlphaCellModel jsonToModel(JSONObject object) { int cellType = object.optInt("cellType"); + AlphaCellModel cellModel = null; switch (CellType.parse(cellType)) { case ACTION: - return ActionSearchManager.getModelFromCloud(object.optString("result")); + cellModel = ActionSearchManager.getModelFromCloud(object.optString(RESULT)); + break; case DOCUMENT: - return DocumentSearchManager.getModelFromCloud(object.optJSONObject("result")); + cellModel = DocumentSearchManager.getModelFromCloud(object.optJSONObject(RESULT)); + break; case FILE: - return FileSearchManager.getModelFromCloud(object.optString("result")); + cellModel = FileSearchManager.getModelFromCloud(object.optString(RESULT)); + break; case PLUGIN: case REUSE: - return PluginSearchManager.getModelFromCloud(object.optJSONObject("result")); + cellModel = PluginSearchManager.getModelFromCloud(object.optJSONObject(RESULT)); + break; } - return null; + return cellModel; } public static String getResultValueFromModel(AlphaCellModel cellModel) { diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java index 26cf95bcf4..9245e6af8c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java @@ -22,9 +22,12 @@ public class ActionModel extends AlphaCellModel implements Serializable { @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof ActionModel)) return false; - + if (this == o) { + return true; + } + if (!(o instanceof ActionModel)) { + return false; + } ActionModel that = (ActionModel) o; return action != null ? action.equals(that.action) : that.action == null; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java index 047bea152a..d70c8d48e4 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java @@ -53,7 +53,12 @@ public class DocumentModel extends AlphaCellModel { @Override public boolean equals(Object o) { - + if (this == o) { + return true; + } + if (!(o instanceof DocumentModel)) { + return false; + } DocumentModel that = (DocumentModel) o; return documentUrl != null ? documentUrl.equals(that.documentUrl) : that.documentUrl == null; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java index bdcc57daf6..edb0af101c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java @@ -50,9 +50,13 @@ public class FileModel extends AlphaCellModel{ @Override public boolean equals(Object o) { - + if (this == o) { + return true; + } + if (!(o instanceof FileModel)) { + return false; + } FileModel fileModel = (FileModel) o; - return filePath != null ? filePath.equals(fileModel.filePath) : fileModel.filePath == null; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java index 76225c8272..d390219250 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java @@ -117,7 +117,12 @@ public class PluginModel extends AlphaCellModel { @Override public boolean equals(Object o) { - + if (this == o) { + return true; + } + if (!(o instanceof PluginModel)) { + return false; + } PluginModel that = (PluginModel) o; return pluginUrl != null ? pluginUrl.equals(that.pluginUrl) : that.pluginUrl == null; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java index 9e401de49c..b95d877f4f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java @@ -36,6 +36,7 @@ public class TitleCellRender implements ListCellRenderer { } if (moreModel.isLoading()) { ImageIcon imageIcon = new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/loading.gif")); + //设置cell的加载动画 imageIcon.setImageObserver(list); UILabel loadingLabel = new UILabel(imageIcon); diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 057c3c6525..bd01c9051a 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -591,7 +591,7 @@ public class AlphaFineDialog extends UIDialog { String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); para.put("token", CodeUtils.md5Encode(date, "", "MD5")); para.put("content", object.toString()); - HttpClient httpClient = new HttpClient(AlphaFineConstants.testurl, para, true); + HttpClient httpClient = new HttpClient(AlphaFineConstants.CLOUD_TEST_URL, para, true); httpClient.setTimeout(5000); httpClient.asGet(); if (!httpClient.isServerAlive()) { From 0656c731f492d513346e4f5c5561b49af16a80e5 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 10:50:50 +0800 Subject: [PATCH 19/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/CellType.java | 25 +++++++++++-------- .../alphafine/cell/CellModelHelper.java | 4 +-- .../alphafine/cell/cellModel/ActionModel.java | 2 +- .../cell/cellModel/DocumentModel.java | 2 +- .../alphafine/cell/cellModel/FileModel.java | 3 +-- .../alphafine/cell/cellModel/PluginModel.java | 8 ++---- .../cell/cellRender/ContentCellRender.java | 2 +- .../alphafine/component/AlphaFineDialog.java | 2 +- 8 files changed, 23 insertions(+), 25 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/CellType.java b/designer/src/com/fr/design/mainframe/alphafine/CellType.java index 016490e44c..f1a6197ca6 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/CellType.java +++ b/designer/src/com/fr/design/mainframe/alphafine/CellType.java @@ -4,30 +4,33 @@ package com.fr.design.mainframe.alphafine; * Created by XiaXiang on 2017/4/27. */ public enum CellType { - PLUGIN(0), DOCUMENT(1), FILE(2), ACTION(3), REUSE(4); + RECOMMEND(0), ACTION(1), DOCUMENT(2), FILE(3), PLUGIN(4), REUSE(5); - private int cellType; + private int typeValue; CellType(int type) { - this.cellType = type; + this.typeValue = type; } public static CellType parse(int cellType) { CellType type; switch (cellType) { case 0: - type = PLUGIN; + type = RECOMMEND; break; case 1: - type = DOCUMENT; + type = ACTION; break; case 2: - type = FILE; + type = DOCUMENT; break; case 3: - type = ACTION; + type = FILE; break; case 4: + type = PLUGIN; + break; + case 5: type = REUSE; break; default: @@ -36,12 +39,12 @@ public enum CellType { return type; } - public int getCellType() { - return cellType; + public int getTypeValue() { + return typeValue; } - public void setCellType(int cellType) { - this.cellType = cellType; + public void setTypeValue(int typeValue) { + this.typeValue = typeValue; } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java index f797e17c40..fdae196573 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java @@ -14,9 +14,9 @@ import com.fr.json.JSONObject; public class CellModelHelper { private static final String RESULT = "result"; public static AlphaCellModel jsonToModel(JSONObject object) { - int cellType = object.optInt("cellType"); + int typeValue = object.optInt("cellType"); AlphaCellModel cellModel = null; - switch (CellType.parse(cellType)) { + switch (CellType.parse(typeValue)) { case ACTION: cellModel = ActionSearchManager.getModelFromCloud(object.optString(RESULT)); break; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java index 9245e6af8c..6c9a4efa2b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java @@ -55,7 +55,7 @@ public class ActionModel extends AlphaCellModel implements Serializable { public JSONObject ModelToJson() { JSONObject object = JSONObject.create(); try { - object.put("result", getAction().getClass().getName()).put("cellType", getType().getCellType()); + object.put("result", getAction().getClass().getName()).put("cellType", getType().getTypeValue()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java index d70c8d48e4..63771ddfdd 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java @@ -39,7 +39,7 @@ public class DocumentModel extends AlphaCellModel { try { JSONObject modelObject = JSONObject.create(); modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()); - object.put("result", modelObject).put("cellType", getType().getCellType()); + object.put("result", modelObject).put("cellType", getType().getTypeValue()); } catch (JSONException e) { FRLogger.getLogger().error("DocumentModel: " + e.getMessage()); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java index edb0af101c..851b0e2a71 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java @@ -5,7 +5,6 @@ import com.fr.design.mainframe.alphafine.CellType; import com.fr.general.FRLogger; import com.fr.json.JSONException; import com.fr.json.JSONObject; -import org.apache.xerces.impl.xpath.regex.REUtil; /** * Created by XiaXiang on 2017/4/20. @@ -35,7 +34,7 @@ public class FileModel extends AlphaCellModel{ public JSONObject ModelToJson() { JSONObject object = JSONObject.create(); try { - object.put("result", getFilePath()).put("cellType", getType().getCellType()); + object.put("result", getFilePath()).put("cellType", getType().getTypeValue()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java index d390219250..c737ea6be9 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java @@ -2,14 +2,10 @@ package com.fr.design.mainframe.alphafine.cell.cellModel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; -import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.json.JSONException; import com.fr.json.JSONObject; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; - /** * Created by XiaXiang on 2017/4/20. */ @@ -100,8 +96,8 @@ public class PluginModel extends AlphaCellModel { JSONObject object = JSONObject.create(); try { JSONObject modelObject = JSONObject.create(); - modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("type", getType().getCellType()).put("price", getPrice()).put("id", getPluginId()).put("link", getLink()); - object.put("result", modelObject).put("cellType", getType().getCellType()); + modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("type", getType().getTypeValue()).put("price", getPrice()).put("id", getPluginId()).put("link", getLink()); + object.put("result", modelObject).put("cellType", getType().getTypeValue()); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/ContentCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/ContentCellRender.java index 6f9a967cb0..e580847e80 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/ContentCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/ContentCellRender.java @@ -32,7 +32,7 @@ public class ContentCellRender implements ListCellRenderer { panel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); AlphaCellModel model = (AlphaCellModel) value; name.setText(model.getName()); - String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getCellType() + ".png"; + String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png"; name.setIcon(new ImageIcon(getClass().getResource(iconUrl))); name.setFont(AlphaFineConstants.MEDIUM_FONT); name.setForeground(AlphaFineConstants.BLACK); diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index bd01c9051a..e17156260c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -579,7 +579,7 @@ public class AlphaFineDialog extends UIDialog { String activitykey = DesignerEnvManager.getEnvManager().getActivationKey(); String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime()); String key = searchKey; - int resultkind = cellModel.getType().getCellType(); + int resultkind = cellModel.getType().getTypeValue(); String resultValue = CellModelHelper.getResultValueFromModel(cellModel); JSONObject object = JSONObject.create(); try { From 326d6fede3882e193ff3096252fa17330bfcd81e Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 10:58:09 +0800 Subject: [PATCH 20/28] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=B8=8BPMD=E6=80=8E?= =?UTF-8?q?=E4=B9=88=E7=9F=A5=E9=81=93=E6=88=91=E6=98=AF=E8=AF=BBjson?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/searchManager/RecentSearchManager.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java index d5337aa940..1a2aa9f79b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java @@ -75,11 +75,11 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear String nodeName = reader.getTagName(); if (nodeName.equals("model")) { String name = reader.getAttrAsString("cellModel", StringUtils.EMPTY); - try { - list.add(CellModelHelper.jsonToModel(new JSONObject(name))); - } catch (JSONException e) { - FRLogger.getLogger().error(e.getMessage()); - } +// try { +// list.add(CellModelHelper.jsonToModel(new JSONObject(name))); +// } catch (JSONException e) { +// FRLogger.getLogger().error(e.getMessage()); +// } } } } From ab008a130a2fb1cd9cfc72d960bb204ba28536dd Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 11:04:14 +0800 Subject: [PATCH 21/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../searchManager/RecentSearchManager.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java index 1a2aa9f79b..408ee2c84b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java @@ -71,17 +71,7 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear reader.readXMLObject(new XMLReadable() { @Override public void readXML(XMLableReader reader) { - if (reader.isChildNode()) { - String nodeName = reader.getTagName(); - if (nodeName.equals("model")) { - String name = reader.getAttrAsString("cellModel", StringUtils.EMPTY); -// try { -// list.add(CellModelHelper.jsonToModel(new JSONObject(name))); -// } catch (JSONException e) { -// FRLogger.getLogger().error(e.getMessage()); -// } - } - } + readCellModel(reader, list); } } ); @@ -94,6 +84,20 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear } + private void readCellModel(XMLableReader reader, List list) { + if (reader.isChildNode()) { + String nodeName = reader.getTagName(); + if (nodeName.equals("model")) { + String name = reader.getAttrAsString("cellModel", StringUtils.EMPTY); + try { + list.add(CellModelHelper.jsonToModel(new JSONObject(name))); + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + } + } + @Override public void writeXML(XMLPrintWriter writer) { writer.startTAG(XML_TAG); From 2fb040b215e91ec31762cdbae19bace7c4bd9814 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 11:55:07 +0800 Subject: [PATCH 22/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/CellType.java | 23 ++++++++++++------- .../alphafine/cell/CellModelHelper.java | 2 +- .../searchManager/RecentSearchManager.java | 5 +++- .../searchManager/RecommendSearchManager.java | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/CellType.java b/designer/src/com/fr/design/mainframe/alphafine/CellType.java index f1a6197ca6..652ac99de8 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/CellType.java +++ b/designer/src/com/fr/design/mainframe/alphafine/CellType.java @@ -7,30 +7,37 @@ public enum CellType { RECOMMEND(0), ACTION(1), DOCUMENT(2), FILE(3), PLUGIN(4), REUSE(5); private int typeValue; + private static final int RECOMMEND_VALUE = 0; + private static final int ACTION_VALUE = 1; + private static final int DOCUMENT_VALUE = 2; + private static final int FILE_VALUE = 3; + private static final int PLUGIN_VALUE = 4; + private static final int REUSE_VALUE = 5; + CellType(int type) { this.typeValue = type; } - public static CellType parse(int cellType) { + public static CellType parse(int typeValue) { CellType type; - switch (cellType) { - case 0: + switch (typeValue) { + case RECOMMEND_VALUE: type = RECOMMEND; break; - case 1: + case ACTION_VALUE: type = ACTION; break; - case 2: + case DOCUMENT_VALUE: type = DOCUMENT; break; - case 3: + case FILE_VALUE: type = FILE; break; - case 4: + case PLUGIN_VALUE: type = PLUGIN; break; - case 5: + case REUSE_VALUE: type = REUSE; break; default: diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java index fdae196573..e5d6664d8f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java @@ -13,7 +13,7 @@ import com.fr.json.JSONObject; */ public class CellModelHelper { private static final String RESULT = "result"; - public static AlphaCellModel jsonToModel(JSONObject object) { + public static AlphaCellModel getModelFromJson(JSONObject object) { int typeValue = object.optInt("cellType"); AlphaCellModel cellModel = null; switch (CellType.parse(typeValue)) { diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java index 408ee2c84b..8afe874416 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java @@ -90,7 +90,7 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear if (nodeName.equals("model")) { String name = reader.getAttrAsString("cellModel", StringUtils.EMPTY); try { - list.add(CellModelHelper.jsonToModel(new JSONObject(name))); + list.add(CellModelHelper.getModelFromJson(new JSONObject(name))); } catch (JSONException e) { FRLogger.getLogger().error(e.getMessage()); } @@ -231,6 +231,9 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear for (String key : recentKVModelMap.keySet()) { if (ComparatorUtils.equals(key, searchText)) { recentModelList = recentKVModelMap.get(searchText); + if (recentModelList.size() > 3) { + return recentModelList.subList(0, 2); + } return recentModelList; } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java index 3febada364..dfd7a85091 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java @@ -44,7 +44,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { JSONArray jsonArray = jsonObject.optJSONArray("result"); if (jsonArray != null && jsonArray.length() > 0) { for (int i = 0; i < jsonArray.length(); i++) { - AlphaCellModel alphaCellModel = CellModelHelper.jsonToModel((JSONObject) jsonArray.get(i)); + AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); if (!RecentSearchManager.getInstance().getRecentModelList().contains(alphaCellModel)) { this.modelList.add(alphaCellModel); } From 213acb8172c37c88dc358b67b49fc7bba6ae7e3a Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 13:13:45 +0800 Subject: [PATCH 23/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/AlphaFineDialog.java | 15 ++------------- .../searchManager/RecentSearchManager.java | 14 +++++++++----- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index e17156260c..ba86aa0276 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -595,7 +595,7 @@ public class AlphaFineDialog extends UIDialog { httpClient.setTimeout(5000); httpClient.asGet(); if (!httpClient.isServerAlive()) { - FRLogger.getLogger().error("404"); + FRLogger.getLogger().error("Failed to sent data to server!"); } } @@ -626,10 +626,6 @@ public class AlphaFineDialog extends UIDialog { repaint(); } - private void updatePopup() { - - } - private SearchResult getMoreResult(MoreModel selectedValue) { SearchResult moreResult; switch (selectedValue.getType()) { @@ -655,14 +651,6 @@ public class AlphaFineDialog extends UIDialog { return (SearchListModel) searchResultList.getModel(); } -// //测试 -// public static void main(String[] args) { -// AlphaFineDialog alphaFineDialog = new AlphaFineDialog(DesignerContext.getDesignerFrame()); -// alphaFineDialog.setSize(new Dimension(680,55)); -// alphaFineDialog.setVisible(true); -// } - - public SearchListModel setListModel(SearchListModel jListModel) { this.searchListModel = jListModel; return this.searchListModel; @@ -676,4 +664,5 @@ public class AlphaFineDialog extends UIDialog { this.searchWorker = searchWorker; } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java index 8afe874416..6f87232ab1 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java @@ -89,15 +89,19 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear String nodeName = reader.getTagName(); if (nodeName.equals("model")) { String name = reader.getAttrAsString("cellModel", StringUtils.EMPTY); - try { - list.add(CellModelHelper.getModelFromJson(new JSONObject(name))); - } catch (JSONException e) { - FRLogger.getLogger().error(e.getMessage()); - } + addModelToList(list, name); } } } + private void addModelToList(List list, String name) { + try { + list.add(CellModelHelper.getModelFromJson(new JSONObject(name))); + } catch (JSONException e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + @Override public void writeXML(XMLPrintWriter writer) { writer.startTAG(XML_TAG); From cf2babbd5dfae22b3a703b438bc9b53d89527860 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 13:15:47 +0800 Subject: [PATCH 24/28] rt --- .../src/com/fr/design/utils/DesignUtils.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer_base/src/com/fr/design/utils/DesignUtils.java b/designer_base/src/com/fr/design/utils/DesignUtils.java index 9e4c924635..8ed8aa6175 100644 --- a/designer_base/src/com/fr/design/utils/DesignUtils.java +++ b/designer_base/src/com/fr/design/utils/DesignUtils.java @@ -50,12 +50,12 @@ public class DesignUtils { * @return 启动了返回true */ public static boolean isStarted() { -// try { -// new Socket("localhost", port); -// return true; -// } catch (Exception exp) { -// -// } + try { + new Socket("localhost", port); + return true; + } catch (Exception exp) { + + } return false; } From b46349667528edcf71d9ee61b0dadf21d4eccbe1 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 14:46:19 +0800 Subject: [PATCH 25/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/AlphaFineHelper.java | 19 ++++++++++ .../design/mainframe/alphafine/CellType.java | 35 +++---------------- .../cell/cellModel/AlphaCellModel.java | 9 +++++ .../alphafine/component/AlphaFineDialog.java | 2 +- .../searchManager/ActionSearchManager.java | 5 +++ .../AlphaFineSearchProcessor.java | 9 +++++ .../searchManager/AlphaSearchManager.java | 16 ++++----- .../searchManager/DocumentSearchManager.java | 17 +++++---- .../searchManager/FileSearchManager.java | 27 ++++++++++++++ .../searchManager/PluginSearchManager.java | 16 +++++---- .../searchManager/RecentSearchManager.java | 20 ++++++++++- .../searchManager/RecommendSearchManager.java | 2 +- .../parameter/ParameterDefinitePane.java | 8 ++--- 13 files changed, 128 insertions(+), 57 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 3e26ab16a5..0e90194dfb 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -14,15 +14,29 @@ import java.io.File; */ public class AlphaFineHelper { + /** + * 弹出alphafine搜索面板 + */ public static void showAlphaFineDialog() { AlphaFineDialog dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame()); dialog.setVisible(true); } + /** + * 获取文件名上级目录 + * @param text + * @return + */ public static String findFolderName (String text) { return getSplitText(text, 2); } + /** + * 分割字符串,获取文件名,文件名上级目录等 + * @param text + * @param index + * @return + */ private static String getSplitText(String text, int index) { if (StringUtils.isNotBlank(text)) { String[] textArray = text.split("/"); @@ -33,6 +47,11 @@ public class AlphaFineHelper { return null; } + /** + * 获取文件名 + * @param text + * @return + */ public static String findFileName (String text) { return getSplitText(text, 1); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/CellType.java b/designer/src/com/fr/design/mainframe/alphafine/CellType.java index 652ac99de8..96b7db6096 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/CellType.java +++ b/designer/src/com/fr/design/mainframe/alphafine/CellType.java @@ -7,43 +7,18 @@ public enum CellType { RECOMMEND(0), ACTION(1), DOCUMENT(2), FILE(3), PLUGIN(4), REUSE(5); private int typeValue; - private static final int RECOMMEND_VALUE = 0; - private static final int ACTION_VALUE = 1; - private static final int DOCUMENT_VALUE = 2; - private static final int FILE_VALUE = 3; - private static final int PLUGIN_VALUE = 4; - private static final int REUSE_VALUE = 5; - CellType(int type) { this.typeValue = type; } public static CellType parse(int typeValue) { - CellType type; - switch (typeValue) { - case RECOMMEND_VALUE: - type = RECOMMEND; - break; - case ACTION_VALUE: - type = ACTION; - break; - case DOCUMENT_VALUE: - type = DOCUMENT; - break; - case FILE_VALUE: - type = FILE; - break; - case PLUGIN_VALUE: - type = PLUGIN; - break; - case REUSE_VALUE: - type = REUSE; - break; - default: - type = FILE; + for (CellType type : CellType.values()) { + if (type.getTypeValue() == typeValue) { + return type; + } } - return type; + return FILE; } public int getTypeValue() { diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java index 8055c88127..18cd2d843c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java @@ -60,8 +60,17 @@ public abstract class AlphaCellModel { this.description = description; } + /** + * model转json + * @return + * @throws JSONException + */ abstract public JSONObject ModelToJson() throws JSONException; + /** + * 获取需要保存到云中心的信息 + * @return + */ abstract public String getStoreInformation(); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index ba86aa0276..0da64af97a 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -561,7 +561,7 @@ public class AlphaFineDialog extends UIDialog { * @param cellModel */ private void saveHistory(String searchText, AlphaCellModel cellModel) { - RecentSearchManager recentSearchManager = RecentSearchManager.getInstance(); + RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger(); recentSearchManager.addRecentModel(searchText, cellModel); recentSearchManager.saveXMLFile(); sendToServer(searchText, cellModel); diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java index 0c3a55699b..e13466b65f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java @@ -68,6 +68,11 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { return moreModelList; } + /** + * 根据类名反射获取对象 + * @param actionName + * @return + */ public static ActionModel getModelFromCloud(String actionName ) { UpdateAction action = null; String name = null; diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java index aaeb510df8..3883fbac8f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java @@ -6,7 +6,16 @@ import com.fr.design.mainframe.alphafine.model.SearchResult; * Created by XiaXiang on 2017/3/27. */ public interface AlphaFineSearchProcessor { + /** + * 获取默认显示条数 + * @param searchText + * @return + */ SearchResult getLessSearchResult(String searchText); + /** + * 获取剩余条数 + * @return + */ SearchResult getMoreSearchResult(); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java index 8462fbb2d6..915db8ae20 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java @@ -30,24 +30,24 @@ public class AlphaSearchManager implements AlphaFineSearchProcessor { fileSearchManager = FileSearchManager.getFileSearchManager(); actionSearchManager = ActionSearchManager.getActionSearchManager(); recommendSearchManager = RecommendSearchManager.getRecommendSearchManager(); - recentSearchManager = RecentSearchManager.getInstance(); + recentSearchManager = RecentSearchManager.getRecentSearchManger(); } } @Override public synchronized SearchResult getLessSearchResult(String searchText) { - SearchResult latestModelList = recentSearchManager.getLessSearchResult(searchText); + SearchResult recentModelList = recentSearchManager.getLessSearchResult(searchText); SearchResult concludeModelList = recommendSearchManager.getLessSearchResult(searchText); SearchResult actionModelList = actionSearchManager.getLessSearchResult(searchText); SearchResult fileModelList = fileSearchManager.getLessSearchResult(searchText); SearchResult documentModelList = documentSearchManager.getLessSearchResult(searchText); SearchResult pluginModelList = pluginSearchManager.getLessSearchResult(searchText); - latestModelList.addAll(concludeModelList); - latestModelList.addAll(actionModelList); - latestModelList.addAll(fileModelList); - latestModelList.addAll(documentModelList); - latestModelList.addAll(pluginModelList); - return latestModelList; + recentModelList.addAll(concludeModelList); + recentModelList.addAll(actionModelList); + recentModelList.addAll(fileModelList); + recentModelList.addAll(documentModelList); + recentModelList.addAll(pluginModelList); + return recentModelList; } public SearchResult showDefaultSearchResult() { diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java index 772597bc56..c16189345d 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java @@ -56,13 +56,13 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i)); this.moreModelList.add(cellModel); } - if (jsonArray.length() > 0) { - if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.DOCUMENT)); - } else { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), CellType.DOCUMENT)); - } + if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.DOCUMENT)); + } else { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), CellType.DOCUMENT)); } + + } } catch (JSONException e) { @@ -75,6 +75,11 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { return lessModelList; } + /** + * 根据json信息获取文档model + * @param object + * @return + */ public static DocumentModel getModelFromCloud(JSONObject object) { String name = object.optString("title"); String content = object.optString("summary"); diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java index 4312b4e6b4..55784d1818 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java @@ -108,6 +108,13 @@ public class FileSearchManager implements AlphaFineSearchProcessor { } } + /** + * 搜索模板 + * @param searchText + * @param node + * @param isAlreadyContain + * @return + */ private boolean searchFile(String searchText, FileNode node, boolean isAlreadyContain) { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainTemplate()) { if (node.getName().toLowerCase().contains(searchText.toLowerCase())) { @@ -124,6 +131,13 @@ public class FileSearchManager implements AlphaFineSearchProcessor { return moreModelList; } + /** + * 获取工作目录下所有符合要求的模板 + * @param env + * @param rootFilePath + * @param recurse + * @return + */ private List listTpl(Env env, String rootFilePath, boolean recurse) { List fileNodeList = new ArrayList(); try { @@ -134,6 +148,14 @@ public class FileSearchManager implements AlphaFineSearchProcessor { return fileNodeList; } + /** + * 获取当前工作目录下所有模板 + * @param env + * @param rootFilePath + * @param nodeList + * @param recurse + * @throws Exception + */ private void listAll(Env env, String rootFilePath, List nodeList, boolean recurse) throws Exception { FileNode[] fns = env.listFile(rootFilePath); for (int i = 0; i < fns.length; i++) { @@ -150,6 +172,11 @@ public class FileSearchManager implements AlphaFineSearchProcessor { } } + /** + * 根据文件路径获取文件模型 + * @param filePath + * @return + */ public static FileModel getModelFromCloud(String filePath) { String name = AlphaFineHelper.findFileName(filePath); String content = AlphaFineHelper.findFolderName(filePath); diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java index 9694caf899..dfbbf44b47 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java @@ -63,13 +63,12 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false); this.moreModelList.add(cellModel); } - if (jsonArray.length() > 0) { - if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.PLUGIN)); - } else { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), CellType.PLUGIN)); - } + if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.PLUGIN)); + } else { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), CellType.PLUGIN)); } + } } catch (Exception e) { @@ -110,6 +109,11 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { return this.moreModelList; } + /** + * 根据json获取对应的插件model + * @param object + * @return + */ public static PluginModel getModelFromCloud(JSONObject object) { JSONObject jsonObject = object.optJSONObject("result"); if (jsonObject != null) { diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java index 6f87232ab1..6066543d68 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java @@ -45,7 +45,7 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear private List recentModelList = new ArrayList<>(); private Map> recentKVModelMap = new HashMap<>(); - public synchronized static RecentSearchManager getInstance() { + public synchronized static RecentSearchManager getRecentSearchManger() { if (recentSearchManager == null) { recentSearchManager = new RecentSearchManager(); try { @@ -163,6 +163,10 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear this.pluginList = pluginList; } + /** + * 获取xml + * @return + */ private File getRecentFile() { if (recentFile == null) { recentFile = new File(ProductConstants.getEnvHome() + File.separator + fileName()); @@ -179,6 +183,10 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear return envFile; } + /** + * 创建XML + * @param envFile + */ private void createRecentFile(File envFile) { try { FileWriter fileWriter = new FileWriter(envFile); @@ -230,6 +238,11 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear this.recentModelList = recentModelList; } + /** + * 根据搜索字段获取对应的model列表 + * @param searchText + * @return + */ public List getRecentModelList(String searchText) { recentModelList = new ArrayList<>(); for (String key : recentKVModelMap.keySet()) { @@ -244,6 +257,11 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear return recentModelList; } + /** + * 将搜索结果加入到当前MAP中 + * @param searchKey + * @param cellModel + */ public void addRecentModel(String searchKey, AlphaCellModel cellModel) { if (recentKVModelMap.keySet().contains(searchKey)) { List cellModels = recentKVModelMap.get(searchKey); diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java index dfd7a85091..f8126ce968 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java @@ -45,7 +45,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { if (jsonArray != null && jsonArray.length() > 0) { for (int i = 0; i < jsonArray.length(); i++) { AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); - if (!RecentSearchManager.getInstance().getRecentModelList().contains(alphaCellModel)) { + if (!RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) { this.modelList.add(alphaCellModel); } } diff --git a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java index 81e334b9e5..e45a144acb 100644 --- a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java @@ -103,7 +103,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus } }; this.add(paraDesignEditor.createWrapper(), BorderLayout.CENTER); -// WidgetToolBarPane.getInstance(formParaDesignEditor); +// WidgetToolBarPane.getRecentSearchManger(formParaDesignEditor); setButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/parametersetting.png")); setButton.set4ToolbarButton(); @@ -378,7 +378,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus currentIndex++; parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter); refreshParameter(); -// FormHierarchyTreePane.getInstance().refreshDockingView(); +// FormHierarchyTreePane.getRecentSearchManger().refreshDockingView(); DesignModuleFactory.getFormHierarchyPane().refreshDockingView(); if (propertyChangeListener != null) { propertyChangeListener.propertyChange(); @@ -398,7 +398,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus currentIndex = currentIndex + NUM_IN_A_LINE - currentIndex % NUM_IN_A_LINE; parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter); refreshParameter(); -// FormHierarchyTreePane.getInstance().refreshDockingView(); +// FormHierarchyTreePane.getRecentSearchManger().refreshDockingView(); DesignModuleFactory.getFormHierarchyPane().refreshDockingView(); if (propertyChangeListener != null) { propertyChangeListener.propertyChange(); @@ -420,7 +420,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus parameterArray = null; refreshParameter(); -// FormHierarchyTreePane.getInstance().refreshDockingView(); +// FormHierarchyTreePane.getRecentSearchManger().refreshDockingView(); DesignModuleFactory.getFormHierarchyPane().refreshDockingView(); if (propertyChangeListener != null) { propertyChangeListener.propertyChange(); From 76b4745e42aaf36e144211e33037b538a7a17aa2 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 14:59:19 +0800 Subject: [PATCH 26/28] rt --- .../src/com/fr/design/parameter/ParameterDefinitePane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java index e45a144acb..300d42c3fc 100644 --- a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java @@ -378,7 +378,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus currentIndex++; parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter); refreshParameter(); -// FormHierarchyTreePane.getRecentSearchManger().refreshDockingView(); +// FormHierarchyTreePane.getInstance().refreshDockingView(); DesignModuleFactory.getFormHierarchyPane().refreshDockingView(); if (propertyChangeListener != null) { propertyChangeListener.propertyChange(); @@ -398,7 +398,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus currentIndex = currentIndex + NUM_IN_A_LINE - currentIndex % NUM_IN_A_LINE; parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter); refreshParameter(); -// FormHierarchyTreePane.getRecentSearchManger().refreshDockingView(); +// FormHierarchyTreePane.getInstance().refreshDockingView(); DesignModuleFactory.getFormHierarchyPane().refreshDockingView(); if (propertyChangeListener != null) { propertyChangeListener.propertyChange(); @@ -420,7 +420,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus parameterArray = null; refreshParameter(); -// FormHierarchyTreePane.getRecentSearchManger().refreshDockingView(); +// FormHierarchyTreePane.getInstance().refreshDockingView(); DesignModuleFactory.getFormHierarchyPane().refreshDockingView(); if (propertyChangeListener != null) { propertyChangeListener.propertyChange(); From 6e92753da58a65ff37670be0e01eaba377254a91 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 15:06:01 +0800 Subject: [PATCH 27/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F=20?= =?UTF-8?q?=E5=8C=85=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/AlphaFineHelper.java | 5 ----- .../mainframe/alphafine/cell/CellModelHelper.java | 10 +++++----- .../cell/{cellModel => model}/ActionModel.java | 2 +- .../cell/{cellModel => model}/AlphaCellModel.java | 2 +- .../cell/{cellModel => model}/DocumentModel.java | 2 +- .../cell/{cellModel => model}/FileModel.java | 2 +- .../cell/{cellModel => model}/MoreModel.java | 2 +- .../cell/{cellModel => model}/PluginModel.java | 2 +- .../{cellRender => render}/ContentCellRender.java | 6 +++--- .../{cellRender => render}/TitleCellRender.java | 4 ++-- .../alphafine/component/AlphaFineDialog.java | 14 +++++++------- .../ActionPreviewPane.java | 2 +- .../DocumentPreviewPane.java | 2 +- .../{previewPane => preview}/FilePreviewPane.java | 2 +- .../PluginPreviewPane.java | 2 +- .../manager}/ActionSearchManager.java | 7 +++---- .../manager}/AlphaFineSearchProcessor.java | 2 +- .../manager}/AlphaSearchManager.java | 4 ++-- .../manager}/DocumentSearchManager.java | 6 +++--- .../manager}/FileSearchManager.java | 7 +++---- .../manager}/PluginSearchManager.java | 8 +++----- .../manager}/RecentSearchManager.java | 6 +++--- .../manager}/RecommendSearchManager.java | 6 +++--- 23 files changed, 48 insertions(+), 57 deletions(-) rename designer/src/com/fr/design/mainframe/alphafine/cell/{cellModel => model}/ActionModel.java (96%) rename designer/src/com/fr/design/mainframe/alphafine/cell/{cellModel => model}/AlphaCellModel.java (96%) rename designer/src/com/fr/design/mainframe/alphafine/cell/{cellModel => model}/DocumentModel.java (97%) rename designer/src/com/fr/design/mainframe/alphafine/cell/{cellModel => model}/FileModel.java (96%) rename designer/src/com/fr/design/mainframe/alphafine/cell/{cellModel => model}/MoreModel.java (96%) rename designer/src/com/fr/design/mainframe/alphafine/cell/{cellModel => model}/PluginModel.java (98%) rename designer/src/com/fr/design/mainframe/alphafine/cell/{cellRender => render}/ContentCellRender.java (90%) rename designer/src/com/fr/design/mainframe/alphafine/cell/{cellRender => render}/TitleCellRender.java (93%) rename designer/src/com/fr/design/mainframe/alphafine/{previewPane => preview}/ActionPreviewPane.java (70%) rename designer/src/com/fr/design/mainframe/alphafine/{previewPane => preview}/DocumentPreviewPane.java (96%) rename designer/src/com/fr/design/mainframe/alphafine/{previewPane => preview}/FilePreviewPane.java (91%) rename designer/src/com/fr/design/mainframe/alphafine/{previewPane => preview}/PluginPreviewPane.java (98%) rename designer/src/com/fr/design/mainframe/alphafine/{searchManager => search/manager}/ActionSearchManager.java (94%) rename designer/src/com/fr/design/mainframe/alphafine/{searchManager => search/manager}/AlphaFineSearchProcessor.java (87%) rename designer/src/com/fr/design/mainframe/alphafine/{searchManager => search/manager}/AlphaSearchManager.java (96%) rename designer/src/com/fr/design/mainframe/alphafine/{searchManager => search/manager}/DocumentSearchManager.java (94%) rename designer/src/com/fr/design/mainframe/alphafine/{searchManager => search/manager}/FileSearchManager.java (96%) rename designer/src/com/fr/design/mainframe/alphafine/{searchManager => search/manager}/PluginSearchManager.java (94%) rename designer/src/com/fr/design/mainframe/alphafine/{searchManager => search/manager}/RecentSearchManager.java (98%) rename designer/src/com/fr/design/mainframe/alphafine/{searchManager => search/manager}/RecommendSearchManager.java (92%) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 0e90194dfb..60ef8a8ef0 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -1,14 +1,9 @@ package com.fr.design.mainframe.alphafine; -import com.fr.base.FRContext; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.alphafine.cell.cellModel.*; import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; -import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import java.io.File; - /** * Created by XiaXiang on 2017/5/8. */ diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java index e5d6664d8f..e8380cb816 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java @@ -1,11 +1,11 @@ package com.fr.design.mainframe.alphafine.cell; import com.fr.design.mainframe.alphafine.CellType; -import com.fr.design.mainframe.alphafine.cell.cellModel.*; -import com.fr.design.mainframe.alphafine.searchManager.ActionSearchManager; -import com.fr.design.mainframe.alphafine.searchManager.DocumentSearchManager; -import com.fr.design.mainframe.alphafine.searchManager.FileSearchManager; -import com.fr.design.mainframe.alphafine.searchManager.PluginSearchManager; +import com.fr.design.mainframe.alphafine.cell.model.*; +import com.fr.design.mainframe.alphafine.search.manager.ActionSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.DocumentSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.FileSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.PluginSearchManager; import com.fr.json.JSONObject; /** diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java similarity index 96% rename from designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java rename to designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java index 6c9a4efa2b..f0f0e32f67 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.cell.cellModel; +package com.fr.design.mainframe.alphafine.cell.model; import com.fr.design.mainframe.alphafine.CellType; import com.fr.general.FRLogger; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java similarity index 96% rename from designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java rename to designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java index 18cd2d843c..082f1f8e72 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.cell.cellModel; +package com.fr.design.mainframe.alphafine.cell.model; import com.fr.design.mainframe.alphafine.CellType; import com.fr.json.JSONException; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java similarity index 97% rename from designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java rename to designer/src/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java index 63771ddfdd..b9237c671f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.cell.cellModel; +package com.fr.design.mainframe.alphafine.cell.model; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/FileModel.java similarity index 96% rename from designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java rename to designer/src/com/fr/design/mainframe/alphafine/cell/model/FileModel.java index 851b0e2a71..8b9acea9b8 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/FileModel.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.cell.cellModel; +package com.fr.design.mainframe.alphafine.cell.model; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/MoreModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java similarity index 96% rename from designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/MoreModel.java rename to designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java index c9449c1101..de9b4fd2e5 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/MoreModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.cell.cellModel; +package com.fr.design.mainframe.alphafine.cell.model; import com.fr.design.mainframe.alphafine.CellType; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java similarity index 98% rename from designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java rename to designer/src/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java index c737ea6be9..c8c4d65dc2 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.cell.cellModel; +package com.fr.design.mainframe.alphafine.cell.model; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/ContentCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java similarity index 90% rename from designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/ContentCellRender.java rename to designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index e580847e80..ba23714212 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/ContentCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -1,9 +1,9 @@ -package com.fr.design.mainframe.alphafine.cell.cellRender; +package com.fr.design.mainframe.alphafine.cell.render; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.design.mainframe.alphafine.cell.cellModel.AlphaCellModel; -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import javax.swing.*; import java.awt.*; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java similarity index 93% rename from designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java rename to designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java index b95d877f4f..84784ecdb3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java @@ -1,8 +1,8 @@ -package com.fr.design.mainframe.alphafine.cell.cellRender; +package com.fr.design.mainframe.alphafine.cell.render; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import javax.swing.*; import java.awt.*; diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 0da64af97a..fca60441a5 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -10,17 +10,17 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper; -import com.fr.design.mainframe.alphafine.cell.cellRender.ContentCellRender; -import com.fr.design.mainframe.alphafine.cell.cellModel.*; +import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; +import com.fr.design.mainframe.alphafine.cell.model.*; import com.fr.design.mainframe.alphafine.listener.ComponentHandler; import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.alphafine.model.SearchListModel; import com.fr.design.mainframe.alphafine.model.SearchResult; -import com.fr.design.mainframe.alphafine.previewPane.DocumentPreviewPane; -import com.fr.design.mainframe.alphafine.previewPane.FilePreviewPane; -import com.fr.design.mainframe.alphafine.previewPane.PluginPreviewPane; -import com.fr.design.mainframe.alphafine.searchManager.*; -import com.fr.design.mainframe.alphafine.searchManager.RecentSearchManager; +import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane; +import com.fr.design.mainframe.alphafine.preview.FilePreviewPane; +import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane; +import com.fr.design.mainframe.alphafine.manager.*; +import com.fr.design.mainframe.alphafine.search.manager.*; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.form.main.Form; diff --git a/designer/src/com/fr/design/mainframe/alphafine/previewPane/ActionPreviewPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java similarity index 70% rename from designer/src/com/fr/design/mainframe/alphafine/previewPane/ActionPreviewPane.java rename to designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java index 156432147c..ec2d6ca38e 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/previewPane/ActionPreviewPane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.previewPane; +package com.fr.design.mainframe.alphafine.preview; /** * Created by XiaXiang on 2017/5/5. diff --git a/designer/src/com/fr/design/mainframe/alphafine/previewPane/DocumentPreviewPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java similarity index 96% rename from designer/src/com/fr/design/mainframe/alphafine/previewPane/DocumentPreviewPane.java rename to designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java index 155ab84900..8464a8e416 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/previewPane/DocumentPreviewPane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.previewPane; +package com.fr.design.mainframe.alphafine.preview; import com.fr.design.gui.itextarea.UITextArea; diff --git a/designer/src/com/fr/design/mainframe/alphafine/previewPane/FilePreviewPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java similarity index 91% rename from designer/src/com/fr/design/mainframe/alphafine/previewPane/FilePreviewPane.java rename to designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java index 97aee06edf..50938d48a5 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/previewPane/FilePreviewPane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.previewPane; +package com.fr.design.mainframe.alphafine.preview; import com.fr.design.gui.ilable.UILabel; diff --git a/designer/src/com/fr/design/mainframe/alphafine/previewPane/PluginPreviewPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java similarity index 98% rename from designer/src/com/fr/design/mainframe/alphafine/previewPane/PluginPreviewPane.java rename to designer/src/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java index 5ae2f5c004..6b8af31cbf 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/previewPane/PluginPreviewPane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.previewPane; +package com.fr.design.mainframe.alphafine.preview; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java similarity index 94% rename from designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java rename to designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java index e13466b65f..c3908681a6 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java @@ -1,16 +1,15 @@ -package com.fr.design.mainframe.alphafine.searchManager; +package com.fr.design.mainframe.alphafine.search.manager; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; -import com.fr.design.mainframe.alphafine.cell.cellModel.ActionModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; +import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.toolbar.UpdateActionManager; import com.fr.general.FRLogger; import com.fr.general.Inter; -import com.fr.json.JSONObject; import java.util.List; diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaFineSearchProcessor.java similarity index 87% rename from designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java rename to designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaFineSearchProcessor.java index 3883fbac8f..26ed7c128d 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaFineSearchProcessor.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaFineSearchProcessor.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.searchManager; +package com.fr.design.mainframe.alphafine.search.manager; import com.fr.design.mainframe.alphafine.model.SearchResult; diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java similarity index 96% rename from designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java rename to designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java index 915db8ae20..e84ebded59 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/AlphaSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java @@ -1,6 +1,6 @@ -package com.fr.design.mainframe.alphafine.searchManager; +package com.fr.design.mainframe.alphafine.search.manager; -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.general.Inter; diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java similarity index 94% rename from designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java rename to designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java index c16189345d..8065554bcc 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java @@ -1,10 +1,10 @@ -package com.fr.design.mainframe.alphafine.searchManager; +package com.fr.design.mainframe.alphafine.search.manager; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; -import com.fr.design.mainframe.alphafine.cell.cellModel.DocumentModel; -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; +import com.fr.design.mainframe.alphafine.cell.model.DocumentModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.general.FRLogger; import com.fr.general.Inter; diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java similarity index 96% rename from designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java rename to designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java index 55784d1818..84c9a502ac 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.alphafine.searchManager; +package com.fr.design.mainframe.alphafine.search.manager; import com.fr.base.Env; import com.fr.base.FRContext; @@ -6,13 +6,12 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; -import com.fr.design.mainframe.alphafine.cell.cellModel.FileModel; -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; +import com.fr.design.mainframe.alphafine.cell.model.FileModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.file.filetree.FileNode; import com.fr.general.FRLogger; import com.fr.general.Inter; -import com.fr.json.JSONObject; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java similarity index 94% rename from designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java rename to designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java index dfbbf44b47..7e4f6b3589 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java @@ -1,19 +1,17 @@ -package com.fr.design.mainframe.alphafine.searchManager; +package com.fr.design.mainframe.alphafine.search.manager; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.CellType; -import com.fr.design.mainframe.alphafine.cell.cellModel.PluginModel; -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; +import com.fr.design.mainframe.alphafine.cell.model.PluginModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; -import com.fr.json.JSONException; import com.fr.json.JSONObject; -import com.fr.plugin.chart.designer.other.HyperlinkMapFactory; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java similarity index 98% rename from designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java rename to designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java index 6066543d68..7971f7f9e4 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java @@ -1,11 +1,11 @@ -package com.fr.design.mainframe.alphafine.searchManager; +package com.fr.design.mainframe.alphafine.search.manager; import com.fr.base.FRContext; import com.fr.base.Utils; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.cell.CellModelHelper; -import com.fr.design.mainframe.alphafine.cell.cellModel.AlphaCellModel; -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.file.XMLFileManager; import com.fr.general.ComparatorUtils; diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java similarity index 92% rename from designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java rename to designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java index f8126ce968..9e23558556 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java @@ -1,8 +1,8 @@ -package com.fr.design.mainframe.alphafine.searchManager; +package com.fr.design.mainframe.alphafine.search.manager; import com.fr.design.mainframe.alphafine.cell.CellModelHelper; -import com.fr.design.mainframe.alphafine.cell.cellModel.AlphaCellModel; -import com.fr.design.mainframe.alphafine.cell.cellModel.MoreModel; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.general.FRLogger; import com.fr.general.Inter; From 08f34726a0c3762cb0b9041114d22d3cc62ceb8d Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 15:13:01 +0800 Subject: [PATCH 28/28] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/manager/ActionSearchManager.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java index c3908681a6..0200cdb241 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java @@ -49,13 +49,12 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { for (int i = length; i < filterModelList.size(); i++) { moreModelList.add(filterModelList.get(i)); } - if (filterModelList.size() > 0) { - if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE) { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.ACTION)); - } else { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION)); - } + if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE) { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.ACTION)); + } else { + lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION)); } + } }