diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index e84969bd0..fe72f9c1d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -110,6 +110,10 @@ public class AlphaFineConstants { public static final String BOTTOM_REGEX_SECOND = "
"; + public static final String LINK_REGEX = "javascript:;\"([\\s\\S]*?)','"; + + public static final String LINK_REGEX_ANOTHER = "javascript:([\\s\\S]*?)url=\""; + public static final String ALPHA_ROBOT_SEARCH_TOKEN = "K8dl0Np6l0gs"; public static final String SIMILAR_SEARCH_URL_PREFIX = CloudCenter.getInstance().acquireUrlByKind("af.similar_search"); @@ -122,6 +126,10 @@ public class AlphaFineConstants { public static final String ALPHA_GO_TO_WEB = CloudCenter.getInstance().acquireUrlByKind("af.go_web"); + public static final String ALPHA_PREVIEW = CloudCenter.getInstance().acquireUrlByKind("af.preview"); + + public static final String JAVASCRIPT_PREFIX = "javascript:SendJava"; + public static final String CHINESE_CHARACTERS = "[\\u4e00-\\u9fa5]"; public static final String FIRST_PAGE = "-1"; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java index 47d95514e..273b29fef 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java @@ -1,16 +1,15 @@ package com.fr.design.mainframe.alphafine.cell.model; import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; -import com.fr.general.http.HttpClient; +import com.fr.general.http.HttpToolbox; import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; +import com.fr.stable.StringUtils; import org.apache.commons.codec.digest.DigestUtils; - import java.awt.Desktop; import java.io.IOException; import java.net.URI; @@ -44,17 +43,17 @@ public class RobotModel extends AlphaCellModel { } public static String getContent(String titleStr) { - String result; String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + titleStr); String url = AlphaFineConstants.ALPHA_GO_TO_WEB + titleStr + "&token=" + token; - HttpClient httpClient = new HttpClient(url); - httpClient.asGet(); - result = httpClient.getResponseText(); - AlphaFineHelper.checkCancel(); + try { + String result = HttpToolbox.get(url); + if(StringUtils.isEmpty(result)){ + return StringUtils.EMPTY; + } JSONObject jsonObject = new JSONObject(result); return jsonObject.optString("msg"); - } catch (JSONException e) { + } catch (JSONException | IOException e) { FineLoggerFactory.getLogger().error("get robotmodel content error: " + e.getMessage()); } return null; @@ -86,7 +85,7 @@ public class RobotModel extends AlphaCellModel { @Override public void doAction() { try { - Desktop.getDesktop().browse(new URI("http://robot.finereport.com?send=" + super.getName())); + Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + super.getName())); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage()); } catch (URISyntaxException e) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 72156d8ae..7fd1dc09c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -11,20 +11,20 @@ import com.fr.design.gui.ilable.UILabel; 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.model.RobotModel; -import com.fr.design.mainframe.alphafine.cell.model.BottomModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.model.BottomModel; import com.fr.design.mainframe.alphafine.cell.model.FileModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.PluginModel; +import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.preview.ContainsCirclePane; import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane; import com.fr.design.mainframe.alphafine.preview.FilePreviewPane; import com.fr.design.mainframe.alphafine.preview.NoResultPane; import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane; import com.fr.design.mainframe.alphafine.preview.RobotPreviewPane; -import com.fr.design.mainframe.alphafine.preview.ContainsCirclePane; import com.fr.design.mainframe.alphafine.search.manager.impl.ActionSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.FileSearchManager; @@ -116,6 +116,7 @@ public class AlphaFineDialog extends UIDialog { private static final String PLACE_HOLDER = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine"); private static final int MAX_SHOW_SIZE = 12; private static final int TIMER_DELAY = 300; + private static final int ONLY_ONE_AVAILABLE_MODEL = 2; private AlphaFineTextField searchTextField; private UIButton closeButton; @@ -705,14 +706,20 @@ public class AlphaFineDialog extends UIDialog { this.showWorker = new SwingWorker