diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index b258cd727f..5d91ef5ccc 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -47,6 +47,8 @@ public class AlphaFineConstants { public static final Color LIGHT_GRAY = new Color(0xcccccc); + public static final Color MEDIUM_GRAY = new Color(0x999999); + public static final Color BLUE = new Color(0x3394f0); public static final Color BLACK = new Color(0x222222); diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 3507978d24..c294218dc7 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -1,22 +1,38 @@ package com.fr.design.mainframe.alphafine; +import com.fr.design.DesignerEnvManager; +import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.model.NoResultModel; import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; +import com.fr.design.mainframe.alphafine.search.manager.RecentSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.RecommendSearchManager; +import com.fr.general.Inter; +import com.fr.general.ProcessCanceledException; import com.fr.stable.StringUtils; + +import java.util.List; + /** * Created by XiaXiang on 2017/5/8. */ public class AlphaFineHelper { + public static final NoResultModel NO_RESULT_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_AlphaFine_NoResult")); + public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_ConnectionFailed")); /** * 弹出alphafine搜索面板 */ public static void showAlphaFineDialog(boolean forceOpen) { AlphaFineDialog dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen); + final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); + manager.setNeedRemind(false); dialog.setVisible(true); } + /** * 获取文件名上级目录 * @param text @@ -51,6 +67,22 @@ public class AlphaFineHelper { return getSplitText(text, 1); } + /** + * 中断当前线程的搜索 + */ + public static void checkCancel() { + if (Thread.interrupted()) { + throw new ProcessCanceledException(); + } + } + + public static List getFilterResult() { + List recentList = RecentSearchManager.getRecentSearchManger().getRecentModelList(); + List recommendList = RecommendSearchManager.getRecommendSearchManager().getRecommendModelList(); + recentList.addAll(recommendList); + return recentList; + } + diff --git a/designer/src/com/fr/design/mainframe/alphafine/CellType.java b/designer/src/com/fr/design/mainframe/alphafine/CellType.java index 96b7db6096..d196a01388 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/CellType.java +++ b/designer/src/com/fr/design/mainframe/alphafine/CellType.java @@ -4,7 +4,7 @@ package com.fr.design.mainframe.alphafine; * Created by XiaXiang on 2017/4/27. */ public enum CellType { - RECOMMEND(0), ACTION(1), DOCUMENT(2), FILE(3), PLUGIN(4), REUSE(5); + RECOMMEND(0), ACTION(1), DOCUMENT(2), FILE(3), PLUGIN(4), REUSE(5), NO_RESULT(6); private int typeValue; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/model/NoResultModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/NoResultModel.java new file mode 100644 index 0000000000..1dbdb450b1 --- /dev/null +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/NoResultModel.java @@ -0,0 +1,24 @@ +package com.fr.design.mainframe.alphafine.cell.model; + +import com.fr.design.mainframe.alphafine.CellType; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; + +/** + * Created by XiaXiang on 2017/6/8. + */ +public class NoResultModel extends AlphaCellModel { + public NoResultModel(String name) { + super(name, null, CellType.NO_RESULT); + } + + @Override + public JSONObject ModelToJson() throws JSONException { + return null; + } + + @Override + public String getStoreInformation() { + return null; + } +} diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index e358df8c16..3380d092bf 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -2,6 +2,7 @@ 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.CellType; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.stable.StringUtils; @@ -34,9 +35,14 @@ public class ContentCellRender implements ListCellRenderer { AlphaCellModel model = (AlphaCellModel) value; name.setText(model.getName()); String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png"; - name.setIcon(new ImageIcon(getClass().getResource(iconUrl))); + if (model.getType() == CellType.NO_RESULT) { + name.setIcon(null); + name.setForeground(AlphaFineConstants.MEDIUM_GRAY); + } else { + name.setIcon(new ImageIcon(getClass().getResource(iconUrl))); + name.setForeground(AlphaFineConstants.BLACK); + } name.setFont(AlphaFineConstants.MEDIUM_FONT); - name.setForeground(AlphaFineConstants.BLACK); name.setVerticalTextPosition(SwingConstants.CENTER); name.setHorizontalTextPosition(SwingConstants.RIGHT); String description = model.getDescription(); 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 9dfba7af6e..1b975f948f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -10,8 +10,8 @@ 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.render.ContentCellRender; import com.fr.design.mainframe.alphafine.cell.model.*; +import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.listener.ComponentHandler; import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.alphafine.model.SearchListModel; @@ -45,7 +45,7 @@ import javax.swing.event.ListSelectionListener; import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; -import java.io.*; +import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; @@ -78,6 +78,7 @@ public class AlphaFineDialog extends UIDialog { initComponents(); } + /** * 初始化全部组件 */ @@ -134,6 +135,7 @@ public class AlphaFineDialog extends UIDialog { addComponentListener(new ComponentHandler()); setSize(AlphaFineConstants.FIELD_SIZE); centerWindow(this); + } /** @@ -156,17 +158,17 @@ public class AlphaFineDialog extends UIDialog { } /** - * 执行搜索,暂时字符要求超过两个才开始搜索 + * 执行搜索 * @param text */ private void doSearch(String text) { - if (text.length() < 2 || text.contains("'")) { - return; - } + if (StringUtils.isBlank(text) || text.equals("AlphaFine")) { removeSearchResult(); + } else if (text.contains("'")) { + return; } else { - showSearchResult(text); + showSearchResult(); } } @@ -198,14 +200,13 @@ public class AlphaFineDialog extends UIDialog { /** * 展示搜索结果 - * @param searchText */ - private void showSearchResult(String searchText) { + private void showSearchResult() { if (searchResultPane == null) { initSearchResultComponents(); - initListListener(searchText); + initListListener(); } - initSearchWorker(searchText); + initSearchWorker(); } /** @@ -213,6 +214,8 @@ public class AlphaFineDialog extends UIDialog { */ private void initSearchResultComponents() { searchResultList = new JList(); + searchListModel = new SearchListModel(new SearchResult()); + searchResultList.setModel(searchListModel); searchResultPane = new JPanel(); searchResultPane.setPreferredSize(AlphaFineConstants.CONTENT_SIZE); searchResultPane.setLayout(new BorderLayout()); @@ -233,56 +236,105 @@ public class AlphaFineDialog extends UIDialog { } /** - * 异步加载搜索结构 - * @param searchText + * 异步加载搜索结果 */ - private void initSearchWorker(final String searchText) { - searchResultList.setModel(new SearchListModel(AlphaSearchManager.getSearchManager().showDefaultSearchResult())); + private void initSearchWorker() { if (this.searchWorker != null && !this.searchWorker.isDone()) { this.searchWorker.cancel(true); this.searchWorker = null; } - this.searchWorker = new SwingWorker() { - + this.searchWorker = new SwingWorker() { @Override - protected SearchListModel doInBackground() { - return setListModel(new SearchListModel(AlphaSearchManager.getSearchManager().getLessSearchResult(searchText))); + protected Object doInBackground() throws Exception { + rebuildList(searchTextField.getText()); + return null; } @Override protected void done() { - try { - if (!isCancelled()) { - searchResultList.setModel(get()); - searchResultList.validate(); - searchResultList.repaint(); - validate(); - repaint(); - /** - * 默认选中第1项,第0项为title - */ - if (searchResultList.getModel().getSize() > 0) { - searchResultList.setSelectedIndex(1); - } - - } - } catch (InterruptedException e) { - FRLogger.getLogger().error(e.getMessage()); - } catch (ExecutionException e) { - FRLogger.getLogger().error(e.getMessage()); + if (!isCancelled()) { + searchResultList.setSelectedIndex(1); } - } - }; this.searchWorker.execute(); } /** - * 初始化监听器 + * 重新构建搜索结果列表 * @param searchText */ - private void initListListener(final String searchText) { + private void rebuildList(String searchText) { + searchListModel.removeAllElements(); + getRecentList(searchText); + getRecommendList(searchText); + getActionList(searchText); + getFileList(searchText); + getDocumentList(searchText); + getPluginList(searchText); + } + + + + private synchronized void getDocumentList(final String searchText) { + + SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText); + for (Object object : documentModelList) { + AlphaFineHelper.checkCancel(); + searchListModel.addElement(object); + } + + + + + } + + private synchronized void getFileList(final String searchText) { + SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText); + for (Object object : fileModelList) { + AlphaFineHelper.checkCancel(); + searchListModel.addElement(object); + } + } + + private synchronized void getActionList(final String searchText) { + SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText); + for (Object object : actionModelList) { + AlphaFineHelper.checkCancel(); + searchListModel.addElement(object); + } + } + + private synchronized void getPluginList(final String searchText) { + SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText); + for (Object object : pluginModelList) { + AlphaFineHelper.checkCancel(); + searchListModel.addElement(object); + } + } + + private synchronized void getRecommendList(final String searchText) { + SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText); + for (Object object : recommendModelList) { + AlphaFineHelper.checkCancel(); + searchListModel.addElement(object); + } + } + + private synchronized void getRecentList(final String searchText) { + SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText); + for (Object object : recentModelList) { + AlphaFineHelper.checkCancel(); + searchListModel.addElement(object); + } + + } + + + /** + * 初始化监听器 + */ + private void initListListener() { /** * 鼠标监听器 */ @@ -536,7 +588,7 @@ public class AlphaFineDialog extends UIDialog { if (SwingUtilities.isLeftMouseButton(k)) { Point p = k.getLocationOnScreen(); Rectangle dialogRectangle = AlphaFineDialog.this.getBounds(); - Rectangle paneRectangle = new Rectangle(AlphaFinePane.createAlphaFinePane().getLocationOnScreen(), AlphaFinePane.createAlphaFinePane().getSize()); + Rectangle paneRectangle = new Rectangle(AlphaFinePane.getAlphaFinePane().getLocationOnScreen(), AlphaFinePane.getAlphaFinePane().getSize()); if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !forceOpen) { AlphaFineDialog.this.dispose(); forceOpen = false; @@ -559,8 +611,8 @@ public class AlphaFineDialog extends UIDialog { if (event instanceof KeyEvent) { KeyEvent e = (KeyEvent) event; KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e); - KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphafineConfigManager().getShortCutKeyStore(); - if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString())) { + KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore(); + if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString()) && AlphaFinePane.getAlphaFinePane().isVisible()) { doClickAction(); } @@ -663,11 +715,11 @@ public class AlphaFineDialog extends UIDialog { SearchResult moreResult = getMoreResult(selectedValue); if((selectedValue).getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowLess"))) { for (int i = 0; i < moreResult.size(); i++) { - this.searchListModel.insertElementAt(moreResult.get(i), index + AlphaFineConstants.SHOW_SIZE + 1 + i); + this.searchListModel.add(index + AlphaFineConstants.SHOW_SIZE + 1 + i, moreResult.get(i)); } } else { for (int i = 0; i < moreResult.size(); i++) { - this.searchListModel.removeElementAt(index + AlphaFineConstants.SHOW_SIZE + 1); + this.searchListModel.remove(index + AlphaFineConstants.SHOW_SIZE + 1); } } @@ -701,7 +753,7 @@ public class AlphaFineDialog extends UIDialog { moreResult = ActionSearchManager.getActionSearchManager().getMoreSearchResult(); break; default: - moreResult = AlphaSearchManager.getSearchManager().getMoreSearchResult(); + moreResult = new SearchResult(); } return moreResult; } @@ -731,4 +783,5 @@ public class AlphaFineDialog extends UIDialog { public void setForceOpen(boolean forceOpen) { this.forceOpen = forceOpen; } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java index 6c23ab4039..e5ea8e2588 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java @@ -1,12 +1,12 @@ package com.fr.design.mainframe.alphafine.component; -import com.fr.base.BaseUtils; import com.fr.design.DesignerEnvManager; -import com.fr.design.actions.help.alphafine.AlphafineContext; -import com.fr.design.actions.help.alphafine.AlphafineListener; +import com.fr.design.actions.help.alphafine.AlphaFineContext; +import com.fr.design.actions.help.alphafine.AlphaFineListener; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.general.IOUtils; import com.fr.general.Inter; import javax.swing.*; @@ -20,7 +20,7 @@ import java.awt.event.ActionListener; public class AlphaFinePane extends BasicPane { private static AlphaFinePane alphaFinePane; - public static AlphaFinePane createAlphaFinePane() { + public static AlphaFinePane getAlphaFinePane() { if (alphaFinePane == null) { alphaFinePane = new AlphaFinePane(); } @@ -28,12 +28,12 @@ public class AlphaFinePane extends BasicPane { } public AlphaFinePane() { setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 14)); - if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) { + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK); } UIButton refreshButton = new UIButton(); - refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); - refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Alphafine")); + refreshButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); + refreshButton.setToolTipText(Inter.getLocText("FR-Designer_AlphaFine")); refreshButton.set4ToolbarButton(); this.add(refreshButton); refreshButton.addActionListener(new ActionListener() { @@ -42,11 +42,17 @@ public class AlphaFinePane extends BasicPane { AlphaFineHelper.showAlphaFineDialog(false); } }); - AlphafineContext.addAlphafineContextListener(new AlphafineListener() { + AlphaFineContext.addAlphaFineListener(new AlphaFineListener() { @Override public void showDialog() { AlphaFineHelper.showAlphaFineDialog(true); } + + @Override + public void setEnable(boolean isEnable) { + alphaFinePane.setVisible(isEnable); + + } }); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/model/SearchListModel.java b/designer/src/com/fr/design/mainframe/alphafine/model/SearchListModel.java index 4369633e6b..2f3dd48c0f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/model/SearchListModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/model/SearchListModel.java @@ -14,7 +14,9 @@ public class SearchListModel extends DefaultListModel { @Override public void addElement(Object element) { + int index = myDelegate.size(); myDelegate.add(element); + fireContentsChanged(this, index, index); } @Override @@ -23,17 +25,26 @@ public class SearchListModel extends DefaultListModel { } @Override - public void insertElementAt(Object element, int index) { - this.myDelegate.add(index, element); + public void add(int index, Object element) { + myDelegate.add(index, element); + fireIntervalAdded(this, index, index); } @Override - public void removeElementAt(int index) { - this.myDelegate.remove(index); + public Object remove(int index) { + Object object = myDelegate.get(index); + myDelegate.remove(object); + fireIntervalRemoved(this, index, index); + return object; } @Override public int getSize() { return this.myDelegate.size(); } + + @Override + public void removeAllElements() { + this.myDelegate.clear(); + } } 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 b174e0b73a..85c43b794b 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 @@ -2,6 +2,7 @@ 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.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; @@ -23,6 +24,9 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { private SearchResult lessModelList; private SearchResult moreModelList; + private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION); + private static final MoreModel MORE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.ACTION); + public synchronized static ActionSearchManager getActionSearchManager() { if (actionSearchManager == null) { actionSearchManager = new ActionSearchManager(); @@ -35,29 +39,33 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { filterModelList = new SearchResult(); lessModelList = new SearchResult(); moreModelList = new SearchResult(); - if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) { List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); for (UpdateActionModel updateActionModel : updateActions) { if (StringUtils.isNotBlank(updateActionModel.getSearchKey())) { - if (updateActionModel.getSearchKey().toLowerCase().contains(searchText.toLowerCase()) ) { + if (updateActionModel.getSearchKey().toLowerCase().contains(searchText.toLowerCase()) && updateActionModel.getAction().isEnabled()) { filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction())); } } } - 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)); + SearchResult result = new SearchResult(); + for (Object object : filterModelList) { + if (!AlphaFineHelper.getFilterResult().contains(object)) { + result.add(object); } - 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)); + + } + if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { + lessModelList.add(0, TITLE_MODEL); + if (result.size() == 0) { + lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); } else { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION)); + lessModelList.addAll(result); } - + } else { + lessModelList.add(0, MORE_MODEL); + lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE)); + moreModelList.addAll(result.subList(AlphaFineConstants.SHOW_SIZE, result.size())); } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java deleted file mode 100644 index cb60f9aa13..0000000000 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fr.design.mainframe.alphafine.search.manager; - -import com.fr.design.mainframe.alphafine.cell.model.MoreModel; -import com.fr.design.mainframe.alphafine.model.SearchResult; -import com.fr.general.Inter; - -/** - * Created by XiaXiang on 2017/3/28. - */ -public class AlphaSearchManager implements AlphaFineSearchProcessor { - private static AlphaSearchManager searchManager; - private static PluginSearchManager pluginSearchManager; - private static DocumentSearchManager documentSearchManager; - private static FileSearchManager fileSearchManager; - private static ActionSearchManager actionSearchManager; - private static RecommendSearchManager recommendSearchManager; - private static RecentSearchManager recentSearchManager; - - public synchronized static AlphaSearchManager getSearchManager() { - init(); - return searchManager; - - } - - private synchronized static void init() { - if (searchManager == null) { - searchManager = new AlphaSearchManager(); - pluginSearchManager = PluginSearchManager.getPluginSearchManager(); - documentSearchManager = DocumentSearchManager.getDocumentSearchManager(); - fileSearchManager = FileSearchManager.getFileSearchManager(); - actionSearchManager = ActionSearchManager.getActionSearchManager(); - recommendSearchManager = RecommendSearchManager.getRecommendSearchManager(); - recentSearchManager = RecentSearchManager.getRecentSearchManger(); - } - } - - @Override - public synchronized SearchResult getLessSearchResult(String searchText) { - SearchResult recentModelList = recentSearchManager.getLessSearchResult(searchText); - SearchResult recommendModelList = recommendSearchManager.getLessSearchResult(searchText); - SearchResult actionModelList = actionSearchManager.getLessSearchResult(searchText); - SearchResult fileModelList = fileSearchManager.getLessSearchResult(searchText); - SearchResult documentModelList = documentSearchManager.getLessSearchResult(searchText); - SearchResult pluginModelList = pluginSearchManager.getLessSearchResult(searchText); - recentModelList.addAll(recommendModelList); - recentModelList.addAll(actionModelList); - recentModelList.addAll(fileModelList); - recentModelList.addAll(documentModelList); - recentModelList.addAll(pluginModelList); - return recentModelList; - } - - public SearchResult showDefaultSearchResult() { - SearchResult searchResult = new SearchResult(); - searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Latest"))); - searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"))); - searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_Set"))); - searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_Templates"))); - searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"))); - searchResult.add(new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"))); - return searchResult; - } - - @Override - public SearchResult getMoreSearchResult() { - return null; - } - -} diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java index 8065554bcc..4fb8a060d3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java @@ -2,6 +2,7 @@ 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.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.DocumentModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; @@ -20,6 +21,8 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { private static DocumentSearchManager documentSearchManager = null; private SearchResult lessModelList; private SearchResult moreModelList; + private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), CellType.DOCUMENT); + private static final MoreModel MORE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.DOCUMENT); public synchronized static DocumentSearchManager getDocumentSearchManager() { if (documentSearchManager == null) { @@ -33,48 +36,62 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor { public synchronized SearchResult getLessSearchResult(String searchText) { lessModelList = new SearchResult(); moreModelList = new SearchResult(); - if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainDocument()) { + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) { String result; String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText + "-1"; HttpClient httpClient = new HttpClient(url); httpClient.setTimeout(5000); httpClient.asGet(); if (!httpClient.isServerAlive()) { - return lessModelList; + return getNoConnectList(); } result = httpClient.getResponseText(); + AlphaFineHelper.checkCancel(); try { JSONObject jsonObject = new JSONObject(result); 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++) { + if (jsonArray != null) { + SearchResult searchResult = new SearchResult(); + for (int i = 0; i < jsonArray.length(); i++) { + AlphaFineHelper.checkCancel(); DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i)); - this.lessModelList.add(cellModel); + if (!AlphaFineHelper.getFilterResult().contains(cellModel)) { + searchResult.add(cellModel); + } } - for (int i = length; i < jsonArray.length(); i++) { - DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i)); - this.moreModelList.add(cellModel); - } - 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 (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { + lessModelList.add(0, TITLE_MODEL); + if (searchResult.size() == 0) { + lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); + } else { + lessModelList.addAll(searchResult); + } + } else { + lessModelList.add(0, MORE_MODEL); + lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE)); + moreModelList.addAll(searchResult.subList(AlphaFineConstants.SHOW_SIZE, searchResult.size())); } - - } } catch (JSONException e) { - FRLogger.getLogger().error(e.getMessage()); - return lessModelList; + FRLogger.getLogger().error("document search error: " + e.getMessage()); } - } return lessModelList; } + /** + * 无连接 + * @return + */ + private SearchResult getNoConnectList() { + SearchResult result = new SearchResult(); + result.add(0, TITLE_MODEL); + result.add(AlphaFineHelper.NO_CONNECTION_MODEL); + return result; + } + /** * 根据json信息获取文档model * @param object diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java index 712331826d..6fe9f5d231 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java @@ -29,6 +29,9 @@ public class FileSearchManager implements AlphaFineSearchProcessor { private List fileNodes = null; private static FileSearchManager fileSearchManager = null; + private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Templates"), CellType.FILE); + private static final MoreModel MORE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.FILE); + public synchronized static FileSearchManager getFileSearchManager() { init(); return fileSearchManager; @@ -44,30 +47,36 @@ public class FileSearchManager implements AlphaFineSearchProcessor { this.filterModelList = new SearchResult(); this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); - Env env = FRContext.getCurrentEnv(); - fileNodes = new ArrayList<>(); - fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true); - for (FileNode node : fileNodes) { - boolean isAlreadyContain = false; - String fileEnvPath = node.getEnvPath(); - String filePath = StableUtils.pathJoin(env.getPath(), fileEnvPath); - isAlreadyContain = searchFile(searchText, node, isAlreadyContain); - searchFileContent(searchText, node, isAlreadyContain, filePath); + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainTemplate()) { + Env env = FRContext.getCurrentEnv(); + fileNodes = new ArrayList<>(); + fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true); + for (FileNode node : fileNodes) { + boolean isAlreadyContain = false; + String fileEnvPath = node.getEnvPath(); + String filePath = StableUtils.pathJoin(env.getPath(), fileEnvPath); + isAlreadyContain = searchFile(searchText, node, isAlreadyContain); + searchFileContent(searchText, node, isAlreadyContain, filePath); - } + } + SearchResult result = new SearchResult(); + for (Object object : filterModelList) { + if (!AlphaFineHelper.getFilterResult().contains(object)) { + result.add(object); + } - 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_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.FILE)); + } + if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { + lessModelList.add(0, TITLE_MODEL); + if (result.size() == 0) { + lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); + } else { + lessModelList.addAll(result); + } } else { - lessModelList.add(0,new MoreModel(Inter.getLocText("FR-Designer_Templates"), CellType.FILE)); + lessModelList.add(0, MORE_MODEL); + lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE)); + moreModelList.addAll(result.subList(AlphaFineConstants.SHOW_SIZE, result.size())); } } return this.lessModelList; @@ -81,7 +90,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor { * @param filePath */ private void searchFileContent(String searchText, FileNode node, boolean isAlreadyContain, String filePath) { - if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainFileContent()) { + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { try { BufferedReader reader = new BufferedReader(new FileReader(filePath)); @@ -115,7 +124,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor { * @return */ private boolean searchFile(String searchText, FileNode node, boolean isAlreadyContain) { - if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainTemplate()) { + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainTemplate()) { if (node.getName().toLowerCase().contains(searchText.toLowerCase())) { FileModel model = new FileModel(node.getName(), node.getEnvPath()); this.filterModelList.add(model); @@ -165,7 +174,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor { } else { nodeList.add(fns[i]); } - } else { + } else if (fileNode.isFileType("cpt") || fileNode.isFileType("frm")) { nodeList.add(fileNode); } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java index 7e4f6b3589..53fc0bb17d 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java @@ -2,6 +2,7 @@ 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.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.PluginModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; @@ -11,6 +12,7 @@ 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 java.io.UnsupportedEncodingException; @@ -21,9 +23,14 @@ import java.net.URLEncoder; */ public class PluginSearchManager implements AlphaFineSearchProcessor { private static PluginSearchManager pluginSearchManager = null; + + private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), CellType.PLUGIN); + private static final MoreModel MORE_MODEL = new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.PLUGIN); + private SearchResult lessModelList; private SearchResult moreModelList; + public synchronized static PluginSearchManager getPluginSearchManager() { if (pluginSearchManager == null) { pluginSearchManager = new PluginSearchManager(); @@ -34,10 +41,9 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { @Override public synchronized SearchResult getLessSearchResult(String searchText) { - this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); - if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainPlugin()) { + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) { String result; try { String encodedKey = URLEncoder.encode(searchText, "UTF-8"); @@ -46,35 +52,51 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { httpClient.setTimeout(5000); httpClient.asGet(); if (!httpClient.isServerAlive()) { - return lessModelList; + return getNoConnectList(); } result = httpClient.getResponseText(); + AlphaFineHelper.checkCancel(); JSONObject jsonObject = new JSONObject(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++) { + if (jsonArray != null) { + SearchResult searchResult = new SearchResult(); + for (int i = 0; i < jsonArray.length(); i++) { PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false); - this.lessModelList.add(cellModel); + if (!AlphaFineHelper.getFilterResult().contains(cellModel)) { + searchResult.add(cellModel); + } } - for (int i = length; i < jsonArray.length(); i++) { - PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false); - this.moreModelList.add(cellModel); - } - 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)); + if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { + lessModelList.add(0, TITLE_MODEL); + if (searchResult.size() == 0) { + lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); + } else { + lessModelList.addAll(searchResult); + } } else { - lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), CellType.PLUGIN)); + lessModelList.add(0, MORE_MODEL); + lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE)); + moreModelList.addAll(searchResult.subList(AlphaFineConstants.SHOW_SIZE, searchResult.size())); } } - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); - return lessModelList; + } catch (JSONException e) { + FRLogger.getLogger().error("plugin search json error :" + e.getMessage()); + } catch (UnsupportedEncodingException e) { + FRLogger.getLogger().error("plugin search encode error :" + e.getMessage()); } } return this.lessModelList; + + + } + + private SearchResult getNoConnectList() { + SearchResult result = new SearchResult(); + result.add(0, TITLE_MODEL); + result.add(AlphaFineHelper.NO_CONNECTION_MODEL); + return result; } private static PluginModel getPluginModel(JSONObject object, boolean isFromCloud) { @@ -121,8 +143,4 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { } } - - - - } diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java index 535d6b1a6a..76de3b84e4 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java @@ -3,7 +3,8 @@ 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.CellType; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.cell.CellModelHelper; 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; @@ -39,10 +40,6 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear private static RecentSearchManager recentSearchManager = null; private static File recentFile = null; private SearchResult modelList; - private List fileList = new ArrayList<>(); - private List actionList = new ArrayList<>(); - private List documentList = new ArrayList<>(); - private List pluginList = new ArrayList<>(); private List recentModelList = new ArrayList<>(); private Map> recentKVModelMap = new HashMap<>(); @@ -98,7 +95,7 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear private void addModelToList(List list, String name) { try { - AlphaCellModel model = getModelFromJson(new JSONObject(name)); + AlphaCellModel model = CellModelHelper.getModelFromJson(new JSONObject(name)); if (model != null) { list.add(model); } @@ -107,60 +104,6 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear } } - /** - * 转成cellModel - * @param object - * @return - */ - private AlphaCellModel getModelFromJson(JSONObject object) { - int typeValue = object.optInt("cellType"); - AlphaCellModel cellModel = null; - switch (CellType.parse(typeValue)) { - case ACTION: - cellModel = ActionSearchManager.getModelFromCloud(object.optString("result")); - if (cellModel != null) { - actionList.add(cellModel); - } - break; - case DOCUMENT: - cellModel = DocumentSearchManager.getModelFromCloud(object.optJSONObject("result")); - if (cellModel != null) { - documentList.add(cellModel); - } - break; - case FILE: - cellModel = FileSearchManager.getModelFromCloud(object.optString("result")); - if (cellModel != null) { - fileList.add(cellModel); - } - break; - case PLUGIN: - case REUSE: - cellModel = PluginSearchManager.getModelFromCloud(object.optJSONObject("result")); - if (cellModel != null) { - pluginList.add(cellModel); - } - break; - - } - return cellModel; - } - - public List getFileList() { - return fileList; - } - - public List getActionList() { - return actionList; - } - - public List getDocumentList() { - return documentList; - } - - public List getPluginList() { - return pluginList; - } @Override public void writeXML(XMLPrintWriter writer) { @@ -209,7 +152,6 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear if (!envFile.exists()) { createRecentFile(envFile); } - return envFile; } @@ -273,9 +215,10 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear * @param searchText * @return */ - public List getRecentModelList(String searchText) { + public synchronized List getRecentModelList(String searchText) { recentModelList = new ArrayList<>(); for (String key : recentKVModelMap.keySet()) { + AlphaFineHelper.checkCancel(); if (ComparatorUtils.equals(key, searchText)) { recentModelList = recentKVModelMap.get(searchText); int size = recentModelList.size(); diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java index 94f718be2e..051c8e66ee 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.alphafine.search.manager; import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; @@ -13,12 +14,16 @@ import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.stable.CodeUtils; +import java.util.ArrayList; +import java.util.List; + /** * Created by XiaXiang on 2017/3/31. */ public class RecommendSearchManager implements AlphaFineSearchProcessor { private static RecommendSearchManager recommendSearchManager = null; private SearchResult modelList; + private List recommendModelList = new ArrayList<>(); //todo:for test private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchKey="; @@ -31,43 +36,60 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { @Override public synchronized SearchResult getLessSearchResult(String searchText) { this.modelList = new SearchResult(); - if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainRecommend()) { + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) { String result; HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); httpClient.asGet(); httpClient.setTimeout(5000); if (!httpClient.isServerAlive()) { - return modelList; + return getNoConnectList(); } result = httpClient.getResponseText(); + AlphaFineHelper.checkCancel(); 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++) { + AlphaFineHelper.checkCancel(); AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); if (alphaCellModel != null && !RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) { - this.modelList.add(alphaCellModel); + this.recommendModelList.add(alphaCellModel); } } } } } catch (JSONException e) { - FRLogger.getLogger().error("data transform error! :" + e.getMessage()); + FRLogger.getLogger().error("recommend search error! :" + e.getMessage()); } if (modelList.size() > 0) { - modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false)); + modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false)); + modelList.addAll(recommendModelList); } } return modelList; } + private SearchResult getNoConnectList() { + SearchResult result = new SearchResult(); + result.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false)); + result.add(AlphaFineHelper.NO_CONNECTION_MODEL); + return result; + } + @Override public SearchResult getMoreSearchResult() { return new SearchResult(); } + public List getRecommendModelList() { + return recommendModelList; + } + + public void setRecommendModelList(List recommendModelList) { + this.recommendModelList = recommendModelList; + } } diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index 276c11b96f..b6855fdb01 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -346,7 +346,7 @@ public class Designer extends BaseDesigner { * @return 面板组件 */ public Component createAlphafinePane() { - return AlphaFinePane.createAlphaFinePane(); + return AlphaFinePane.getAlphaFinePane(); } diff --git a/designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj b/designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj index 48701f7640..aef3d7a404 100644 --- a/designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj +++ b/designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj @@ -1,7 +1,7 @@ package com.fr.aspectj.designerbase; import com.fr.design.DesignerEnvManager; -import com.fr.design.actions.help.alphafine.AlphafineConfigManager; +import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.RemindDialog; import com.fr.design.mainframe.DesignerContext; @@ -30,7 +30,7 @@ public aspect AlphaFineReminder { * 判断是否弹出广告框 */ private static void remind() { - AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager(); + AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); if (manager.isNeedRemind()) { if (manager.getOperateCount() > 4) { diff --git a/designer_base/src/com/fr/design/DesignerEnvManager.java b/designer_base/src/com/fr/design/DesignerEnvManager.java index 75b4749d83..2dd6bef373 100644 --- a/designer_base/src/com/fr/design/DesignerEnvManager.java +++ b/designer_base/src/com/fr/design/DesignerEnvManager.java @@ -5,7 +5,7 @@ package com.fr.design; import com.fr.base.*; import com.fr.dav.LocalEnv; -import com.fr.design.actions.help.alphafine.AlphafineConfigManager; +import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.constants.UIConstants; import com.fr.env.RemoteEnv; import com.fr.env.SignIn; @@ -108,7 +108,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { /** * alphafine */ - private AlphafineConfigManager alphafineConfigManager = new AlphafineConfigManager(); + private AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager(); public static final String CAS_CERTIFICATE_PATH = "certificatePath"; @@ -1344,7 +1344,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } private void readAlphaFineAttr(XMLableReader reader) { - reader.readXMLObject(this.alphafineConfigManager = new AlphafineConfigManager()); + reader.readXMLObject(this.alphaFineConfigManager = new AlphaFineConfigManager()); } private void readHttpsParas(XMLableReader reader){ @@ -1551,8 +1551,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } private void writeAlphaFineAttr(XMLPrintWriter writer) { - if (this.alphafineConfigManager != null) { - this.alphafineConfigManager.writeXML(writer); + if (this.alphaFineConfigManager != null) { + this.alphaFineConfigManager.writeXML(writer); } } @@ -1830,11 +1830,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { return env; } - public AlphafineConfigManager getAlphafineConfigManager() { - return alphafineConfigManager; + public AlphaFineConfigManager getAlphaFineConfigManager() { + return alphaFineConfigManager; } - public void setAlphafineConfigManager(AlphafineConfigManager alphafineConfigManager) { - this.alphafineConfigManager = alphafineConfigManager; + public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { + this.alphaFineConfigManager = alphaFineConfigManager; } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineAction.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java similarity index 68% rename from designer_base/src/com/fr/design/actions/help/alphafine/AlphafineAction.java rename to designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java index 23cf7de758..221354108f 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineAction.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.help.alphafine; -import com.fr.base.BaseUtils; +import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -17,13 +17,13 @@ import java.awt.event.ActionEvent; /** * Created by XiaXiang on 2017/4/1. */ -public class AlphafineAction extends UpdateAction { - public AlphafineAction() { +public class AlphaFineAction extends UpdateAction { + public AlphaFineAction() { this.setMenuKeySet(ALPHAFINE); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); - this.setSearchText(new AlphafineConfigPane()); + this.setSearchText(new AlphaFineConfigPane()); } public static final MenuKeySet ALPHAFINE = new MenuKeySet() { @@ -49,15 +49,19 @@ public class AlphafineAction extends UpdateAction { public void actionPerformed(ActionEvent e) { final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final AlphafineConfigPane alphafineConfigPane = new AlphafineConfigPane(); - alphafineConfigPane.populate(DesignerEnvManager.getEnvManager().getAlphafineConfigManager()); + final AlphaFineConfigPane alphaFineConfigPane = new AlphaFineConfigPane(); + final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); + if (!FRContext.isChineseEnv()) { + manager.setSearchOnLine(false); + } + alphaFineConfigPane.populate(manager); DialogActionListener dialogActionListener = new DialogActionAdapter() { public void doOk() { - alphafineConfigPane.update(); - designerFrame.refreshToolbar(); + alphaFineConfigPane.update(); + AlphaFineContext.fireAlphaFineEnable(manager.isEnabled()); } }; - BasicDialog basicDialog = alphafineConfigPane.showMediumWindow(designerFrame, dialogActionListener); + BasicDialog basicDialog = alphaFineConfigPane.showMediumWindow(designerFrame, dialogActionListener); basicDialog.setVisible(true); } } diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigManager.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java similarity index 96% rename from designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigManager.java rename to designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index c119e09b99..5df9691adb 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigManager.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -11,7 +11,7 @@ import javax.swing.*; /** * Created by XiaXiang on 2017/4/5. */ -public class AlphafineConfigManager implements XMLable { +public class AlphaFineConfigManager implements XMLable { /** * 是否开启alphafine @@ -80,10 +80,10 @@ public class AlphafineConfigManager implements XMLable { - private static AlphafineConfigManager alphafineConfigManager = new AlphafineConfigManager(); + private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager(); - public static AlphafineConfigManager getInstance() { - return alphafineConfigManager; + public static AlphaFineConfigManager getInstance() { + return alphaFineConfigManager; } @Override 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 similarity index 79% rename from designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigPane.java rename to designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java index d982cbeece..59fef59523 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 @@ -1,5 +1,6 @@ package com.fr.design.actions.help.alphafine; +import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; @@ -20,7 +21,7 @@ import java.awt.event.KeyEvent; /** * Created by XiaXiang on 2017/4/6. */ -public class AlphafineConfigPane extends BasicPane { +public class AlphaFineConfigPane extends BasicPane { private static final String TYPE = "pressed"; private static final String DISPLAY_TYPE = "+"; private static final String BACK_SLASH = "BACK_SLASH"; @@ -56,7 +57,7 @@ public class AlphafineConfigPane extends BasicPane { private UICheckBox isEnabledCheckbox, isSearchOnlineCheckbox, isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox, isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox; private UITextField shortcutsField; - public AlphafineConfigPane() { + public AlphaFineConfigPane() { this.initComponents(); } @@ -71,7 +72,7 @@ public class AlphafineConfigPane extends BasicPane { } - private Component[][] initsearchRangeComponents() { + private Component[][] initSearchRangeComponents() { Component[][] components = new Component[][]{ new Component[]{isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox}, new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox} @@ -85,13 +86,13 @@ public class AlphafineConfigPane extends BasicPane { double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP}; JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_AlphaFine_SearchRange")); - isContainRecommendCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_AlphaFine_Conclude")); + isContainRecommendCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_AlphaFine_Recommend")); isContainActionCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Set")); isContainPluginCheckbox = new UICheckBox(Inter.getLocText("FR-Designer-Plugin_Addon")); isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP")); isContainTemplateCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates")); isContainFileContentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates_Content")); - JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initsearchRangeComponents(), rowSize, columnSize); + JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initSearchRangeComponents(), rowSize, columnSize); northPane.add(searchConfigPane); contentPane.add(northPane); } @@ -154,34 +155,36 @@ public class AlphafineConfigPane extends BasicPane { return "AlphaFine"; } - public void populate(AlphafineConfigManager alphafineConfigManager) { - this.isEnabledCheckbox.setSelected(alphafineConfigManager.isEnabled()); - this.isSearchOnlineCheckbox.setSelected(alphafineConfigManager.isSearchOnLine()); - this.isContainActionCheckbox.setSelected(alphafineConfigManager.isContainAction()); - this.isContainTemplateCheckbox.setSelected(alphafineConfigManager.isContainTemplate()); - this.isContainDocumentCheckbox.setSelected(alphafineConfigManager.isContainDocument() && alphafineConfigManager.isSearchOnLine()); - this.isContainDocumentCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); - this.isContainPluginCheckbox.setSelected(alphafineConfigManager.isContainPlugin() && alphafineConfigManager.isSearchOnLine()); - this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); - this.isContainRecommendCheckbox.setSelected(alphafineConfigManager.isContainRecommend() && alphafineConfigManager.isSearchOnLine()); - this.isContainRecommendCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); - this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts())); - shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts()); + public void populate(AlphaFineConfigManager alphaFineConfigManager) { + this.isEnabledCheckbox.setSelected(alphaFineConfigManager.isEnabled()); + this.isSearchOnlineCheckbox.setEnabled(FRContext.isChineseEnv()); + this.isSearchOnlineCheckbox.setSelected(alphaFineConfigManager.isSearchOnLine()); + this.isContainActionCheckbox.setSelected(alphaFineConfigManager.isContainAction()); + this.isContainTemplateCheckbox.setSelected(alphaFineConfigManager.isContainTemplate()); + this.isContainFileContentCheckbox.setSelected(alphaFineConfigManager.isContainFileContent()); + this.isContainDocumentCheckbox.setSelected(alphaFineConfigManager.isContainDocument() && alphaFineConfigManager.isSearchOnLine()); + this.isContainDocumentCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine()); + this.isContainPluginCheckbox.setSelected(alphaFineConfigManager.isContainPlugin() && alphaFineConfigManager.isSearchOnLine()); + this.isContainPluginCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine()); + this.isContainRecommendCheckbox.setSelected(alphaFineConfigManager.isContainRecommend() && alphaFineConfigManager.isSearchOnLine()); + this.isContainRecommendCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine()); + this.shortcutsField.setText(getDisplayShortCut(alphaFineConfigManager.getShortcuts())); + shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts()); } public void update() { DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); - AlphafineConfigManager alphafineConfigManager = designerEnvManager.getAlphafineConfigManager(); - alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected()); - alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected()); - alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected()); - alphafineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected()); - alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected()); - alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected()); - alphafineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected()); - alphafineConfigManager.setContainFileContent(this.isContainFileContentCheckbox.isSelected()); - alphafineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText()); - designerEnvManager.setAlphafineConfigManager(alphafineConfigManager); + AlphaFineConfigManager alphaFineConfigManager = designerEnvManager.getAlphaFineConfigManager(); + alphaFineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected()); + alphaFineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected()); + alphaFineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected()); + alphaFineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected()); + alphaFineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected()); + alphaFineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected()); + alphaFineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected()); + alphaFineConfigManager.setContainFileContent(this.isContainFileContentCheckbox.isSelected()); + alphaFineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText()); + designerEnvManager.setAlphaFineConfigManager(alphaFineConfigManager); try { DesignerEnvManager.loadLogSetting(); DesignerEnvManager.getEnvManager().saveXMLFile(); @@ -192,8 +195,8 @@ public class AlphafineConfigPane extends BasicPane { } - private String getDisplayShortCut(String shotrCut) { - return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) + private String getDisplayShortCut(String shortCut) { + return shortCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) .replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) .replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE) .replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS).replace(COMMAND, DISPLAY_COMMAND).replace(SMALL_COMMAND, DISPLAY_COMMAND); diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java new file mode 100644 index 0000000000..4dd92bc3d6 --- /dev/null +++ b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java @@ -0,0 +1,40 @@ +package com.fr.design.actions.help.alphafine; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by XiaXiang on 2017/5/27. + */ +public class AlphaFineContext { + private static List fireAlphaFineListener = new ArrayList(); + + /** + * 触发AlphaFine弹窗 + */ + public static void fireAlphaFineShowDialog() { + for (AlphaFineListener l : fireAlphaFineListener) { + l.showDialog(); + } + } + + /** + * 触发开启或关闭AlphaFine功能 + * @param isEnable + */ + public static void fireAlphaFineEnable(boolean isEnable) { + for (AlphaFineListener l : fireAlphaFineListener) { + l.setEnable(isEnable); + } + } + + /** + * 添加一个AlphaFine的监听事件 + * + * @param l AlphaFine监听事件 + */ + public static void addAlphaFineListener(AlphaFineListener l) { + fireAlphaFineListener.add(l); + } + +} diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java new file mode 100644 index 0000000000..078bbdfd5c --- /dev/null +++ b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java @@ -0,0 +1,18 @@ +package com.fr.design.actions.help.alphafine; + +/** + * Created by XiaXiang on 2017/5/27. + * AlphaFine监听器 + */ +public interface AlphaFineListener { + /** + * 显示dialog + */ + void showDialog(); + + /** + * 设置可用性 + * @param isEnable + */ + void setEnable(boolean isEnable); +} diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineContext.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineContext.java deleted file mode 100644 index 429f299d6c..0000000000 --- a/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineContext.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.fr.design.actions.help.alphafine; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by XiaXiang on 2017/5/27. - */ -public class AlphafineContext { - private static List fireLoginContextListener = new ArrayList(); - - /** - * 触发AlphaFine弹窗 - */ - public static void fireAlphaFineContextListener() { - for (AlphafineListener l : fireLoginContextListener) { - l.showDialog(); - } - } - - /** - * 添加一个弹出AlphaFine的监听事件 - * - * @param l AlphaFine框弹出监听事件 - */ - public static void addAlphafineContextListener(AlphafineListener l) { - fireLoginContextListener.add(l); - } -} diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineListener.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineListener.java deleted file mode 100644 index 01c7905d61..0000000000 --- a/designer_base/src/com/fr/design/actions/help/alphafine/AlphafineListener.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.fr.design.actions.help.alphafine; - -/** - * Created by XiaXiang on 2017/5/27. - */ -public interface AlphafineListener { - void showDialog(); -} diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/RemindDialog.java b/designer_base/src/com/fr/design/actions/help/alphafine/RemindDialog.java index 9ae6f864a4..fe894437d7 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/RemindDialog.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/RemindDialog.java @@ -8,6 +8,7 @@ import java.awt.*; /** * Created by XiaXiang on 2017/5/26. + * 提示弹窗 */ public class RemindDialog extends UIDialog { private RemindPane remindPane; @@ -22,7 +23,7 @@ public class RemindDialog extends UIDialog { } private void initComponent() { - final AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager(); + final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); remindPane = new RemindPane(manager, this); this.add(remindPane); diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java b/designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java index 1e8261965c..dce47b97a2 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java @@ -42,7 +42,7 @@ public class RemindPane extends JPanel { } }; - public RemindPane(AlphafineConfigManager manager, UIDialog remindDialog) { + public RemindPane(AlphaFineConfigManager manager, UIDialog remindDialog) { this.setPreferredSize(new Dimension(WIDTH, HEIGHT)); initUI(manager, remindDialog); this.setLayout(getAbsoluteLayout()); @@ -53,7 +53,7 @@ public class RemindPane extends JPanel { * @param manager * @param dialog */ - private void initUI(final AlphafineConfigManager manager, final UIDialog dialog) { + private void initUI(final AlphaFineConfigManager manager, final UIDialog dialog) { openButton = new UIButton(); openButton.setIcon(openIcon); @@ -63,7 +63,7 @@ public class RemindPane extends JPanel { public void mousePressed(MouseEvent e) { manager.setOperateCount(0); dialog.dispose(); - AlphafineContext.fireAlphaFineContextListener(); + AlphaFineContext.fireAlphaFineShowDialog(); } }); diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index e632fafd2c..1453ff2df4 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -1998,7 +1998,7 @@ FR-Designer_AlphaFine_EnableInternet=Designer_AlphaFine_EnableInternet FR-Designer_AlphaFine_EnableInternetSearch=SearchOnLine FR-Designer_AlphaFine_Shortcut_Config=Shortcut Config FR-Designer_AlphaFine_SearchRange=Search Range -FR-Designer_AlphaFine_Conclude=Conclude +FR-Designer_AlphaFine_Recommend=Recommend FR-Designer-Plugin_Addon=Plugin Addon FR-Designer_Templates=FR-Designer_Templates FR-Designer_Templates_Content=Templates Contents @@ -2006,4 +2006,6 @@ FR-Designer_AlphaFine_ShowAll=show all FR-Designer_AlphaFine_Latest=Latest FR-Designer_AlphaFine_ShowLess=show less FR-Designer_Alphafine=AlphaFine -FR-Designer-Alphafine_No_Remind= \ No newline at end of file +FR-Designer-Alphafine_No_Remind= +FR-Designer_AlphaFine_NoResult=no results +FR-Designer_ConnectionFailed=connection failed \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 25c2921e11..96d7374290 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -1993,15 +1993,19 @@ FR-Designer_Permissions=Permissions FR-Designer_Form_Button=Button FR-Designer_WF_Name=Name FR-Designer_AlphaFine_Enable=Enable -FR-Designer_AlphaFine_EnableInternetSearch=SearchOnLine +FR-Designer_AlphaFine_EnableInternetSearch=Search OnLine FR-Designer_AlphaFine_Shortcut_Config=Shortcut Config FR-Designer_AlphaFine_SearchRange=Search Range -FR-Designer_AlphaFine_Conclude=Conclude +FR-Designer_AlphaFine_Recommend=Recommend FR-Designer-Plugin_Addon=Plugin Addon -FR-Designer_Templates=Templates -FR-Designer_Templates_Content=Template'Contents -FR-Designer_AlphaFine_ShowAll=show all +FR-Designer_Templates=Files +FR-Designer_Templates_Content=Files'contents +FR-Designer_AlphaFine_ShowAll=Show all FR-Designer_AlphaFine_Latest=Recent -FR-Designer_AlphaFine_ShowLess=show less +FR-Designer_AlphaFine_ShowLess=Show less FR-Designer_Alphafine=AlphaFine -FR-Designer-Alphafine_No_Remind=don't remind \ No newline at end of file +FR-Designer-Alphafine_No_Remind=Don't remind +FR-Designer_AlphaFine_NoResult=No results +FR-Designer_ConnectionFailed=Connection failed +FR-Designer_AlphaFine_EnableAlphaFine=Enable AlphaFine +FR-Designer_AlphaFine_EnableInternet=Internet 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 08d9d3285e..d63b22e166 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 @@ -1998,8 +1998,10 @@ 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=\u663E\u793A\u5168\u90E8 -FR-Designer_AlphaFine_Conclude=\u731C\u60A8\u9700\u8981 +FR-Designer_AlphaFine_Recommend=\u731C\u60A8\u9700\u8981 FR-Designer_AlphaFine_Latest=\u672C\u5730\u5E38\u7528 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 -FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A \ No newline at end of file +FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A +FR-Designer_AlphaFine_NoResult=\u6682\u65E0\u76F8\u5173\u5185\u5BB9 +FR-Designer_ConnectionFailed=\u94FE\u63A5\u5931\u8D25 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 156339cfe1..9e59a18a09 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 @@ -1992,7 +1992,7 @@ FR-Designer_AlphaFine_EnableAlphaFine=\u958B\u555FAlphaFine\u529F\u80FD FR-Designer_AlphaFine_EnableInternetSearch=\u806F\u7DB2\u641C\u7D22 FR-Designer_AlphaFine_Shortcut_Config=\u5FEB\u6377\u9375\u914D\u7F6E FR-Designer_AlphaFine_SearchRange=\u641C\u7D22\u7BC4\u570D -FR-Designer_AlphaFine_Conclude=\u731C\u60A8\u9700\u8981 +FR-Designer_AlphaFine_Recommend=\u731C\u60A8\u9700\u8981 FR-Designer-Plugin_Addon=\u61C9\u7528\u4E2D\u5FC3 FR-Designer_Templates=\u6A21\u677F FR-Designer_Templates_Content=\u6A21\u677F\u5167\u5BB9 @@ -2000,4 +2000,6 @@ FR-Designer_AlphaFine_Latest=\u6700\u8FD1\u5E38\u7528 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 FR-Designer_AlphaFine_ShowAll=\u986F\u793A\u5168\u90E8 -FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A \ No newline at end of file +FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A +FR-Designer_AlphaFine_NoResult=\u66AB\u7121\u76F8\u95DC\u5167\u5BB9 +FR-Designer_ConnectionFailed=\u93C8\u63A5\u5931\u6557 diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index f67608aca0..c3b6abee24 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -197,7 +197,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } }); - if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) { + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER); } return northEastPane; diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 9c9a356310..d71bd9b5f1 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -11,7 +11,7 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.actions.community.*; import com.fr.design.actions.file.*; import com.fr.design.actions.help.AboutAction; -import com.fr.design.actions.help.alphafine.AlphafineAction; +import com.fr.design.actions.help.alphafine.AlphaFineAction; import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.server.*; @@ -374,7 +374,7 @@ public abstract class ToolBarMenuDock { shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(new AboutAction()); shortCuts.add(SeparatorDef.DEFAULT); - shortCuts.add(new AlphafineAction()); + shortCuts.add(new AlphaFineAction()); return shortCuts.toArray(new ShortCut[shortCuts.size()]); }